OrderSprinter 1.3.23

This commit is contained in:
Geno 2020-11-19 23:03:48 +01:00
parent e872007aca
commit 3358ea081f
32 changed files with 1257 additions and 357 deletions

Binary file not shown.

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.22");
Database::setVersion($pdo,$prefix,"1.3.23");
Database::setAccessPassword($pdo,$prefix,$adminpass);
Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour
return array("status" => "OK","msg" => "Installation successful");

Binary file not shown.

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -9,8 +9,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.23">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -31,7 +31,7 @@ var I_TIMEDIFF_NO_ADMIN = ["Zeit am Server und am Endgerät unterscheiden sich.
function fillUserList(userinfo) {
var text = '<div class="ui-field-contain">';
text += '<select name="userlistselection" id="userlistselection" data-theme="f">';
$.each(userinfo, function (i, aUser) {
$.each(userinfo.users, function (i, aUser) {
var username = aUser.username;
var userid = aUser.id;
text += '<option value=' + userid + '>' + username + '</option>';
@ -215,7 +215,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.3.22"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.23"},500);
}
}

View File

@ -725,7 +725,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.3.22</button>
<button id="updatebtn">Update -> 1.3.23</button>
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
</td>
<td>&nbsp;</td>

View File

@ -9,7 +9,9 @@ require_once( "../php/config1.php" );
require_once( "../php/config.php" );
}
require_once ('../php/utilities/basedb.php');
require_once ('../php/utilities/HistFiller.php');
require_once ('../php/utilities/decimaldefs.php');
require_once ('../php/utilities/roles.php');
require_once ('../php/admin.php');
class ConfigWriter {
@ -2477,6 +2479,173 @@ return false;
}
}
function updateUserTable1322_1323($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.22") {
$ret = $this->updateUserTable1321_1322($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.3.21 to 1.3.22 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$this->insertIntRow($pdo,"%printjobs%","removed","printer");
$this->insertIntRow($pdo,"%queue%","printjobid","workprinted");
$cancelTemplate = $this->getDefaultCancelWorkTemplate();
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('canceltemplate',$cancelTemplate));
$sql = "SHOW COLUMNS FROM %user% LIKE 'right_waiter'";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
if (count($result) > 0) {
$this->basedb->createRolesTable($pdo);
try {
$sql = "DELETE FROM %roles%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
} catch (Exception $ex) {
}
$sql = "ALTER TABLE %user% ADD roleid INT (10) NULL AFTER active";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$existingRights = array(
"is_admin",
"right_waiter",
"right_kitchen",
"right_bar",
"right_supply",
"right_paydesk",
"right_statistics",
"right_bill",
"right_products",
"right_manager",
"right_closing",
"right_dash",
"right_reservation",
"right_rating",
"right_changeprice",
"right_customers"
);
$rightInStr = implode(",", $existingRights);
$sql = "SELECT DISTINCT $rightInStr FROM %user% WHERE active='1'";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
$allDistinctPermutations = $stmt->fetchAll(PDO::FETCH_ASSOC);
$i=1;
foreach($allDistinctPermutations as $aPerm) {
$addOnToName = "";
if ($aPerm["is_admin"] == 1) {
$addOnToName = " (Admin)";
} else if ($aPerm["right_manager"] == 1) {
$addOnToName = " (Verwaltung)";
}
$sql = "INSERT INTO %roles% (name,$rightInStr) VALUES('Rolle $i $addOnToName',?,?,?,?,? ,?,?,?,?,? , ?,?,?,?,?, ?)";
$params = array(
$aPerm["is_admin"],
$aPerm["right_waiter"],
$aPerm["right_kitchen"],
$aPerm["right_bar"],
$aPerm["right_supply"],
$aPerm["right_paydesk"],
$aPerm["right_statistics"],
$aPerm["right_bill"],
$aPerm["right_products"],
$aPerm["right_manager"],
$aPerm["right_closing"],
$aPerm["right_dash"],
$aPerm["right_reservation"],
$aPerm["right_rating"],
$aPerm["right_changeprice"],
$aPerm["right_customers"]
);
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute($params);
$newroleid = $pdo->lastInsertId();
$where = "is_admin=? AND ";
$where .= "right_waiter=? AND ";
$where .= "right_kitchen=? AND ";
$where .= "right_bar=? AND ";
$where .= "right_supply=? AND ";
$where .= "right_paydesk=? AND ";
$where .= "right_statistics=? AND ";
$where .= "right_bill=? AND ";
$where .= "right_products=? AND ";
$where .= "right_manager=? AND ";
$where .= "right_closing=? AND ";
$where .= "right_dash=? AND ";
$where .= "right_reservation=? AND ";
$where .= "right_rating=? AND ";
$where .= "right_changeprice=? AND ";
$where .= "right_customers=?";
$sql = "SELECT id FROM %user% WHERE $where AND active=1";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute($params);
$allUserIdsOfThatRole = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($allUserIdsOfThatRole as $u) {
$sql = "UPDATE %user% SET roleid=? WHERE id=?";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array($newroleid,$u["id"]));
}
$i++;
}
foreach ($existingRights as $r) {
$sql = "ALTER TABLE %user% DROP COLUMN " . $r;
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
$sql = "UPDATE %user% SET roleid=? WHERE active='0'";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array(null));
$sql = "OPTIMIZE TABLE %user%";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array(null));
}
$this->updateVersion($pdo, '1.3.23');
return true;
} catch (PDOException $e) {
echo "Error in v1.3.22 to 1.3.23: $e";
return false;
}
}
function insertIntRow($pdo,$table,$rowToInsert,$afterRow) {
$sql = "SHOW COLUMNS FROM $table LIKE '$rowToInsert'";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
if (count($result) == 0) {
$sql = "ALTER TABLE $table ADD $rowToInsert INT(1) NULL AFTER $afterRow";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
@ -2505,7 +2674,7 @@ return $rect;
}
function getDefaultWorkTemplateFood() {
$rect = "SS:Speisen\nt:v\nz:v\n";
$rect = "SS:Speisen\n\ni_ID:v\nt:v\nz:v\n";
$rect .= "\n";
$rect .= "START_WORK\n";
$rect .= "f:-;\n";
@ -2517,7 +2686,7 @@ return $rect;
}
function getDefaultWorkTemplateDrinks() {
$rect = "SS:Getränke\nt:v\nz:v\n";
$rect = "SS:Getränke\n\ni_ID:v\nt:v\nz:v\n";
$rect .= "\n";
$rect .= "START_WORK\n";
$rect .= "f:-;\n";
@ -2528,6 +2697,19 @@ $rect .= "f:-";
return $rect;
}
function getDefaultCancelWorkTemplate() {
$rect = "SS: Stornierung\n\n";
$rect .= "s:zu stornieren ;n:v\n";
$rect .= "s: ID: ;i:v\n";
$rect .= "s: Tisch: ;t:v\n";
$rect .= "s: Zeit: ;z:v\n";
$rect .= "s: Extras: ;e:v\n";
$rect .= "s: Preis: ;p:v\n";
$rect .= "s: Typ: ;k:v\n";
$rect .= "s: zu storn. Arb.bon: ;q:v\n";
return $rect;
}
function createTables($decpoint,$billlanguage,$currency,$timezone)
{
$pdo = $this->pdo;
@ -2539,6 +2721,7 @@ $this->basedb->dropTables($pdo);
$this->basedb->createLogTable($pdo);
$this->basedb->createRatingsTable($pdo);
$this->createPaymentTable($pdo);
$this->basedb->createRolesTable($pdo);
$this->basedb->createUserTable($pdo);
$this->basedb->createRoomTable($pdo);
$this->basedb->createRestTables($pdo);
@ -2575,6 +2758,7 @@ $this->basedb->createHsoutTable($pdo);
$rect = $this->getDefaultCustomRecTemplate();
$foodtemplate = $this->getDefaultWorkTemplateFood();
$drinktemplate = $this->getDefaultWorkTemplateDrinks();
$canceltemplate = $this->getDefaultCancelWorkTemplate();
$printpass = md5("123");
@ -2595,6 +2779,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'rectemplate', '$rect')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'foodtemplate', '$foodtemplate')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'drinktemplate', '$drinktemplate')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'canceltemplate', '$canceltemplate')");
$resTxt = 'Vielen Dank für Ihre Reservierung am DATUM um ZEIT Uhr für ANZAHL Personen.\n\nWir freuen uns auf Ihren Besuch!\n\nBETRIEBSINFO';
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'reservationnote', '$resTxt')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'serverurl', '')");
@ -2604,7 +2789,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.22')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.23')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')");
@ -2770,28 +2955,19 @@ $stmt_insert_hist = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($s
$stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist));
}
function insertUser($username,$adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,
$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,
$right_manager,$right_closing,$right_dash,$right_reservation,$right_rating,$lang,$prefertablemap) {
function insertUser($username,$adminpass,$roleid,$lang,$prefertablemap) {
$md5adminpass = md5($adminpass);
$pdo = $this->pdo;
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_customers`,`right_manager`,`right_closing`,`right_dash`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`showplusminus`,`preferimgdesk`,`preferimgmobile`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1','1','1','1','1')";
$userInsertSql = "INSERT INTO `%user%` (`username` , `userpassword`, `roleid`,`language`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`showplusminus`,`preferimgdesk`,`preferimgmobile`,`active`) "
. "VALUES (?,?,?,?,?,?,'1','1','1','1','1')";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,$right_manager,$right_closing,$right_dash,$right_reservation,$right_rating,$lang,$prefertablemap,0));
$stmt->execute(array($username,$md5adminpass,$roleid,$lang,$prefertablemap,0));
$newUserIdForHist = $pdo->lastInsertId();
// now insert into hist
$sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` ,
`is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,
`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_customers`,`right_manager`,`right_closing`,`right_dash`,`right_reservation`,`right_rating`,`active`) VALUES (
NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt_insert_histuser = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histuser));
$stmt_insert_histuser->execute(array($newUserIdForHist,$username,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,$right_manager,$right_closing,$right_dash,$right_reservation,$right_rating,1));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '3', $newRefIdForHist);
HistFiller::createUserInHist($pdo, $newUserIdForHist);
}
function createPaymentTable($pdo) {
@ -2949,15 +3125,23 @@ $stmt->execute(array(6,76,22));
}
if ($workflow == 2) {
$this->insertUser( $waiterTxt[$lang], $adminpass,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,0,$lang,1);
$roleid = Roles::insertWorkWaiterRole($pdo);
$this->insertUser($waiterTxt[$lang], $adminpass, $roleid, $lang, 1);
if ($level == 3) {
$this->insertUser( $bossTxt[$lang], $adminpass,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,$lang,1);
$roleid = Roles::insertWorkManagerRole($pdo);
$this->insertUser($bossTxt[$lang], $adminpass, $roleid, $lang, 1);
}
} else {
$this->insertUser( $waiterTxt[$lang], $adminpass,0,1,0,0,1,1,0,1,0,0,0,0,0,0,1,0,$lang,1);
$roleid = Roles::insertDigiWaiterRole($pdo);
$this->insertUser($waiterTxt[$lang], $adminpass, $roleid, $lang, 1);
if ($level == 3) {
$this->insertUser( $cookTxt[$lang], $adminpass,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,$lang,1);
$this->insertUser( $bossTxt[$lang], $adminpass,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,$lang,1);
$roleid = Roles::insertCookRole($pdo);
$this->insertUser($cookTxt[$lang], $adminpass, $roleid, $lang, 1);
$roleid = Roles::insertDigiManagerRole($pdo);
$this->insertUser($bossTxt[$lang], $adminpass, $roleid, $lang, 1);
}
}
@ -3018,7 +3202,8 @@ if (!$ok) {
echo json_encode("Fehler: Ist OpenSSL richtig installiert?");
return;
}
$admin->insertUser("admin",$_POST['adminpass'],1,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,$_POST['lang'],1);
$roleid = Roles::insertAdminRole($pdo);
$admin->insertUser("admin", $_POST['adminpass'], $roleid, $_POST['lang'], 1);
$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']);
if(session_id() == '') {
@ -3048,7 +3233,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.22";
$installerVersion = "1.3.23";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -3079,7 +3264,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30",
"1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.2.10","1.2.11","1.2.12","1.2.13","1.2.14","1.2.15","1.2.16","1.2.17",
"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1","1.3.2","1.3.3","1.3.4","1.3.5","1.3.6","1.3.7","1.3.8","1.3.9","1.3.10","1.3.11","1.3.12",
"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20","1.3.21"
"1.3.13","1.3.14","1.3.15","1.3.16","1.3.17","1.3.18","1.3.19","1.3.20","1.3.21","1.3.22"
);
if (!in_array($version, $supportedVersions)) {
@ -3087,7 +3272,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1321_1322($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1322_1323($_POST['prefix'], $version, $_POST['db']);
if(session_id() == '') {
session_start();

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -54,7 +54,10 @@ var MAN_USER = ["Benutzer","Users","Usarios"];
var MAN_CONFIG = ["Konfiguration","Configuration","Configuración"];
var MAN_DB = ["Datenbank","Data base","Base de datos"];
var MAN_NEW_USER = ["Neuer Benutzer","New user","Nuevo usario"];
var MAN_NEW_ROLE = ["Neue Rolle","New Role","Nuevo Derechos"];
var MAN_ROLE = ["Rolle","Role","Derechos"];
var MAN_ROLE_NAME = ["Name","Name","Nombre"];
var MAN_ROLES = ["Rollen","Rolen","Derechos"];
var MAN_ADMIN = ["Administrator","Administrator","Administrador"];
var MAN_WAITER = ["Kellner","Waiter","Camarero"];
var MAN_KITCHEN = ["Küche","Kitchen","Cocina"];
@ -241,6 +244,9 @@ var MAN_FOODTEMPLATE_HINT = ["Hinweis: Die Anpassung der Bonvorlage ist in der A
var MAN_DRINKTEMPLATE_HINT = ["Hinweis: Die Anpassung der Bonvorlage ist in der Anleitung und auf der Produktwebseite beschrieben.",
"Hint: The customization of the receipt template is described in the manual and on the product home page.",
"Nota: La adapción del template esta explicada en la página web y el manual."];
var MAN_CANCELTEMPLATE_HINT = ["Hinweis: Die Anpassung der Bonvorlage ist in der Anleitung und auf der Produktwebseite beschrieben.",
"Hint: The customization of the receipt template is described in the manual and on the product home page.",
"Nota: La adapción del template esta explicada en la página web y el manual."];
var MAN_NO_ADMIN = ["Um Admin-Rechte zu bearbeiten, muss der Benutzer selbst Adminrechte besitzen.", "Modifying admin rights require that the changing user has also admin rights.", "Necesitas derecho de admin para modificar derecho de admin para otros usarios."];
var MAN_NO_ADMIN_CREATE = ["Nur Admin-Benutzer können andere Admin-Benutzer anlegen",
"Only admin users can create other admin users",
@ -262,6 +268,7 @@ var MAN_DRINK_PRINTER = ["Getränkearbeitsbon-Drucker","Drinks work ticket print
var MAN_UPDATE_PRINTJOBS = ["Aktualisieren","Update","Actualizar"];
var MAN_CLEAR_PRINTJOBS = ["Alle Druckjobs löschen","Clear all print jobs","Remover todo"];
var MAN_PRINT_JOBS_COUNT = ["Druckaufträge","print jobs","tareas de impresión"];
var MAN_REPRINT = ["Erneut drucken","Print again","Imprimir de nuevo"];
var MAN_PARSE_ERROR = ["Speisekarte konnte nicht erfolgreich eingelesen werden. Stimmt die Syntax, z.B. die korrekte Einrückung?",
"Menu could not be parsed - is the intendation correct?",
"Menú no se puede leido - esta correcto la intendación?"];
@ -402,6 +409,7 @@ var newerversionavailable = 0;
var adminIsLoggedIn = false;
var managerIsLoggedIn = false;
var defaulttmp = '';
var rolesOnceExtended = false;
var generalValuesSettings = [
["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"],
@ -417,6 +425,7 @@ var generalValuesSettings = [
["rectemplate","Bonvorlage ","i",0],
["foodtemplate","Arb.bonvorlage Speisen","i",0],
["drinktemplate","Arb.bonvorlage Getränke","i",0],
["canceltemplate","Storno Arb.bonvorlage","i",0],
["serverUrl","Serveradresse","i",0],
["email","Emailadresse","i",0],
["emailbadrating","Emailadresse schlechte Bewertung","i",0],
@ -509,6 +518,7 @@ function setLanguage(l) {
$("#acc_exporttxt").html(MAN_ACCOUNT_EXPORT[l]);
$("#info_acc_exporttxt").html(MAN_INFO_ACCOUNT_EXPORT[l]);
$("#usertxt").html(MAN_USER[l]);
$("#rolestxt").html(MAN_ROLES[l]);
$("#configtxt").html(MAN_CONFIG[l]);
$("#dbtxt").html(MAN_DB[l]);
$("#speisekarte").html(MAN_SPEISEKARTE[l]);
@ -608,6 +618,7 @@ function setLanguage(l) {
$("#printjobsheader").html(MAN_PRINTJOBS[l]);
$("#updateprintqueue").html(MAN_UPDATE_PRINTJOBS[l]);
$("#clearprintqueue").html(MAN_CLEAR_PRINTJOBS[l]);
$("#reprintworkreceiptbtn").html(MAN_REPRINT[l]);
$("#tmimgdelbtntxt").html(MAN_TM_DEL[l]);
$("#tmimgbtntxt").html(MAN_TM[l]);
@ -627,6 +638,7 @@ function setLanguage(l) {
$("#rectemplatehint").html(MAN_RECTEMPLATE_HINT[l]);
$("#foodtemplatehint").html(MAN_FOODTEMPLATE_HINT[l]);
$("#drinktemplatehint").html(MAN_DRINKTEMPLATE_HINT[l]);
$("#canceltemplatehint").html(MAN_CANCELTEMPLATE_HINT[l]);
$("#digiprinthint").html(MAN_DIGI_PRINTWORK_HINT[l]);
$("#generalsectiontxt").html(MAN_GENSECTION_TXT[l]);
@ -685,6 +697,7 @@ function showPanelsDueToUserStatus(jsonAnswer) {
if (jsonAnswer == "manager" || (jsonAnswer == 'admin')) {
managerIsLoggedIn = true;
$("#userpart").show();
$("#rolespart").show();
$("#configpart").show();
$("#printerqueue").show();
$("#dataexport").show();
@ -732,6 +745,7 @@ function insertGeneralConfigItems(configResult) {
$("#rectemplate").val(values.rectemplate);
$("#foodtemplate").val(values.foodtemplate);
$("#drinktemplate").val(values.drinktemplate);
$("#canceltemplate").val(values.canceltemplate);
$("#reservationnote").val(values.reservationnote);
@ -1217,7 +1231,7 @@ function initRestoreFileUpload() {
} else {
alert("Import war erfolgreich.");
setTimeout(function(){
document.location.href = "index.html?v=1.3.22";
document.location.href = "index.html?v=1.3.23";
},250);
}
},
@ -1230,7 +1244,8 @@ function initRestoreFileUpload() {
}
$(document).ready(function() {
$.ajaxSetup({ cache: false });
$.ajaxSetup({ cache: false });
$("#reprintworkreceipt").val("");
requestUnpaidTables();
var refreshId = setInterval(function() {
requestUnpaidTables();
@ -1378,6 +1393,16 @@ function bindingClosing() {
});
}
function bindingRolesPart() {
$("#rolespart").off("collapsibleexpand").on("collapsibleexpand", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
if (!rolesOnceExtended) {
doAjax("GET","php/contenthandler.php?module=admin&command=getRoleList",null, fillRoleListIntoGui,"no role data received",true);
}
});
}
function bindingExports() {
$(".exportbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
@ -1658,7 +1683,15 @@ function binding() {
e.stopImmediatePropagation();
e.preventDefault();
getSpooledPrintJobs();
});
$("#reprintworkreceiptbtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var data = {
workid: $("#reprintworkreceipt").val()
};
doAjax("GET","php/contenthandler.php?module=printqueue&command=reprintworkreceipt",data,handleReprint,null);
});
$("#clearprintqueue").off("click").on("click", function (e) {
e.stopImmediatePropagation();
@ -1757,9 +1790,9 @@ function handleUpdateCheckResult(answer) {
var millis=getMillis();
setTimeout(function(){
document.location.href = "install.html?v=1.3.22&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.3.23&mode=onlyupdate&n=" + millis;
},250);
document.location.href = "install.html?v=1.3.22&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.3.23&mode=onlyupdate&n=" + millis;
}
function handleUpdateReplace(answer) {
@ -2004,7 +2037,15 @@ function confirmMsg (result) {
window.location.reload();
}
}
function handleReprint(answer) {
if (answer.status == "OK") {
$("#reprintworkreceipt").val("");
getSpooledPrintJobs();
} else {
alert("Fehler: " + answer.msg);
}
}
function handleDelLogo() {
d = new Date();
$("#logoimgpart").attr("src", "php/contenthandler.php?module=printqueue&command=getLogoAsPng&"+d.getTime());
@ -2251,6 +2292,7 @@ function displayReceivedClosings(closingresult) {
$('#partofclosings').trigger('create');
bindingClosing();
bindingExports();
bindingRolesPart();
}
}
@ -2263,49 +2305,69 @@ function getClosings(month,year) {
}
function createLabelWithTextField(aLabel,displayedName,defaultText) {
var labelid = 'userlabel_' + aLabel;
var labelid = aLabel;
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<input type="text" id="' + labelid + '" value="" data-mini="true" placeholder="' + defaultText + '" />';
text += '<input type="text" id="' + labelid + '" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;" />';
text += '</div>';
return text;
}
function createButtonWithTextField(aLabel,displayedName,defaultText) {
var labelid = 'userlabel_' + aLabel;
function createButtonWithTextField(id,displayedName,defaultText) {
var text = '<div class="ui-field-contain">';
text += '<input type="text" class="' + labelid + '" value="" data-mini="true" placeholder="' + defaultText + '" />';
text += '<button data-theme="f" data-icon="check" class="changepassword">' + displayedName + '</button>';
text += '<input id="userpassword_' + id + '" type="text" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;" />';
text += '<button data-theme="f" data-icon="check" class="changepassword" id="changepassword_' + id + '" >' + displayedName + '</button>';
text += '</div>';
return text;
}
function createLabelWithOption(aLabel,displayedName,hasTheRight) {
var labelid = 'userlabel_' + aLabel;
function createLabelWithOption(prefix,id,aLabel,displayedName,allValues,theValue) {
var labelid = prefix + aLabel + "_" + id;
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
if (hasTheRight) {
text += '<select name="' + labelid + '" id="' + labelid + '" data-theme="f">';
text += '<option value="1" selected>' + MAN_YES[lang] + '</option>';
text += '<option value="0">' + MAN_NO[lang] + '</option>';
} else {
text += '<select name="' + labelid + '" id="' + labelid + '" data-theme="d">';
text += '<option value="1">' + MAN_YES[lang] + '</option>';
text += '<option value="0" selected>' + MAN_NO[lang] + '</option>';
text += '<select name="' + labelid + '" id="' + labelid + '" data-theme="f">';
for (var i=0;i<allValues.length;i++) {
var aValue = allValues[i];
if (aValue.id == theValue) {
text += '<option value="' + aValue.id + '" selected>' + aValue.text + '</option>';
} else {
text += '<option value="' + aValue.id + '" >' + aValue.text + '</option>';
}
}
text += '</select></div>';
return text;
}
function createYesNoArr() {
var yesnoarr = [
{id:1,text:MAN_YES[lang]},
{id:0,text:MAN_NO[lang]}
];
return yesnoarr;
}
function createRolesArr(roles) {
var rolesArr = [];
for (var i=0;i<roles.length;i++) {
var aRole = roles[i];
rolesArr[rolesArr.length] = {
id:aRole.id,
text:aRole.name
};
}
return rolesArr;
}
/*
* Creates a table for a user with the info about the user, i.e.
* the username and the rights that the user has to work in the
* various modules.
*/
function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rManager,forNewUser) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
function createCollapsibeOfUser(id,username,roleid,forNewUser,roles) {
var collapsiblePart = '<div data-role="collapsible" id="userdef_' + id + '"';
if (forNewUser) {
collapsiblePart += ' data-theme="d" data-content-theme="d">';
} else {
@ -2314,32 +2376,61 @@ function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSuppl
collapsiblePart += '<h3>'+ username + '</h3>';
collapsiblePart += '<form>';
if (forNewUser) {
collapsiblePart += createLabelWithTextField("username",MAN_USER_NAME[lang],MAN_USER_NAME[lang]);
collapsiblePart += createLabelWithTextField("password",MAN_USER_PASS[lang],MAN_USER_PASS[lang]);
collapsiblePart += createLabelWithTextField("userlabel_username_new",MAN_USER_NAME[lang],MAN_USER_NAME[lang]);
collapsiblePart += createLabelWithTextField("userlabel_password_new",MAN_USER_PASS[lang],MAN_USER_PASS[lang]);
}
collapsiblePart += createLabelWithOption("admin",MAN_ADMIN[lang],isAdmin);
collapsiblePart += createLabelWithOption("waiter",MAN_WAITER[lang],rWaiter);
collapsiblePart += createLabelWithOption("kitchen",MAN_KITCHEN[lang],rKitchen);
collapsiblePart += createLabelWithOption("bar",MAN_BAR[lang],rBar);
collapsiblePart += createLabelWithOption("supplydesk",MAN_SUPPLY[lang],rSupply);
collapsiblePart += createLabelWithOption("paydesk",MAN_PAYDESK[lang],rPay);
collapsiblePart += createLabelWithOption("stat",MAN_STAT[lang],rStat);
collapsiblePart += createLabelWithOption("bill",MAN_BILLS[lang],rBill);
collapsiblePart += createLabelWithOption("products",MAN_PRODUCTS[lang],rProd);
collapsiblePart += createLabelWithOption("reservation",MAN_RESERVATION[lang],rReservation);
collapsiblePart += createLabelWithOption("rating",MAN_RATING[lang],rRating);
collapsiblePart += createLabelWithOption("changeprice",MAN_CHANGEPRICE[lang],rChangeprice);
collapsiblePart += createLabelWithOption("customers",MAN_CUSTOMERS[lang],rCustomers);
collapsiblePart += createLabelWithOption("closingright",MAN_CLOSINGRIGHT[lang],rClosing);
collapsiblePart += createLabelWithOption("dash",MAN_DASHRIGHT[lang],rDash);
collapsiblePart += createLabelWithOption("manager",MAN_MANAGER[lang],rManager);
var rolesArr = createRolesArr(roles);
collapsiblePart += createLabelWithOption("userlabel_",id,"userrole",MAN_ROLE[lang],rolesArr,roleid);
if (forNewUser) {
collapsiblePart += '<button data-theme="f" data-icon="plus" id="CreateNewUser">' + MAN_CREATE[lang] + '</button>';
} else {
collapsiblePart += '<button data-theme="f" data-icon="check" class="userUpdateButton">Rechte ändern</button>';
collapsiblePart += createButtonWithTextField("newpassword", "Passwort ändern", "Anderes Passwort");
collapsiblePart += '<button data-theme="d" data-icon="minus" class="userDeleteButton">Löschen</button>';
collapsiblePart += '<button data-theme="f" data-icon="check" class="userUpdateButton" id="userupdatebtn_' + id + '">Rolle ändern</button>';
collapsiblePart += createButtonWithTextField("changepasswordbtn_"+id, "Passwort ändern", "Anderes Passwort");
collapsiblePart += '<button data-theme="d" data-icon="minus" class="userDeleteButton" id="deleteuserbtn_' + id + '">Löschen</button>';
}
collapsiblePart += '<form>';
collapsiblePart += '</div>';
return collapsiblePart;
}
function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rManager,forNewRole) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
if (forNewRole) {
collapsiblePart += ' data-theme="d" data-content-theme="d">';
} else {
collapsiblePart += ' data-theme="c" data-content-theme="c">';
}
collapsiblePart += '<h3>'+ toHtml(name) + '</h3>';
collapsiblePart += '<form>';
var possibleValues = createYesNoArr();
collapsiblePart += createLabelWithTextField("rolelabel_name_" + id,MAN_ROLE_NAME[lang],MAN_ROLE_NAME[lang]);
collapsiblePart += createLabelWithOption("rolelabel_",id,"admin",MAN_ADMIN[lang],possibleValues,isAdmin);
collapsiblePart += createLabelWithOption("rolelabel_",id,"waiter",MAN_WAITER[lang],possibleValues,rWaiter);
collapsiblePart += createLabelWithOption("rolelabel_",id,"kitchen",MAN_KITCHEN[lang],possibleValues,rKitchen);
collapsiblePart += createLabelWithOption("rolelabel_",id,"bar",MAN_BAR[lang],possibleValues,rBar);
collapsiblePart += createLabelWithOption("rolelabel_",id,"supplydesk",MAN_SUPPLY[lang],possibleValues,rSupply);
collapsiblePart += createLabelWithOption("rolelabel_",id,"paydesk",MAN_PAYDESK[lang],possibleValues,rPay);
collapsiblePart += createLabelWithOption("rolelabel_",id,"stat",MAN_STAT[lang],possibleValues,rStat);
collapsiblePart += createLabelWithOption("rolelabel_",id,"bill",MAN_BILLS[lang],possibleValues,rBill);
collapsiblePart += createLabelWithOption("rolelabel_",id,"products",MAN_PRODUCTS[lang],possibleValues,rProd);
collapsiblePart += createLabelWithOption("rolelabel_",id,"reservation",MAN_RESERVATION[lang],possibleValues,rReservation);
collapsiblePart += createLabelWithOption("rolelabel_",id,"rating",MAN_RATING[lang],possibleValues,rRating);
collapsiblePart += createLabelWithOption("rolelabel_",id,"changeprice",MAN_CHANGEPRICE[lang],possibleValues,rChangeprice);
collapsiblePart += createLabelWithOption("rolelabel_",id,"customers",MAN_CUSTOMERS[lang],possibleValues,rCustomers);
collapsiblePart += createLabelWithOption("rolelabel_",id,"closingright",MAN_CLOSINGRIGHT[lang],possibleValues,rClosing);
collapsiblePart += createLabelWithOption("rolelabel_",id,"dash",MAN_DASHRIGHT[lang],possibleValues,rDash);
collapsiblePart += createLabelWithOption("rolelabel_",id,"manager",MAN_MANAGER[lang],possibleValues,rManager);
if (forNewRole) {
collapsiblePart += '<button data-theme="f" data-icon="plus" id="CreateNewRole">' + MAN_CREATE[lang] + '</button>';
} else {
collapsiblePart += '<button data-theme="f" data-icon="check" class="roleUpdateButton" id="updaterolebtn_' + id + '">Rechte ändern</button>';
collapsiblePart += '<button data-theme="d" data-icon="minus" class="roleDeleteButton" id="deleterolebtn_' + id + '">Löschen</button>';
}
collapsiblePart += '<form>';
collapsiblePart += '</div>';
@ -2347,8 +2438,10 @@ function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSuppl
}
function fillUserListIntoGui(userinfo) {
function fillUserListIntoGui(answer) {
var userPart = "";
var userinfo = answer.users;
var roles = answer.roles;
$.each(userinfo, function (i, aUser) {
var userid = aUser.id;
var username = aUser.username;
@ -2356,46 +2449,76 @@ function fillUserListIntoGui(userinfo) {
userPart += createCollapsibeOfUser(
"userid_" + userid,
username,
aUser.is_admin == 1,
aUser.right_waiter == 1,
aUser.right_kitchen == 1,
aUser.right_bar == 1,
aUser.right_supply == 1,
aUser.right_paydesk == 1,
aUser.right_statistics == 1,
aUser.right_bill == 1,
aUser.right_products == 1,
aUser.right_reservation == 1,
aUser.right_rating == 1,
aUser.right_changeprice == 1,
aUser.right_customers == 1,
aUser.right_closing == 1,
aUser.right_dash == 1,
aUser.right_manager == 1,
false
aUser.roleid,
false,
roles
);
});
userPart += createCollapsibeOfUser(
"userid_newuser",
"userid_newuser_newuser",
MAN_NEW_USER[lang],
false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true);
0,
true,roles);
$("#userlist").html(userPart);
$('#userpart').trigger('create');
$.each(userinfo, function (i, aUser) {
var userid = aUser.id;
var deleteButtonElem = $("#userlist").find("#userid_" + userid).find(".userDeleteButton");
deleteButtonElem.data("userid",userid);
var updateButtonElem = $("#userlist").find("#userid_" + userid).find(".userUpdateButton");
updateButtonElem.data("userid",userid);
var passwdButtonElem = $("#userlist").find("#userid_" + userid).find(".changepassword");
passwdButtonElem.data("userid",userid);
});
dynamicUserBinding();
}
function fillRoleListIntoGui(answer) {
if (answer.status != "OK") {
return;
}
rolesOnceExtended = true;
var roles = answer.msg;
var rolesPart = "";
for (var i=0;i<roles.length;i++) {
var aRole = roles[i];
var roleid = aRole.id;
var name = aRole.name;
rolesPart += createCollapsibeOfRole(
"roleid_" + roleid,
name,
aRole.is_admin,
aRole.right_waiter,
aRole.right_kitchen,
aRole.right_bar,
aRole.right_supply,
aRole.right_paydesk,
aRole.right_statistics,
aRole.right_bill,
aRole.right_products,
aRole.right_reservation,
aRole.right_rating,
aRole.right_changeprice,
aRole.right_customers,
aRole.right_closing,
aRole.right_dash,
aRole.right_manager,
false
);
}
rolesPart += createCollapsibeOfRole(
"roleid_newrole",MAN_NEW_ROLE[lang],
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true);
$("#rolescontentpart").html(rolesPart);
$("#rolescontentpart").trigger("create");
for (var j=0;j<roles.length;j++) {
var aRole = roles[j];
var roleid = aRole.id;
var name = aRole.name;
$("#rolelabel_name_roleid_" + roleid).val(name);
}
dynamicRolesBinding();
}
function askAndFillUserList() {
doAjax("GET","php/contenthandler.php?module=admin&command=getUserList",null, fillUserListIntoGui,"no user data received",true);
}
@ -2404,22 +2527,7 @@ function collectUserInfo(userInfoContainer,colIndexForDecision) {
var userData = [
["username", "#userlabel_username", true,false],
["password", "#userlabel_password", true,false],
["isAdmin", "#userlabel_admin", true,true],
["rWaiter", "#userlabel_waiter", true,true],
["rKitchen", "#userlabel_kitchen", true,true],
["rBar", "#userlabel_bar", true,true],
["rSupply", "#userlabel_supplydesk", true,true],
["rPayDesk", "#userlabel_paydesk", true,true],
["rStat", "#userlabel_stat", true,true],
["rBill", "#userlabel_bill", true,true],
["rProducts", "#userlabel_products", true,true],
["rReservation","#userlabel_reservation", true,true],
["rRating", "#userlabel_rating", true,true],
["rChangeprice","#userlabel_changeprice", true,true],
["rCustomers", "#userlabel_customers", true,true],
["rManager", "#userlabel_manager", true,true],
["rClosing", "#userlabel_closingright", true,true],
["rDash", "#userlabel_dash", true,true]
["roleid", "#userlabel_userrole", true,true],
];
var data = {};
@ -2433,16 +2541,89 @@ function collectUserInfo(userInfoContainer,colIndexForDecision) {
return data;
}
function collectRoleInfo(roleid) {
var roleData = [
["isAdmin", "#rolelabel_admin", true,true],
["rWaiter", "#rolelabel_waiter", true,true],
["rKitchen", "#rolelabel_kitchen", true,true],
["rBar", "#rolelabel_bar", true,true],
["rSupply", "#rolelabel_supplydesk", true,true],
["rPayDesk", "#rolelabel_paydesk", true,true],
["rStat", "#rolelabel_stat", true,true],
["rBill", "#rolelabel_bill", true,true],
["rProducts", "#rolelabel_products", true,true],
["rReservation","#rolelabel_reservation", true,true],
["rRating", "#rolelabel_rating", true,true],
["rChangeprice","#rolelabel_changeprice", true,true],
["rCustomers", "#rolelabel_customers", true,true],
["rManager", "#rolelabel_manager", true,true],
["rClosing", "#rolelabel_closingright", true,true],
["rDash", "#rolelabel_dash", true,true]
];
var data = {};
data["username"] = $("#rolelabel_name_roleid_" + roleid).val().trim();
for (var i=0;i<roleData.length;i++) {
var anEntry = roleData[i];
data[anEntry[0]] = $(anEntry[1] + "_roleid_" + roleid).val();
}
return data;
}
function dynamicRolesBinding() {
$("#CreateNewRole").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var data = collectRoleInfo("newrole");
if (data["username"].length == 0) {
alert ("Name ist nicht gesetzt");
} else {
doAjax("POST","php/contenthandler.php?module=admin&command=createNewRole",data,doCreateNewRole,"Anlegen neue Rolle");
}
});
$(".roleDeleteButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id.split("_")[2];
var data = {
roleid: id
};
doAjax("POST","php/contenthandler.php?module=admin&command=deleteRole",data,handleDelOrUpdateRole,"Entfernen einer Rolle");
});
$(".roleUpdateButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id.split("_")[2];
var data = collectRoleInfo(id);
data["roleid"] = id;
doAjax("POST","php/contenthandler.php?module=admin&command=updateRole",data,handleDelOrUpdateRole,"Ändern einer Rolle");
});
}
function dynamicUserBinding() {
$("#CreateNewUser").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var newUserInfoContainer = $(this).closest(".ui-collapsible");
var username = $("#userlabel_username_new").val();
var password = $("#userlabel_password_new").val();
var roleid = $("#userlabel_userrole_userid_newuser_newuser").val();
var data = collectUserInfo(newUserInfoContainer,2);
var data = {
name: username.trim(),
password: password,
roleid: roleid
};
if ((data["username"].length == 0) || (data["password"].length == 0)) {
if ((data["name"].length == 0) || (data["password"].length == 0)) {
alert ("Benutzername oder Passwort sind nicht gesetzt");
} else {
doAjax("POST","php/contenthandler.php?module=admin&command=createNewUser",data,doCreateNewUser,"Anlegen neuer Benutzer");
@ -2452,27 +2633,31 @@ function dynamicUserBinding() {
$(".userUpdateButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var userid = $(this).data("userid");
var userInfoContainer = $(this).closest(".ui-collapsible");
var data = collectUserInfo(userInfoContainer,3);
data["userid"] = userid;
var userid = this.id.split("_")[2];
var roleid = $("#userlabel_userrole_userid_" + userid).val();
var data = {
userid: userid,
roleid: roleid
};
doAjax("POST","php/contenthandler.php?module=admin&command=updateUser",data,askAndFillUserListNoData,"Benutzerdaten");
});
$(".userDeleteButton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var userid = this.id.split("_")[2];
var data = {
userid: $(this).data("userid")
userid: userid
};
doAjax("POST","php/contenthandler.php?module=admin&command=deleteUser",data,handleDelUser,"Benutzer entfernen");
});
$(".changepassword").off("click").on("click", function (e) {
var userid = $(this).data("userid");
var userInfoContainer = $(this).closest(".ui-collapsible");
var newPassword = userInfoContainer.find(".userlabel_newpassword").val();
var userid = this.id.split("_")[3];
var newPassword = $("#userpassword_changepasswordbtn_userid_" + userid).val();
if (newPassword.length == 0) {
alert ("Passwort ist leer!");
@ -2500,7 +2685,7 @@ function askAndFillUserListNoData(data) {
if (data == "noadmin") {
alert (MAN_NO_ADMIN[lang]);
} else {
setTimeout(function(){document.location.href = "manager.html"},250);
askAndFillUserList();
}
}
@ -2510,11 +2695,29 @@ function reloadPage(dummyData) {
function doCreateNewUser(result) {
if (result.status == "OK") {
askAndFillUserList("OK");
askAndFillUserList();
} else {
alert("Fehler: " + result.msg);
}
}
function handleDelOrUpdateRole(result) {
if (result.status == "OK") {
askAndFillUserList();
doAjax("GET","php/contenthandler.php?module=admin&command=getRoleList",null, fillRoleListIntoGui,"no role data received",true);
} else {
alert("Fehler: " + result.msg);
}
}
function doCreateNewRole(result) {
if (result.status == "OK") {
askAndFillUserList();
doAjax("GET","php/contenthandler.php?module=admin&command=getRoleList",null, fillRoleListIntoGui,"no role data received",true);
} else {
alert("Fehler: " + result.msg);
}
}
function handleResultOfDbAction(jsonText) {
if (jsonText.status == "OK") {
@ -3086,6 +3289,14 @@ $(document).on("pageinit", "#admin-page", function () {
</div> <!-- collapsible Abrechnung und Datenexport -->
<div id="rolespart" data-role="collapsible" data-collapsed="true" data-theme="e" data-content-theme="c" class="noprint" style="display:none;">
<h3><span id="rolestxt">Rollen</span></h3>
<p><div id="rolescontentpart">
<img id="roleswaiticon" src="php/3rdparty/images/ajax-loader.gif" />
</div>
</div> <!-- Benutzer -->
<div id="userpart" data-role="collapsible" data-collapsed="true" data-theme="e" data-content-theme="c" class="noprint" style="display:none;">
<h3><span id="usertxt">Benutzer</span></h3>
<div id="userlist" data-role="collapsible" data-theme="c" data-content-theme="c">
@ -3154,6 +3365,11 @@ $(document).on("pageinit", "#admin-page", function () {
<textarea cols="40" rows="8" name="drinktemplate" id="drinktemplate" class="genConfigEl" style="background-color:#FFFFFF;"></textarea>
<i id=drinktemplatehint style="padding-left: 50px;padding-right: 50px;">Hinweis: siehe Anleitung</i>
</div>
<div data-role="fieldcontain">
<label for="canceltemplate">Vorlage Storno-Arbeitsbon:</label>
<textarea cols="40" rows="8" name="canceltemplate" id="canceltemplate" class="genConfigEl" style="background-color:#FFFFFF;"></textarea>
<i id=canceltemplatehint style="padding-left: 50px;padding-right: 50px;">Hinweis: siehe Anleitung</i>
</div>
<div data-role="fieldcontain">
<label for="reservationnote">Reservierungstemplate Email:</label>
<textarea cols="40" rows="8" name="reservationnote" id="reservationnote" class="genConfigEl" style="background-color:#FFFFFF;"></textarea>
@ -3453,10 +3669,15 @@ $(document).on("pageinit", "#admin-page", function () {
<h3><span id="printjobsheader">Druckerwarteschlangen</span></h3>
<p><div id=printjobsarea>Daten</div>
<div class="ui-grid-a" class="noprint">
<div class="ui-block-a"><input type="text" placeholder="Arbeitsbon-Id" id="reprintworkreceipt" style="background:white;" /></div>
<div class="ui-block-b"><button type="submit" data-theme="f" data-icon="check" id="reprintworkreceiptbtn">Re-Print</button></div>
</div><!-- /grid-a -->
<div class="ui-grid-a" class="noprint">
<div class="ui-block-a"><button type="submit" data-theme="f" data-icon="check" id="updateprintqueue">Refresh</button></div>
<div class="ui-block-b"><button type="submit" data-theme="d" data-icon="delete" id="clearprintqueue">Clear print jobs</button></div>
</div><!-- /grid-a -->
<div class="ui-block-a"><button type="submit" data-theme="f" data-icon="check" id="updateprintqueue">Refresh</button></div>
<div class="ui-block-b"><button type="submit" data-theme="d" data-icon="delete" id="clearprintqueue">Clear print jobs</button></div>
</div><!-- /grid-a -->
</div> <!-- Druckerwarteschlangen -->

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -21,8 +21,11 @@ class Admin {
private static $rights = array(
"createNewUser" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"createNewRole" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"updateUser" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"updateRole" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"deleteUser" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"deleteRole" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"changepassword" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"changeConfig" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
"readlogo" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("manager_or_admin")),
@ -40,6 +43,7 @@ class Admin {
"hasUserPaydeskRight" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getJsonMenuItemsAndVersion" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"getUserList" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"getRoleList" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"setTime" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"changeOwnPassword" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
@ -124,7 +128,7 @@ class Admin {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
} else {
if ($_SESSION['is_admin'] == 0) {
if ($_SESSION['is_admin'] == false) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_ADMIN, "msg" => ERROR_COMMAND_NOT_ADMIN_MSG));
return false;
}
@ -133,11 +137,11 @@ class Admin {
if (!is_null($cmdRights["rights"])) {
foreach($cmdRights["rights"] as $aRight) {
if ($aRight == 'manager_or_admin') {
if (($_SESSION['is_admin'] == 1) || ($_SESSION['right_manager'] == 1)) {
if (($_SESSION['is_admin']) || ($_SESSION['right_manager'])) {
return true;
}
} else if ($aRight == 'dash') {
if ($_SESSION['right_dash'] == 1) {
if ($_SESSION['right_dash']) {
return true;
}
}
@ -179,14 +183,22 @@ class Admin {
$this->getJsonMenuItemsAndVersion();
} else if ($command == 'getUserList') {
$this->getUserList();
} else if ($command == 'getRoleList') {
$this->getRoleList();
} else if ($command == 'setTime') {
$this->setTime($_POST['day'],$_POST['month'],$_POST['year'],$_POST['hour'],$_POST['minute']);
} else if ($command == 'createNewUser') {
$this->createNewUser();
} else if ($command == 'createNewRole') {
$this->createNewRole();
} else if ($command == 'updateUser') {
$this->updateUser();
} else if ($command == 'updateRole') {
$this->updateRole();
} else if ($command == 'deleteUser') {
$this->deleteUser($_POST['userid']);
} else if ($command == 'deleteRole') {
$this->deleteRole($_POST['roleid']);
} else if ($command == 'changepassword') {
$this->changepassword($_POST['userid'],$_POST['password']);
} else if ($command == 'changeOwnPassword') {
@ -458,7 +470,7 @@ class Admin {
}
$sql = "SELECT * FROM %user% WHERE id=? AND active='1'";
$sql = "SELECT *,%user%.id as id FROM %user%,%roles% WHERE %user%.id=? AND active='1' AND %user%.roleid=%roles%.id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
$result = $stmt->fetchAll();
@ -923,7 +935,7 @@ class Admin {
$right_changeprice = 0;
$supplyRight = 0;
if ($userLoggedIn) {
$sql = "SELECT language,right_supply,right_changeprice,keeptypelevel,extrasapplybtnpos,right_paydesk,IFNULL(preferimgdesk,0) as preferimgdesk,IFNULL(preferimgmobile,0) as preferimgmobile,IFNULL(showplusminus,0) as showplusminus FROM %user% WHERE id=?";
$sql = "SELECT language,right_supply,right_changeprice,keeptypelevel,extrasapplybtnpos,right_paydesk,IFNULL(preferimgdesk,0) as preferimgdesk,IFNULL(preferimgmobile,0) as preferimgmobile,IFNULL(showplusminus,0) as showplusminus FROM %user%,%roles% WHERE %user%.id=? AND %user%.roleid=%roles%.id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($_SESSION['userid']));
$row = $stmt->fetchObject();
@ -967,6 +979,7 @@ class Admin {
$rectemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"rectemplate",null);
$foodtemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"foodtemplate",null);
$drinktemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"drinktemplate",null);
$canceltemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"canceltemplate",null);
$decpoint = CommonUtils::getConfigValueStmt($pdo,$stmt,"decpoint",null);
$version = CommonUtils::getConfigValueStmt($pdo,$stmt,"version",null);
$payprinttype = CommonUtils::getConfigValueStmt($pdo,$stmt,"payprinttype",null);
@ -1038,7 +1051,7 @@ class Admin {
$smtpsecure = 1;
$smtpport = "";
if ( (isset($_SESSION['is_admin']) && ($_SESSION['is_admin'] == 1)) || (isset($_SESSION['right_manager']) && ($_SESSION['right_manager'] == 1))) {
if ( (isset($_SESSION['is_admin']) && ($_SESSION['is_admin'] == 1)) || (isset($_SESSION['right_manager']) && ($_SESSION['right_manager']))) {
$smtphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtphost","");
$smtpauth = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpauth",1);
$smtpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpuser","");
@ -1080,7 +1093,7 @@ class Admin {
date_default_timezone_set(DbUtils::getTimeZone());
$now = getdate();
$retVal = array("companyinfo" => $companyInfo, "rectemplate" => $rectemplate, "foodtemplate" => $foodtemplate, "drinktemplate" => $drinktemplate,
$retVal = array("companyinfo" => $companyInfo, "rectemplate" => $rectemplate, "foodtemplate" => $foodtemplate, "drinktemplate" => $drinktemplate, "canceltemplate" => $canceltemplate,
"version" => $version, "decpoint" => $decpoint,
"serverurl" => $serverurl, "email" => $email, "receiveremail" => $receiveremail, "billlanguage" => $billlanguage,
"hotelinterface" => $hotelinterface, "hsinfile" => $hsinfile, "hsoutfile" => $hsoutfile, "hscurrency" => $hscurrency,
@ -1190,11 +1203,11 @@ class Admin {
if (($view == 'preferences.html') || ($view == 'feedback.html') || ($view == 'help.php')) {
$valid = true;
} else if ($view == 'manager.html') {
if (($_SESSION['is_admin'] == 1) || ($_SESSION['right_manager'] == 1) || ($_SESSION['right_closing'] == 1)) {
if (($_SESSION['is_admin']) || ($_SESSION['right_manager']) || ($_SESSION['right_closing'])) {
$valid = true;
}
} else {
if (($view == "index.html") || ($_SESSION[$mapping[$view]] == 1)) {
if (($view == "index.html") || ($_SESSION[$mapping[$view]])) {
$valid = true;
}
}
@ -1202,7 +1215,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.22");
echo json_encode($view . "?v=1.3.23");
}
}
@ -1409,27 +1422,27 @@ class Admin {
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.22"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.23"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.22"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.23"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.22"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.22"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.22"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.23"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.23"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.23"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.22"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.23"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.22"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.22"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.22"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.22"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.22"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.22"); };
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.3.22"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.22"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.22");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.3.22");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.22");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.23"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.23"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.23"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.23"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.23"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.23"); };
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.3.23"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.23"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.23");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.3.23");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.23");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1437,7 +1450,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.22",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.23",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1573,13 +1586,30 @@ class Admin {
}
}
function getUserList() {
function getRoleList() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT * FROM %user% WHERE active='1' ORDER BY is_admin";
$roles = $this->getRoleListCore($pdo);
echo json_encode(array("status" => "OK","msg" => $roles));
}
function getRoleListCore($pdo) {
$sql = "SELECT * from %roles% ORDER BY is_admin,right_manager";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$result = $stmt->fetchAll();
echo json_encode($result);
$roles = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $roles;
}
function getUserList() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT *,%user%.id as id,is_admin,right_manager FROM %user%,%roles% WHERE active='1' AND %user%.roleid=%roles%.id ORDER BY is_admin,right_manager";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
$roles = $this->getRoleListCore($pdo);
echo json_encode(array("users" => $users,"roles" => $roles));
}
function setTime($day,$month,$year,$hour,$min) {
@ -1607,13 +1637,93 @@ class Admin {
}
}
function updateRole() {
if(session_id() == '') {
session_start();
}
$pdo = DbUtils::openDbAndReturnPdoStatic();
if ($_POST["isAdmin"] == 1) {
echo json_encode(array("status" => "ERROR","msg" => "Nicht-Admins dürfen keine Rollen mit Admin-Rechten setzen!"));
return;
}
$roleid = $_POST["roleid"];
$roleIsAdmin = self::isRoleAdmin($pdo, $roleid);
if ($roleIsAdmin && !($this->isCurrentUserAdmin())) {
echo json_encode(array("status" => "ERROR","msg" => "Benutzer ist kein Admin und darf keine Admin-Rollen bearbeiten!"));
return;
}
$sql = "SELECT id FROM %user% WHERE roleid=? AND active='1'";
$effectedUsers = CommonUtils::fetchSqlAll($pdo, $sql, array($roleid));
$keys = array();
$vals = array();
foreach(DbUtils::$userCols as $userCol) {
if (!is_null($userCol["update"])) {
$key = $userCol["col"];
$keys[] = $key . "=?";
$vals[] = $_POST[$userCol["update"]];
}
}
$keys[] = "name=?";
$vals[] = $_POST["username"];
$vals[] = $roleid;
$keysStr = join(",",$keys);
$sql = "UPDATE %roles% SET " . $keysStr . " WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute($vals);
foreach( $effectedUsers as $aUser) {
$userid = $aUser["id"];
HistFiller::updateUserInHist($pdo, $userid);
}
echo json_encode(array("status" => "OK"));
}
function createNewRole() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$keys = array();
$vals = array();
$quests = array();
foreach(DbUtils::$userCols as $userCol) {
if (!is_null($userCol["new"])) {
$quests[] = '?';
$key = $userCol["col"];
if ($key == "username") {
$key = "name";
}
$keys[] = $key;
$vals[] = $_POST[$userCol['new']];
}
}
$keysStr = join(",",$keys);
$questsStr = join(",",$quests);
$sql = "INSERT INTO %roles% (" . $keysStr . ") VALUES(" . $questsStr . ")";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute($vals);
echo json_encode(array("status" => "OK"));
}
function createNewUser() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$username = $_POST['username'];
$isAdmin = $_POST['isAdmin'];
$username = $_POST['name'];
$password = $_POST['password'];
$roleid = $_POST['roleid'];
$sql = "SELECT count(id) as countid FROM %user% WHERE active='1' AND username=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($username));
@ -1629,44 +1739,24 @@ class Admin {
}
$lang = $_SESSION['language'];
if ($isAdmin && !($this->isCurrentUserAdmin())) {
$roleIsAdmin = self::isRoleAdmin($pdo, $roleid);
if ($roleIsAdmin && !($this->isCurrentUserAdmin())) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_ADMIN, "msg" => ERROR_COMMAND_NOT_ADMIN_MSG));
return;
} else {
$password_hash = md5($password);
$keys = array('id','userpassword','language');
$vals = array(null,$password_hash,$lang);
$quests = array('?','?','?');
foreach(DbUtils::$userCols as $userCol) {
if (!is_null($userCol["new"])) {
$quests[] = '?';
$keys[] = $userCol["col"];
$vals[] = $_POST[$userCol['new']];
} else if (isset($userCol["default"])) {
$quests[] = '?';
$keys[] = $userCol["col"];
$vals[] = $userCol["default"];
}
}
$keysStr = join(",",$keys);
$questsStr = join(",",$quests);
$userInsertSql = "INSERT INTO %user% (" . $keysStr . ") VALUES(" . $questsStr . ")";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute($vals);
$sql = "INSERT INTO %user% (username,userpassword,roleid,language,showplusminus,keeptypelevel,extrasapplybtnpos,prefertablemap,preferimgdesk,preferimgmobile,active) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($username,$password_hash,$roleid,$lang,1,1,1,1,1,1,1));
$lastId = $pdo->lastInsertId();
$sql = "UPDATE %user% SET showplusminus=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(1,$lastId));
HistFiller::createUserInHist($pdo, $lastId);
echo json_encode(array("status" => "OK"));
}
}
HistFiller::createUserInHist($pdo,$lastId);
}
function getPayPrintType() {
@ -1775,6 +1865,7 @@ class Admin {
"rectemplate" => array("dbcol" => "rectemplate","checknum" => 0),
"foodtemplate" => array("dbcol" => "foodtemplate","checknum" => 0),
"drinktemplate" => array("dbcol" => "drinktemplate","checknum" => 0),
"canceltemplate" => array("dbcol" => "canceltemplate","checknum" => 0),
"serverUrl" => array("dbcol" => "serverurl","checknum" => 0),
"email" => array("dbcol" => "email","checknum" => 0),
"emailbadrating" => array("dbcol" => "emailbadrating","checknum" => 0),
@ -1973,77 +2064,70 @@ class Admin {
return $theUserId;
}
public static function isRoleAdmin($pdo,$roleid) {
$sql = "SELECT is_admin FROM %roles% WHERE id=?";
$is_admin_role = CommonUtils::getRowSqlObject($pdo, $sql, array($roleid));
return ($is_admin_role->is_admin == 1 ? true : false);
}
public static function isRoleOfUserAdmin($pdo,$userid) {
$sql = "SELECT roleid FROM %user% WHERE id=?";
$role = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
$roleid = $role->roleid;
return self::isRoleAdmin($pdo, $roleid);
}
function updateUser() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$theUserId = $_POST['userid'];
$isAdmin = $_POST['isAdmin'];
$sql = "SELECT username,is_admin FROM %user% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($theUserId));
$row = $stmt->fetchObject();
$userToModIsAdmin = $row->is_admin;
$roleid = $_POST['roleid'];
$doChangeAdminRights = false;
if ($isAdmin != $userToModIsAdmin) {
$doChangeAdminRights = true;
}
if ($doChangeAdminRights && !($this->isCurrentUserAdmin())) {
$is_admin_role = self::isRoleAdmin($pdo, $roleid);
if (!$this->isCurrentUserAdmin() && $is_admin_role) {
echo json_encode("noadmin");
} else {
$keys = array();
$vals = array();
foreach(DbUtils::$userCols as $userCol) {
if (!is_null($userCol["update"])) {
$keys[] = $userCol["col"] . "=?";
$vals[] = $_POST[$userCol["update"]];
}
}
$vals[] = $theUserId;
$keysStr = join(",",$keys);
$sql = "UPDATE %user% SET " . $keysStr . " WHERE active='1' AND id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute($vals);
HistFiller::updateUserInHist($pdo,$theUserId);
echo json_encode("OK");
$sql = "UPDATE %user% SET roleid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($roleid,$theUserId));
HistFiller::updateUserInHist($pdo,$theUserId);
echo json_encode("OK");
}
}
function deleteRole($roleid) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT id FROM %user% WHERE roleid=? AND active='1'";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($roleid));
if (count($result) > 0) {
echo json_encode(array("status" => "ERROR","msg" => "Rolle ist noch Benutzern zugewiesen!"));
} else {
$sql = "DELETE FROM %roles% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($roleid));
echo json_encode(array("status" => "OK"));
}
}
function deleteUser($theUserId) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT is_admin FROM %user% WHERE active='1' AND id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($theUserId));
$row =$stmt->fetchObject();
$userToDelIsAdmin = ($row->is_admin == 1 ? true : false);
if ($userToDelIsAdmin && !($this->isCurrentUserAdmin())) {
$is_admin_role = self::isRoleOfUserAdmin($pdo, $theUserId);
if (!$this->isCurrentUserAdmin() && $is_admin_role) {
echo json_encode("noadmin");
} else {
$sql = "SELECT count(id) as countid FROM %user% WHERE active='1' AND is_admin='1' AND id <> ?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($theUserId));
$row = $stmt->fetchObject();
$numberOfOtherAdmins = $row->countid;
$sql = "UPDATE %user% set active='0' WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($theUserId));
if (($numberOfOtherAdmins == 0) && $userToDelIsAdmin) {
echo json_encode("lastadmin");
} else {
$userSql = "UPDATE %user% set active='0' WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userSql));
$stmt->execute(array($theUserId));
HistFiller::updateUserInHist($pdo,$theUserId);
echo json_encode("OK");
}
}
HistFiller::updateUserInHist($pdo,$theUserId);
$sql = "UPDATE %user% set roleid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$theUserId));
echo json_encode("OK");
}
}
function getCurrentUser() {
@ -2065,33 +2149,29 @@ class Admin {
echo json_encode("ERROR");
return;
}
$sql = "SELECT is_admin FROM %user% WHERE active='1' AND id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
$row = $stmt->fetchObject();
$userToChgPassIsAdm = false;
if ($row->is_admin == 1) {
$userToChgPassIsAdm = true;
}
$userToChgPassIsAdm = self::isRoleOfUserAdmin($pdo, $userid);
if(session_id() == '') {
session_start();
}
$otherUser = false;
if ($_SESSION['userid'] != $userid) {
$otherUser = true;
}
if ($otherUser && $userToChgPassIsAdm && !($this->isCurrentUserAdmin())) {
$currentUserAdmin = $this->isCurrentUserAdmin();
if (!$currentUserAdmin && $userToChgPassIsAdm) {
echo json_encode("noadmin");
} else {
$password_hash = md5($password);
$userSql = "UPDATE %user% set userpassword=? WHERE active='1' AND id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userSql));
$stmt->execute(array($password_hash,$userid));
echo json_encode("OK");
if(session_id() == '') {
session_start();
}
$otherUser = false;
if ($_SESSION['userid'] != $userid) {
$otherUser = true;
}
if ($otherUser && $userToChgPassIsAdm && !($this->isCurrentUserAdmin())) {
echo json_encode("noadmin");
} else {
$password_hash = md5($password);
$sql = "UPDATE %user% set userpassword=? WHERE active='1' AND id=?";
CommonUtils::execSql($pdo, $sql, array($password_hash,$userid));
echo json_encode("OK");
}
}
}
@ -2301,22 +2381,22 @@ class Admin {
}
private function getConfigTablesToBackupRestore() {
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods");
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config","roles","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods");
}
private function getConfigGuestsTablesToBackupRestore() {
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","customers","groups","groupcustomer","vacations");
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config","roles","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","customers","groups","groupcustomer","vacations");
}
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config",
"user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
private function getAllWithLogsTablesToBackupRestore() {
return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config",
"user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
@ -2922,6 +3002,7 @@ class Admin {
self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null);
self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", null);
self::doSql($pdo, "OPTIMIZE TABLE %log%", null);
self::doSql($pdo, "OPTIMIZE TABLE %roles%", null);
echo json_encode(array("status" => "OK"));
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG));
@ -3037,6 +3118,7 @@ class Admin {
self::doSql($pdo, "DELETE FROM %vacations%", null);
self::doSql($pdo, "DELETE FROM %groups%", null);
self::doSql($pdo, "DELETE FROM %customers%", null);
Workreceipts::resetWorkReceiptId($pdo);
echo json_encode(array("status" => "OK"));
} catch(Exception $e) {

View File

@ -795,13 +795,16 @@ class Bill {
$queueIdArray = array();
foreach($result as $row) {
if ($removeproducts == 1) {
Workreceipts::createCancelWorkReceipt($pdo, $row['id']);
}
$queueIdArray[] = $row['id'];
}
if ($removeproducts == 0) {
$sql = "UPDATE %queue% SET paidtime=null,billid=null WHERE billid=?";
} else {
$sql = "UPDATE %queue% SET ordertime=null,paidtime=null,billid=null WHERE billid=?";
$sql = "UPDATE %queue% SET ordertime=null,paidtime=null,billid=null WHERE billid=?";
}
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));

View File

@ -257,6 +257,8 @@ $sql = "DELETE FROM %log%";
CommonUtils::execSql($pdo, $sql, null);
}
workreceipts::resetWorkReceiptId($pdo);
// commit must before email, because there direct access to db happens
$pdo->commit();

View File

@ -16,7 +16,9 @@ require_once ('rating.php');
require_once ('customers.php');
require_once ('commonutils.php');
require_once ('updater.php');
require_once ('workreceipts.php');
require_once ('utilities/Logger.php');
require_once ('utilities/roles.php');
$module = $_GET["module"];
$command = $_GET["command"];

View File

@ -114,6 +114,7 @@ class DbUtils {
$out = str_replace("%queueextras%",$prefix . 'queueextras', $out);
$out = str_replace("%ratings%",$prefix . 'ratings', $out);
$out = str_replace("%prodimages%",$prefix . 'prodimages', $out);
$out = str_replace("%roles%",$prefix . 'roles', $out);
return (str_replace("%prodtype%",$prefix . 'prodtype',$out));
}

View File

@ -5,6 +5,7 @@ require_once ('globals.php');
require_once ('dbutils.php');
require_once ('bill.php');
require_once ('closing.php');
require_once ('admin.php');
class PrintQueue {
var $dbutils;
@ -12,6 +13,13 @@ class PrintQueue {
var $admin;
var $instance = null;
private static $FOOD = 1;
private static $DRINK = 2;
private static $RECEIPT = 3;
private static $CLOSING = 4;
public static $CANCELFOOD = 5;
public static $CANCELDRINK = 6;
function __construct() {
$this->dbutils = new DbUtils();
$this->userrights = new Userrights();
@ -48,6 +56,21 @@ class PrintQueue {
} else {
$this->getNextDrinkWorkPrintJobs(null,$_POST['pass'],$fl);
}
} else if ($command == 'getNextCancelFoodWorkPrintJobs') {
if (isset($_GET['printer'])) {
$this->getNextCancelFoodWorkPrintJobs($_GET['printer'],$_POST['pass'],$fl);
} else {
$this->getNextCancelFoodWorkPrintJobs(null,$_POST['pass'],$fl);
}
} else if ($command == 'getNextCancelDrinkWorkPrintJobs') {
if (isset($_GET['printer'])) {
$this->getNextCancelDrinkWorkPrintJobs($_GET['printer'],$_POST['pass'],$fl);
} else {
$this->getNextCancelDrinkWorkPrintJobs(null,$_POST['pass'],$fl);
}
} else if ($command == 'deletePrintJob') {
$this->deletePrintJob($_POST['pass'],$_POST['id']);
} else if ($command == 'queueReceiptPrintJob') {
@ -78,6 +101,8 @@ class PrintQueue {
$this->getLastLog($_POST['pass']);
} else if ($command == 'deleteSpooledPrintJob') {
$this->deleteSpooledPrintJob($_POST['id']);
} else if ($command == 'reprintworkreceipt') {
$this->reprintworkreceipt($_GET["workid"]);
} else {
echo "Kommando nicht erkannt!";
}
@ -135,10 +160,12 @@ class PrintQueue {
* Insert a "work" (food or drink) job into the printjob queue. The POS Print Server will
* pick these jobs and delete them after successful printing
*/
public static function queueWorkPrintJob($pdo,$table,$timestamp,$prods,$kind,$printer,$username) {
public static function queueWorkPrintJob($pdo,$table,$timestamp,$prods,$kind,$printer,$username) {
$workId = Workreceipts::getNextWorkReceiptId($pdo);
$table .= " ($username)";
$content = json_encode(array("table" => $table, "time" => $timestamp, "products" => $prods));
$content = json_encode(array("workid" => $workId,"table" => $table, "time" => $timestamp, "products" => $prods));
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($printInsertSql));
@ -146,6 +173,13 @@ class PrintQueue {
$idOfWorkJob = $pdo->lastInsertId();
$sql = "UPDATE %queue% SET printjobid=? WHERE id=?";
foreach($prods as $aProd) {
$queueid = $aProd["id"];
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($idOfWorkJob,$queueid));
}
CommonUtils::log($pdo,"QUEUE","Create work job with id=$idOfWorkJob for tableid $table from user $username of kind $kind for printer=$printer");
}
@ -168,16 +202,16 @@ class PrintQueue {
$jobs[] = array("printer" => $printer, "count" => count($result),"jobs" => $result);
}
$sql = "SELECT %printjobs%.id as id,content FROM %printjobs% WHERE type=?";
$sql = "SELECT %printjobs%.id as id,content FROM %printjobs% WHERE type=? AND removed is null";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(1));
$stmt->execute(array(self::$FOOD));
$result = $stmt->fetchAll();
$works = array();
foreach($result as $r) {
$works[] = array("id" => $r['id'],"content" => json_decode($r['content']));
}
$jobs[] = array("printer" => 7, "count" => count($result),"jobs" => $works);
$stmt->execute(array(2));
$stmt->execute(array(self::$DRINK));
$result = $stmt->fetchAll();
$works = array();
foreach($result as $r) {
@ -185,6 +219,7 @@ class PrintQueue {
}
$jobs[] = array("printer" => 8, "count" => count($result),"jobs" => $works);
echo json_encode(array("status" => "OK", "msg" => $jobs));
}
@ -195,9 +230,12 @@ class PrintQueue {
echo json_encode(array("status" => "ERROR", "code" => ERROR_DB_PRIVS_MISSING, "msg" => ERROR_DB_PRIVS_MISSING_MSG));
return;
}
$sql = "DELETE FROM %printjobs%";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "DELETE FROM %printjobs% WHERE (type <> ?) AND (type <> ?)";
CommonUtils::execSql($pdo, $sql, array(self::$FOOD,self::$DRINK));
$sql = "UPDATE %printjobs% SET removed=? WHERE (type = ?) OR (type = ?)";
CommonUtils::execSql($pdo, $sql, array(1,self::$FOOD,self::$DRINK));
$this->getPrintJobOverview($pdo);
}
@ -238,18 +276,52 @@ class PrintQueue {
}
}
function deleteSpooledPrintJob($printjobid) {
function checkForUserRightManagerAdmin() {
if (!($this->userrights->hasCurrentUserRight('right_manager')) &&
!($this->userrights->hasCurrentUserRight('is_admin'))
) {
echo "Benutzerrechte nicht ausreichend!";
return false;
} else {
return true;
}
}
function reprintworkreceipt($workid) {
if ($this->checkForUserRightManagerAdmin()) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if (is_null($workid)) {
echo json_encode(array("status" => "ERROR","msg" => "Keine gültige ID angegeben!"));
return;
}
$workid = trim($workid);
$sql = "SELECT id,content FROM %printjobs% WHERE type IN (?,?,?,?)";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array(self::$FOOD,self::$DRINK,self::$CANCELFOOD,self::$CANCELDRINK));
foreach ($result as $w) {
$content = json_decode($w["content"],true);
if ($content["workid"] == $workid) {
$sql = "UPDATE %printjobs% SET removed=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$w["id"]));
echo json_encode(array("status" => "OK"));
return;
}
}
echo json_encode(array("status" => "ERROR","msg" => "Kein Arbeitsbon-Druckjob mit der ID gefunden!"));
}
}
function deleteSpooledPrintJob($printjobid) {
if ($this->checkForUserRightManagerAdmin()) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "DELETE FROM %printjobs% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($printjobid));
echo json_encode(array("status" => "OK"));
}
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "DELETE FROM %printjobs% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($printjobid));
echo json_encode(array("status" => "OK"));
}
function queueReceiptPrintJob($billid,$useaddrecprinter) {
@ -283,10 +355,10 @@ class PrintQueue {
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($printInsertSql));
$stmt->execute(array((string)($billid),'3',$printer));
$stmt->execute(array((string)($billid),self::$RECEIPT,$printer));
if (!is_null($addprinter) && ($addprinter != "") && ($useaddrecprinter == 1)) {
$stmt->execute(array((string)($billid),'3',$addprinter));
$stmt->execute(array((string)($billid),self::$RECEIPT,$addprinter));
}
echo json_encode("OK");
@ -315,7 +387,7 @@ class PrintQueue {
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($printInsertSql));
$stmt->execute(array((string)($closingid),'4',$printer));
$stmt->execute(array((string)($closingid),self::$CLOSING,$printer));
echo json_encode("OK");
}
}
@ -541,11 +613,11 @@ class PrintQueue {
}
function getNextFoodWorkPrintJobs($printer,$md5pass,$fl) {
$this->getNextWorkPrintJobs($md5pass,1,$printer,$fl);
$this->getNextWorkPrintJobs($md5pass,self::$FOOD,$printer,$fl);
}
function getNextDrinkWorkPrintJobs($printer,$md5pass,$fl) {
$this->getNextWorkPrintJobs($md5pass,2,$printer,$fl);
$this->getNextWorkPrintJobs($md5pass,self::$DRINK,$printer,$fl);
}
function getNextWorkPrintJobs($md5pass,$theType,$printer,$fl) {
@ -574,11 +646,11 @@ class PrintQueue {
$template = $this->getTemplate($pdo, $templatekey);
if (is_null($printer)) {
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? ORDER BY id";
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? AND removed is null ORDER BY id";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($theType));
} else {
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? AND printer=? ORDER BY id";
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? AND printer=? AND removed is null ORDER BY id";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($theType,$printer));
}
@ -591,6 +663,9 @@ class PrintQueue {
$aWork = (array) json_decode($aWorkJob["content"]); // is in json format
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: collect work receipt with id=" . $aWorkJob["id"] . " for printer=$printer");
$workid = $aWork["workid"];
unset($aWork["workid"]);
if (($fl >= 5) && ($fl <= 6)) {
$prods = (array) ($aWork["products"]);
$targetProds = array();
@ -609,13 +684,12 @@ class PrintQueue {
$targetProds[] = $newTargetProd;
}
$aWork["products"] = $targetProds;
} else
if ($fl < 5) {
} else if ($fl < 5) {
$prods = (array) ($aWork["products"]);
$targetProds = array();
foreach ($prods as $aProd) {
$theArrProd = (array) $aProd;
$newTargetProd = array("id" => $theArrProd["id"],
"longname" => $theArrProd["longname"],
"option" => $theArrProd["option"],
@ -629,10 +703,14 @@ class PrintQueue {
$aWork["products"] = $targetProds;
}
if ($fl >= 2) {
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt), "template" => $template);
if ($fl >= 10) {
$workarray[] = array("workid" => $workid,"id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt), "template" => $template);
} else {
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt), "template" => $template);
}
} else {
// default without template
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt));
// default without template
$workarray[] = array("id" => $aWorkJob["id"],"content" => $aWork, "bigfontworkreceipt" => intval($bigFontWorkReceipt));
}
}
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: sent data to caller");
@ -643,6 +721,75 @@ class PrintQueue {
}
}
function getNextCancelFoodWorkPrintJobs($printer,$md5pass,$fl) {
$this->getNextCancelWorkPrintJobs($md5pass,self::$CANCELFOOD,$printer,$fl);
}
function getNextCancelDrinkWorkPrintJobs($printer,$md5pass,$fl) {
$this->getNextCancelWorkPrintJobs($md5pass,self::$CANCELDRINK,$printer,$fl);
}
function getNextCancelWorkPrintJobs($md5pass,$theType,$printer,$fl) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$isCorrect = $this->isPasswordCorrect($pdo,$md5pass,false);
if ($isCorrect) {
CommonUtils::log($pdo,"PRINTQUEUE", "getNextCancelWorkPrintJobs: type = $theType, printer = $printer, fl= $fl");
$checkType = "f";
if ($theType == 6) {
$checkType = "d";
}
if (!$this->checkForPrinterInstance($pdo, $checkType . $printer)) {
echo json_encode(array());
return;
}
$this->saveLastPrintServerAccess($pdo);
$templatekey = "canceltemplate";
$template = $this->getTemplate($pdo, $templatekey);
if (is_null($printer)) {
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? AND removed is null ORDER BY id";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($theType));
} else {
$sql = "SELECT id,content,type FROM %printjobs% WHERE type=? AND printer=? AND removed is null ORDER BY id";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($theType,$printer));
}
$result = $stmt->fetchAll();
CommonUtils::log($pdo,"PRINTQUEUE", "getNextCancelWorkPrintJobs: retrieve " . count($result) . " jobs");
$workarray = array();
foreach($result as $aWorkJob) {
$aWork = (array) json_decode($aWorkJob["content"],true); // is in json format
CommonUtils::log($pdo,"PRINTQUEUE", "getNextCancelWorkPrintJobs: collect work receipt with id=" . $aWorkJob["id"] . " for printer=$printer");
$workid = $aWork["workid"];
unset($aWork["workid"]);
$workarray[] = array("workid" => $workid,
"id" => $aWorkJob["id"],
"refworkid" => $aWork["refworkid"],
"longname" => $aWork["longname"],
"kind" => $theType,
"table" => $aWork["table"],
"time" => $aWork["time"],
"price" => $aWork["price"],
"extras" => $aWork["extras"],
"template" => $template);
}
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: sent data to caller");
echo json_encode($workarray);
} else {
CommonUtils::log($pdo,"PRINTQUEUE", "getNextWorkPrintJobs: wrong printcode");
echo json_encode(array());
}
}
function deletePrintJob($pass,$id) {
$pdo = $this->dbutils->openDbAndReturnPdo();
@ -650,10 +797,20 @@ class PrintQueue {
if ($isCorrect) {
$pdo = $this->dbutils->openDbAndReturnPdo();
$this->saveLastPrintServerAccess($pdo);
$sql = "DELETE FROM %printjobs% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($id));
$sql = "SELECT type FROM %printjobs% WHERE id=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($id));
if (count($result) > 0) {
$type = $result[0]['type'];
if (($type == self::$FOOD) || ($type == self::$DRINK) || ($type == self::$CANCELFOOD) || ($type == self::$CANCELDRINK)) {
$sql = "UPDATE %printjobs% SET removed=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(1,$id));
} else {
$sql = "DELETE FROM %printjobs% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($id));
}
}
echo json_encode(array("status" => "OK", "code" => OK, "msg" => "Druckauftrag erfolgreich gelöscht."));
} else {
CommonUtils::log($pdo,"PRINTQUEUE", "deletePrintJob: wrong printcode");
@ -661,4 +818,3 @@ class PrintQueue {
}
}
}
?>

View File

@ -1056,6 +1056,7 @@ class QueueContent {
$stmt->execute(array($queueid));
$rowsAffected = $stmt->rowCount();
if ($rowsAffected == 1) {
Workreceipts::createCancelWorkReceipt($pdo, $queueid);
echo json_encode(array("status" => "OK"));
} else {
echo json_encode(array("status" => "Failed", "msg" => "Affected rows: $rowsAffected"));

View File

@ -110,6 +110,7 @@ class Updater {
}
private static function getAvailableVersion($pdo) {
$url = CommonUtils::getConfigValue($pdo, "updateurl", '');
$installedVersion = CommonUtils::getConfigValue($pdo, "version", '');
$infoFile = self::getInfoFile($url,'updateinfo.txt',true,3);
if ($infoFile["status"] != "OK") {
return array("status" => "ERROR","msg" => "could not get info file: " . $infoFile["msg"],"url" => $url);
@ -117,7 +118,7 @@ class Updater {
$infoFileLines = $infoFile["msg"];
if (count($infoFileLines) > 1) {
$checkIfNewerVersion = self::isV2Newer('1.3.22',trim($infoFileLines[0]));
$checkIfNewerVersion = self::isV2Newer($installedVersion,trim($infoFileLines[0]));
return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url,"neweravailable" => ($checkIfNewerVersion ? 1 : 0));
} else {
return array("status" => "ERROR","msg" => "Info file not valid","url" => $url);

View File

@ -41,10 +41,10 @@ class HistFiller {
}
public static function readUserTableAndSendToHist($pdo) {
$sql = "SELECT * FROM %user%";
$sql = "SELECT * FROM %user% WHERE active='1'";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array());
$result = $stmt->fetchAll();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($result as $aUser) {
self::createUserInHist($pdo, $aUser["id"]);
}
@ -60,7 +60,7 @@ class HistFiller {
$pdo->commit();
}
private static function updateOrCreateUserInHist($pdo,$userid,$histaction) {
self::updateOrCreateEntryInHist($pdo, $userid, $histaction, self::getColNamesForUserHistTable(), 'userid', 'user','histuser',null,null);
self::updateOrCreateUserEntryInHist($pdo, $userid, $histaction, self::getColNamesForUserHistTable(), 'userid', 'user','histuser',null,null);
}
public static function readAllProdsAndFillHistByDb($pdo) {
@ -94,7 +94,53 @@ class HistFiller {
self::updateOrCreateEntryInHist($pdo, $prodid, $histaction, self::getColNamesForProdHistTable(), 'prodid', 'products', 'histprod',$extraCol,$extras);
}
private static function updateOrCreateUserEntryInHist($pdo,$id,$histaction,$colsInSourceTable,$idInHist,$sourcetable, $histtable,$extraCol,$extraVal) {
if (!is_null($extraVal)) {
if (strlen($extraVal) > 299) {
$extraVal = substr($extraVal, 0, 299);
}
}
$sql = "SELECT * from %". $sourcetable . "%,%roles% WHERE %user%.id=? AND %user%.roleid=%roles%.id ";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($id));
$row = $stmt->fetchObject();
$cols = $colsInSourceTable;
array_splice($cols, 0, 1, $idInHist);
$valuesStr = implode(",", $cols);
$quests = array();
$vals = array();
foreach($colsInSourceTable as $aHistCol) {
if ($aHistCol == "id") {
$vals[] = $id;
} else {
$vals[] = $row->$aHistCol;
}
$quests[] = "?";
}
$sql_insert_hist = "INSERT INTO %". $histtable . "% (id," . $valuesStr . ") VALUES(NULL," . implode(",",$quests) . ")";
$stmt_insert_hist = $pdo->prepare(DbUtils::substTableAlias($sql_insert_hist));
$stmt_insert_hist->execute($vals);
$newRefIdForHist = $pdo->lastInsertId();
if (!is_null($extraCol)) {
$sql = "UPDATE %". $histtable . "% SET " . $extraCol . "=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
try {
if (strlen($extraVal) > 300) {
$extraVal = substr($extraVal, 0, 300);
}
$stmt->execute(array($extraVal,$newRefIdForHist));
} catch (Exception $ex) {
}
}
self::insertIntoHist($pdo, $histaction, $newRefIdForHist);
}
private static function updateOrCreateEntryInHist($pdo,$id,$histaction,$colsInSourceTable,$idInHist,$sourcetable, $histtable,$extraCol,$extraVal) {
if (!is_null($extraVal)) {
if (strlen($extraVal) > 299) {

View File

@ -117,6 +117,7 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%bill%`");
$this->doSQLcatch($pdo, "drop TABLE `%ratings%`");
$this->doSQLcatch($pdo, "drop TABLE `%user%`");
$this->doSQLcatch($pdo, "drop TABLE `%roles%`");
$this->doSQLcatch($pdo, "drop TABLE `%closing%`");
$this->doSQLcatch($pdo, "drop TABLE `%config%`");
$this->doSQLcatch($pdo, "drop TABLE `%products%`");
@ -191,22 +192,6 @@ class Basedb {
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR ( 150 ) NOT NULL,
`userpassword` VARCHAR ( 150 ) NOT NULL,
`is_admin` INT (1) NOT NULL,
`right_waiter` INT (1) NOT NULL,
`right_kitchen` INT (1) NOT NULL,
`right_bar` INT (1) NOT NULL,
`right_supply` INT (1) NOT NULL,
`right_paydesk` INT (1) NOT NULL,
`right_statistics` INT (1) NOT NULL,
`right_bill` INT (1) NOT NULL,
`right_products` INT (1) NOT NULL,
`right_manager` INT (1) NOT NULL,
`right_closing` INT (1) NOT NULL,
`right_dash` INT (1) NOT NULL,
`right_reservation` INT (1) NOT NULL,
`right_rating` INT (1) NOT NULL,
`right_changeprice` INT (1) NOT NULL,
`right_customers` INT (1) NOT NULL,
`lastmodule` VARCHAR ( 30 ) NULL,
`ordervolume` INT (2) NULL,
`language` INT (2) NULL,
@ -222,12 +207,45 @@ class Basedb {
`keeptypelevel` INT(1) NOT NULL,
`extrasapplybtnpos` INT(1) NOT NULL,
`failedlogins` VARCHAR(20) NULL,
`active` INT (2) NOT NULL
`active` INT (2) NOT NULL,
`roleid` INT (10) NULL,
FOREIGN KEY (roleid) REFERENCES %roles%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
}
function createRolesTable($pdo)
{
try {
$sql = "
CREATE TABLE %roles% (
id INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
name VARCHAR ( 150 ) NOT NULL,
is_admin INT (1) NOT NULL,
right_waiter INT (1) NOT NULL,
right_kitchen INT (1) NOT NULL,
right_bar INT (1) NOT NULL,
right_supply INT (1) NOT NULL,
right_paydesk INT (1) NOT NULL,
right_statistics INT (1) NOT NULL,
right_bill INT (1) NOT NULL,
right_products INT (1) NOT NULL,
right_manager INT (1) NOT NULL,
right_closing INT (1) NOT NULL,
right_dash INT (1) NOT NULL,
right_reservation INT (1) NOT NULL,
right_rating INT (1) NOT NULL,
right_changeprice INT (1) NOT NULL,
right_customers INT (1) NOT NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$this->doSQL($pdo,$sql);
} catch (Exception $ex) {
// table may exists due to other installations
}
}
function createRoomTable($pdo)
{
$sql = "
@ -578,6 +596,7 @@ class Basedb {
`toremove` INT(3) NOT NULL,
`cooking` INT(10) NULL,
`workprinted` INT(2) NOT NULL,
`printjobid` INT(1) NULL,
`isclosed` INT(1) NULL,
FOREIGN KEY (tablenr) REFERENCES %resttables%(id),
FOREIGN KEY (pricelevel) REFERENCES %pricelevel%(id),
@ -706,7 +725,8 @@ class Basedb {
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`content` TEXT NOT NULL ,
`type` INT (2) NOT NULL ,
`printer` INT(2) NULL
`printer` INT(2) NULL,
`removed` INT(1) NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
@ -837,6 +857,7 @@ class Basedb {
{
$this->createLogTable($pdo);
$this->createPaymentTable($pdo);
$this->createRolesTable($pdo);
$this->createUserTable($pdo);
$this->createRoomTable($pdo);
$this->createRestTables($pdo);

View File

@ -0,0 +1,86 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of roles
*
* @author stefan
*/
class Roles {
public static function insertAdminRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Admin",1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0));
$id = $pdo->lastInsertId();
return $id;
}
public static function insertDigiManagerRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Manager",0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1));
$id = $pdo->lastInsertId();
return $id;
}
public static function insertWorkManagerRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Manager",0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1));
$id = $pdo->lastInsertId();
return $id;
}
public static function insertDigiWaiterRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Kellner",0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0));
$id = $pdo->lastInsertId();
return $id;
}
public static function insertWorkWaiterRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Kellner",0,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0));
$id = $pdo->lastInsertId();
return $id;
}
public static function insertCookRole($pdo) {
$sql = "INSERT INTO %roles% (name,"
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk,"
. "right_statistics,right_bill,right_products,right_manager,right_closing,"
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers) VALUES("
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array("Koch",0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0));
$id = $pdo->lastInsertId();
return $id;
}
}

View File

@ -0,0 +1,93 @@
<?php
class Workreceipts {
public static function getNextWorkReceiptId($pdo) {
$sql = "SELECT value from %work% WHERE item=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array('workid'));
$workid = 0;
if (count($result) == 0) {
$sql = "INSERT INTO %work% (item,value,signature) VALUES(?,?,?)";
CommonUtils::execSql($pdo, $sql, array("workid",0,null));
} else {
$workid = $result[0]['value'];
}
$nextid = intval($workid) + 1;
$sql = "UPDATE %work% SET value=? WHERE item=?";
CommonUtils::execSql($pdo, $sql, array($nextid,'workid'));
return $nextid;
}
public static function resetWorkReceiptId($pdo) {
$sql = "UPDATE %queue% SET printjobid=?";
CommonUtils::execSql($pdo, $sql, array(null));
$sql = "DELETE FROM %work% WHERE item=?";
CommonUtils::execSql($pdo, $sql, array('workid'));
}
public static function createCancelWorkReceipt($pdo,$queueid) {
$sql = "SELECT printjobid FROM %queue% WHERE id=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($queueid));
if (count($result) == 1) {
try {
$workid = Workreceipts::getNextWorkReceiptId($pdo);
$printjobid = $result[0]["printjobid"];
if (!is_null($printjobid)) {
$sql = "SELECT content,printer FROM %printjobs% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($printjobid));
$origJobJson = $row->content;
$printer = $row->printer;
$origJob = json_decode($origJobJson, true);
$refworkid = $origJob["workid"];
$table = $origJob["table"];
$time = $origJob["time"];
$products = $origJob["products"];
foreach ($products as $prod) {
$id = $prod["id"];
if ($id == $queueid) {
$kind = $prod["kind"];
$longname = $prod["longname"];
$price = $prod["price"];
$extrasArr = $prod["extras"];
$extrasStr = implode(",", $extrasArr);
$cancelJob = array(
"workid" => $workid,
"refworkid" => $refworkid,
"table" => $table,
"time" => $time,
"longname" => $longname,
"kind" => $kind,
"price" => $price,
"extras" => $extrasStr);
$cancelJobJson = json_encode($cancelJob);
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($printInsertSql));
$type = PrintQueue::$CANCELFOOD;
if ($kind == 1) {
$type = PrintQueue::$CANCELDRINK;
}
$stmt->execute(array($cancelJobJson,$type,$printer));
$idOfWorkJob = $pdo->lastInsertId();
CommonUtils::log($pdo,"QUEUE","Create cancel work job with id=$idOfWorkJob for tableid $table of kind $kind for printer=$printer");
}
}
}
} catch (Exception $ex) {
$msg = $ex->getMessage();
return;
}
}
}
}

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.23">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

File diff suppressed because one or more lines are too long