OrderSprinter 1.3.7

This commit is contained in:
Geno 2020-11-19 23:02:33 +01:00
parent 8d4b613966
commit 82309eed7e
25 changed files with 510 additions and 131 deletions

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.6");
Database::setVersion($pdo,$prefix,"1.3.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.

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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -203,7 +203,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") {
useInstallation();
} else {
setTimeout(function(){document.location.href = "install.html?v=1.3.6"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.7"},500);
}
}

View File

@ -560,11 +560,41 @@ $(document).ready(function() {
$("#startinstall").css({ width: '300px', 'padding-top': '10px', 'padding-bottom': '10px' });
getTimeZones();
$("#languagesettings").show();
$("#timezones").hide();
$("#installsettings").hide();
$("#samplesettings").hide();
$("#workflowsettings").hide();
var urlsuffix = location.search;
var suffices = urlsuffix.split('&');
var doOnlyUpdate = false;
for(var i=0;i<suffices.length;i++) {
if ((suffices[i] == 'mode=onlyupdate') || (suffices[i] == '?mode=onlyupdate')) {
doOnlyUpdate = true;
break;
}
}
if (doOnlyUpdate) {
$("#languagesettings").hide();
$("#timezones").hide();
$("#installsettings").show();
$("#samplesettings").hide();
$("#workflowsettings").hide();
$("#startinstall").hide();
$(".applarea").hide();
$("#db_host").prop('disabled', true);
$("#db_name").prop('disabled', true);
$("#dbuser").prop('disabled', true);
$("#dbpass").prop('disabled', true);
$("#table_prefix").prop('disabled', true);
$("#updatebtn").height("70px");
} else {
$("#languagesettings").show();
$("#timezones").hide();
$("#installsettings").hide();
$("#samplesettings").hide();
$("#workflowsettings").hide();
}
});
</script>
@ -652,26 +682,26 @@ $(document).ready(function() {
<td><button type="submit" id="testwriteaccess" onclick="checkWriteAccess();">Teste Schreibberechtigungen</button>
<td align=center id=writestatus>
</tr>
<tr>
<td id="application" rowspan=4>Applikation
<td id="adminpassword" align="right">Administrator-Passwort:</td>
<td><input id="adminpass" type="password" size="30" maxlength="30" /></td>
</tr>
<tr>
<td id="adminpasswordrepeat" align="right">Administrator-Passwort (Wdh.):</td>
<td><input id="adminpass2" type="password" size="30" maxlength="30"></td>
</tr>
<tr>
<td id=currencytxt align="right">Währung:</td>
<td><input id="currency" value="Euro" size="30" maxlength="30"/></td>
</tr>
<tr>
<td id="decimalpoint" align="right">Dezimaltrennzeichen:</td>
<td><select name="point" id="point" size="1">
<option id="commachar" selected>Komma</option>
<option id="pointchar">Punkt</option>
</td>
</tr>
<tr class="applarea">
<td id="application" rowspan=4>Applikation
<td id="adminpassword" align="right">Administrator-Passwort:</td>
<td><input id="adminpass" type="password" size="30" maxlength="30" /></td>
</tr>
<tr class="applarea">
<td id="adminpasswordrepeat" align="right">Administrator-Passwort (Wdh.):</td>
<td><input id="adminpass2" type="password" size="30" maxlength="30"></td>
</tr>
<tr class="applarea">
<td id=currencytxt align="right">Währung:</td>
<td><input id="currency" value="Euro" size="30" maxlength="30"/></td>
</tr>
<tr class="applarea">
<td id="decimalpoint" align="right">Dezimaltrennzeichen:</td>
<td><select name="point" id="point" size="1">
<option id="commachar" selected>Komma</option>
<option id="pointchar">Punkt</option>
</td>
</tr>
<tr>
<td>PHP-Status
<td id=phpstatusfield colspan=2>?
@ -679,7 +709,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.3.6</button>
<button id="updatebtn">Update -> 1.3.7</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -1934,6 +1934,31 @@ return false;
}
}
function updateUserTable1306_1307($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.6") {
$ret = $this->updateUserTable1305_1306($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.3.5 to 1.3.6 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('updateurl','http://www.ordersprinter.de/update'));
$this->updateVersion($pdo, '1.3.7');
return true;
} catch (PDOException $e) {
echo "Error in v1.3.6 to 1.3.7: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
@ -2060,7 +2085,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.6')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.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')");
@ -2104,6 +2129,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'hscurrency', 'EUR')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'hs3refresh', '60')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'memorylimit', '512')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'updateurl', 'http://www.ordersprinter.de/update')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'restaurantmode', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'returntoorder', '1')");
@ -2443,7 +2469,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.6";
$installerVersion = "1.3.7";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -2473,7 +2499,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.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"
);
if (!in_array($version, $supportedVersions)) {
@ -2481,7 +2507,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1305_1306($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1306_1307($_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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -196,6 +196,14 @@ var MAN_BAK_BTN = ["Sicherung (Konfiguration)","Backup (Configuration)","Exporta
var MAN_BAK_GUEST_BTN = ["Sicherung (Konfiguration + Gäste)","Backup (Configuration + guests)","Exportar (configuración y clientes)"];
var MAN_BAK_BTN_ALL = ["Sicherung (Alles ohne Logs)","Backup (all without logs)","Exportar (todo sin protocolo)"];
var MAN_BAK_BTN_ALL_LOGS = ["Sicherung (Alles mit Logs)","Backup (all with logs)","Exportar (todo y protocolo)"];
var MAN_UPDATE_HEAD = ["Versionsupdate","Version update","Actualizar la versión"];
var MAN_CHECK_UPDATE_BTN = ["Update starten","Start update","Empezar actualizar"];
var MAN_UPDATE_HINT = ["Das Updaten über diesen Weg funktioniert nur, wenn die Dateien im Webverzeichnis beschreibbar sind und eine Verbindung zum OrderSprinter-Webserver besteht.",
"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_UPD_PROGRESS = ["Fortschritt","Progress","Progreso"];
var MAN_RESTORE_BTN = ["Importieren","Restore","Importar"];
var MAN_GO_LIVE = ["Starte Produktivbetrieb","Start productive mode","Empezar trabajar realmente"];
var MAN_SHUTDOWN = ["Server herunterfahren","Shutdown server","Apagar servidor"];
@ -263,6 +271,7 @@ var MAN_SMTPPASS = ["SMTP-Passwort","SMTP password","SMTP contraseña"];
var MAN_SMTPSECURE = ["SMTP-Protokoll","SMTP Protocol","SMTP Seguridad"];
var MAN_SMTPPORT = ["SMTP-Port","SMTP Port","SMTP Port"];
var MAN_MEMORYLIMIT = ["PHP Memory Limit (MB)","PHP Memory Limit (MB)","PHP Memory Limit (MB)"];
var MAN_UPDATEURL = ["Update-Server","Update server","Servidor de actualizar"];
var MAN_HS3REFRESH = ["HS/3 Updateinterval (Sek.)","HS/3 Update interval (sec.)","HS/3 Update Interval (sec)"];
var MAN_WEBIMPRESSUM = ["Webimpressum","Web company info","www café info"];
var MAN_TAX_ASSIGN = ["Umsatzsteuer-Zuweisung","Taxes assigment","Asignar impuestos"];
@ -334,6 +343,7 @@ 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_DO_UPDATESTEP = ["Die Dateien wurden hochgeladen. Es findet eine Weiterleitung auf die Installationsseite statt. Klicken Sie dort auf den Update-Button!","The files have been uploaded. You will be forwarded to the install page. Please click on the update button there!","Los ficheros estan aquí ahora. La página de install es el proximo paso donde puedes click on el boton 'update'!"];
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];
@ -341,6 +351,7 @@ 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];
var numberOfClosings = 0;
var unpaidTables = "";
var version = '';
var generalValuesSettings = [
["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"],
@ -404,6 +415,7 @@ var generalValuesSettings = [
["hscurrency",MAN_HSCURRENCY[lang],"i",0],
["memorylimit",MAN_MEMORYLIMIT[lang],"i",0,""],
["updateurl",MAN_UPDATEURL[lang],"i",0,""],
["hs3refresh",MAN_HS3REFRESH[lang],"i",0,""]
];
@ -458,6 +470,7 @@ function setLanguage(l) {
$("#smtpporttxt").html(MAN_SMTPPORT[l]);
$("#memorylimittxt").html(MAN_MEMORYLIMIT[l]);
$("#updateurltxt").html(MAN_UPDATEURL[l]);
$("#hs3refreshtxt").html(MAN_HS3REFRESH[l]);
$("#paydeskidtxt").html(MAN_PAYDESKID[l]);
@ -476,6 +489,11 @@ function setLanguage(l) {
$("#bakresinfotxtall").html(MAN_BAK_REST_INFO_ALL[l]);
$("#uplfiletxt").html(MAN_UPLOAD_FILE[l]);
$("#bakrestxt").html(MAN_BAK_REST_HEAD[l]);
$("#updatetxt").html(MAN_UPDATE_HEAD[l]);
$("#updatebtntxt").html(MAN_CHECK_UPDATE_BTN[l]);
$("#updatehinttxt").html(MAN_UPDATE_HINT[l]);
$("#availableversiontxt").html(MAN_AVAIL_UPD_VERSION[l]);
$("#urltxt").html(MAN_UPDATE_URL[l]);
$("#backupbtntxt").html(MAN_BAK_BTN[l]);
$("#backupguestsbtntxt").html(MAN_BAK_GUEST_BTN[l]);
$("#backupbtntxtall").html(MAN_BAK_BTN_ALL[l]);
@ -530,6 +548,8 @@ function setLanguage(l) {
$("#restmodehint").html(MAN_REST_MODE_HINT[l]);
$("#workfontsizehint").html(MAN_FONTSIZE_HINT[l]);
$("#updateprogresslabel").html(MAN_UPD_PROGRESS[l] + ": ");
}
function createMonthSelection(label) {
@ -595,6 +615,8 @@ function insertGeneralConfigItems(configResult) {
saveValueIntoForm(values.taxaustriaerm2,decpoint,"#taxaustriaerm2val");
saveValueIntoForm(values.taxaustriaspecial,decpoint,"#taxaustriaspecialval");
version = values.version;
$("#companyinfo").val(values.companyinfo);
$("#rectemplate").val(values.rectemplate);
$("#foodtemplate").val(values.foodtemplate);
@ -694,6 +716,7 @@ function insertGeneralConfigItems(configResult) {
$("#smtpport").val(values.smtpport);
$("#memorylimit").val(values.memorylimit);
$("#updateurl").val(values.updateurl);
$("#hs3refresh").val(values.hs3refresh);
$("#paydeskid").val(values.paydeskid);
@ -1338,6 +1361,17 @@ 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);
} else {
doAjax("GET","php/contenthandler.php?module=updater&command=updatecheck",null,handleUpdateCheckResult,"Skriptproblem");
}
});
$("#shutdown_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
@ -1415,6 +1449,74 @@ function getSpooledPrintJobs() {
doAjax("GET","php/contenthandler.php?module=printqueue&command=getPrintJobOverview",null,insertPrintQueue,null);
}
function getVersionInfoForUpdate() {
var data = {
n: getMillis()
};
doAjax("GET","php/contenthandler.php?module=updater&command=getAvailableVersion",data,insertAvailableUpdateVersion,null,true);
}
function insertAvailableUpdateVersion(answer) {
$("#urlpath").val(answer.url);
if (answer.status == "OK") {
$("#availversion").html(answer.msg);
} else {
$("#availversion").html('?');
}
}
function handleUpdateCheckResult(answer) {
if (answer.status != "OK") {
alert("Error: " + answer.msg);
return;
}
var updateinfolines = answer.msg;
var totalLines = updateinfolines.length;
if (totalLines < 2) {
alert("Info file not valid");
return;
}
totalLines--;
$("#sliderarea").show();
for (var index=0;index<totalLines;index++) {
var data = {
fileindex: index,
millis: getMillis(),
totalLines: totalLines
};
doAjax("GET","php/contenthandler.php?module=updater&command=replace",data,handleUpdateReplace,"Replace problem",null,false);
}
$("#sliderarea").hide();
alert(MAN_DO_UPDATESTEP[lang]);
var millis=getMillis();
setTimeout(function(){document.location.href = "install.html?v=1.3.7&mode=onlyupdate&n=" + millis},250);
}
function handleUpdateReplace(answer) {
if (answer.status != "OK") {
alert("Fehler: " + answer.msg);
location.reload();
}
var index = parseInt(answer.msg.index) + 1;
var file = answer.msg.file;
var totalLines = parseInt(answer.msg.totalLines);
var porc = index * 100 / totalLines;
$("#updatestatus").html(porc + "% (" + toHtml(file) + ")");
$("#updateslider").val(porc);
$("#updateslider").slider("refresh");
}
function bindSelectionsWithActions() {
$("#austria").off("change").on("change", function (e) {
e.stopImmediatePropagation();
@ -2465,6 +2567,8 @@ $(document).on("pageinit", "#admin-page", function () {
$("#userfile").val('');
getSpooledPrintJobs();
getVersionInfoForUpdate();
});
@ -2746,6 +2850,11 @@ $(document).on("pageinit", "#admin-page", function () {
<label for="memorylimit"><span id="memorylimittxt">PHP Memory Limit:</span></label>
<input type="text" value="" data-mini="true" placeholder="256" id="memorylimit" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="updateurl"><span id="updateurltxt">Update-Server:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="updateurl" data-theme="c" class="genConfigEl"/>
</div>
<div id="partOfAustria"></div>
@ -3077,6 +3186,24 @@ $(document).on("pageinit", "#admin-page", function () {
<p><button type="submit" data-theme="d" id="golive"><span id="golivetxt">Starte Produktivbetrieb</span></button>
</div>
<p><div data-role="collapsible" data-collapsed="true" data-theme="f" data-content-theme="c" class="noprint" id="updatearea">
<p><h3><span id="updatetxt">Update</span></h3>
<span id='updatehinttxt'>Update-Hinweis...</span>
<p><div>
<form action='dummy'>
<span id="availableversiontxt">Verf.Version</span>: <span id="availversion">?</span><br>
<span id="urltxt">URL</span>:
<input id="urlpath" type="text" value="" style="background:white;" disabled /><br>
<button type="submit" data-theme="f" id="update_btn"><span id="updatebtntxt">Upd</span></button><br>
<div id="sliderarea" style="display:none;">
<label for="updateslider" id="updateprogresslabel">Fortschr.</label> <span id="updatestatus"></span>
<input type="range" name="updateslider" id="updateslider" value="0" min="0" max="100" data-theme="b" data-track-theme="e" class="ui-hidden-accessible" />
</div>
</form>
</div>
</div>
<p>
<form action="dummy" method="GET">

File diff suppressed because one or more lines are too long

View File

@ -830,6 +830,7 @@ class Admin {
}
$memorylimit = CommonUtils::getConfigValue($pdo,"memorylimit",256);
$updateurl = CommonUtils::getConfigValue($pdo,"updateurl","");
$hs3refresh = CommonUtils::getConfigValue($pdo, "hs3refresh", 60);
$paydeskid = CommonUtils::getConfigValue($pdo,"paydeskid","");
@ -864,7 +865,7 @@ class Admin {
"smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "hs3refresh" => $hs3refresh,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "updateurl" => $updateurl, "hs3refresh" => $hs3refresh,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"restaurantmode" => $restaurantmode
);
@ -956,7 +957,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.6");
echo json_encode($view . "?v=1.3.7");
}
}
@ -1158,25 +1159,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.6"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.7"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.6"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.7"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.6"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.6"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.6"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.7"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.7"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.7"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.6"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.7"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.6"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.6"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.6"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.6"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.6"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.6"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.6"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.6");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.6");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.7"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.7"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.7"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.7"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.7"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.7"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.7"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.7");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.7");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1184,7 +1185,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.6",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.7",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1470,6 +1471,7 @@ class Admin {
"smtpport" => array("dbcol" => "smtpport","checknum" => 0),
"memorylimit" => array("dbcol" => "memorylimit","checknum" => 0),
"updateurl" => array("dbcol" => "updateurl","checknum" => 0),
"hs3refresh" => array("dbcol" => "hs3refresh","checknum" => 0),
"paydeskid" => array("dbcol" => "paydeskid","checknum" => 0),
@ -1521,6 +1523,10 @@ class Admin {
}
}
if ($name == "updateurl") {
$aVal = trim($aVal);
}
if ($name == "hs3refresh") {
$aVal = trim($aVal);
if (!ctype_digit($aVal)) {

View File

@ -15,6 +15,7 @@ require_once ('reservation.php');
require_once ('rating.php');
require_once ('customers.php');
require_once ('commonutils.php');
require_once ('updater.php');
require_once ('utilities/Logger.php');
$module = $_GET["module"];
@ -70,6 +71,9 @@ if ($module == 'admin') {
} else if ($module == 'customers') {
$rating = new Customers();
$rating->handleCommand($command);
} else if ($module == 'updater') {
$updater = new Updater();
$updater->handleCommand($command);
}

171
webapp/php/updater.php Normal file
View File

@ -0,0 +1,171 @@
<?php
class Updater {
function handleCommand($command) {
if (!self::isUserAlreadyLoggedInAndAdmin()) {
echo json_encode(array("status" => "ERROR", "msg" => "Not authorized"));
} else {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if ($command == 'getAvailableVersion') {
echo json_encode(self::getAvailableVersion($pdo));
} else if ($command == 'updatecheck') {
echo json_encode(self::updatecheck($pdo));
} else if ($command == 'replace') {
echo json_encode(self::replace($pdo,$_GET["fileindex"],$_GET["totalLines"]));
}
else {
echo "Kommando nicht unterstuetzt.";
}
}
}
private static function isUserAlreadyLoggedInAndAdmin() {
if(session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
return false;
} else {
return ($_SESSION['is_admin']);
}
}
private static function getFile($url,$file,$asArray = false,$timeout = 200) {
$ctx = stream_context_create(array('http' =>
array(
'timeout' => $timeout, // seconds
)
));
$url = $url . "/" . $file;
try {
$infoFile = @file_get_contents($url, false, $ctx);
if ($infoFile != FALSE) {
if ($asArray) {
$retArr = array();
$lines = explode("\n", $infoFile);
if (count($lines) < 1) {
return array("status" => "ERROR","msg" => "Info file not valid");
}
$versionMatch = '/^[0-9]*\.[0-9]*\.[0-9]*/';
$ret = preg_match($versionMatch, $lines[0]);
if ($ret == 0) {
return array("status" => "ERROR","msg" => "Info file has no version info.");
}
foreach($lines as $aLine) {
$l = trim($aLine);
if ($l != '') {
$retArr[] = $l;
}
}
return array("status" => "OK","msg" => $retArr);
} else {
return array("status" => "OK","msg" => $infoFile);
}
} else {
return array("status" => "ERROR","msg" => "Info file not found");
}
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function getAvailableVersion($pdo) {
$url = CommonUtils::getConfigValue($pdo, "updateurl", '');
$infoFile = self::getFile($url,'updateinfo.txt',true,3);
if ($infoFile["status"] != "OK") {
return array("status" => "ERROR","msg" => "could not get info file: " . $infoFile["msg"],"url" => $url);
}
$infoFileLines = $infoFile["msg"];
if (count($infoFileLines) > 1) {
return array("status" => "OK","msg" => $infoFileLines[0],"url" => $url);
} else {
return array("status" => "ERROR","msg" => "Info file not valid","url" => $url);
}
}
private static function doCheck($lineArr) {
if (count($lineArr) < 2) {
return array("status" => "OK","msg" => '');
}
for ($i=1;$i<count($lineArr);$i++) {
if (trim($lineArr[$i]) == '') {
continue;
}
$aLine = "../" . $lineArr[$i];
$basename = basename($aLine);
$dirname = dirname($aLine);
$isDirExists = file_exists($dirname);
$isFileExists = file_exists($aLine);
$isDirWritable = is_writable($dirname);
$isFileWritable = is_writable($aLine);
if ($isDirExists) {
if ($isFileExists) {
if (!$isFileWritable) {
return array("status" => "ERROR","msg" => $aLine . " cannot be overwritten");
}
} else {
// file does not exist, but can it be created?
if (!$isDirWritable) {
return array("status" => "ERROR","msg" => $basename . " cannot be written into $dirname");
}
}
} else {
return array("status" => "ERROR","msg" => $dirname . " does not exist");
}
}
return array("status" => "OK","msg" => "");
}
public static function updatecheck($pdo) {
$url = CommonUtils::getConfigValue($pdo, "updateurl", '');
$infoFile = self::getFile($url,'updateinfo.txt',true,3);
if ($infoFile["status"] != "OK") {
return array("status" => "ERROR","msg" => "could not get info file: " . $infoFile["msg"]);
}
$infoFileLines = $infoFile["msg"];
$check = self::doCheck($infoFileLines);
if ($check["status"] != "OK") {
$ret = array("status" => "ERROR","msg" => "Check returned: " . $check["msg"]);
} else {
$ret = array("status" => "OK","msg" => $infoFileLines);
}
return $ret;
}
public static function replace($pdo,$fileindex,$totallines) {
$url = CommonUtils::getConfigValue($pdo, "updateurl", '');
$infoFile = self::getFile($url,'updateinfo.txt',true,3);
if ($infoFile["status"] != "OK") {
return array("status" => "ERROR","msg" => "could not get info file: " . $infoFile["msg"]);
}
$lineArr = $infoFile["msg"];
try {
$fileToRead = $lineArr[intval($fileindex) + 1];
if (trim($fileToRead) != '') {
$targetFile = "../" . $fileToRead;
$fileContent = self::getFile($url, $fileToRead);
file_put_contents($targetFile, $fileContent["msg"]);
}
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
return array("status" => "OK","msg" => array("index" => $fileindex,"file" => $fileToRead,"totalLines" => $totallines));
}
}

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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<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.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -198,4 +198,10 @@ function isInt(value) {
} else {
return false;
}
}
function getMillis() {
var d = new Date();
var n = d.getTime();
return n;
}

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">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.6">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.7">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
<aside class="aside aside1" id="tablepanel">
<div class="tablepanel" >
<header id="location" class="tablepanelheader">Raum: Raum xyz</header>
<div id="roompanel" class="roompanel"></div>
<div id="tablepanelcontent" class="tablepanelcontent"></div>
<div id=tablemapcontent style="position: relative;width:100%;display:none;">
<img id="mapimgpart" style="width:100%;position: relative;left: 0;top: 0;" src=img/empty-room.png />
<div id=tableoverlay></div>
</div>
<div id="receiptpanel" style="display:none;"></div>
</div>
</aside>
<article class="main">
<div id="groupchain" class="grouppanel"></div>
<div id="groupchoice" class="grouppanel"></div>
<div id="paybuttonpanel" style="display:none;">
<input id="payall" class="input50 inputwhite" type="submit" value="Alles" />
<div class="infoarea"><span id="priceinreceipt"></span></div>
</div>
<div id="oben" class="paypanel" style="display:none;"></div>
<hr>
<div id="unten" class="paypanel" style="display:none;"></div>
<!-- a hack: info-page is for compatibility to mobile view at which data is stored -->
<div id="info-page" style='display:none;'></div>
<div id="searchpanel" style="display:none;"><input id="search" class="input100 inputwhite" type="text" placeholder="Suchen..." /></div>
<div id="productspanel" class="productspanel" style="display:none;"></div>
<div id="remarkpanel" style="display:none;">
<input id="remark" class="input100 inputwhite" type="text" placeholder="Produktbemerkung" />
</div>
</article>
<aside class="aside aside2">
<div class="buttonarea">
<input id="mainmenubtn" class="input100 inputwhite"type="submit" value="Hauptmenü" />
<input id="paydeskbtn" class="input100 inputwhite"type="submit" value="Kasse" style="display:none;"/><br>
<input id="goorderbtn" class="input100 inputwhite"type="submit" value="Bestellung" style="display:none;"/>
<input id="cashbutton" class="input100 inputwhite"type="submit" style="display:none;" value="Ein-/Auslage" />
<input id="hostbutton" class="input100 inputwhite btnswitchoff"type="submit" style="display:none;" value="Bewirtungsbeleg" />
<input id="paydeskcash" class="input100 inputwhite"type="submit" style="display:none;" value="Zahlung" />
<input id="paydeskprint" class="input100 inputwhite"type="submit" style="display:none;" value="Bondruck" />
<input id="workbtn" class="input100 inputwhite" type="submit" value="Arbeitsbon" style="display:none;" />
<input id="sendNewOrders" class="input100 inputwhite" type="submit" value="Bestellung abschließen" style="display:none;" />
<input id="changetablebtn" class="input100 inputwhite" type="submit" value="Tischwechsel" style="display:none;" />
</div>
<div id="neworders" class="ordereditem-container"></div>
</aside>
<div id="ordered" class="ordereditem-sentcontainer"></div>
<div id="waitermessagearea" class="waitermsg" style="display:none;">Waiter Message</div>