OrderSprinter 1.3.9

This commit is contained in:
Geno 2020-11-19 23:02:49 +01:00
parent 619fc68a10
commit ebbaf1a4e6
33 changed files with 477 additions and 83 deletions

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.8");
Database::setVersion($pdo,$prefix,"1.3.9");
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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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

@ -1 +1 @@
@charset "UTF-8";.numfield{border-radius:25px;background:#bbb;padding:10px;border-style:solid;border-color:green;width:280px;border-spacing:5px}.numfield td{border-radius:15px;background:#eee;padding:10px;border-style:solid;border-color:black;font-size:30px;text-align:center;color:black}.numfield td:hover{background:#999}.numfield td.numnav{color:red}
@charset "UTF-8";.numfield{border-radius:25px;background:#bbb;padding:10px;border-style:solid;border-color:green;width:280px;border-spacing:5px}.numfield td{border-radius:15px;background:#eee;padding:10px;border-style:solid;border-color:black;font-size:30px;text-align:center;color:black}.numfield td:hover{background:#999}.numfield td.numnav{color:red}.numfield td.keyboardapply{color:green}

View File

@ -11,6 +11,8 @@ function createProdTableHeaderLine() {
"<th id=shortnameheader class='prodheader'>Kurzname<th>Preis (A)" +
"<th class='prodheader'>Preis (B)" +
"<th class='prodheader'>Preis (C)" +
"<th class='prodheader'>Einheit" +
"<th class='prodheader'>Tage" +
"<th class='prodheader'>Steuersatz" +
"<th class='prodheader'>Steuersatz Österreich" +
"<th class='prodheader'>Audio" +
@ -27,7 +29,7 @@ function ident(depth) {
return txt;
}
function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,amount,available,audio,favorite) {
function newProduct(id, longname, shortname,priceA,priceB,priceC,unit,days,tax,taxaustria,amount,available,audio,favorite) {
var product = {
id:id,
longname:longname,
@ -35,6 +37,8 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
priceA: priceA,
priceB: priceB,
priceC: priceC,
unit: unit,
days: days,
tax: tax,
taxaustria: taxaustria,
amount: amount,
@ -51,6 +55,8 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
+ "<td><input type='text' class='prodpriceA'></input>"
+ "<td><input type='text' class='prodpriceB'></input>"
+ "<td><input type='text' class='prodpriceC'></input>"
+ "<td><input type='text' class='produnit'></input>"
+ "<td><input type='text' class='proddays'></input>"
+ "<td><input type='text' class='prodtax'></input>"
+ "<td>" + this.createTaxAustriaSelection("prodtaxaustriasel_" + this.id)
+ "<td><input type='text' class='prodamount'></input>"
@ -67,6 +73,12 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
$("#prodleaf_" + this.id + " input.prodpriceA").val(this.priceA);
$("#prodleaf_" + this.id + " input.prodpriceB").val(this.priceB);
$("#prodleaf_" + this.id + " input.prodpriceC").val(this.priceC);
$("#prodleaf_" + this.id + " input.produnit").val(this.unit);
if (this.days == '0123456') {
$("#prodleaf_" + this.id + " input.proddays").val('');
} else {
$("#prodleaf_" + this.id + " input.proddays").val(this.days);
}
$("#prodleaf_" + this.id + " input.prodtax").val(this.tax);
$("#prodleaf_" + this.id + " input.prodamount").val(this.amount);
},
@ -117,6 +129,19 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
return txt;
},
createUnitSelection:function(id) {
var txt = "<select id='" + id + "'>";
if ((this.unit == 0) || (this.unit == 'null')) {
this.unit = 0;
}
txt += this.createOption(0,this.unit,"Stück");
txt += this.createOption(1,this.unit,"Eingabe");
txt += "</select>";
return txt;
},
createTaxAustriaSel:function(id) {
var visi = ""
if (austria == 0) {
@ -129,6 +154,14 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
return txt;
},
createUnitField:function(id) {
var txt = '<p><div data-role="fieldcontain" >'
+ '<label for="' + id + '">Einheit:</label>'
+ this.createUnitSelection(id)
+ '</div></p>';
return txt;
},
createFavoriteSelection:function(id,text0,text1) {
if (this.favorite == 1) {
return "<select id=" + id + "><option value=0>" + text0[lang] + "</option><option value=1 selected>" + text1[lang] + "</option></select>";
@ -176,6 +209,13 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
+ createInputField("prodpriceA_" + this.id,"prodpriceA_input_" + this.id,"priceA")
+ createInputField("prodpriceB_" + this.id,"prodpriceB_input_" + this.id,"priceB")
+ createInputField("prodpriceC_" + this.id,"prodpriceC_input_" + this.id,"priceC")
+ "<div id=unitcont_" + this.id + ">"
+ this.createUnitField("produnit_input_" + this.id)
+ "</div>"
+ createInputField("proddays_" + this.id,"proddays_input_" + this.id,"days")
+ createInputField("prodtax_" + this.id,"prodtax_input_" + this.id,"tax")
+ '</div></p>'
@ -225,12 +265,20 @@ function newProduct(id, longname, shortname,priceA,priceB,priceC,tax,taxaustria,
$("#prodpriceA_" + this.id).html(PROD_PRICE[lang] + ' (A)');
$("#prodpriceB_" + this.id).html(PROD_PRICE[lang] + ' (B)');
$("#prodpriceC_" + this.id).html(PROD_PRICE[lang] + ' (C)');
$("#produnit_" + this.id).html(PROD_UNIT[lang]);
$("#proddays_" + this.id).html(PROD_DAYS[lang]);
$("#prodtax_" + this.id).html(PROD_TAX[lang]);
$("#prodtaxaustria_" + this.id).html(PROD_TAXAUSTRIA[lang]);
$("#prodamount_" + this.id).html(PROD_AMOUNT[lang]);
$("#prodpriceA_input_" + this.id).val(this.priceA.toString().replace(".",decpoint));
$("#prodpriceB_input_" + this.id).val(this.priceB.toString().replace(".",decpoint));
$("#prodpriceC_input_" + this.id).val(this.priceC.toString().replace(".",decpoint));
$("#produnit_input_" + this.id).val(this.unit);
if (this.days == '0123456') {
$("#proddays_input_" + this.id).val('');
} else {
$("#proddays_input_" + this.id).val(this.days);
}
if (this.tax != "null") {
$("#prodtax_input_" + this.id).val(this.tax.toString().replace(".",decpoint));

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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.9">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -108,6 +108,9 @@ function displayLoginOrLogoutMask(jsonContent) {
// forward to valid page!
doAjax("GET","php/contenthandler.php?module=admin&command=getViewAfterLogin",null,goToView,"Einstiegsseite nicht bekommen");
} else if (status == "WAIT") {
alert("Zu viele Fehlversuche - in 3 Minuten erneut versuchen");
$("#passwordfield").val("");
} else {
alert("Falsches Passwort?");
// user needs to log in!
@ -203,7 +206,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.3.8"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.9"},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.8</button>
<button id="updatebtn">Update -> 1.3.9</button>
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
</td>
<td>&nbsp;</td>

View File

@ -1996,6 +1996,45 @@ return false;
}
}
function updateUserTable1308_1309($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.8") {
$ret = $this->updateUserTable1307_1308($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.3.7 to 1.3.8 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %products% ADD unit INT(2) NULL AFTER priceC";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %histprod% ADD unit INT(2) NULL AFTER priceC";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->updateVersion($pdo, '1.3.9');
$sql = "ALTER TABLE %products% ADD days VARCHAR(20) NULL AFTER unit";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %histprod% ADD days VARCHAR(20) NULL AFTER unit";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %user% ADD failedlogins VARCHAR(20) NULL AFTER extrasapplybtnpos";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
return true;
} catch (PDOException $e) {
echo "Error in v1.3.8 to 1.3.9: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
@ -2122,7 +2161,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.8')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.9')");
$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')");
@ -2510,7 +2549,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.8";
$installerVersion = "1.3.9";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -2540,7 +2579,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27"
"1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11","1.1.12","1.1.13","1.1.14","1.1.15","1.1.16","1.1.17",
"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.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"
);
if (!in_array($version, $supportedVersions)) {
@ -2548,7 +2587,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1307_1308($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1308_1309($_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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -202,7 +202,7 @@ var MAN_UPDATE_HINT = ["Das Updaten über diesen Weg funktioniert nur, wenn die
"This update function only works if the files in the web directory are not write-protected and if a internet connection to the OrderSprinter webserver is available.",
"Esta función the actualizar solo funciona si los ficheros no sin protegidos de escribirt y si hay una conección al servidor de OrderSprinter por Internet."];
var MAN_UPDATE_URL = ["Updateserver","Update Server","Servidor"];
var MAN_AVAIL_UPD_VERSION = ["Neuste verfügbare Version","Newest released version","ùltima version"];
var MAN_AVAIL_UPD_VERSION = ["Neueste verfügbare Version","Newest released version","ùltima version"];
var MAN_UPD_PROGRESS = ["Fortschritt","Progress","Progreso"];
var MAN_RESTORE_BTN = ["Importieren","Restore","Importar"];
var MAN_GO_LIVE = ["Starte Produktivbetrieb","Start productive mode","Empezar trabajar realmente"];
@ -346,6 +346,8 @@ var MAN_DEL_HINT = ["Zum Löschen anklicken","Click to delete","Click para remov
var MAN_FONTSIZE_HINT = ["Die Schriftgröße hat nur Einfluss, wenn kein eigenes Layout festgelegt wurde.","The font size only effects receipts if they do not use a specified layout.","El valor sólo funciona si no se usa un layout individual."];
var MAN_INIT_AUSTRIA = ["Erstelle Startbeleg (Österreich)","Create initial receipt (Austria)","Crear tiquet inicial (Austria)"];
var MAN_GOLIVE_WAIT_HINT = ["Bitte beachten Sie, dass diese Aktion auf langsamen Servern mehrere Minuten dauern kann. Schließen Sie diesen Dialog und warten Sie auf die Meldung, dass det Vorgang abgeschlossen wurde.","Please be aware that this action may take a while on slow servers. Please close this dialog and wait for the message that the process has completed.","Esta acción puede durar unos minutos. Por favor confirme este dialogo y espere por el mensaje que la acción esta completada."]
var MAN_CLOSING_TIME_LIMIT_ERROR = ["Ein Tagesabschluss wurde nicht erzeugt, weil zwischen zwei Tagesabschlüssen etwas Zeit (mind. 2 Min.) vergehen sollte.","No closure was created because between two clsoings there should be some time (at least 2 minutes).","No conclusión esta creado porque el tiempo entre dos conclusiones debe ser un rato (min, 2 minutos)."];
var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1,0,1,0,0,1,1];
@ -354,6 +356,7 @@ var numberOfClosings = 0;
var unpaidTables = "";
var version = '';
var newerversionavailable = 0;
var generalValuesSettings = [
["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"],
@ -1378,9 +1381,8 @@ function binding() {
$("#update_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var availVersion = $("#availversion").html();
if (availVersion == version) {
alert("Update not possible (versions do not differ): " + version);
if (newerversionavailable == 0) {
alert("Update not possible (version on server unknown or not newer): " + version);
} else {
doAjax("GET","php/updatehandler.php?command=updatecheck",null,handleUpdateCheckResult,"Skriptproblem");
}
@ -1475,6 +1477,7 @@ function insertAvailableUpdateVersion(answer) {
$("#urlpath").val(answer.url);
if (answer.status == "OK") {
$("#availversion").html(answer.msg);
newerversionavailable = answer.neweravailable;
} else {
$("#availversion").html('?');
}
@ -1511,8 +1514,9 @@ function handleUpdateCheckResult(answer) {
var millis=getMillis();
setTimeout(function(){
document.location.href = "install.html?v=1.3.8&mode=onlyupdate&n=" + millis;
document.location.href = "install.html?v=1.3.9&mode=onlyupdate&n=" + millis;
},250);
document.location.href = "install.html?v=1.3.9&mode=onlyupdate&n=" + millis;
}
function handleUpdateReplace(answer) {
@ -1685,7 +1689,11 @@ function createClosing(closingresult) {
doAjax("GET","php/contenthandler.php?module=closing&command=getClosingSummary",{closingid: closingid},doPrintClosingSummary,"Druckproblem");
}
} else {
alert("Fehler " + closingresult.code + ": " + closingresult.msg);
if (closingresult.code == 33) {
alert("Fehler: " + MAN_CLOSING_TIME_LIMIT_ERROR[lang]);
} else {
alert("Fehler " + closingresult.code + ": " + closingresult.msg);
}
}
}
@ -2842,15 +2850,15 @@ $(document).on("pageinit", "#admin-page", function () {
<div data-role="fieldcontain">
<label for="discountname1"><span id="discountname1txt">Rabattname 1:</span></label>
<input type="text" value="" data-mini="true" placeholder="256" id="discountname1" data-theme="c" class="genConfigEl"/>
<input type="text" value="" data-mini="true" placeholder="Bezeichnung" id="discountname1" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="discountname2"><span id="discountname2txt">Rabattname 2:</span></label>
<input type="text" value="" data-mini="true" placeholder="256" id="discountname2" data-theme="c" class="genConfigEl"/>
<input type="text" value="" data-mini="true" placeholder="Bezeichnung" id="discountname2" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="discountname3"><span id="discountname3txt">Rabattname 3:</span></label>
<input type="text" value="" data-mini="true" placeholder="256" id="discountname3" data-theme="c" class="genConfigEl"/>
<input type="text" value="" data-mini="true" placeholder="Bezeichnung" id="discountname3" data-theme="c" class="genConfigEl"/>
</div>
<div id="partOfHotelInterface"></div>
@ -3039,7 +3047,13 @@ $(document).on("pageinit", "#admin-page", function () {
bekommt.
<li><b>Steuersatz-Austria</b>: Diese Einstellung ist für Österreichische Betriebe wichtig: 1: Steuersatz 'Normal', 2: Ermäßigt-1, 3: Ermäßigt-2, 4: Steuersatz 'Besonders'. Ist der Betriebsmodus 'Österreich' ausgewählt, so wird <u><i>immer</i></u> dieser Steuersatz verwendet.
<li><b>Menge</b>: Die verfügbare Menge. Bei jeder Bestellung wird die Anzahl um 1 vermindert. Kurz vor Erreichen der Anzahl 0 bekommt der Kellner einen Warnhinweis bei dem Produkt.
</ul>
<li><b>Einheit</b>:
<ul>
<li>Stück: Die Preisangaben beziehen sich auf ein Stück dieses Artikels (in diesem Fall muss diese Eigenschaft nicht angegeben werden.)
<li>Eingabe: Preis des Produktes wird bei der Bestellaufnahme abgefragt.
</ul>
<li><b>Tage</b>: Man kann die Tage einschränken, an denen ein Produkt bestellt werden kann. 0=Sonntag, 1=Montag, usw. bis 6=Samstag. Wird ein Produkt an allen Tagen verkauft, ist keine Angabe erforderlich. Ein Produkt, welches nur an Wochenenden verkauft wird, muss mit '06' oder '60' ausgezeichnet werden.
</ul>
<p>Ein Produkteintrag mit weiteren Eigenschaften kann beispielsweise so aussehen:
<pre>

File diff suppressed because one or more lines are too long

View File

@ -393,6 +393,15 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$authenticated = false;
$isLoginAllowed = self::checkIsLoginAllowed($pdo,$userid);
if (!$isLoginAllowed) {
Logger::logcmd("admin","authentication","Login with id $userid failed");
echo json_encode(array("status" => "WAIT"));
return;
}
$sql = "SELECT * FROM %user% WHERE id=? AND active='1'";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($userid));
@ -533,14 +542,66 @@ class Admin {
if ($authenticated) {
Logger::logcmd("admin","authentication","Login $username successful");
self::clearFailedLogins($pdo, $userid);
$loginMessage = $this->getMessage(null,'loginmessage');
echo json_encode(array("status" => "YES","loginmessage" => $loginMessage, "timediff" => $timeDiff, "isadmin" => $zeile['is_admin'],"lang" => $_SESSION["language"]));
} else {
Logger::logcmd("admin","authentication","Login with id $userid failed");
self::increaseFailedLogins($pdo,$userid);
echo json_encode(array("status" => "NO"));
}
}
private static function checkIsLoginAllowed($pdo,$userid) {
date_default_timezone_set(DbUtils::getTimeZone());
$now = getdate();
$serverTime = $now["0"];
$sql = "SELECT failedlogins FROM %user% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
if (is_null($row) || is_null($row->failedlogins)) {
return true;
} else {
$lastFailure = explode("_",$row->failedlogins)[0];
$attempt = intval(explode("_",$row->failedlogins)[1]);
if ($attempt >= 5) {
if (abs($serverTime - $lastFailure) > (60*3)) {
self::clearFailedLogins($pdo, $userid);
return true;
} else {
return false;
}
} else {
return true;
}
}
}
private static function increaseFailedLogins($pdo,$userid) {
date_default_timezone_set(DbUtils::getTimeZone());
$now = getdate();
$serverTime = $now["0"];
$lastFailure = (string) $serverTime . "_";
$sql = "SELECT failedlogins FROM %user% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
if (is_null($row) || is_null($row->failedlogins)) {
$lastFailure .= "1";
} else {
$attempt = intval(explode("_",$row->failedlogins)[1]);
$lastFailure .= ($attempt + 1);
}
$sql = "UPDATE %user% SET failedlogins=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($lastFailure,$userid));
}
private static function clearFailedLogins($pdo,$userid) {
$sql = "UPDATE %user% SET failedlogins=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$userid));
}
private function getMessage($pdo,$messageType) {
if (is_null($pdo)) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
@ -1002,7 +1063,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.8");
echo json_encode($view . "?v=1.3.9");
}
}
@ -1204,25 +1265,25 @@ 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.8"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.9"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.8"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.9"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.8"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.8"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.8"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.9"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.9"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.9"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.8"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.9"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.8"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.8"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.8"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.8"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.8"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.8"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.8"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.8");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.8");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.9"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.9"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.9"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.9"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.9"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.9"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.9"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.9");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.9");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1230,7 +1291,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.8",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.9",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,

View File

@ -67,6 +67,45 @@ $row = $stmt->fetchObject();
return($row->setting);
}
private function saveLastClosingCreation($pdo) {
date_default_timezone_set(DbUtils::getTimeZone());
$date = new DateTime();
$unixTimeStamp = $date->getTimestamp();
$sql = "SELECT count(id) as countid FROM %work% WHERE item=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
if ($row->countid == 0) {
$sql = "INSERT INTO %work% (item,value,signature) VALUES(?,?,?)";
CommonUtils::execSql($pdo, $sql, array('lastclosing', $unixTimeStamp, null));
} else {
$sql = "UPDATE %work% SET value=? WHERE item=?";
CommonUtils::execSql($pdo, $sql, array($unixTimeStamp, 'lastclosing'));
}
}
private function isClosingAllowed($pdo) {
$TIMEOUT = 120;
$sql = "SELECT count(id) as countid FROM %work% WHERE item=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
if ($row->countid == 0) {
return true;
} else {
$sql = "SELECT value FROM %work% WHERE item=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array('lastclosing'));
$lastaccess = $row->value;
date_default_timezone_set(DbUtils::getTimeZone());
$date = new DateTime();
$currentTimeStamp = $date->getTimestamp();
if (($currentTimeStamp - $lastaccess) > $TIMEOUT) {
return true;
} else {
return false;
}
}
}
private function createClosing ($remark) {
if (is_null($remark)) {
$remark = "";
@ -80,8 +119,16 @@ date_default_timezone_set(DbUtils::getTimeZone());
$closingTime = date('Y-m-d H:i:s');
$pdo = $this->dbutils->openDbAndReturnPdo();
if (!$this->isClosingAllowed($pdo)) {
echo json_encode(array("status" => "ERROR", "msg" => "Time between closings too short", "code" => ERROR_CLOSING_TIME_LIMIT));
return;
}
$pdo->beginTransaction();
$this->saveLastClosingCreation($pdo);
if (CommonUtils::callPlugin($pdo, "createClosing", "replace")) {
return;
}

View File

@ -175,6 +175,8 @@ class DbUtils {
array("col" => 'priceA', "hist" => 1, "property" => "priceA"),
array("col" => 'priceB', "hist" => 1, "property" => "priceB"),
array("col" => 'priceC', "hist" => 1, "property" => "priceC"),
array("col" => 'unit', "hist" => 1, "property" => "unit"),
array("col" => 'days', "hist" => 1, "property" => "days"),
array("col" => 'tax', "hist" => 1, "property" => "tax"),
array("col" => 'taxaustria', "hist" => 1, "property" => "taxaustria"),
array("col" => 'amount', "hist" => 0, "property" => "amount"),

View File

@ -99,4 +99,6 @@ define ( 'ERROR_COMMAND_ERROR', 31);
define ( 'ERROR_COMMAND_ERROR_MSG', 'Kommando konnte nicht korrekt ausgeführt werden');
define ( 'ERROR_BILL_CUSTOMER_PAID', '32');
define ( 'ERROR_BILL_CUSTOMER_PAID_MSG', 'Bon wurde schon von einem Gast bezahlt - siehe Gästeansicht');
define ( 'ERROR_BILL_CUSTOMER_PAID_MSG', 'Bon wurde schon von einem Gast bezahlt - siehe Gästeansicht');
define ( 'ERROR_CLOSING_TIME_LIMIT', 33);

View File

@ -146,15 +146,17 @@ class Products {
array("id" => "id","get" => "%products%.id as id","histid" => "prodid","histget" => "prodid","histexportname" => "Produktid","isnumber" => "0"),
array("id" => "shortname", "get" => "shortname","histid" => "shortname","histget" => "shortname","histexportname" => "Kurzname","isnumber" => "0"),
array("id" => "longname", "get" => "longname","histid" => "longname","histget" => "longname","histexportname" => "Langname","isnumber" => "0"),
array("id" => "available", "get" => "available","histid" => "available","histget" => "available","histexportname" => "","histexportname" => "Verfügbarkeit","isnumber" => "0"),
array("id" => "available", "get" => "available","histid" => "available","histget" => "available","histexportname" => "","histexportname" => "Verfügbarkeit","isnumber" => "0", "exportvals" => array("default" => "Nein","1" => "Ja")),
array("id" => "priceA", "get" => "priceA","histid" => "priceA","histget" => "priceA","histexportname" => "Preis (Stufe A)","isnumber" => "1"),
array("id" => "priceB", "get" => "priceB","histid" => "priceB","histget" => "priceB","histexportname" => "Preis (Stufe B)","isnumber" => "1"),
array("id" => "priceC", "get" => "priceC","histid" => "priceC","histget" => "priceC","histexportname" => "Preis (Stufe C)","isnumber" => "1"),
array("id" => "unit", "get" => "unit","histid" => "unit","histget" => "unit","histexportname" => "Einheit","isnumber" => "0", "exportvals" => array("default" => "Stück","1" => "Preiseingabe bei Bestellung")),
array("id" => "days", "get" => "days","histid" => "days","histget" => "days","histexportname" => "Tage","isnumber" => "0"),
array("id" => "tax", "get" => "IF(tax is not null, tax, 'null') as tax","histid" => "tax","histget" => "tax","histexportname" => "Steuer","isnumber" => "1"),
array("id" => "taxaustria", "get" => "IF(taxaustria is not null, taxaustria, 'null') as taxaustria","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "amount", "get" => "IF(amount is not null, amount, 'null') as amount","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "audio", "get" => "IF(audio is not null, audio, '') as audio","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
array("id" => "favorite", "get" => "IF(favorite is not null, favorite, '') as favorite","histid" => "prodid","histget" => "favorite","histexportname" => "Favorit","isnumber" => "0"),
array("id" => "favorite", "get" => "IF(favorite is not null, favorite, '') as favorite","histid" => "prodid","histget" => "favorite","histexportname" => "Favorit","isnumber" => "0", "exportvals" => array("default" => "Nein","1" => "Ja")),
array("id" => "type", "get" => "'p' as type","histid" => "","histget" => "","histexportname" => "","isnumber" => "0"),
);
@ -168,6 +170,13 @@ class Products {
}
private function getAllTypesAndAvailProds() {
date_default_timezone_set(DbUtils::getTimeZone());
$date = new DateTime();
$dayofweek = date('N');
if ($dayofweek == 7) {
$dayofweek = 0;
}
$pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction();
@ -197,10 +206,10 @@ class Products {
$typeArray[] = array("id" => $row['id'], "name" => $row['name'], "ref" => $ref);
}
$sql = "select id,shortname,longname,audio,category as ref,favorite,$priceTxt as price,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 from %products% where available='1' AND removed is null ORDER BY sorting";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$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 ";
$sql .= " from %products% where available='1' AND removed is null AND (days is null OR days like ?) ORDER BY sorting";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array("%$dayofweek%"));
$prodArray = array();
foreach($result as $row) {
$ref = $row['ref'];
@ -223,7 +232,7 @@ class Products {
$stmt->execute(array($row['id']));
$extras = $stmt->fetchAll(PDO::FETCH_OBJ);
$prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref, "favorite" => $fav, "price" => $row['price'], "tax" => $row['tax'], "taxaustria" => $row['taxaustria'],"amount" => $row['amount'],"extras" => $extras);
$prodArray[] = array("id" => $row['id'], "name" => $row['shortname'], "longname" => $row['longname'], "audio" => $audio, "ref" => $ref, "favorite" => $fav, "price" => $row['price'], "unit" => $row['unit'],"days" => $row['days'],"tax" => $row['tax'], "taxaustria" => $row['taxaustria'],"amount" => $row['amount'],"extras" => $extras);
}
$pdo->commit();
@ -515,10 +524,14 @@ class Products {
$value = '-';
}
$value = str_replace(".",$decpoint,$value);
} else if ($itemsql == 'available') {
$value = ($zeile['available'] == '1' ? "Ja" : "Nein");
} else if ($itemsql == 'favorite') {
$value = ($zeile['favorite'] == '1' ? "Ja" : "Nein");
} else if (isset($aProdDef["exportvals"])) {
$exportvals = $aProdDef["exportvals"];
$value = $zeile[$itemsql];
if (isset($exportvals[$value])) {
$value = $exportvals[$value];
} else {
$value = $exportvals["default"];
}
} else {
$isNumber = $aProdDef["isnumber"];
$value = $zeile[$aProdDef["histget"]];
@ -537,7 +550,7 @@ class Products {
function getSingleProdData($pdo,$id) {
if (is_numeric($id)) {
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,IF(tax is not null, tax, 'null') as tax,available,audio,favorite from %products% where id=?";
$sql = "SELECT id,shortname,longname,priceA,priceB,priceC,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,available,audio,favorite from %products% where id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($id));

View File

@ -117,11 +117,44 @@ class Updater {
$infoFileLines = $infoFile["msg"];
if (count($infoFileLines) > 1) {
return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url);
$checkIfNewerVersion = self::isV2Newer('1.3.9',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);
}
}
private static function isV2Newer($v1,$v2) {
if (is_null($v1) || is_null($v2)) {
return false;
}
$v1key = self::genVerKey($v1);
$v2key = self::genVerKey($v2);
if (is_null($v1key) || is_null($v2key)) {
return false;
}
if ($v1key < $v2key) {
return true;
} else {
return false;
}
}
private static function genVerKey($v) {
$vparts = split("\.",$v);
$len = count($vparts);
$key = 0;
try {
for ($i=0;$i<$len;$i++) {
$key += intval($vparts[$i]) * pow(1000,2-$i);
}
return $key;
} catch (Exception $e) {
return null;
}
}
private static function doCheck($lineArr) {

View File

@ -15,6 +15,8 @@ class ProductEntry {
private $favorite = "";
private $audio = "";
private $category = null;
private $unit = null;
private $days = null;
private static $PRICE_B = "PreisB";
private static $PRICE_C = "PreisC";
@ -23,6 +25,8 @@ class ProductEntry {
private static $AMOUNT = "Menge";
private static $SHORTNAME = "Kurzname";
private static $AVAILABLE = "vorhanden";
private static $UNIT = "Einheit";
private static $DAYS = "Tage";
private static $ID = "ID";
@ -52,6 +56,16 @@ class ProductEntry {
if (!is_numeric($this->priceC)) {
$this->priceC = 0.00;
}
if (!is_numeric($this->unit)) {
$this->unit = null;
} else {
if ($this->unit == 0) {
$this->unit = null;
}
}
if (is_null($this->days) || ($this->days == "")) {
$this->days = '0123456';
}
if ($this->tax == "null") {
$this->tax = null;
}
@ -67,17 +81,23 @@ class ProductEntry {
}
public function createProductInDb($pdo) {
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `taxaustria`,`amount`,`category`,`favorite`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?)";
$sql = "INSERT INTO `%products%` (`id`,`shortname`,`longname`,`priceA`,`priceB`,`priceC`,`unit`,`days`,`tax`,`taxaustria`,`amount`,`category`,`favorite`,`available`,`audio`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->tax,$this->taxaustria,$this->amount,$this->category,$this->favorite,$this->available,$this->audio));
if ($this->days == '0123456') {
$this->days = null;
}
$stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->unit,$this->days,$this->tax,$this->taxaustria,$this->amount,$this->category,$this->favorite,$this->available,$this->audio));
return ($pdo->lastInsertId());
}
public function applyProductInDb($pdo) {
$updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, tax=?, taxaustria=?, amount=?,available=?, audio=?, favorite=? WHERE id=?";
$updateSql = "UPDATE %products% SET shortname=?, longname=?, priceA=?, priceB=?, priceC=?, unit=?, days=?, tax=?, taxaustria=?, amount=?,available=?, audio=?, favorite=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($updateSql));
$stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->tax,$this->taxaustria,$this->amount,$this->available,$this->audio,$this->favorite,$this->prodid));
if ($this->days == '0123456') {
$this->days = null;
}
$stmt->execute(array($this->shortName,$this->longName,$this->priceA,$this->priceB,$this->priceC,$this->unit,$this->days,$this->tax,$this->taxaustria,$this->amount,$this->available,$this->audio,$this->favorite,$this->prodid));
}
//
@ -91,6 +111,8 @@ class ProductEntry {
$priceA = str_replace('.', $decpoint, $aProd['priceA']);
$priceB = str_replace('.', $decpoint, $aProd['priceB']);
$priceC = str_replace('.', $decpoint, $aProd['priceC']);
$unit = $aProd['unit'];
$days = $aProd['days'];
$tax = str_replace('.', $decpoint, $aProd['tax']);
$taxaustria = $aProd['taxaustria'];
$amount = $aProd['amount'];
@ -122,6 +144,17 @@ class ProductEntry {
if ($available == 0) {
$extArr[] = self::$AVAILABLE . ":nein";
}
if (!is_null($unit)) {
if ($unit == 1) {
$extArr[] = self::$UNIT . ":Eingabe";
}
}
if (!is_null($days)) {
$extArr[] = self::$DAYS . ":$days";
}
if (!is_null($prodId)) {
$extArr[] = self::$ID . ":" . $prodId;
}
@ -145,6 +178,8 @@ class ProductEntry {
$this->priceB = null;
$this->priceC = null;
$this->unit = null;
$this->days = null;
$this->shortName = null;
$this->taxaustria = 0;
@ -169,6 +204,14 @@ class ProductEntry {
} else {
$this->available = 0;
}
} else if ($identifier == self::$UNIT) {
if ($value == "Stück") {
$this->unit = null;
} else if ($value == "Eingabe") {
$this->unit = 1;
}
} else if ($identifier == self::$DAYS) {
$this->days = $value;
} else if ($identifier == self::$TAX) {
$this->tax = floatval(str_replace(",",".",(string) $value));
} else if ($identifier == self::$SHORTNAME) {
@ -216,7 +259,14 @@ class ProductEntry {
function getPriceC() {
return $this->priceC;
}
function getUnit() {
return $this->unit;
}
function getDays() {
return $this->days;
}
function getTax() {
return $this->tax;
}

View File

@ -351,6 +351,8 @@ class TypeAndProductFileManager {
$priceA = $product->getPriceA();
$priceB = $product->getPriceB();
$priceC = $product->getPriceC();
$unit = $product->getUnit();
$days = $product->getDays();
$tax = $product->getTax();
$taxaustria = trim($product->getTaxAustria());
if (($taxaustria == "") || ($taxaustria == 0)) {
@ -387,15 +389,15 @@ class TypeAndProductFileManager {
}
}
if ($isNewProd) {
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `tax`, `taxaustria`, `amount`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
$sql = $sql . "?,?,?,?,?,?,?,?,?,?,?,?)";
$sql = "INSERT INTO `%products%` (`id`, `shortname`, `longname`, `priceA`, `priceB`, `priceC`, `unit`,`days`, `tax`, `taxaustria`, `amount`, `category`,`available`,`favorite`,`sorting`) VALUES (NULL,";
$sql = $sql . "?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax, $taxaustria, $amount, $category,$available,$favorite,$sorting));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$unit,$days,$tax, $taxaustria, $amount, $category,$available,$favorite,$sorting));
$prodid = $pdo->lastInsertId();
HistFiller::createProdInHist($pdo, $prodid);
} else {
$sql = "SELECT shortname,longname,priceA,priceB,priceC,tax,taxaustria,amount,available,category FROM %products% WHERE id=?";
$sql = "SELECT shortname,longname,priceA,priceB,priceC,unit,days,tax,taxaustria,amount,available,category FROM %products% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($prodid));
$row = $stmt->fetchObject();
@ -405,15 +407,17 @@ class TypeAndProductFileManager {
|| ($row->priceA != $priceA)
|| ($row->priceB != $priceB)
|| ($row->priceC != $priceC)
|| ($row->unit != $unit)
|| ($row->days != $days)
|| ($row->available != $available)
|| ($row->tax != $tax)
|| ($row->taxaustria != $taxaustria)
|| ($row->amount != $amount));
if ($changed) {
$sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,tax=?,taxaustria=?,amount=?,available=?,sorting=? WHERE id=?";
$sql = "UPDATE %products% SET shortname=?,longname=?,priceA=?,priceB=?,priceC=?,unit=?,days=?,tax=?,taxaustria=?,amount=?,available=?,sorting=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$tax,$taxaustria,$amount,$available,$sorting,$prodid));
$stmt->execute(array($shortName,$longName,$priceA,$priceB,$priceC,$unit,$days,$tax,$taxaustria,$amount,$available,$sorting,$prodid));
HistFiller::updateProdInHist($pdo, $prodid);
} else {
$sql = "UPDATE %products% SET sorting=? WHERE id=?";

View File

@ -216,6 +216,7 @@ class Basedb {
`prefertablemap` INT(1) NULL,
`keeptypelevel` INT(1) NOT NULL,
`extrasapplybtnpos` INT(1) NOT NULL,
`failedlogins` VARCHAR(20) NULL,
`active` INT (2) NOT NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
@ -377,6 +378,8 @@ class Basedb {
`priceA` " . DECIMALSMALL . " NULL,
`priceB` " . DECIMALSMALL . " NULL,
`priceC` " .DECIMALSMALL . " NULL,
`unit` INT(2) NULL,
`days` VARCHAR(20) NULL,
`tax` " . DECIMALSMALL . " NULL,
`taxaustria` INT(1) NULL,
`amount` INT(5) NULL,
@ -611,6 +614,8 @@ class Basedb {
`priceA` " . DECIMALSMALL . " NULL,
`priceB` " . DECIMALSMALL . " NULL,
`priceC` " . DECIMALSMALL . " NULL,
`unit` INT(2) NULL,
`days` VARCHAR(20) NULL,
`tax` " . DECIMALSMALL . " NULL,
`taxaustria` INT(1) NULL,
`sorting` INT(2) NULL,

View File

@ -187,7 +187,10 @@ class PdfExport extends FPDF {
$host = ($zeile['host'] == 1 ? "x" : "-");
if (!$commonUtils->verifyBillByValues(null,$billdate, $brutto_orig, $netto_orig, $tax_orig, $userid, $signature)) {
echo "Database is inconsistent!";
echo "Database is inconsistent! Bill $billid ";
if ($zeile['status'] == "c") {
echo '- a cash operation ("Bareinlage/Barauslage"). ';
}
return null;
}

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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -28,6 +28,8 @@ var PROD_NO = ["Nein","No","No"];
var PROD_NEW_PROD = ["Neues Produkt","New product","Nuevo producto"];
var PROD_NO_TONE = ["Kein Ton","No audio","Ningún sonido"];
var PROD_PRICE = ["Preis","Price","Precio"];
var PROD_UNIT = ["Einheit","Unit","Unidad"];
var PROD_DAYS = ["Tage","Days","Dias"];
var PROD_TAX = ["Steuersatz immer","Tax always","Impuesto siempre"];
var PROD_TAXAUSTRIA = ["Steuersatz Österreich","Tax Austria","Impuesto Austria"];
var PROD_AMOUNT = ["Verfügbare Menge","Available amount","Cuanto hay"];
@ -163,13 +165,21 @@ function setLanguage(language) {
var i=0;
for (i=0;i<pt.length;i++) {
var prod = pt[i];
var aProduct = newProduct(prod.id,prod.longname,prod.shortname,prod.priceA,prod.priceB,prod.priceC,prod.tax,prod.taxaustria,prod.amount,prod.available,prod.audio,prod.favorite);
var unit = 0;
if ((prod.unit !== undefined) && (prod.unit != null)) {
unit = prod.unit;
}
var days = '';
if (days != '0123456') {
days = prod.days;
}
var aProduct = newProduct(prod.id,prod.longname,prod.shortname,prod.priceA,prod.priceB,prod.priceC,unit,days,prod.tax,prod.taxaustria,prod.amount,prod.available,prod.audio,prod.favorite);
prodleafs[prodleafs.length] = aProduct;
txt += aProduct.createListStructureLine(audiofiles);
}
if (ct != null) {
var dummyPrice = "0.00".replace(".",decpoint);
var aProduct = newProduct("n" + ct.id,"","",dummyPrice,dummyPrice,dummyPrice,"null",0,"null",1,"",0);
var aProduct = newProduct("n" + ct.id,"","",dummyPrice,dummyPrice,dummyPrice,0,"0123456","null",0,"null",1,"",0);
prodleafs[prodleafs.length] = aProduct;
txt += aProduct.createListStructureLine(audiofiles);
}
@ -376,6 +386,8 @@ function setLanguage(language) {
var priceA = $("#prodpriceA_input_" + prodid).val().trim();
var priceB = $("#prodpriceB_input_" + prodid).val().trim();
var priceC = $("#prodpriceC_input_" + prodid).val().trim();
var unit = $("#produnit_input_" + prodid).val();
var days = $("#proddays_input_" + prodid).val().trim();
var tax = $("#prodtax_input_" + prodid).val().trim();
if (tax == "") {
tax = "null";
@ -421,6 +433,10 @@ function setLanguage(language) {
}
}
if (days == '') {
days = '0123456';
}
if (priceA_Arr[0] && priceB_Arr[0] && priceC_Arr[0]) {
return {
status:true,
@ -430,6 +446,8 @@ function setLanguage(language) {
priceB:priceB_Arr[1],
priceC:priceC_Arr[1],
tax:taxTxt,
unit:unit,
days:days,
taxaustria: selectedTaxAustria,
amount: amount,
selectedAudioFile:selectedAudioFile,
@ -458,6 +476,11 @@ function setLanguage(language) {
return;
}
var days = '0123456';
if (props.days != '') {
days = props.days;
}
var origAssignedExtras = $("#prodextra_" + prodid).data("orig_assignedextras");
var doChangeExtras = 0;
@ -481,6 +504,8 @@ function setLanguage(language) {
priceA: props.priceA,
priceB: props.priceB,
priceC: props.priceC,
unit:props.unit,
days:days,
tax: props.tax,
taxaustria: props.taxaustria,
amount: props.amount,
@ -512,7 +537,7 @@ function setLanguage(language) {
}
function refreshProduct(prodData) {
var aProduct = newProduct(prodData.id,prodData.longname,prodData.shortname,prodData.priceA,prodData.priceB,prodData.priceC,prodData.tax,prodData.taxaustria,prodData.amount,prodData.available,prodData.audio,prodData.favorite);
var aProduct = newProduct(prodData.id,prodData.longname,prodData.shortname,prodData.priceA,prodData.priceB,prodData.priceC,prodData.unit,prodData.days,prodData.tax,prodData.taxaustria,prodData.amount,prodData.available,prodData.audio,prodData.favorite);
aProduct.insertValuesIntoMenuList();
$("#assextralist_" + prodData.id).html("");
$("#assextralist_" + prodData.id).trigger("create");
@ -534,12 +559,18 @@ function setLanguage(language) {
amount = "null";
}
var days = '0123456';
if (days != '') {
days = props.days;
}
var data = {
longname: props.longname,
shortname: props.shortname,
priceA: props.priceA,
priceB: props.priceB,
priceC: props.priceC,
unit: props.unit,
days:days,
tax: props.tax,
taxaustria: props.taxaustria,
amount: amount,

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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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.8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.9">
<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

@ -200,6 +200,10 @@ function isInt(value) {
}
}
function isFloat(n){
return Number(n) === n && n % 1 !== 0;
}
function getMillis() {
var d = new Date();
var n = d.getTime();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long