OrderSprinter 1.4.7
This commit is contained in:
parent
6ac093bae8
commit
29d9104286
|
@ -9,8 +9,8 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Stefan Pichel">
|
||||
|
||||
<link rel="stylesheet" href="css/gueststyle.css?v=1.4.6" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.4.6" />
|
||||
<link rel="stylesheet" href="css/gueststyle.css?v=1.4.7" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.4.7" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
|
||||
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
|
||||
|
@ -105,7 +105,7 @@
|
|||
<div data-role="footer" data-theme="b" id="thefooter1">
|
||||
<div class="ui-grid-a">
|
||||
<div class="ui-block-a"> OrderSprinter</div>
|
||||
<div class="ui-block-b grid_right" id="versioninfo">1.4.6 </div>
|
||||
<div class="ui-block-b grid_right" id="versioninfo">1.4.7 </div>
|
||||
</div><!-- /grid-a -->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -90,10 +90,10 @@ if (isset($_POST['code'])) {
|
|||
} else {
|
||||
echo "<html>";
|
||||
echo "<head><title>Installation Gastsystem</title>";
|
||||
echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.4.6">';
|
||||
echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.4.7">';
|
||||
echo "</head>";
|
||||
echo "<body><div class=surround>";
|
||||
echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.4.6</span><br><br>";
|
||||
echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.4.7</span><br><br>";
|
||||
echo "<form action='install.php' method='post'><input class=installfield name=code id=code type=text placeholder='Installationscode' />";
|
||||
echo "<br><input type=submit value='Installation starten' class=installbtn />";
|
||||
echo "</form></div></html>";
|
||||
|
|
Binary file not shown.
|
@ -85,7 +85,7 @@ class Installer {
|
|||
}
|
||||
Database::dropTables($pdo);
|
||||
Database::createEmptyTables($pdo, $prefix);
|
||||
Database::setVersion($pdo,$prefix,"1.4.6");
|
||||
Database::setVersion($pdo,$prefix,"1.4.7");
|
||||
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.
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
@ -215,7 +215,7 @@ function handleResultOfInstallCheck(is_installed) {
|
|||
if (is_installed == "Yes") {
|
||||
useInstallation();
|
||||
} else {
|
||||
setTimeout(function(){document.location.href = "install.html?v=1.4.6"},500);
|
||||
setTimeout(function(){document.location.href = "install.html?v=1.4.7"},500);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -727,7 +727,7 @@ $(document).ready(function() {
|
|||
<tr id=updateline>
|
||||
<td> </td>
|
||||
<td align=center>
|
||||
<button id="updatebtn">Update -> 1.4.6</button>
|
||||
<button id="updatebtn">Update -> 1.4.7</button>
|
||||
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
|
||||
</td>
|
||||
<td> </td>
|
||||
|
|
|
@ -2931,6 +2931,30 @@ return false;
|
|||
}
|
||||
}
|
||||
|
||||
function updateUserTable1406_1407($prefix, $version, $dbname) {
|
||||
$pdo = $this->pdo;
|
||||
try {
|
||||
if ($version != "1.4.6") {
|
||||
$ret = $this->updateUserTable1405_1406($prefix, $version, $dbname);
|
||||
if (!$ret) {
|
||||
echo "Version update v1.4.5 to 1.4.6 not successful.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DbUtils::overrulePrefix($prefix);
|
||||
|
||||
$this->basedb->sortProdTypes($pdo);
|
||||
|
||||
$this->updateVersion($pdo, '1.4.7');
|
||||
|
||||
return true;
|
||||
} catch (PDOException $e) {
|
||||
echo "Error in v1.4.6 to 1.4.7: $e";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function insertIntRow($pdo,$table,$rowToInsert,$afterRow) {
|
||||
$this->insertTypeRow($pdo, $table, $rowToInsert, $afterRow, 'INT(1) NULL');
|
||||
}
|
||||
|
@ -3106,7 +3130,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.4.6')");
|
||||
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.4.7')");
|
||||
$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')");
|
||||
|
@ -3558,7 +3582,7 @@ $zones[] = $timezone_identifiers[$i];
|
|||
echo json_encode($zones);
|
||||
} else if ($command == 'update') {
|
||||
set_time_limit(60*30);
|
||||
$installerVersion = "1.4.6";
|
||||
$installerVersion = "1.4.7";
|
||||
|
||||
$admin = new InstallAdmin();
|
||||
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
|
||||
|
@ -3590,7 +3614,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
|
|||
"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.22","1.3.23","1.3.24","1.3.25","1.3.26","1.4.0","1.4.1","1.4.2","1.4.3",
|
||||
"1.4.4","1.4.5"
|
||||
"1.4.4","1.4.5","1.4.6"
|
||||
);
|
||||
|
||||
if (!in_array($version, $supportedVersions)) {
|
||||
|
@ -3598,7 +3622,7 @@ echo json_encode("Quellversion nicht unterstützt");
|
|||
return;
|
||||
}
|
||||
|
||||
$ret = $admin->updateUserTable1405_1406($_POST['prefix'], $version, $_POST['db']);
|
||||
$ret = $admin->updateUserTable1406_1407($_POST['prefix'], $version, $_POST['db']);
|
||||
|
||||
if(session_id() == '') {
|
||||
session_start();
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
@ -1246,7 +1246,7 @@ function initRestoreFileUpload() {
|
|||
} else {
|
||||
alert("Import war erfolgreich.");
|
||||
setTimeout(function(){
|
||||
document.location.href = "index.html?v=1.4.6";
|
||||
document.location.href = "index.html?v=1.4.7";
|
||||
},250);
|
||||
}
|
||||
},
|
||||
|
@ -1783,9 +1783,9 @@ function handleUpdateCheckResult(answer) {
|
|||
|
||||
var millis=getMillis();
|
||||
setTimeout(function(){
|
||||
document.location.href = "install.html?v=1.4.6&mode=onlyupdate&n=" + millis;
|
||||
document.location.href = "install.html?v=1.4.7&mode=onlyupdate&n=" + millis;
|
||||
},250);
|
||||
document.location.href = "install.html?v=1.4.6&mode=onlyupdate&n=" + millis;
|
||||
document.location.href = "install.html?v=1.4.7&mode=onlyupdate&n=" + millis;
|
||||
}
|
||||
|
||||
function handleUpdateReplace(answer) {
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -970,7 +970,7 @@ class Admin {
|
|||
|
||||
$buttonSizes = self::getButtonSizesCore($pdo);
|
||||
|
||||
$jsonMenuItems = $this->getJsonMenuItemsAndVersionCore();
|
||||
$jsonMenuItems = $this->getJsonMenuItemsAndVersionCore($pdo);
|
||||
|
||||
$retVal = array("config" => $configresult,
|
||||
"rightchangeprice" => $row->right_changeprice,
|
||||
|
@ -1253,7 +1253,7 @@ class Admin {
|
|||
$view = "preferences.html";
|
||||
}
|
||||
|
||||
echo json_encode($view . "?v=1.4.6");
|
||||
echo json_encode($view . "?v=1.4.7");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1388,6 +1388,9 @@ class Admin {
|
|||
Products::cleanProdImagesTable($pdo);
|
||||
}
|
||||
|
||||
$basedb = new Basedb();
|
||||
$basedb->sortProdTypes($pdo);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -1416,13 +1419,14 @@ class Admin {
|
|||
}
|
||||
|
||||
function getJsonMenuItemsAndVersion() {
|
||||
echo json_encode($this->getJsonMenuItemsAndVersionCore());
|
||||
$pdo = DbUtils::openDbAndReturnPdoStatic();
|
||||
echo json_encode($this->getJsonMenuItemsAndVersionCore($pdo));
|
||||
}
|
||||
|
||||
/*
|
||||
* Return all the entries for the main menu (the modules)
|
||||
*/
|
||||
private function getJsonMenuItemsAndVersionCore() {
|
||||
private function getJsonMenuItemsAndVersionCore($pdo) {
|
||||
if(session_id() == '') {
|
||||
session_start();
|
||||
}
|
||||
|
@ -1460,27 +1464,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.4.6"); };
|
||||
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.4.7"); };
|
||||
} else {
|
||||
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.4.6"); };
|
||||
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.4.7"); };
|
||||
}
|
||||
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.4.7"); };
|
||||
if ($_SESSION['modus'] == 0) {
|
||||
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.4.7"); };
|
||||
}
|
||||
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.4.6"); };
|
||||
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.4.6"); };
|
||||
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.4.6"); };
|
||||
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.4.6");
|
||||
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.4.6");
|
||||
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.4.6");
|
||||
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.4.7"); };
|
||||
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.4.7"); };
|
||||
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.4.7"); };
|
||||
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.4.7");
|
||||
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.4.7");
|
||||
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.4.7");
|
||||
}
|
||||
|
||||
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
|
||||
|
@ -1488,7 +1492,9 @@ class Admin {
|
|||
|
||||
$waiterMessage = $this->getMessage(null, "waitermessage");
|
||||
}
|
||||
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.4.6",
|
||||
$installedVersion = CommonUtils::getConfigValue($pdo, 'version', '?');
|
||||
|
||||
$mainMenuAndVersion = array ("version" => "OrderSprinter $installedVersion",
|
||||
"user" => $currentUser,
|
||||
"menu" => $mainMenu,
|
||||
"waitermessage" => $waiterMessage,
|
||||
|
|
|
@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) {
|
|||
if (strlen($status) > 150) {
|
||||
$status = substr($status, 0,149);
|
||||
}
|
||||
$version = "1.4.6";
|
||||
$version = "1.4.7";
|
||||
|
||||
$arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion);
|
||||
} else {
|
||||
|
|
|
@ -218,7 +218,7 @@ class Products {
|
|||
$priceTxt = "priceC";
|
||||
}
|
||||
|
||||
$sql = "select id,name,reference from %prodtype% where removed is null";
|
||||
$sql = "select id,name,reference,sorting from %prodtype% where removed is null";
|
||||
$result = CommonUtils::fetchSqlAll($pdo, $sql, null);
|
||||
$typeArray = array();
|
||||
|
||||
|
@ -227,7 +227,7 @@ class Products {
|
|||
if ($ref == null) {
|
||||
$ref = 0;
|
||||
}
|
||||
$typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref);
|
||||
$typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref,"sorting" => $row["sorting"]);
|
||||
}
|
||||
|
||||
$sql = "select id,shortname,longname,audio,category as ref,favorite,$priceTxt as price,IF(unit is not null, unit, '0') as unit,IF(days is not null, days, '0123456') as days,IF(tax is not null, tax, 'null') as tax,IF(taxaustria is not null, taxaustria, 'null') as taxaustria,IF(amount is not null, amount, 'null') as amount ";
|
||||
|
@ -261,10 +261,17 @@ class Products {
|
|||
$pdo->commit();
|
||||
|
||||
$filteredTypes = self::filterUsedTypes($typeArray, $prodArray);
|
||||
usort($filteredTypes,"Products::cmptypes");
|
||||
|
||||
$retArray = array("types" => $filteredTypes, "prods" => $prodArray);
|
||||
echo json_encode($retArray);
|
||||
}
|
||||
|
||||
public static function cmptypes($a, $b)
|
||||
{
|
||||
return $a['sorting'] - $b['sorting'];
|
||||
}
|
||||
|
||||
|
||||
private static function filterUsedTypes($types,$products) {
|
||||
$typesWithContent = array();
|
||||
|
@ -279,7 +286,7 @@ class Products {
|
|||
$keys = array_keys($typesWithContent);
|
||||
foreach($keys as $aKey) {
|
||||
$t = $typesWithContent[$aKey];
|
||||
$out[] = array("id" => $t["id"],"name" => $t["name"],"ref" => $t["ref"]);
|
||||
$out[] = array("id" => $t["id"],"name" => $t["name"],"ref" => $t["ref"],"sorting" => $t["sorting"]);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
@ -296,8 +303,9 @@ class Products {
|
|||
private static function declareProdTypeAndParentsInUse($alltypes,$aType,$typesWithContent) {
|
||||
$typeid = $aType["id"];
|
||||
$reference = $aType["ref"];
|
||||
$sorting = $aType["sorting"];
|
||||
if (!array_key_exists($typeid, $typesWithContent)) {
|
||||
$typesWithContent[$typeid] = array("id" => $typeid,"name" => $aType["name"],"ref" => $reference);
|
||||
$typesWithContent[$typeid] = array("id" => $typeid,"name" => $aType["name"],"ref" => $reference,"sorting" => $sorting);
|
||||
|
||||
$parent = null;
|
||||
foreach($alltypes as $a) {
|
||||
|
@ -422,10 +430,9 @@ class Products {
|
|||
* ["id" => 2, "name" => "Drinks"], ...
|
||||
*/
|
||||
private function getProdTypesWithReferenz($pdo,$ref) {
|
||||
|
||||
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk,printer,'t' as type from %prodtype% where removed is null AND reference is null";
|
||||
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk,printer,'t' as type,sorting from %prodtype% where removed is null AND reference is null ORDER BY sorting";
|
||||
if ($ref > 0) {
|
||||
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk,printer,'t' as type from %prodtype% where removed is null AND reference=$ref";
|
||||
$sql = "SELECT id,name,kind,usekitchen,usesupplydesk,printer,'t' as type,sorting from %prodtype% where removed is null AND reference=$ref ORDER BY sorting";
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
|
@ -443,7 +450,7 @@ class Products {
|
|||
|
||||
private function getMenuLevelUp($ref) {
|
||||
$pdo = $this->dbutils->openDbAndReturnPdo();
|
||||
$sql = "SELECT reference from %prodtype% where removed is null AND id=?";
|
||||
$sql = "SELECT reference from %prodtype% where removed is null AND id=? ORDER BY sorting";
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
$stmt->execute(array($ref));
|
||||
$currentRef =$stmt->fetchObject();
|
||||
|
@ -1358,17 +1365,35 @@ class Products {
|
|||
echo json_encode(array("status" => "OK"));
|
||||
}
|
||||
|
||||
function getMaxSortOfTypeInKat($pdo,$idOfKat) {
|
||||
if (!is_null($idOfKat)) {
|
||||
$sql = "SELECT MAX(sorting) as maxsort,reference FROM %prodtype% WHERE reference=? GROUP BY reference";
|
||||
$maxSorting = CommonUtils::fetchSqlAll($pdo, $sql, array($idOfKat));
|
||||
} else {
|
||||
$sql = "SELECT MAX(sorting) as maxsort,reference FROM %prodtype% WHERE reference is null AND removed is null GROUP BY reference";
|
||||
$maxSorting = CommonUtils::fetchSqlAll($pdo, $sql, null);
|
||||
}
|
||||
|
||||
if (count($maxSorting) != 1) {
|
||||
return null;
|
||||
} else {
|
||||
return intval($maxSorting[0]["maxsort"]) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
function createProdType($id,$prodTypeName) {
|
||||
$pdo = DbUtils::openDbAndReturnPdoStatic();
|
||||
$pdo->beginTransaction();
|
||||
|
||||
if ($id == "top") {
|
||||
$nextSort = $this->getMaxSortOfTypeInKat($pdo, null);
|
||||
|
||||
$kind = 0;
|
||||
if (isset($_POST["kind"])) {
|
||||
$kind = $_POST["kind"];
|
||||
}
|
||||
$sql = "INSERT INTO `%prodtype%` (`name`,`usekitchen`,`usesupplydesk`,`kind`,`printer`,`sorting`,`reference`) VALUES(?,1,1,?,1,NULL,?)";
|
||||
CommonUtils::execSql($pdo, $sql, array($prodTypeName,$kind,null));
|
||||
$sql = "INSERT INTO `%prodtype%` (`name`,`usekitchen`,`usesupplydesk`,`kind`,`printer`,`sorting`,`reference`) VALUES(?,1,1,?,1,?,?)";
|
||||
CommonUtils::execSql($pdo, $sql, array($prodTypeName,$kind,$nextSort,null));
|
||||
$pdo->commit();
|
||||
echo json_encode(array("status" => "OK"));
|
||||
return;
|
||||
|
@ -1378,7 +1403,7 @@ class Products {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
$nextSort = $this->getMaxSortOfTypeInKat($pdo, $id);
|
||||
|
||||
$sql = "SELECT kind FROM %prodtype% WHERE id=?";
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
|
@ -1391,11 +1416,8 @@ class Products {
|
|||
}
|
||||
$kind = $row->kind;
|
||||
|
||||
$sql = "INSERT INTO `%prodtype%` (`id`,`name`,`usekitchen`,`usesupplydesk`,`kind`,`printer`,`sorting`,`reference`) ";
|
||||
$sql .= " VALUES(NULL,?,1,1,?,1,NULL,?)";
|
||||
|
||||
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
|
||||
$stmt->execute(array($prodTypeName,$kind,$id));
|
||||
$sql = "INSERT INTO `%prodtype%` (`name`,`usekitchen`,`usesupplydesk`,`kind`,`printer`,`sorting`,`reference`) VALUES(?,?,?,?,?,?,?)";
|
||||
CommonUtils::execSql($pdo, $sql, array($prodTypeName,1,1,$kind,1,$nextSort,$id));
|
||||
|
||||
$pdo->commit();
|
||||
echo json_encode(array("status" => "OK"));
|
||||
|
@ -1470,6 +1492,24 @@ class Products {
|
|||
$sql = "UPDATE %prodtype% SET removed=? WHERE id=?";
|
||||
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
|
||||
$stmt->execute(array(1,$id));
|
||||
|
||||
|
||||
$sql = "SELECT IFNULL(reference,0) as reference FROM %prodtype% WHERE id=?";
|
||||
$parentRef = CommonUtils::fetchSqlAll($pdo, $sql, array($id));
|
||||
if (count($parentRef) != 1) {
|
||||
return;
|
||||
}
|
||||
$parentId = $parentRef[0]['reference'];
|
||||
|
||||
$sql = "SELECT id,reference,sorting FROM %prodtype% WHERE reference=? AND removed is null ORDER BY sorting";
|
||||
$allChildren = CommonUtils::fetchSqlAll($pdo, $sql, array($parentId));
|
||||
|
||||
$sort = 1;
|
||||
$sql = "UPDATE %prodtype% SET sorting=? WHERE id=?";
|
||||
foreach($allChildren as $c) {
|
||||
CommonUtils::execSql($pdo, $sql, array($sort,$c["id"]));
|
||||
$sort++;
|
||||
}
|
||||
}
|
||||
|
||||
static private function declareProductAsDeletedWithoutResort($pdo,$id) {
|
||||
|
@ -1628,6 +1668,4 @@ class Products {
|
|||
|
||||
echo json_encode($audioFiles);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
}
|
|
@ -971,4 +971,34 @@ class Basedb {
|
|||
|
||||
fclose ($handle);
|
||||
}
|
||||
|
||||
public function sortProdTypes($pdo) {
|
||||
$orderedTypeIds = array();
|
||||
$sql = "SELECT id,IFNULL(reference,0) as reference,removed FROM %prodtype% WHERE removed is null ORDER by id";
|
||||
$alltypes = CommonUtils::fetchSqlAll($pdo, $sql, null);
|
||||
foreach($alltypes as $aType) {
|
||||
$id = $aType["id"];
|
||||
$sql = "UPDATE %prodtype% SET sorting=? WHERE id=?";
|
||||
if (!array_key_exists($id, $orderedTypeIds)) {
|
||||
$brothersAndMe = self::getAllTypesOfSameParent($alltypes, $aType);
|
||||
// REMÜ* start from 1
|
||||
$sort = 1;
|
||||
foreach($brothersAndMe as $brotherid) {
|
||||
CommonUtils::execSql($pdo, $sql, array($sort,$brotherid));
|
||||
$orderedTypeIds[] = $brotherid;
|
||||
$sort++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function getAllTypesOfSameParent($alltypes,$keyType) {
|
||||
$brothers = array();
|
||||
foreach($alltypes as $t) {
|
||||
if ($t['reference'] == $keyType['reference']) {
|
||||
$brothers[] = $t['id'];
|
||||
}
|
||||
}
|
||||
return $brothers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
|
@ -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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<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.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.6">
|
||||
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.4.7">
|
||||
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.4.7">
|
||||
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
|
||||
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue