OrderSprinter 1.3.3

This commit is contained in:
Geno 2020-11-19 23:02:19 +01:00
parent 803f8d00de
commit f84bcbe3ef
29 changed files with 396 additions and 87 deletions

View File

@ -85,7 +85,7 @@ class Installer {
}
Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.3.2");
Database::setVersion($pdo,$prefix,"1.3.3");
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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -38,6 +38,8 @@ var CUS_REMARK_LABEL = ["Bemerkung:","Remark:","Comentario:"];
var CUS_PHONE_LABEL = ["Telefon","Phone","Telefono"];
var CUS_MOBIL_LABEL = ['Mobil','Mobile','Móvil'];
var CUS_WWW_LABEL = ['Webseite','Home page', ' Página web'];
var CUS_HELLO_LABEL = ["Anrede (für Emails)","Saludation (for emails)","Encabezamiento (email)"];
var CUS_REGARDS_LABEL = ["Gruß (Email-Abschluss)","Greeting (end of email)","Abrazo (Email)"];
var CUS_ROOM_LABEL = ['Zimmer','Room','Habitación'];
var CUS_NEW_CUS_BTN = ["Gast anlegen","Create guest","Crear cliente"];
var CUS_EMPTY_NAME = ["Gästenamen nicht angegeben","Name of the guest not specified","Ningún nombre del cliente"];
@ -76,10 +78,13 @@ var CUS_PRINT_ALL = ["Alle Bons drucken","Print all receipts","Imprimir todos lo
var CUS_FILTER_OPEN_BILLS = ["Filter Gäste mit offenen Rechnungen","Filter on customers with ooen bills","Filtrar clientes con tiquets non-pagados"];
var CUS_LOGBTN = ["Rechnungslog (csv)","Log of payments (csv)","Protocolo de los pagos (csv)"];
var CUS_SEND_EMAIL = ["Email an alle Gruppenmitglieder senden","Send email to all group members","Enviar email a todos los miembros"];
var CUS_EMAIL_WARNING = ["Emails lassen sich nur versenden, wenn die Email-Konfiguration vorgenommen wurde","Emails can only be sent if the email configuration was done","Sólo puede enviar emails si la configuración es completada"];
var CUS_EMAIL_WARNING = ["Emails lassen sich nur versenden, wenn die Email-Konfiguration vorgenommen wurde.","Emails can only be sent if the email configuration was done.","Sólo puede enviar emails si la configuración es completada."];
var CUS_STORNO_QUEST_TITLE = ["Storno?","Cancel?","Contrapartida?"];
var CUS_STORNO_QUEST_TEXT = ["Bon als vom Gast unbezahlt deklarieren?","Cancel the payment of the guest?","Contrapartida del tique por el cliente?"];
var CUS_YES = ["Ja","Yes","Si"];
var CUS_PLACEHOLDER_HINT = ["Im Text können die Platzhalter {NAME}, {ANREDE}, {GRUSS} verwendet werden.",
"You can use {NAME}, {ANREDE}, {GRUSS} as placeholder for the name, the salutation or the greeting in the text.",
"En el texto se puede usar {NAME}, {ANREDE}, {GRUSS} para sustituir nombre, encabezamiento o abrazo."];
var l = 0;
@ -93,6 +98,8 @@ function setLanguage(language) {
$("#newcusphonelabel").html(CUS_PHONE_LABEL[l]);
$("#newcusmobillabel").html(CUS_MOBIL_LABEL[l]);
$("#newcuswwwlabel").html(CUS_WWW_LABEL[l]);
$("#newcushellolabel").html(CUS_HELLO_LABEL[l] + ":");
$("#newcusregardslabel").html(CUS_REGARDS_LABEL[l] + ":");
$("#newcusroomlabel").html(CUS_ROOM_LABEL[l]);
$("#newcustomerbtn").html(CUS_NEW_CUS_BTN[l]);
$("#customersearchlabel").html(CUS_SEARCH_LABEL[l]);
@ -125,7 +132,7 @@ $(document).on("pageinit", "#info-page", function () {
</div>
<div data-role="content" id="content">
<div class="ui-grid-a" class="noprint">
<div class="ui-grid-a noprint">
<div class="ui-block-a"><button type="submit" data-theme="c" class="" data-icon="arrow-d" id="customersbtn">Gäste</button></div>
<div class="ui-block-b"><button type="submit" data-theme="c" class="" data-icon="arrow-d" id="groupsbtn">Gruppen</button></div>
</div>
@ -182,6 +189,16 @@ $(document).on("pageinit", "#info-page", function () {
<input id='newcustomerwww' type="text" value="" data-mini="true" placeholder="www.the-homepage-of-the-guest.de" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label id="newcushellolabel" for="newcustomerhello">Anrede</label>
<input id='newcustomerhello' type="text" value="" data-mini="true" placeholder="Sehr geehrter Herr xyz" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label id="newcusregardslabel" for="newcustomerregards">Gruß</label>
<textarea cols="40" rows="8" name="newcustomerregards" id="newcustomerregards" data-theme="a" placeholder='Viele Grüße, Dein Max Mustermann'></textarea>
</div>
<div data-role="fieldcontain" id="datepickerareacheckin">
<label for="newcustomercheckin"><span id=datetxtcheckin>Check-In</span>: </label>
<input data-role="date" data-inline="true" type="text" id="newcustomercheckin" data-theme="a">

File diff suppressed because one or more lines are too long

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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.3.3">
<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.2"},500);
setTimeout(function(){document.location.href = "install.html?v=1.3.3"},500);
}
}

View File

@ -679,7 +679,7 @@ $(document).ready(function() {
<tr id=updateline>
<td>&nbsp;</td>
<td align=center>
<button id="updatebtn">Update -> 1.3.2</button>
<button id="updatebtn">Update -> 1.3.3</button>
</td>
<td>&nbsp;</td>
</tr>

View File

@ -64,7 +64,7 @@ return $pdo;
}
function checkPhpStatus() {
$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib");
$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib","curl");
$missing = array();
$extensions_status = 1;
@ -1832,6 +1832,39 @@ return false;
}
}
function updateUserTable1302_1303($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.3.2") {
$ret = $this->updateUserTable1301_1302($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.3.1 to 1.3.2 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$sql = "ALTER TABLE %customers% ADD hello VARCHAR(100) NULL AFTER www";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %customers% ADD regards VARCHAR(100) NULL AFTER hello";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->execSql($pdo, "OPTIMIZE TABLE %customers%");
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('rksvserver',''));
$this->updateVersion($pdo, '1.3.3');
return true;
} catch (PDOException $e) {
echo "Error in v1.3.2 to 1.3.3: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
@ -1958,7 +1991,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.2')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.3')");
$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')");
@ -1985,6 +2018,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paydeskid', 'OrderSprinter-1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'aeskey', '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'certificatesn', '1234567')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'rksvserver', '')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'digigopaysetready', '1')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'waitergopayprint', '0')");
@ -2340,7 +2374,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.3.2";
$installerVersion = "1.3.3";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -2371,7 +2405,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.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1","1.3.2"
);
if (!in_array($version, $supportedVersions)) {
@ -2379,7 +2413,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1301_1302($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1302_1303($_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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -193,6 +193,7 @@ var MAN_REST_INFO = ["Der Import dauert eine Weile...","The import takes a while
var MAN_UPLOAD_FILE = ["Diese Datei hochladen (<i>importieren</i>): ", "Upload this file: ","Importar este file: "];
var MAN_BAK_REST_HEAD = ["Sicherung und Import","Backup and Restore","Exportar y Importar"];
var MAN_BAK_BTN = ["Sicherung (Konfiguration)","Backup (Configuration)","Exportar (configuración)"];
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_RESTORE_BTN = ["Importieren","Restore","Importar"];
@ -308,6 +309,7 @@ var MAN_AESKEY = ["AES256 Schlüssel","AES256 Key","AES256 LLave"];
var MAN_AESKEY_WRONG_LENGTH = ["Ein AES256-Schlüssel muss in Hex-Darstellung 64 Zeichen haben.","An AES256 key requires to have 64 characters in a hex string.", "Una llave de AES256 tiene que contener 64 characteres en forma hex."];
var MAN_AESKEY_NO_HEX = ["Der AES-Schlüssel muss als Hex-Zahl angegeben werden.","The AES key must be specified as hex number","La llava AES tiene que especificado en formato hex."];
var MAN_CERTIFICATE_SN = ["Zertifikatsseriennummer", "Certificate Serial No","Certificado ID"];
var MAN_RKSVSERVER = ["RKSV-Server-URL","RKSV server URL","RKSV-Server URL"];
var MAN_TAX = ["Steuersatz (%)","Tax (%)","Impuesto (%)"];
var MAN_CONFIRM_GO_LIVE = ["Die Umsatz- und Logdaten wurden gelöscht und nur die Konfiguration übernommen. Deswegen ist nun ein erneutes Einloggen erforderlich.",
"The sales and log data is deleted and configuration is recreated. Therefore a log-in is required now.",
@ -330,6 +332,8 @@ var MAN_HSOUTFILE = ["HS/3 Datei HS3CASH.OUT","HS/3 file HS3CASH.OUT","HS/3 file
var MAN_HSCURRENCY = ["HS/3 Währungsangabe","HS/3 Currency","HS/3 Moneda"];
var MAN_DEL_HINT = ["Zum Löschen anklicken","Click to delete","Click para removar"];
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 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];
@ -393,6 +397,7 @@ var generalValuesSettings = [
["paydeskid",MAN_PAYDESKID[lang],"i",0,""],
["aeskey",MAN_AESKEY[lang],"i",0,""],
["certificatesn",MAN_CERTIFICATE_SN[lang],"i",0,""],
["rksvserver",MAN_RKSVSERVER[lang],"i",0,""],
["hotelinterface",MAN_HOTELINTERFACE[lang],"s",22],
["hsinfile",MAN_HSINFILE[lang],"i",0],
["hsoutfile",MAN_HSOUTFILE[lang],"i",0],
@ -462,6 +467,7 @@ function setLanguage(l) {
$("#addrecprinterhint").html("<p style='padding-left: 50px;padding-right: 50px;'><i>" + MAN_ADD_RECPRINTER_DESCR[l] + "</i></p>");
$("#aeskeytxt").html(MAN_AESKEY[l]);
$("#certificatesntxt").html(MAN_CERTIFICATE_SN[l]);
$("#rksvservertxt").html(MAN_RKSVSERVER[l]);
$("#emailbadratingtxt").html(MAN_EMAIL_BAD_RATING[l]);
$("#emailratingcontacttxt").html(MAN_EMAIL_RATING_CONTACT[l]);
@ -471,6 +477,7 @@ function setLanguage(l) {
$("#uplfiletxt").html(MAN_UPLOAD_FILE[l]);
$("#bakrestxt").html(MAN_BAK_REST_HEAD[l]);
$("#backupbtntxt").html(MAN_BAK_BTN[l]);
$("#backupguestsbtntxt").html(MAN_BAK_GUEST_BTN[l]);
$("#backupbtntxtall").html(MAN_BAK_BTN_ALL[l]);
$("#backupbtntxtalllogs").html(MAN_BAK_BTN_ALL_LOGS[l])
$("#restorebtntxt").html(MAN_RESTORE_BTN[l]);
@ -479,6 +486,7 @@ function setLanguage(l) {
$("#shutdownbtntxt").html(MAN_SHUTDOWN[l]);
$("#shutdownhinttxt").html(MAN_SHUTDOWN_HINT[l]);
$("#optimizebtntxt").html(MAN_OPTIMIZE[l]);
// $("#initreceiptbtntxt").html(MAN_INIT_AUSTRIA[l]);
$("#optimizehinttxt").html(MAN_OPTIMIZE_HINT[l]);
$("#upllogotxt").html(MAN_UPLOAD_LOGO[l]);
$("#dellogobtn").html(MAN_NO_LOGO_BTN[l]);
@ -691,6 +699,7 @@ function insertGeneralConfigItems(configResult) {
$("#paydeskid").val(values.paydeskid);
$("#aeskey").val(values.aeskey);
$("#certificatesn").val(values.certificatesn);
$("#rksvserver").val(values.rksvserver);
$("#partOfHotelInterface").html(createHotelInterfacePart(values.hotelinterface));
@ -1311,6 +1320,12 @@ function binding() {
window.location.href = "php/contenthandler.php?module=admin&command=backup&type=alllogs";
});
$("#backupguests_btn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
window.location.href = "php/contenthandler.php?module=admin&command=backup&type=confandguests";
});
$("#restorebtntxt").off("click").on("click", function (e) {
$("#restinfoafterclick").html(MAN_REST_INFO[lang]);
});
@ -1334,6 +1349,11 @@ function binding() {
e.preventDefault();
doAjax("GET","php/contenthandler.php?module=admin&command=optimize",null,handleAnswerOptimize,"Skriptproblem");
});
// $("#initreceiptbutton").off("click").on("click", function (e) {
// e.stopImmediatePropagation();
// e.preventDefault();
// doAjax("GET","php/contenthandler.php?module=bill&command=initaustriareceipt",null,handleAnswerInitReceipt,"Skriptproblem");
// });
$("#dellogobtn").off("click").on("click", function (e) {
e.stopImmediatePropagation();
@ -1513,6 +1533,13 @@ function handleAnswerOptimize(result) {
alert("Fehler " + result.code + ": " + result.msg);
}
}
function handleAnswerInitReceipt(answer) {
if (answer.status == "OK") {
alert("Startbeleg wurde erzeugt.");
} else {
alert("Fehler: " + answer.msg);
}
}
function hasChangedData(idOfElem) {
var fieldChangedAttr = $("" + idOfElem).data("changed");
if (typeof fieldChangedAttr != 'undefined') {
@ -2246,8 +2273,8 @@ function initroomfield(roomfield_json) {
}
function golive() {
doAjax("POST","php/contenthandler.php?module=admin&command=golive",null,handleGoLive,"Produktivbetriebsstart");
alert(MAN_GOLIVE_WAIT_HINT[lang]);
doAjax("POST","php/contenthandler.php?module=admin&command=golive",null,handleGoLive,"Produktivbetriebsstart");
}
function handleGoLive(answer) {
@ -2724,6 +2751,10 @@ $(document).on("pageinit", "#admin-page", function () {
<label for="aeskey"><span id="aeskeytxt">AES-Schlüssel:</span></label>
<input type="text" value="" data-mini="true" placeholder="" id="aeskey" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="rksvserver"><span id="rksvservertxt">RKSV-Modul:</span></label>
<input type="text" value="" data-mini="true" placeholder="http://localhost/rksv:8099" id="rksvserver" data-theme="c" class="genConfigEl"/>
</div>
<div data-role="fieldcontain">
<label for="certificatesn"><span id="certificatesntxt">Zert.Seriennummer:</span></label>
<input type="text" value="" data-mini="true" placeholder="1234567" id="certificatesn" data-theme="c" class="genConfigEl"/>
@ -3006,16 +3037,20 @@ $(document).on("pageinit", "#admin-page", function () {
<p>
<div data-role="collapsible" data-collapsed="true" data-theme="f" data-content-theme="c" class="noprint" id="dbactionbakrest">
<p><h3><span id="bakrestxt">Sicherung und Import</span></h3></p>
<p><h3><span id="bakrestxt">Sicherung und Import</span></h3>
<span id='bakresinfotxt'>Die Datensicherung und -wiederherstellung erfordert...</span>
<div id=backuparea>
<div id=backuparea1>
<form action='dummy'>
<button type="submit" data-theme="f" id="backup_btn"><span id="backupbtntxt">Sicherung</span></button>
</form>
</div>
<div id=backuparea2>
<form action='dummy'>
<button type="submit" data-theme="f" id="backupguests_btn"><span id="backupguestsbtntxt">Sicherung</span></button>
</form>
</div>
<span id='bakresinfotxtall'>Die Datensicherung und -wiederherstellung erfordert...</span>
<div id=backuparea>
<div id=backuparea3>
<form action='dummy'>
<button type="submit" data-theme="f" id="backup_btnall"><span id="backupbtntxtall">Sicherung</span></button>
<button type="submit" data-theme="f" id="backup_btnalllogs"><span id="backupbtntxtalllogs">Sicherung</span></button>
@ -3037,6 +3072,7 @@ $(document).on("pageinit", "#admin-page", function () {
<p>
<form action="dummy" method="GET">
<!-- <button type="submit" data-theme="e" id="initreceiptbutton"><span id="initreceiptbtntxt">Startbeleg</span></button>-->
<button type="submit" data-theme="d" id="optimize_btn"><span id="optimizebtntxt">Datenbank optimieren</span></button>
<div id="optimizehinttxt"></div><br>
<button type="submit" data-theme="d" id="shutdown_btn"><span id="shutdownbtntxt">Shutdown</span></button>

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

View File

@ -835,6 +835,7 @@ class Admin {
$paydeskid = CommonUtils::getConfigValue($pdo,"paydeskid","");
$aeskey = CommonUtils::getConfigValue($pdo,"aeskey","");
$certificatesn = CommonUtils::getConfigValue($pdo,"certificatesn","");
$rksvserver = CommonUtils::getConfigValue($pdo,"rksvserver","");
$webimpressum = CommonUtils::getConfigValue($pdo,"webimpressum","");
$userlang = 0; // of no interest, if not called from web
@ -864,7 +865,7 @@ class Admin {
"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,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"restaurantmode" => $restaurantmode
);
@ -955,7 +956,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.3.2");
echo json_encode($view . "?v=1.3.3");
}
}
@ -1157,25 +1158,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.2"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.3"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.2"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.3"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.2"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.2"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.2"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.3"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.3"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.3"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.2"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.3"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.2"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.2"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.2"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.2"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.2"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.2"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.2"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.2");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.2");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.3"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.3"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.3"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.3"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.3"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.3"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.3"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.3");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.3");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1183,7 +1184,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.2",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.3",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1473,7 +1474,8 @@ class Admin {
"paydeskid" => array("dbcol" => "paydeskid","checknum" => 0),
"aeskey" => array("dbcol" => "aeskey","checknum" => 0),
"certificatesn" => array("dbcol" => "certificatesn","checksum" => 0)
"certificatesn" => array("dbcol" => "certificatesn","checksum" => 0),
"rksvserver" => array("dbcol" => "rksvserver","checksum" => 0)
);
$problem = false;
foreach ($changedValues as $aChangeSet) {
@ -1912,6 +1914,10 @@ class Admin {
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods");
}
private function getConfigGuestsTablesToBackupRestore() {
return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","customers","groups","groupcustomer","vacations");
}
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
@ -1958,10 +1964,14 @@ class Admin {
$fileName = "backup-" . $version . "_" . $nowtime . "-all.json";
} else if ($theType == "alllogs") {
$fileName = "backup-" . $version . "_" . $nowtime . "-all-logs.json";
} else if ($theType == "confandguests") {
$fileName = "backup-" . $version . "_" . $nowtime . "-guests.json";
}
if ($theType == "configuration") {
$tables = $this->getConfigTablesToBackupRestore();
} else if ($theType == "confandguests") {
$tables = $this->getConfigGuestsTablesToBackupRestore();
} else if (($theType == "all") || ($theType == "auto")) {
HistFiller::insertSaveHistEntry($pdo);
$tables = $this->getAllTablesToBackupRestore();
@ -2033,7 +2043,7 @@ class Admin {
}
if(!file_exists($_FILES['userfile']['tmp_name'])) {
header("Location: ../infopage.html?e=manager.html=Datei_existiert_nicht._Bitte_PHP-Variable_upload_max_filesize_checken.");
header("Location: ../infopage.html?e=manager.html=Datei_existiert_nicht._Bitte_PHP-Variablen_upload_max_filesize_und_post_max_size_checken.");
exit();
}
@ -2204,20 +2214,20 @@ class Admin {
}
private function optimize() {
try {
$pdo = DButils::openDbAndReturnPdoStatic();
self::doSql($pdo, "OPTIMIZE TABLE %queue%", null);
self::doSql($pdo, "OPTIMIZE TABLE %billproducts%", null);
self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null);
self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", null);
self::doSql($pdo, "OPTIMIZE TABLE %log%", null);
echo json_encode(array("status" => "OK"));
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG));
}
set_time_limit(60 * 10);
try {
$pdo = DButils::openDbAndReturnPdoStatic();
self::doSql($pdo, "OPTIMIZE TABLE %queue%", null);
self::doSql($pdo, "OPTIMIZE TABLE %billproducts%", null);
self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null);
self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", null);
self::doSql($pdo, "OPTIMIZE TABLE %log%", null);
echo json_encode(array("status" => "OK"));
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG));
}
}
private static function getForeignKeyName($pdo,$fromtable,$totable,$dbname,$default = null) {
$foreignKey = null;
try {
@ -2238,18 +2248,21 @@ class Admin {
}
private function golive() {
set_time_limit(60*10);
$pdo = DButils::openDbAndReturnPdoStatic();
try {
$billprodref_fk = self::getForeignKeyName($pdo, 'billproducts', 'bill', MYSQL_DB);
$queuebillref_fk = self::getForeignKeyName($pdo, 'queue', 'bill', MYSQL_DB);
$billclosingref_fk = self::getForeignKeyName($pdo, 'bill', 'closing', MYSQL_DB);
$billbillref_fk = self::getForeignKeyName($pdo, 'bill', 'bill', MYSQL_DB);
$cuslogbillref_fk = self::getForeignKeyName($pdo, 'customerlog', 'bill', MYSQL_DB);
} catch (Exception $ex) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG . " - impossible to get foreign keys: $e"));
}
try {
self::doSql($pdo, "DELETE FROM %customerlog%", null);
self::doSql($pdo, "DELETE FROM %hist%", null);
self::doSql($pdo, "DELETE FROM %histprod%", null);
self::doSql($pdo, "DELETE FROM %histconfig%", null);
@ -2294,11 +2307,13 @@ class Admin {
}
self::doSql($pdo, "alter table %bill% drop foreign key $billbillref_fk", null);
self::doSql($pdo, "alter table %customerlog% drop foreign key $cuslogbillref_fk", null);
self::doSql($pdo, "alter table %billproducts% drop foreign key $billprodref_fk", null);
self::doSql($pdo, "alter table %queue% drop foreign key $queuebillref_fk", null);
self::doSql($pdo, "ALTER TABLE %bill% DROP id", null);
self::doSql($pdo, "ALTER TABLE %bill% ADD id INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST", null);
self::doSql($pdo, "ALTER TABLE %bill% ADD CONSTRAINT $billbillref_fk FOREIGN KEY (ref) REFERENCES %bill%(id)", null);
self::doSql($pdo, "ALTER TABLE %customerlog% ADD CONSTRAINT $cuslogbillref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null);
self::doSql($pdo, "ALTER TABLE %billproducts% ADD CONSTRAINT $billprodref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null);
self::doSql($pdo, "ALTER TABLE %queue% ADD CONSTRAINT $queuebillref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null);
self::doSql($pdo, "alter table %bill% drop foreign key $billclosingref_fk", null);

View File

@ -116,7 +116,16 @@ class Bill {
}
return;
}
if ($command == 'initaustriareceipt') {
if ($this->hasCurrentUserAdminOrManagerRights()) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$status = $this->initaustriareceipt($pdo);
echo json_encode($status);
} else {
echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG));
}
return;
}
if ($this->hasCurrentUserBillRights()) {
if ($command == 'getLastBillsWithContent') {
$this->getLastBillsWithContent($_GET['day'],$_GET['month'],$_GET['year']);
@ -506,6 +515,55 @@ class Bill {
}
}
private function initaustriareceipt($pdo) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
$pdo->beginTransaction();
try {
// calculate next bill id
$sql = "SELECT MAX(id) as maxid FROM %bill%";
$row = CommonUtils::getRowSqlObject($pdo, $sql);
$maxbillid = $row->maxid;
$nextbillid = 1;
$newprevbrutto = 0;
$newprevnetto = 0;
if (!is_null($maxbillid)) {
$nextbillid = intval($maxbillid) + 1;
$sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array(intval($maxbillid)));
$newprevbrutto = $row->prevbrutto ;
$newprevnetto = $row->prevnetto;
}
$commonUtils = new CommonUtils();
$commonUtils->setLastBillIdInWorkTable($pdo, $nextbillid);
$tableid = 0;
if(session_id() == '') {
session_start();
}
$userid = $_SESSION['userid'];
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, '0.00', '0.00', '0.00', $userid);
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`prevbrutto`,`prevnetto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`intguestid`,`signature`,`reason`) VALUES (?,?,?,?,?,?,?,?,?,NULL,NULL,?,?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($nextbillid,$currentTime,'0.00', '0.00',$newprevbrutto,$newprevnetto,$tableid,1,$userid,0,null,null,null,$signature,'STARTBELEG'));
CommonUtils::log($pdo, "QUEUE", "Created bill STARTBELEG with id=$nextbillid from user $userid");
Rksv::doStartBeleg($pdo, $nextbillid, $currentTime);
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR", "msg" => $ex->getMessage());
}
$pdo->commit();
return array("status" => "OK");
}
private function changeBillHost($pdo,$billid,$isNowHost) {
$sql = "SELECT host,closingid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));

View File

@ -7,6 +7,7 @@ require_once ('products.php');
require_once ('roomtables.php');
require_once ('reports.php');
require_once ('bill.php');
require_once ('rksv.php');
require_once ('closing.php');
require_once ('printqueue.php');
require_once ('feedback.php');

View File

@ -93,11 +93,11 @@ class Customers {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if ($command == 'createNewCustomer') {
echo json_encode($this->createNewCustomer($pdo,$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['checkin'],$_POST['checkout'],$_POST['room']));
echo json_encode($this->createNewCustomer($pdo,$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['hello'],$_POST['regards'],$_POST['checkin'],$_POST['checkout'],$_POST['room']));
} else if ($command == 'deleteCustomer') {
echo json_encode($this->deleteCustomer($pdo,$_POST['id']));
} else if ($command == 'changeCustomer') {
echo json_encode($this->changeCustomer($pdo,$_POST["id"],$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST["groups"]));
echo json_encode($this->changeCustomer($pdo,$_POST["id"],$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['hello'],$_POST['regards'],$_POST["groups"]));
} else if ($command == 'getCustomers') {
echo json_encode($this->getCustomers($pdo,$_POST['search'],$_POST['date'],$_POST['onlyopenbills']));
} else if ($command == 'createNewGroup') {
@ -129,7 +129,7 @@ class Customers {
} else if ($command == 'printallbills') {
echo json_encode($this->printallbills($pdo,$_POST['id']));
} else if ($command == 'emailGroup') {
echo json_encode($this->emailGroup($pdo,$_POST['groupid'],$_POST["subject"],$_POST["text"]));
echo json_encode($this->emailGroup($pdo,$_POST['groupid'],$_POST["subject"],$_POST["bcc"],$_POST["text"]));
} else if ($command == 'getPaymentsForGuest') {
echo json_encode($this->getPaymentsForGuest($pdo));
} else if ($command == 'exportLog') {
@ -150,7 +150,7 @@ class Customers {
}
}
private function createNewCustomer($pdo,$name,$email,$addr,$remark,$phone,$mobil,$www,$checkin,$checkout,$room) {
private function createNewCustomer($pdo,$name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$checkin,$checkout,$room) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
@ -163,6 +163,12 @@ class Customers {
if ($room == '') {
$room = null;
}
if ($hello == '') {
$hello = null;
}
if ($regards == '') {
$regards = null;
}
try {
$pdo->beginTransaction();
@ -175,9 +181,9 @@ class Customers {
$code = 0;
}
$sql = "INSERT INTO %customers% (name,email,address,remark,phone,mobil,www,created,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)";
$sql = "INSERT INTO %customers% (name,email,address,remark,phone,mobil,www,hello,regards,created,lastmodified) VALUES(?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($name,$email,$addr,$remark,$phone,$mobil,$www,$currentTime,$currentTime));
$stmt->execute(array($name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$currentTime,$currentTime));
$cusid = $pdo->lastInsertId();
self::addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,null);
@ -220,13 +226,13 @@ class Customers {
}
}
private function changeCustomer($pdo,$id,$name,$email,$addr,$remark,$phone,$mobil,$www,$groups) {
private function changeCustomer($pdo,$id,$name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$groups) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
try {
$sql = "UPDATE %customers% SET name=?,email=?,address=?, remark=?, phone=?, mobil=?, www=?,lastmodified=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($name,$email,$addr,$remark,$phone,$mobil,$www,$currentTime,$id));
$sql = "UPDATE %customers% SET name=?,email=?,address=?, remark=?, phone=?, mobil=?, www=?,hello=?,regards=?,lastmodified=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$currentTime,$id));
$sql = "DELETE FROM %groupcustomer% WHERE customerid=?";
CommonUtils::execSql($pdo, $sql, array($id));
@ -463,8 +469,7 @@ class Customers {
try {
$allcustomers = array();
//$sql = "SELECT id,name,email,address,remark,phone,mobil,www,IFNULL(checkin,'') as checkin,IFNULL(checkout,'') as checkout,IFNULL(room,'') as room,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name";
$sql = "SELECT %customers%.id as id,name,email,address,remark,phone,mobil,www,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name";
$sql = "SELECT %customers%.id as id,name,email,address,remark,phone,mobil,www,hello,regards,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($s,$s));
@ -495,6 +500,8 @@ class Customers {
"phone" => $aCustomer["phone"],
"mobil" => $aCustomer["mobil"],
"www" => $aCustomer["www"],
"hello" => $aCustomer["hello"],
"regards" => $aCustomer["regards"],
"created" => $aCustomer["created"],
"lastmodified" => $aCustomer["lastmodified"],
"groups" => $assgroups,
@ -573,8 +580,8 @@ class Customers {
}
}
private function emailGroup($pdo,$grpid,$subject,$text) {
$sql = "SELECT %customers%.name as name ,%customers%.email as email from %customers%,%groupcustomer% WHERE %groupcustomer%.groupid=? AND %groupcustomer%.customerid=%customers%.id ORDER by name";
private function emailGroup($pdo,$grpid,$subject,$bcc,$text) {
$sql = "SELECT %customers%.name as name,IFNULL(%customers%.hello,'') as hello,IFNULL(%customers%.regards,'') as regards ,%customers%.email as email from %customers%,%groupcustomer% WHERE %groupcustomer%.groupid=? AND %groupcustomer%.customerid=%customers%.id ORDER by name";
$customersInGroup = CommonUtils::fetchSqlAll($pdo, $sql, array($grpid));
$emails = array();
@ -583,14 +590,22 @@ class Customers {
if (!is_null($email)) {
$email = trim($email);
if ($email != '') {
$emails[] = $email;
$emails[] = array("email" => $email,"hello" => $aCustomer["hello"],"regards" => $aCustomer["regards"],"name" => $aCustomer["name"]);
}
}
}
$ok = true;
foreach($emails as $anEmail) {
if (!Emailer::sendEmail($pdo, $text, $anEmail, $subject)) {
foreach($emails as $anEmailEntry) {
$anEmail = $anEmailEntry["email"];
$name = $anEmailEntry["name"];
$hello = $anEmailEntry["hello"];
$regards = $anEmailEntry["regards"];
$textToSend = str_replace("{NAME}",$name,$text);
$textToSend = str_replace("{ANREDE}",$hello,$textToSend);
$textToSend = str_replace("{GRUSS}",$regards,$textToSend);
if (!Emailer::sendEmail($pdo, $textToSend, $anEmail, $subject,$bcc)) {
$ok = false;
}
}

View File

@ -1702,6 +1702,8 @@ class QueueContent {
$billInfo = array("billid" => $billid, "date" => $currentTime);
// Rksv::signBill($pdo, $billid);
CommonUtils::callPlugin($pdo, "createBill", "after");
CommonUtils::log($pdo, "QUEUE", "Created bill with id=$billid from user $userid");

120
webapp/php/rksv.php Normal file
View File

@ -0,0 +1,120 @@
<?php
require_once ('dbutils.php');
class Rksv {
private static $TAX_NORMAL = 1;
private static $TAX_ERM1 = 2;
private static $TAX_ERM2 = 3;
private static $TAX_BESONDERS = 4;
private static function checkEnvironment($pdo) {
$isAustria = CommonUtils::getConfigValue($pdo, "austria", 0);
if ($isAustria != 1) {
return array("status" => "OK");
}
$rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null);
if (is_null($rksvserver)) {
return array("status" => "ERROR","msg" => "No RKSV server configured");
}
$paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null);
if (is_null($paydeskid) || ($paydeskid == '')) {
return array("status" => "ERROR","msg" => "No Paydesk ID configured");
}
if (!extension_loaded("curl")) {
return array("status" => "ERROR","msg" => "PHP curl extension is missing");
}
return array("status" => "OK");
}
public static function doStartBeleg($pdo,$billid,$billdate) {
$envStatus = self::checkEnvironment($pdo);
if ($envStatus["status"] != "OK") {
return $envStatus;
}
$rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null);
$paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null);
$myvars = 'paydeskid=' . $paydeskid;
$myvars .= '&billid=' . $billid;
$myvars .= '&billdate=' . $billdate;
$myvars .= '&command=startbeleg';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_VERBOSE, true);
curl_setopt( $ch, CURLOPT_URL, $rksvserver);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
try {
$response = curl_exec($ch);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => "RKSV Server call exception: " . $ex->getMessage());
}
}
public static function signBill($pdo,$billid) {
$envStatus = self::checkEnvironment($pdo);
if ($envStatus["status"] != "OK") {
return $envStatus;
}
$rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null);
$paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null);
$sql = "SELECT billdate,brutto FROM %bill% WHERE id=?";
$billrow = CommonUtils::getRowSqlObject($pdo, $sql, array($billid));
$billdate = $billrow->billdate;
$sql = "SELECT SUM(price) as sumprice FROM %queue% WHERE billid=? AND taxaustria=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid,self::$TAX_NORMAL));
$taxnormalsum = $stmt->fetchObject()->sumprice;
$taxnormalsum = (is_null($taxnormalsum) ? '0.00' : $taxnormalsum);
$stmt->execute(array($billid,self::$TAX_ERM1));
$taxerm1sum = $stmt->fetchObject()->sumprice;
$taxerm1sum = (is_null($taxerm1sum) ? '0.00' : $taxerm1sum);
$stmt->execute(array($billid,self::$TAX_ERM2));
$taxerm2sum = $stmt->fetchObject()->sumprice;
$taxerm2sum = (is_null($taxerm2sum) ? '0.00' : $taxerm2sum);
$stmt->execute(array($billid,self::$TAX_BESONDERS));
$taxbessum = $stmt->fetchObject()->sumprice;
$taxbessum = (is_null($taxbessum) ? '0.00' : $taxbessum);
$myvars = 'paydeskid=' . $paydeskid;
$myvars .= '&taxnormalsum=' . $taxnormalsum;
$myvars .= '&taxerm1sum=' . $taxerm1sum;
$myvars .= '&taxerm2sum=' . $taxerm2sum;
$myvars .= '&taxbessum=' . $taxbessum;
$myvars .= '&billid=' . $billid;
$myvars .= '&billdate=' . $billdate;
$ch = curl_init();
curl_setopt( $ch, CURLOPT_VERBOSE, true);
curl_setopt( $ch, CURLOPT_URL, $rksvserver);
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
try {
$response = curl_exec($ch);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => "RKSV Server call exception: " . $ex->getMessage());
}
}
}

View File

@ -1,10 +1,16 @@
<?php
require_once (__DIR__. '/../3rdparty/phpmailer/phpmailer.php');
require_once (__DIR__. '/../3rdparty/phpmailer/phpmailer.php');
require_once (__DIR__. '/../3rdparty/phpmailer/smtp.php');
class Emailer {
class Emailer {
public static function sendEmail($pdo,$msg,$to,$subject) {
public static function sendEmail($pdo,$msg,$to,$subject,$bcc = null) {
if (!is_null($bcc)) {
$bcc = trim($bcc);
}
if ($bcc == '') {
$bcc = null;
}
$mail = new PHPMailer;
@ -39,6 +45,9 @@ class Emailer {
$mail->setFrom(self::getConfigItemOrDefault($pdo, "email", ""));
$mail->addAddress($to); // Add a recipient
if (!is_null($bcc)) {
$mail->addBCC($bcc);
}
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
@ -53,7 +62,7 @@ class Emailer {
$ret = $mail->send();
return $ret;
} else {
return $true;
return true;
}
}

View File

@ -481,6 +481,8 @@ class Basedb {
`phone` VARCHAR(30) NULL,
`mobil` VARCHAR(30) NULL,
`www` VARCHAR(50) NULL,
`hello` VARCHAR(100) NULL,
`regards` VARCHAR(100) NULL,
`remark` VARCHAR(500) NULL,
`created` DATETIME NULL,
`lastmodified` DATETIME 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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<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">
<meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.2">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.3">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />