diff --git a/javaprinter/javaprinter.jar b/javaprinter/javaprinter.jar index c437d8c..a1b3d5c 100644 Binary files a/javaprinter/javaprinter.jar and b/javaprinter/javaprinter.jar differ diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index 4b77620..c6c2dc7 100644 Binary files a/printserver/OrderSprinterPrintserver.exe and b/printserver/OrderSprinterPrintserver.exe differ diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe index 4b77620..c6c2dc7 100644 Binary files a/webapp/OrderSprinterPrintserver.exe and b/webapp/OrderSprinterPrintserver.exe differ diff --git a/webapp/bar.html b/webapp/bar.html index 69d2caa..a0129ae 100644 --- a/webapp/bar.html +++ b/webapp/bar.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/bill.html b/webapp/bill.html index 74e2f42..be64817 100644 --- a/webapp/bill.html +++ b/webapp/bill.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/feedback.html b/webapp/feedback.html index c88aa3d..898cb84 100644 --- a/webapp/feedback.html +++ b/webapp/feedback.html @@ -4,7 +4,7 @@ - + diff --git a/webapp/index.html b/webapp/index.html index 8b6f562..0694fda 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -6,8 +6,8 @@ - - + + diff --git a/webapp/install.html b/webapp/install.html index fb1a342..7ad1689 100644 --- a/webapp/install.html +++ b/webapp/install.html @@ -679,7 +679,7 @@ $(document).ready(function() {
- + diff --git a/webapp/paydesk.html b/webapp/paydesk.html index d5127d0..7a3b2b3 100644 --- a/webapp/paydesk.html +++ b/webapp/paydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/php/admin.php b/webapp/php/admin.php index ec07f7c..3e8b161 100644 --- a/webapp/php/admin.php +++ b/webapp/php/admin.php @@ -51,6 +51,7 @@ class Admin { "getPayments" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "autobackup" => array("loggedin" => 0, "isadmin" => 0, "rights" => null), "shutdown" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), + "optimize" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "backup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "restore" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "golive" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), @@ -207,6 +208,9 @@ class Admin { } else if ($command == 'shutdown') { $this->shutdown(); return; + } else if ($command == 'optimize') { + $this->optimize(); + return; } else if ($command == 'assignTaxes') { $this->assignTaxes($_POST['food'],$_POST['drinks']); return; @@ -800,7 +804,7 @@ class Admin { $smtpsecure = 1; $smtpport = ""; - if ($_SESSION['is_admin'] || $_SESSION['right_manager']) { + if ( (isset($_SESSION['is_admin']) && ($_SESSION['is_admin'] == 1)) || (isset($_SESSION['right_manager']) && ($_SESSION['right_manager'] == 1))) { $smtphost = CommonUtils::getConfigValue($pdo,"smtphost",""); $smtpauth = CommonUtils::getConfigValue($pdo,"smtpauth",1); $smtpuser = CommonUtils::getConfigValue($pdo,"smtpuser",""); @@ -932,7 +936,7 @@ class Admin { $view = "preferences.html"; } - echo json_encode($view . "?v=1.2.14"); + echo json_encode($view . "?v=1.2.15"); } } @@ -1138,24 +1142,24 @@ 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.2.14"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.15"); }; } else { - if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.2.14"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.2.15"); }; } - if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.14"); }; - if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.14"); }; - if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.14"); }; + if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.15"); }; + if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.15"); }; + if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.15"); }; if ($_SESSION['modus'] == 0) { - if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.14"); }; + if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.15"); }; } - if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.14"); }; - if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.14"); }; - if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.14"); }; - if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.14"); }; - if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.14"); }; - if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.14"); }; - $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.14"); - $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.14"); + if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.15"); }; + if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.15"); }; + if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.15"); }; + if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.15"); }; + if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.15"); }; + if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.15"); }; + $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.15"); + $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.15"); } $mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php"); @@ -1164,7 +1168,7 @@ class Admin { $waiterMessage = $this->getMessage(null, "waitermessage"); } // CAUTION: change version also in config.txt!!! - $mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.14", + $mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.15", "user" => $currentUser, "menu" => $mainMenu, "waitermessage" => $waiterMessage, @@ -2083,6 +2087,19 @@ class Admin { } + private function optimize() { + try { + $pdo = DButils::openDbAndReturnPdoStatic(); + self::doSql($pdo, "OPTIMIZE TABLE %queue%", null); + self::doSql($pdo, "OPTIMIZE TABLE %billproducts%", null); + self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null); + self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", 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)); + } + } + private function golive() { try { $pdo = DButils::openDbAndReturnPdoStatic(); diff --git a/webapp/php/closing.php b/webapp/php/closing.php index adbb761..7143152 100644 --- a/webapp/php/closing.php +++ b/webapp/php/closing.php @@ -163,7 +163,7 @@ $sql = "UPDATE %queue% set paidtime=?,delivertime=? WHERE billid is not null AND $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($closingTime,$closingTime)); -$sql = "UPDATE %queue% set delivertime=?,workprinted=? WHERE billid is not null AND delivertime = '0000-00-00 00:00:00'"; +$sql = "UPDATE %queue% set delivertime=?,workprinted=? WHERE billid is not null AND delivertime IS NULL"; $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($closingTime,1)); diff --git a/webapp/php/queuecontent.php b/webapp/php/queuecontent.php index 8769b4e..569bf9c 100644 --- a/webapp/php/queuecontent.php +++ b/webapp/php/queuecontent.php @@ -107,21 +107,11 @@ class QueueContent { } } - // needed if paydesk gets the tableid by direct call function getJsonTableNameFromId($tableid) { $pdo = DbUtils::openDbAndReturnPdoStatic(); $commonUtils = new CommonUtils(); echo json_encode($commonUtils->getTableNameFromId($pdo,$tableid)); } - - function getDateValueAsBoolInterpretatedIcon($aValue) { - if ($aValue != '0000-00-00 00:00:00' ) { - $imgFile = "ok.png"; - } else { - $imgFile = "wait.png"; - } - return ""; - } function getUserName($userid) { $pdo = $this->dbutils->openDbAndReturnPdo(); @@ -175,7 +165,7 @@ class QueueContent { } else { $sql = "SELECT DISTINCT %queue%.id as id,%resttables%.id as tableid,tablenr,longname,anoption,tableno,date_format(ordertime,'%Y-%m-%d %H:%i:00') as ordertime,cooking,TIMESTAMPDIFF(MINUTE,ordertime,?) AS waittime FROM %queue%,%products%,%prodtype%,%resttables% "; } - $sql .= "WHERE (readytime = '0000-00-00 00:00:00' AND "; + $sql .= "WHERE (readytime IS NULL AND "; $sql .= " ordertime is not null AND "; $sql .= "%queue%.productid=%products%.id AND "; $sql .= "%queue%.tablenr = %resttables%.id AND "; @@ -199,7 +189,7 @@ class QueueContent { $sql = "SELECT DISTINCT q.id as id,'-' as tableid,'-' as tablenr,longname,anoption,'-' as tableno,date_format(ordertime,'%Y-%m-%d %H:%i:00') as ordertime,cooking,TIMESTAMPDIFF(MINUTE,ordertime,?) AS waittime FROM %products%,%prodtype%,%resttables%, %queue% q LEFT OUTER JOIN %bill% b "; $sql .= " ON q.billid=b.id "; - $sql .= "WHERE (readytime = '0000-00-00 00:00:00' AND "; + $sql .= "WHERE (readytime IS NULL AND "; $sql .= " ordertime is not null AND "; $sql .= "q.productid=%products%.id AND "; $sql .= "q.tablenr is null AND "; @@ -536,8 +526,8 @@ class QueueContent { } else { $sql = "SELECT DISTINCT %queue%.id as id,tablenr,longname,anoption,tableno,readytime,%products%.id as prodid FROM %queue%,%products%,%prodtype%,%resttables% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' AND "; - $sql .= "delivertime = '0000-00-00 00:00:00' AND "; + $sql .= "WHERE (readytime IS NOT NULL AND "; + $sql .= "delivertime IS NULL AND "; $sql .= "ordertime is not null AND "; $sql .= "%queue%.productid=%products%.id AND "; $sql .= "%queue%.tablenr = %resttables%.id AND "; @@ -563,8 +553,8 @@ class QueueContent { $sql = "SELECT DISTINCT %queue%.id as id,0 as tablenr,longname,anoption,'-' as tableno,readytime,%products%.id as prodid FROM %queue%,%products%,%prodtype%,%resttables% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' AND "; - $sql .= "delivertime = '0000-00-00 00:00:00' AND "; + $sql .= "WHERE (readytime IS NOT NULL AND "; + $sql .= "delivertime IS NULL AND "; $sql .= "ordertime is not null AND "; $sql .= "%queue%.productid=%products%.id AND "; $sql .= "%queue%.tablenr is null AND "; @@ -620,7 +610,7 @@ class QueueContent { $sql .= "FROM %queue%,%resttables%,%products%,%bill%,%prodtype% "; $sql .= "WHERE (%queue%.productid=%products%.id "; $sql .= "AND %queue%.tablenr=%resttables%.id "; - $sql .= "AND %queue%.readytime <> '0000-00-00 00:00:00' "; + $sql .= "AND %queue%.readytime IS NOT NULL "; $sql .= "AND toremove <> '1' AND "; $sql .= "ordertime is not null AND "; $sql .= "(%queue%.productid = %products%.id AND %products%.category = %prodtype%.id AND %prodtype%.kind=? AND %prodtype%.usesupplydesk='0' AND %prodtype%.usekitchen='1') AND "; @@ -742,16 +732,16 @@ class QueueContent { $pdo->beginTransaction(); // first: is the product still declared as delivered? - $sql = "SELECT id FROM %queue% WHERE id=? AND readytime <> '0000-00-00 00:00:00'"; + $sql = "SELECT id FROM %queue% WHERE id=? AND readytime IS NOT NULL"; $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($queueid)); $row =$stmt->fetchObject(); if ($row != null) { $foundid = $row->id; if ($foundid == $queueid) { - $sql = "UPDATE %queue% SET readytime='0000-00-00 00:00:00', delivertime='0000-00-00 00:00:00', cooking=NULL WHERE id=?"; + $sql = "UPDATE %queue% SET readytime=?, delivertime=?, cooking=NULL WHERE id=?"; $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); - $stmt->execute(array($queueid)); + $stmt->execute(array(null,null,$queueid)); $pdo->commit(); echo json_encode(array("status" => "OK")); } else { @@ -938,7 +928,7 @@ class QueueContent { $insertSql = "INSERT INTO `%queue%` ( `id` , `tablenr`,`productid`,`pricelevel`,`price`,`tax`,`taxaustria`,`productname`,`ordertime`,`orderuser`,`anoption`,`pricechanged`,`togo`,`readytime`,`delivertime`,`paidtime`,`billid`,`toremove`,`cooking`,`workprinted`) VALUES ( - NULL , ?,?,?,?,?,?,?,?,?,?,?,?, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL,NULL,'0',NULL,'0');"; + NULL , ?,?,?,?,?,?,?,?,?,?,?,?, null, null, NULL,NULL,'0',NULL,'0');"; $stmt = $pdo->prepare(DbUtils::substTableAlias($insertSql)); $stmt->execute(array($theTableid,$productid,$currentPriceLevelId,$price,$tax,$taxaustrianumber,$productname,$ordertime,$_SESSION['userid'],$theOption,($theChangedPrice == "NO" ? 0 : 1),$togo)); @@ -1011,11 +1001,11 @@ class QueueContent { } else { $sql = "UPDATE %queue% "; } - $sql .= "SET ordertime=null WHERE %queue%.id=? AND ordertime <> '0000-00-00 00:00:00' "; + $sql .= "SET ordertime=null WHERE %queue%.id=? AND ordertime IS NOT NULL "; if ($isPaid == '1') { - $sql .= " AND paidtime <> '0000-00-00 00:00:00' "; + $sql .= " AND paidtime IS NOT NULL "; } else { - $sql .= " AND (paidtime = '0000-00-00 00:00:00' or paidtime is null) "; + $sql .= " AND (paidtime IS NULL or paidtime is null) "; } if ($isCooking == '1') { $sql .= " AND cooking is not null "; @@ -1023,9 +1013,9 @@ class QueueContent { $sql .= " AND cooking is null "; } if ($isReady == '1') { - $sql .= " AND readytime <> '0000-00-00 00:00:00' "; + $sql .= " AND readytime IS NOT NULL "; } else { - $sql .= " AND (readytime = '0000-00-00 00:00:00' or readytime is null) "; + $sql .= " AND (readytime IS NULL or readytime is null) "; } // and not in a closing: if ($hasBills) { @@ -1101,8 +1091,8 @@ class QueueContent { $allNotClosedQueueIds = $stmt->fetchAll(); $resultids = array(); - $sql = "SELECT count(id) as countid FROM %queue% WHERE %queue%.id=? AND (%queue%.delivertime = '0000-00-00 00:00:00' "; - $sql .= " OR %queue%.readytime = '0000-00-00 00:00:00' "; + $sql = "SELECT count(id) as countid FROM %queue% WHERE %queue%.id=? AND (%queue%.delivertime IS NULL "; + $sql .= " OR %queue%.readytime IS NULL "; $sql .= " OR (%queue%.billid is null AND %queue%.paidtime is null)) "; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); foreach($allNotClosedQueueIds as $aQueueId) {# @@ -1126,7 +1116,7 @@ class QueueContent { $isDelivered = "1"; $isPaid = "1"; $isCooking = '1'; - if ($row->readytime == '0000-00-00 00:00:00') { + if ($row->readytime == null) { $isReady = "0"; // not yet prepared by the kitchen } if ($row->paidtime == null) { @@ -1175,8 +1165,8 @@ class QueueContent { $sql = "SELECT %queue%.id as queueid,productname FROM "; $sql .= "%queue% LEFT OUTER JOIN %bill% ON %queue%.billid=%bill%.id WHERE "; $sql .= "(tablenr=? OR (tablenr IS NULL AND ? IS NULL)) AND ordertime is not null AND isclosed is null AND billid is null AND ("; - $sql .= "%queue%.delivertime = '0000-00-00 00:00:00' OR "; - $sql .= "(%queue%.delivertime <> '0000-00-00 00:00:00' AND workprinted='1')) "; + $sql .= "%queue%.delivertime IS NULL OR "; + $sql .= "(%queue%.delivertime IS NOT NULL AND workprinted='1')) "; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt->execute(array($tableid,$tableid)); $undeliveredresultungrouped = $stmt->fetchAll(); @@ -1326,7 +1316,7 @@ class QueueContent { if (is_numeric($queueid)) { date_default_timezone_set(DbUtils::getTimeZone()); $delivertime = date('Y-m-d H:i:s'); - $updateSql = "UPDATE %queue% SET delivertime='0000-00-00 00:00:00' WHERE id=?"; + $updateSql = "UPDATE %queue% SET delivertime IS NULL WHERE id=?"; $stmt = $pdo->prepare(DbUtils::substTableAlias($updateSql)); $stmt->execute(array($queueid)); } @@ -1340,7 +1330,7 @@ class QueueContent { } else { $sql .= "FROM %queue%,%products%,%resttables% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; + $sql .= "WHERE (readytime IS NOT NULL and delivertime IS NULL "; $sql .= "AND %queue%.productid=%products%.id "; $sql .= "AND %queue%.tablenr=%resttables%.id "; $sql .= "AND %queue%.isclosed is null "; @@ -1363,7 +1353,7 @@ class QueueContent { } else { $sql .= "FROM %queue%,%products%,%resttables% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; + $sql .= "WHERE (readytime IS NOT NULL and delivertime IS NULL "; $sql .= "AND %queue%.productid=%products%.id "; $sql .= "AND %queue%.tablenr is null "; $sql .= "AND ordertime is not null "; @@ -1418,7 +1408,7 @@ class QueueContent { } else { $sql .= "FROM %queue% "; } - $sql .= "WHERE delivertime = '0000-00-00 00:00:00' "; + $sql .= "WHERE delivertime IS NULL "; $sql .= "AND ordertime is not null "; $sql .= "AND %queue%.isclosed is null "; $sql .= "AND workprinted='0' "; @@ -1449,7 +1439,7 @@ class QueueContent { } else { $sql .= "FROM %queue%,%resttables% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; + $sql .= "WHERE (readytime IS NOT NULL and delivertime IS NULL "; $sql .= "AND toremove <> '1' "; $sql .= "AND %queue%.tablenr=%resttables%.id AND "; $sql .= "ordertime is not null AND "; @@ -1474,7 +1464,7 @@ class QueueContent { } else { $sql .= "FROM %queue% "; } - $sql .= "WHERE (readytime <> '0000-00-00 00:00:00' and delivertime = '0000-00-00 00:00:00' "; + $sql .= "WHERE (readytime IS NOT NULL and delivertime IS NULL "; $sql .= "AND toremove <> '1' "; $sql .= "AND %queue%.tablenr is null AND "; $sql .= "ordertime is not null AND "; @@ -1545,7 +1535,7 @@ class QueueContent { } else { $sql .= "FROM %queue%,%resttables%,%products% "; } - $sql .= "WHERE (delivertime <> '0000-00-00 00:00:00' "; + $sql .= "WHERE (delivertime IS NOT NULL "; $sql .= "AND %queue%.productid=%products%.id "; $sql .= "AND %queue%.tablenr=%resttables%.id "; $sql .= "AND toremove <> '1' AND "; @@ -1572,7 +1562,7 @@ class QueueContent { } else { $sql .= "FROM %queue%,%resttables%,%products% "; } - $sql .= "WHERE (delivertime <> '0000-00-00 00:00:00' "; + $sql .= "WHERE (delivertime IS NOT NULL "; $sql .= "AND %queue%.productid=%products%.id "; $sql .= "AND %queue%.tablenr is null "; $sql .= "AND toremove <> '1' AND "; diff --git a/webapp/php/roomtables.php b/webapp/php/roomtables.php index 4f81ed7..db0d2c2 100644 --- a/webapp/php/roomtables.php +++ b/webapp/php/roomtables.php @@ -13,19 +13,19 @@ class Roomtables { } function handleCommand($command) { - if(session_id() == '') { + if(session_id() == '') { session_start(); - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { + if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { // no user logged in echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG)); - } + } } - header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); - header("Cache-Control: post-check=0, pre-check=0", false); - header("Pragma: no-cache"); + header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); - if($command == 'showAllRooms') { + if($command == 'showAllRooms') { $this->showAllRooms(); } else if ($command == 'getRooms') { $this->getRooms(); // only rooms! @@ -43,54 +43,54 @@ class Roomtables { } private function hasCurrentUserAdminRights() { - if(session_id() == '') { - session_start(); - } - if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { - // no user logged in - return false; - } else { - return ($_SESSION['is_admin']); - } + if(session_id() == '') { + session_start(); + } + if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) { + // no user logged in + return false; + } else { + return ($_SESSION['is_admin']); + } } function showAllRooms() { $pdo = $this->dbutils->openDbAndReturnPdo(); - $roomtables = $this->getAllTablesAndRooms($pdo); + $roomtables = $this->getAllTablesAndRooms($pdo); echo json_encode($roomtables); } public static function getUnpaidTablesCore($pdo,$roomid) { // first get all tables of that rooms $tablesSql = "SELECT id,tableno FROM %resttables% WHERE %resttables%.roomid =? AND removed is null"; - - $stmt = $pdo->prepare(DbUtils::substTableAlias($tablesSql)); - $stmt->execute(array($roomid)); - $result = $stmt->fetchAll(); - $tablesArr = array(); - - foreach($result as $row) { - $entry = array("id" => $row['id'], "name" => $row['tableno']); - $tablesArr[] = $entry; + + $stmt = $pdo->prepare(DbUtils::substTableAlias($tablesSql)); + $stmt->execute(array($roomid)); + $result = $stmt->fetchAll(); + $tablesArr = array(); + + foreach($result as $row) { + $entry = array("id" => $row['id'], "name" => $row['tableno']); + $tablesArr[] = $entry; } $tableresult = array(); foreach($tablesArr as $aTable) { $tableid = $aTable['id']; - $sql = "SELECT sum(%queue%.price) as sumprice,count(%queue%.price) as prodcount - FROM %queue% - INNER JOIN %products% ON %queue%.productid = %products%.id - INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id - WHERE tablenr = ? AND paidtime is null AND toremove <> '1' + $sql = "SELECT sum(%queue%.price) as sumprice,count(%queue%.price) as prodcount + FROM %queue% + INNER JOIN %products% ON %queue%.productid = %products%.id + INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id + WHERE tablenr = ? AND paidtime is null AND toremove <> '1' AND ordertime is not null AND isclosed is null"; - $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt->execute(array($tableid)); - $row = $stmt->fetchObject(); + $row = $stmt->fetchObject(); if ($row != null) { - $prodcount = $row->prodcount; + $prodcount = $row->prodcount; $sumprice = $row->sumprice; if ($prodcount > 0) { $aTableEntry = array("id" => $tableid,"name" => $aTable["name"], "pricesum" => $sumprice); @@ -127,16 +127,16 @@ class Roomtables { function hasTableUnpaidItems($tableid) { // sql copied from getJsonProductsOfTableToPay - $sql = "SELECT %queue%.id as id,longname,%queue%.price as price,%pricelevel%.name as pricelevelname,%products%.id as prodid - FROM %queue% - INNER JOIN %products% ON %queue%.productid = %products%.id - INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id - WHERE tablenr = $tableid AND paidtime is null AND toremove <> '1' - AND ordertime is not null + $sql = "SELECT %queue%.id as id,longname,%queue%.price as price,%pricelevel%.name as pricelevelname,%products%.id as prodid + FROM %queue% + INNER JOIN %products% ON %queue%.productid = %products%.id + INNER JOIN %pricelevel% ON %queue%.pricelevel = %pricelevel%.id + WHERE tablenr = $tableid AND paidtime is null AND toremove <> '1' + AND ordertime is not null ORDER BY ordertime;"; $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(); $count = $stmt->rowCount(); if ($count > 0) { @@ -151,15 +151,15 @@ class Roomtables { */ function getRooms() { $sql = "SELECT id,roomname FROM %room% WHERE removed is null"; - $pdo = $this->dbutils->openDbAndReturnPdo(); - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $pdo = $this->dbutils->openDbAndReturnPdo(); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(); - $result = $stmt->fetchAll(); - $roomArr = array(); - + $result = $stmt->fetchAll(); + $roomArr = array(); + foreach($result as $row) { - $roomEntry = array("id" => $row['id'], "name" => $row['roomname']); - $roomArr[] = $roomEntry; + $roomEntry = array("id" => $row['id'], "name" => $row['roomname']); + $roomArr[] = $roomEntry; } $priceTakeAway = $this->getUnpaidSumOfTakeAway($pdo); @@ -176,19 +176,19 @@ class Roomtables { return $row->pricesum; } - // Part of chain to choose a product , here we start with chosing a room - private function getAllTablesAndRooms($pdo) + // Part of chain to choose a product , here we start with chosing a room + private function getAllTablesAndRooms($pdo) { - $queue = new QueueContent(); + $queue = new QueueContent(); $sql = "SELECT id,roomname FROM %room% WHERE removed is null ORDER BY id"; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); - $stmt->execute(); + $stmt->execute(); $dbresult = $stmt->fetchAll(PDO::FETCH_ASSOC); - + $arrayOfRooms = array(); foreach($dbresult as $zeile) { - $roomid = $zeile['id']; + $roomid = $zeile['id']; // now find the tables that are in that room $tablesArray = array(); @@ -216,8 +216,8 @@ class Roomtables { } $aRoomEntry = array ("id" => $roomid, "name" => $zeile['roomname'], "tables" => $tablesArray); - - $arrayOfRooms[] = $aRoomEntry; + + $arrayOfRooms[] = $aRoomEntry; } $priceTakeAway = $this->getUnpaidSumOfTakeAway($pdo); @@ -228,12 +228,12 @@ class Roomtables { $numberOfProductsTotalToServe = $queue->numberOfProductsForTableNotDelivered($pdo,null); $numberOfReadyProducts = count($arrayOfProdsOfATable); $queueids = $this->getIdsFromProdList($arrayOfProdsOfATable); - + return array("roomstables" => $arrayOfRooms, "takeawayprice" => $priceTakeAway, "takeawayprodcount" => $numberOfProductsTotalToServe, "takeawayprodready" => $numberOfReadyProducts, "takeawayReadyQueueIds" => $queueids - ); + ); } function getIdsFromProdList($arrayOfProdsOfATable) { @@ -255,12 +255,12 @@ class Roomtables { // clear room table $sql = "UPDATE %room% SET removed=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array('1')); - // clear resttables table - $sql = "UPDATE %resttables% SET removed=?"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + // clear resttables table + $sql = "UPDATE %resttables% SET removed=?"; + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array('1')); // clear table positions and maps @@ -285,7 +285,7 @@ class Roomtables { } $sql = "INSERT INTO `%room%` (`id`, `roomname`, `abbreviation`, `printer`) VALUES (NULL,?,?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($aRoomName,$aRoomAbbr,$roomPrinter)); $roomId = $pdo->lastInsertId(); @@ -295,7 +295,7 @@ class Roomtables { for ($tableindex = 0; $tableindex < $noOfTables; $tableindex++) { $aTableName = $tablesArr[$tableindex]; $sql = "INSERT INTO `%resttables%` (`id` , `tableno`, `roomid`) VALUES (NULL ,?,?)"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($aTableName,$roomId)); } } @@ -304,18 +304,18 @@ class Roomtables { } function getRoomfield() { - $pdo = $this->dbutils->openDbAndReturnPdo(); + $pdo = $this->dbutils->openDbAndReturnPdo(); $sql = "SELECT id,roomname,IFNULL(abbreviation,'') as abbreviation,IFNULL(printer,0) as printer FROM %room% WHERE removed is null ORDER BY 'sorting'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(); $result = $stmt->fetchAll(); $numberOfRooms = $stmt->rowCount(); - - $roomIdNameArray = array(); + + $roomIdNameArray = array(); $maxTables = 0; - $roomArr = array(); + $roomArr = array(); foreach($result as $row) { $roomid = $row['id']; $roomname = $row['roomname']; @@ -324,17 +324,17 @@ class Roomtables { // now get the tables of this room $sql = "SELECT id,tableno FROM %resttables% WHERE roomid=? AND removed is null ORDER BY 'sorting'"; - $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); + $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt->execute(array($row['id'])); $numberOfTables = $stmt->rowCount(); - $maxTables = ($maxTables < $numberOfTables ? $numberOfTables : $maxTables); + $maxTables = ($maxTables < $numberOfTables ? $numberOfTables : $maxTables); $tableresult = $stmt->fetchAll(); $tableArr = array(); foreach($tableresult as $aTable) { $tableArr[] = array("id" => $aTable['id'], "tablename" => $aTable['tableno']); } - $roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "abbreviation" => $abbreviation, "printer" => $printer, "tables" => $tableArr, "noOfTables" => $numberOfTables); + $roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "abbreviation" => $abbreviation, "printer" => $printer, "tables" => $tableArr, "noOfTables" => $numberOfTables); } echo json_encode(array("status" => "OK", "noOfRooms" => $numberOfRooms, "maxTables" => $maxTables, "roomfield" => $roomArr)); diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php index c1e902b..ab6f55a 100644 --- a/webapp/php/utilities/basedb.php +++ b/webapp/php/utilities/basedb.php @@ -519,7 +519,7 @@ class Basedb { `anoption` VARCHAR( 150 ) NULL , `pricechanged` INT(1) NULL , `togo` INT(1) NULL , - `readytime` DATETIME NOT NULL, + `readytime` DATETIME NULL, `delivertime` DATETIME NULL, `paidtime` DATETIME NULL, `billid` INT(10), diff --git a/webapp/preferences.html b/webapp/preferences.html index 5e66037..50d25e9 100644 --- a/webapp/preferences.html +++ b/webapp/preferences.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/products.html b/webapp/products.html index 51f5b4e..8e43a3c 100644 --- a/webapp/products.html +++ b/webapp/products.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/rating.html b/webapp/rating.html index efbe795..1f02384 100644 --- a/webapp/rating.html +++ b/webapp/rating.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reports.html b/webapp/reports.html index 4ddbf1e..cde5823 100644 --- a/webapp/reports.html +++ b/webapp/reports.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reservation.html b/webapp/reservation.html index cc9df11..f6a9024 100644 --- a/webapp/reservation.html +++ b/webapp/reservation.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html index 79d1f7d..16a0c3b 100644 --- a/webapp/supplydesk.html +++ b/webapp/supplydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/waiter.html b/webapp/waiter.html index 46a12dc..e89a197 100644 --- a/webapp/waiter.html +++ b/webapp/waiter.html @@ -4,7 +4,7 @@ - +