OrderSprinter 1.3.0

This commit is contained in:
Geno 2020-11-19 23:02:08 +01:00
parent 0e8a91ecff
commit 40828e9b5b
36 changed files with 1276 additions and 106 deletions

24
readme.txt Normal file
View File

@ -0,0 +1,24 @@
Liesmich - Readme:
==================
Das Gesamtpaket "OrderSprinter" besteht aus verschiedenen Komponenten:
webapp:
-------
In diesem Unterverzeichnis befindet sich die Kernapplikation. Der Inhalt dieses Ordners muss auf den Webspace des Webservers kopiert werden. Siehe Installationsanleitung auf der Webseite.
spider:
-------
Spider ist eine eigenständige Webapplikation, mit der man verschiedene OrderSprinter-Instanzen aus der Ferne überwachen kann. Siehe Installationsanleitung auf der Webseite.
printserver:
------------
In diesem Ordner befindet sich der Windows-Printserver. Er kann alleine oder in Kombination mit dem Javaprinter eingesetzt werden.
javaprinter:
------------
In diesem Ordner befindet sich der Java-Printserver. Er eignet sich für den Einsatz auf Linux-Systemen. Er kann alleine oder in Kombination mit dem Windows-Printserver eingesetzt werden.
scripts:
--------
Dieser Ordner enthält nützliche Skripte, die man zusätzlich einsetzen kann, z.B. Backup-Skripte.

View File

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

File diff suppressed because one or more lines are too long

258
webapp/customers.html Normal file
View File

@ -0,0 +1,258 @@
<html>
<head>
<title>Ansicht Gäste</title>
<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={VERSION}">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<link rel="stylesheet" href="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.css" />
<script src="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.js"></script>
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" href="php/3rdparty/jqueryui1-11-4/jquery-ui.min.css" />
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui.min.js"></script>
<script src="php/3rdparty/jqueryui1-11-4/jquery-ui-i18n.min.js"></script>
<script src="utilities.js"></script>
<script src="elements/customers.js"></script>
</head>
<body>
<script>
var CUS_CUSTOMERS = ["Gäste...","Guests...", "Clientes..." ];
var CUS_GROUPS = ["Gruppen...","Groups...", "Grupos..." ];
var CUS_ADR_LABEL = ["Adresse:","Address:","Dirección:"];
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_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"];
var GROUP_EMPTY_NAME = ["Gruppenname nicht angegeben","Name of the group not specified","Ningún nombre del grupo"];
var CUS_ACTION_FAILED = ["Aktion fehlgeschlagen","Action failed","Error"];
var CUS_ALREADY_CUS_NAME = ["Der Kunde wurde angelegt. Allerdings gab es bereits %number% Kunden mit dem Namen.",
"The customer is created, although there have been already %number% customers with this name",
"El cliente esta creado aunque había sido ya %number% clientes con este nombre."];
var CUS_SEARCH_LABEL = ["Suche:","Search:","Buscar:"];
var CUS_APPLY = ["Anwenden","Apply","Aplicar"];
var CUS_DEL = ["Löschen","Delete","Removar"];
var CUS_DEL_TEXT = ["Diesen Gast unwiederbringlich aus der Datenbank löschen?","Delete this guest irretrievably from the data base?","Removar este cliente?"];
var GRP_DEL = ["Löschen","Delete","Removar"];
var GRP_DEL_TEXT = ["Diese Gruppe unwiederbringlich aus der Datenbank löschen?","Delete this group irretrievably from the data base?","Removar este grupo?"];
var CUS_CREATED = ["Erstellt","Created","Creado"];
var CUS_LAST_MODIFIED = ["Zuletzt geändert","Last modified","Cambio último"];
var CUS_GROUP_EXISTS = ["Eine Gruppe mit dem Namen existiert bereits.","A group with this name already exists.","Ya hay un grupo con este nombre."];
var CUS_GRP_ASS_LIST = ["Gruppenzuordnung","Group assignment","Grupos del cliente"];
var CUS_ALERT_TEXT_LEN = ["Text zu lang: ","Text too long: ","Texto tan largo: "];
var CUS_CONTAINED_IN_GRP = ["Gäste in dieser Gruppe","Guests in this group","Clientes en este grupo"];
var CUS_NEW_CUS_HEADER = ["Neuer Gast","New guest","Cliente nuevo"];
var CUS_CHECKIN_AFTER_OUT = ["Das Check-in-Datum liegt nach dem Check-out-Datum","Check-in date is after check.out date","Check-in despues Check-out"];
var CUS_VACATIONS = ["Aufenthalte","Stays","Estancias"];
var CUS_NEWVACATIONS = ["Neuer Aufenthalt","New Stay","Estancia nueva"];
var CUS_DATE = ["Anwesenheitsdatum","Customer present at","Cliente esta durante"];
var CUS_BILLS = ["Kassenbons","Receipts","Tiquetes"];
var CUS_BILLID = ["ID des Kassenbons","Bill id","ID del tiquet"];
var CUS_BILLDATE = ["Rechnungsdatum","Date of bill","Fecha de tiquet"];
var CUS_BILLBRUTTO = ["Betrag","Brutto","Pagar"];
var CUS_GUESTINFO = ["Angabe zum Gast","Guest info","Información del client"];
var CUS_DECLAREPAY = ["Deklariere bezahlt","Declare paid","Declarar pagado"];
var CUS_DECLAREUNPAY = ["Deklariere unbezahlt","Declare unpaid","Declarar no pagado"];
var CUS_PRINTBILL = ["Drucken","Print","Imprimir"];
var CUS_DECLARE_ALL_PAY = ["Alle als bezahlt deklarieren","Declare all as paid","Declarar todo pagado"];
var CUS_PRINT_ALL = ["Alle Bons drucken","Print all receipts","Imprimir todos los tiquetes"];
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_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 l = 0;
function setLanguage(language) {
l = language;
$("#customersbtn").html(CUS_CUSTOMERS[l]);
$("#groupsbtn").html(CUS_GROUPS[l]);
$("#newcusadrlabel").html(CUS_ADR_LABEL[l]);
$("#newcusremarklabel").html(CUS_REMARK_LABEL[l]);
$("#newcusphonelabel").html(CUS_PHONE_LABEL[l]);
$("#newcusmobillabel").html(CUS_MOBIL_LABEL[l]);
$("#newcuswwwlabel").html(CUS_WWW_LABEL[l]);
$("#newcusroomlabel").html(CUS_ROOM_LABEL[l]);
$("#newcustomerbtn").html(CUS_NEW_CUS_BTN[l]);
$("#customersearchlabel").html(CUS_SEARCH_LABEL[l]);
$("#newguestheader").html(CUS_NEW_CUS_HEADER[l]);
$("#customerdatetxt").html(CUS_DATE[l]);
$("#customeropenbillstxt").html(CUS_FILTER_OPEN_BILLS[l]);
}
$(document).on("pageinit", "#info-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
getGeneralConfigItemsCus();
});
</script>
<div data-role="page" id="info-page">
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay">
<ul data-role="listview" id="modulemenu" data-divider-theme="a" data-inset="true">
<li data-role="list-divider" data-theme="b" data-role="heading">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1><span id="reportttitletxt">Gäste</span> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1>
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Module</a>
</div>
</div>
<div data-role="content" id="content">
<div class="ui-grid-a" class="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>
<div id="customersarea" style="display:none;">
<form>
<div class="ui-field-contain">
<label id="customersearchlabel" for="customersearch">Suche:</label>
<input id='customersearch' type="text" value="" data-mini="true" placeholder="Name / Email" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label for="customeropenbills"><span id=customeropenbillstxt>Nur mit offenen Rechnungen</span>: </label>
<input data-role="date" data-inline="true" type="checkbox" id="customeropenbills" data-theme="a">
</div>
<div class="ui-field-contain">
<label for="customerdate"><span id=customerdatetxt>Datum</span>: </label>
<input data-role="date" data-inline="true" type="text" id="customerdate" data-theme="a">
</div>
</form>
<div data-role="collapsible" id="newcustomerdiv" data-theme="d" data-content-theme="d">
<h3><span id="newguestheader">Neuer Kunde</span></h3>
<p>
<form>
<div class="ui-field-contain">
<label for="newcustomername">Name:</label>
<input id='newcustomername' type="text" value="" data-mini="true" placeholder="Name" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label id="newcusadrlabel" for="newcustomeraddress">Adresse:</label>
<textarea cols="40" rows="8" name="newcustomeraddress" id="newcustomeraddress" data-theme="a"></textarea>
</div>
<div class="ui-field-contain">
<label for="newcustomerphone" id="newcusphonelabel">Tel.:</label>
<input id='newcustomerphone' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label for="newcustomermobil" id="newcusmobillabel">Handy:</label>
<input id='newcustomermobil' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label for="newcustomeremail">E-Mail:</label>
<input id='newcustomeremail' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label for="newcustomerwww">Homepage:</label>
<input id='newcustomerwww' type="text" value="" data-mini="true" placeholder="E-Mail" class="whiteinput" />
</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">
</div>
<div data-role="fieldcontain" id="datepickerareacheckout">
<label for="newcustomercheckout"><span id=datetxtcheckout>Check-Out</span>: </label>
<input data-role="date" data-inline="true" type="text" id="newcustomercheckout" data-theme="a">
</div>
<div class="ui-field-contain">
<label for="newcustomerroom" id="newcusroomlabel">Zimmer</label>
<input id='newcustomerroom' type="text" value="" data-mini="true" placeholder="Zimmer" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label id="newcusremarklabel" for="newcustomerremark">Bemerkung:</label>
<textarea cols="40" rows="8" name="newcustomerremark" id="newcustomerremark" data-theme="a" ></textarea>
</div>
<button type="submit" data-theme="c" class="" data-icon="check" id="newcustomerbtn">Anlegen</button>
</form>
</div>
<div id="customersearchresult"></div>
</div>
<div id="groupsarea" style="display:none;">
<form>
<div class="ui-field-contain">
<label id="groupsearchlabel" for="groupsearch">Suche:</label>
<input id='groupsearch' type="text" value="" data-mini="true" placeholder="Name" class="whiteinput" />
</div>
</form>
<div data-role="collapsible" id="newgroupdiv" data-theme="d" data-content-theme="d">
<h3>Neue Gruppe</h3>
<p>
<form>
<div class="ui-field-contain">
<label for="newgroupname">Name:</label>
<input id='newgroupname' type="text" value="" data-mini="true" placeholder="Name" class="whiteinput" />
</div>
<div class="ui-field-contain">
<label id="newgroupremarklabel" for="newgroupremark">Bemerkung:</label>
<textarea cols="40" rows="8" name="newgroupremark" id="newgroupremark" data-theme="a" ></textarea>
</div>
<button type="submit" data-theme="c" class="" data-icon="check" id="newgroupbtn">Anlegen</button>
</form>
</div>
<div id="groupsearchresult"></div>
</div>
</div>
<div data-role="footer" data-theme="b" id="thefooterr">
<div class="ui-grid-a">
<div class="ui-block-a userinfo" id="loggedinuser"></div>
<div class="ui-block-b grid_right" id="versioninfo"></div>
</div><!-- /grid-a -->
</div> <!-- footer -->
</div>
<!-- Dialog page -->
<div data-role="dialog" id="sure" data-title="Entfernen?">
<div data-role="content">
<h3 class="sure-1">?</h3>
<p class="sure-2">?</p>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Ja</a>
<a href="#" data-role="button" data-theme="c" data-rel="back">Nein</a>
</div>
</div>
</body>
</html>

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

View File

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

View File

@ -1712,6 +1712,75 @@ return false;
}
}
function updateUserTable1222_1300($prefix, $version, $dbname) {
$pdo = $this->pdo;
try {
if ($version != "1.2.22") {
$ret = $this->updateUserTable1221_1222($prefix, $version, $dbname);
if (!$ret) {
echo "Version update v1.2.21 to 1.2.22 not successful.";
return false;
}
}
DbUtils::overrulePrefix($prefix);
$sql = "INSERT INTO %payment% (id,name,name_en,name_esp) VALUES (?,?,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('8', 'Gast','Guest','Cliente'));
$sql = "ALTER TABLE %user% ADD right_customers INT (1) NULL AFTER right_changeprice";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %user% SET right_customers=right_manager";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %user% MODIFY right_customers INT (1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->execSql($pdo, "OPTIMIZE TABLE %user%");
$sql = "ALTER TABLE %histuser% ADD right_customers INT (1) NULL AFTER right_changeprice";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "UPDATE %histuser% SET right_customers=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array(0));
$sql = "ALTER TABLE %histuser% MODIFY right_customers INT (1) NOT NULL";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->execSql($pdo, "OPTIMIZE TABLE %histuser%");
$this->basedb->createCustomersTable($pdo);
$this->basedb->createGroupsTable($pdo);
$this->basedb->createGroupCustomerTable($pdo);
$this->basedb->createVacationsTable($pdo);
$sql = "ALTER TABLE %bill% ADD intguestid INT(10) NULL AFTER guestinfo";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %bill% ADD intguestpaid INT(2) NULL AFTER intguestid";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$sql = "ALTER TABLE %bill% ADD FOREIGN KEY (intguestid) REFERENCES %customers%(id)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
$this->execSql($pdo, "OPTIMIZE TABLE %bill%");
$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)";
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('restaurantmode','1'));
$this->updateVersion($pdo, '1.3.0');
return true;
} catch (PDOException $e) {
echo "Error in v1.2.22 to 1.3.0: $e";
return false;
}
}
function setVersion($prefix,$theVersion) {
$pdo = $this->pdo;
try {
@ -1783,6 +1852,10 @@ $this->basedb->createProdTypeTable($pdo);
$this->basedb->createProductTable($pdo);
$this->basedb->createPriceLevelTable($pdo);
$this->basedb->createClosingTable($pdo);
$this->basedb->createCustomersTable($pdo);
$this->basedb->createGroupsTable($pdo);
$this->basedb->createGroupCustomerTable($pdo);
$this->basedb->createVacationsTable($pdo);
$this->basedb->createBillTable($pdo);
$this->basedb->createQueueTable($pdo);
$this->basedb->createBillProductsTable($pdo);
@ -1799,6 +1872,7 @@ $this->basedb->createQueueExtrasTable($pdo);
$this->basedb->createHsinTable($pdo);
$this->basedb->createHsoutTable($pdo);
$rect = $this->getDefaultCustomRecTemplate();
$foodtemplate = $this->getDefaultWorkTemplateFood();
$drinktemplate = $this->getDefaultWorkTemplateDrinks();
@ -1831,7 +1905,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.2.22')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.0')");
$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')");
@ -1874,6 +1948,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', '256')");
$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'restaurantmode', '1')");
// prepare for later inconsistency check if version is obsolete
date_default_timezone_set($timezone);
@ -1941,25 +2016,25 @@ $stmt_insert_hist->execute(array($currentTime, $action, $refIdForHist));
}
function insertUser($username,$adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,
$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,
$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,
$right_manager,$right_closing,$right_reservation,$right_rating,$lang,$prefertablemap) {
$md5adminpass = md5($adminpass);
$pdo = $this->pdo;
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_closing`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1','1')";
$userInsertSql = "INSERT INTO `%user%` (`id` , `username` , `userpassword`, `is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_customers`,`right_manager`,`right_closing`,`right_reservation`,`right_rating`,`language`,`prefertablemap`,`keeptypelevel`,`extrasapplybtnpos`,`active`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'1','1')";
$stmt = $pdo->prepare(DbUtils::substTableAlias($userInsertSql));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_closing,$right_reservation,$right_rating,$lang,$prefertablemap,0));
$stmt->execute(array($username,$md5adminpass,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,$right_manager,$right_closing,$right_reservation,$right_rating,$lang,$prefertablemap,0));
$newUserIdForHist = $pdo->lastInsertId();
// now insert into hist
$sql_insert_histuser = "INSERT INTO %histuser% (`id` , `userid`, `username` ,
`is_admin`, `right_waiter`,`right_kitchen`,`right_bar`,`right_supply`,`right_paydesk`,
`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_manager`,`right_closing`,`right_reservation`,`right_rating`,`active`) VALUES (
NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
`right_statistics`,`right_bill`,`right_products`,`right_changeprice`,`right_customers`,`right_manager`,`right_closing`,`right_reservation`,`right_rating`,`active`) VALUES (
NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt_insert_histuser = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql_insert_histuser));
$stmt_insert_histuser->execute(array($newUserIdForHist,$username,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_manager,$right_closing,$right_reservation,$right_rating,1));
$stmt_insert_histuser->execute(array($newUserIdForHist,$username,$is_admin,$right_waiter,$right_kitchen,$right_bar,$right_supply,$right_paydesk,$right_statistics,$right_bill,$right_products,$right_changeprice,$right_customers,$right_manager,$right_closing,$right_reservation,$right_rating,1));
$newRefIdForHist = $pdo->lastInsertId();
$this->insertIntoHist($pdo, '3', $newRefIdForHist);
}
@ -1984,6 +2059,8 @@ $stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('6', 'Lastschrift','Debit','Cargo en cuenta'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('7', 'Hotelzimmer','Hotel room','Habitación'));
$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql));
$stmt->execute(array('8', 'Gast','Guest','Cliente'));
}
public function defineHistActions ($pdo) {
@ -2116,16 +2193,15 @@ $stmt->execute(array(6,76,22));
}
if ($workflow == 2) {
// only receipts - no views kitchen,bar,supply
$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,0,1,0,1,0,0,0,0,1,0,$lang,1);
$this->insertUser( $waiterTxt[$lang], $adminpass,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,$lang,1);
if ($level == 3) {
$this->insertUser($bossTxt[$lang],$adminpass ,0,1,0,0,0,1,1,1,1,1,1,1,1,1,$lang,1);
$this->insertUser( $bossTxt[$lang], $adminpass,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,$lang,1);
}
} else {
$this->insertUser($waiterTxt[$lang],$adminpass,0,1,0,0,1,1,0,1,0,0,0,0,1,0,$lang,1);
$this->insertUser( $waiterTxt[$lang], $adminpass,0,1,0,0,1,1,0,1,0,0,0,0,0,1,0,$lang,1);
if ($level == 3) {
$this->insertUser($cookTxt[$lang],$adminpass ,0,0,1,1,1,0,0,0,0,0,0,0,0,0,$lang,1);
$this->insertUser($bossTxt[$lang],$adminpass ,0,1,1,1,1,1,1,1,1,1,1,1,1,1,$lang,1);
$this->insertUser( $cookTxt[$lang], $adminpass,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,$lang,1);
$this->insertUser( $bossTxt[$lang], $adminpass,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,$lang,1);
}
}
@ -2180,8 +2256,7 @@ if (!$ok) {
echo json_encode("Fehler: Ist OpenSSL richtig installiert?");
return;
}
$admin->insertUser("admin",$_POST['adminpass'],1,0,0,0,0,0,0,0,0,1,1,1,0,0,$_POST['lang'],1);
$admin->insertUser("admin",$_POST['adminpass'],1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,$_POST['lang'],1);
$admin->writeConfigFile($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password'],$_POST['prefix']);
if(session_id() == '') {
@ -2211,7 +2286,7 @@ $zones[] = $timezone_identifiers[$i];
}
echo json_encode($zones);
} else if ($command == 'update') {
$installerVersion = "1.2.22";
$installerVersion = "1.3.0";
$admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);
@ -2242,7 +2317,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.18","1.2.19","1.2.20","1.2.21","1.2.22"
);
if (!in_array($version, $supportedVersions)) {
@ -2250,7 +2325,7 @@ echo json_encode("Quellversion nicht unterstützt");
return;
}
$ret = $admin->updateUserTable1221_1222($_POST['prefix'], $version, $_POST['db']);
$ret = $admin->updateUserTable1222_1300($_POST['prefix'], $version, $_POST['db']);
if(session_id() == '') {
session_start();

View File

@ -0,0 +1,2 @@
<?php
phpinfo();

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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -64,6 +64,7 @@ var MAN_PRODUCTS = ["Angebot","Products","Productos"];
var MAN_RESERVATION = ["Reservierung","Reservation","Reserva"];
var MAN_RATING = ["Bewertung","Rating","Valoración"];
var MAN_CHANGEPRICE = ["Preisänderung während Bestellung","Change price during ordering","Modificar precio durante ordenar"];
var MAN_CUSTOMERS = ["Gäste","Guests","Clientes"];
var MAN_MANAGER = ["Verwaltung","Administration","Administración"];
var MAN_CLOSINGRIGHT = ["Tageserfassung","Closing","Cerrar día"];
var MAN_USER_NAME = ["Benutzername","User name","Nombre de usario"];
@ -311,6 +312,8 @@ var MAN_MOBILSECTION_TXT = ["Einstellungen für die Mobilansicht:","Settings for
var MAN_PRINT_AND_QUEUE = ["Drucke Jobs und zeige sie auch in der Küchen-/Baransicht an","Print jobs and show them also in the kitchen/bar view","Imprimir orders y también inserta en la vista de cocina/bar"];
var MAN_CASH = ["Kassenfunktion aktiviert","Enabled cash function","Caja activada"];
var MAN_BEEP_COOKED = ["Signalton, wenn neues Produkt serviert werden kann (experimentell)","Audio signal if new product can be served (experimental)","Señal audio si un producto nuevo esta cocinado"];
var MAN_RESTAURANT_MODE = ["Restaurantmodus","Restaurant mode","Usar para restaurantes"];
var MAN_REST_MODE_HINT = ["Hinweis: Wird der Restaurantmodus auf <i>Nein</i> gesetzt, wird in der <b>Desktopansicht</b> die Tischauswahl deaktiviert. Alle Produkte werden als Außer-Haus-Verkauf gebucht.","Hint: If the restautant mode is set to <i>no</i> in the <b>desktop view</b> the table selection is deactivated and all products are ordered as <i>to-go</i>","Nota: Si el modus del restaurante es configurado a <i>no</i> en la vista de <b>Desktop</b> la selección de las mesas es deactivada y todos los productos son ordenados como <i>to-go</i>"];
var MAN_SPECIAL_SETTINGS_TXT = ["Einstellungen für spezielle Abläufe:","Settings for special workflows:","Configuración para workflows muy escpeciales:"];
var MAN_ROOMCHANGE_WARNING = ["Alten Raumplan löschen und neuen festlegen? Bestellungen offener Tische gehen verloren!","Replace room map? Orders of open tables will be lost!","Sustituir mapa de mesas? Orders de mesas abiertas van a ser borradas!"];
@ -320,7 +323,7 @@ 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 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];
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];
var numberOfClosings = 0;
@ -360,6 +363,7 @@ var generalValuesSettings = [
["printandqueuejobs",MAN_PRINT_AND_QUEUE[lang],"s",19],
["cashenabled",MAN_CASH[lang],"s",20],
["beepcooked",MAN_BEEP_COOKED[lang],"s",21],
["restaurantmode",MAN_RESTAURANT_MODE[lang],"s",23],
["addreceipttoprinter",MAN_ADD_RECPRINTER[lang],"s",16],
["workflowconfig",MAN_WORKFLOW[lang],"s",4],
["receiptfontsize",MAN_RECEIPT_FONTSIZE[lang],"s",0],
@ -504,6 +508,8 @@ function setLanguage(l) {
$("#hsinfiletxt").html(MAN_HSINFILE[l]);
$("#hsoutfiletxt").html(MAN_HSOUTFILE[l]);
$("#hscurrencytxt").html(MAN_HSCURRENCY[l]);
$("#restmodehint").html(MAN_REST_MODE_HINT[l]);
}
function createMonthSelection(label) {
@ -608,6 +614,7 @@ function insertGeneralConfigItems(configResult) {
$("#partOfPrintAndQueueJobs").html(createPrintAndQueueJobs(values.printandqueuejobs));
$("#partOfCash").html(createCash(values.cashenabled));
$("#partOfBeepCooked").html(createBeepCooked(values.beepcooked));
$("#partOfRestaurantmode").html(createRestaurantmode(values.restaurantmode));
var language = values.billlanguage;
generalVals[2] = language;
@ -654,6 +661,7 @@ function insertGeneralConfigItems(configResult) {
generalVals[20] = values.cashenabled;
generalVals[21] = values.beepcooked;
generalVals[22] = values.hotelinterface;
generalVals[23] = values.restaurantmode;
$("#smtphost").val(values.smtphost);
$("#partOfSmtpauth").html(createSMTPAuth(values.smtpauth));
@ -809,6 +817,9 @@ function createCash(theValue) {
function createBeepCooked(theValue) {
return createYesNo("beepcooked",MAN_BEEP_COOKED, theValue);
}
function createRestaurantmode(theValue) {
return createYesNo("restaurantmode",MAN_RESTAURANT_MODE, theValue);
}
function createYesNo(label,nameOnGui,theValue) {
var html = '<div class="ui-field-contain">';
@ -1742,7 +1753,7 @@ function createLabelWithOption(aLabel,displayedName,hasTheRight) {
* the username and the rights that the user has to work in the
* various modules.
*/
function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rClosing, rManager,forNewUser) {
function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rManager,forNewUser) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
if (forNewUser) {
collapsiblePart += ' data-theme="d" data-content-theme="d">';
@ -1767,6 +1778,7 @@ function createCollapsibeOfUser(id,username,isAdmin,rWaiter,rKitchen,rBar,rSuppl
collapsiblePart += createLabelWithOption("reservation",MAN_RESERVATION[lang],rReservation);
collapsiblePart += createLabelWithOption("rating",MAN_RATING[lang],rRating);
collapsiblePart += createLabelWithOption("changeprice",MAN_CHANGEPRICE[lang],rChangeprice);
collapsiblePart += createLabelWithOption("customers",MAN_CUSTOMERS[lang],rCustomers);
collapsiblePart += createLabelWithOption("closingright",MAN_CLOSINGRIGHT[lang],rClosing);
collapsiblePart += createLabelWithOption("manager",MAN_MANAGER[lang],rManager);
@ -1804,6 +1816,7 @@ function fillUserListIntoGui(userinfo) {
aUser.right_reservation == 1,
aUser.right_rating == 1,
aUser.right_changeprice == 1,
aUser.right_customers == 1,
aUser.right_closing == 1,
aUser.right_manager == 1,
false
@ -1813,7 +1826,7 @@ function fillUserListIntoGui(userinfo) {
userPart += createCollapsibeOfUser(
"userid_newuser",
MAN_NEW_USER[lang],
false,false,false,false,false,false,false,false,false,false,false,false,false,false,true);
false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true);
$("#userlist").html(userPart);
$('#userpart').trigger('create');
@ -1855,6 +1868,7 @@ function dynamicUserBinding() {
var rReservation = newUserInfoContainer.find("#userlabel_reservation").val();
var rRating = newUserInfoContainer.find("#userlabel_rating").val();
var rChangeprice = newUserInfoContainer.find("#userlabel_changeprice").val();
var rCustomers = newUserInfoContainer.find("#userlabel_customers").val();
var rManager = newUserInfoContainer.find("#userlabel_manager").val();
var rClosing = newUserInfoContainer.find("#userlabel_closingright").val();
@ -1876,6 +1890,7 @@ function dynamicUserBinding() {
rReservation: rReservation,
rRating: rRating,
rChangeprice : rChangeprice,
rCustomers: rCustomers,
rManager: rManager,
rClosing: rClosing
};
@ -1901,6 +1916,7 @@ function dynamicUserBinding() {
var rReservation = userInfoContainer.find("#userlabel_reservation").val();
var rRating = userInfoContainer.find("#userlabel_rating").val();
var rChangeprice = userInfoContainer.find("#userlabel_changeprice").val();
var rCustomers = userInfoContainer.find("#userlabel_customers").val();
var rManager = userInfoContainer.find("#userlabel_manager").val();
var rClosing = userInfoContainer.find("#userlabel_closingright").val();
@ -1918,6 +1934,7 @@ function dynamicUserBinding() {
rReservation: rReservation,
rRating: rRating,
rChangeprice: rChangeprice,
rCustomers: rCustomers,
rManager: rManager,
rClosing: rClosing
};
@ -2491,6 +2508,10 @@ $(document).on("pageinit", "#admin-page", function () {
<label for="remoteaccesscode">Fernzugriffscode:</label>
<input type="password" value="" data-mini="true" id="remoteaccesscode" class="genConfigEl"/>
</div>
<div id="partOfRestaurantmode"></div>
<i id=restmodehint style="padding-left: 50px;padding-right: 50px;">Hinweis: siehe Anleitung</i>
<div data-role="fieldcontain">
<label for="companyinfo">Betriebsinfo:</label>
<textarea cols="40" rows="8" name="companyinfo" id="companyinfo" class="genConfigEl"></textarea>

File diff suppressed because one or more lines are too long

View File

@ -442,7 +442,7 @@ class Admin {
$rights = array($zeile['is_admin'],$zeile['right_waiter'],$zeile['right_kitchen'],
$zeile['right_bar'],$zeile['right_supply'],$zeile['right_paydesk'],
$zeile['right_statistics'],$zeile['right_bill'],$zeile['right_products'],
$zeile['right_reservation'],$zeile['right_changeprice'],$zeile['right_manager'],
$zeile['right_reservation'],$zeile['right_changeprice'],$zeile['right_customers'],$zeile['right_manager'],
$zeile['right_closing']);
$right_rating = $zeile['right_rating'];
@ -460,6 +460,7 @@ class Admin {
$_SESSION['right_products'] = false;
$_SESSION['right_reservation'] = false;
$_SESSION['right_changeprice'] = false;
$_SESSION['right_customers'] = false;
$_SESSION['right_manager'] = false;
$_SESSION['right_closing'] = false;
$_SESSION['keeptypelevel'] = false;
@ -482,6 +483,7 @@ class Admin {
$_SESSION['right_reservation'] = ($zeile['right_reservation'] == 1 ? true : false);
$_SESSION['right_rating'] = ($zeile['right_rating'] == 1 ? true : false);
$_SESSION['right_changeprice'] = ($zeile['right_changeprice'] == 1 ? true : false);
$_SESSION['right_customers'] = ($zeile['right_customers'] == 1 ? true : false);
$_SESSION['right_manager'] = ($zeile['right_manager'] == 1 ? true : false);
$_SESSION['right_closing'] = ($zeile['right_closing'] == 1 ? true : false);
$_SESSION['keeptypelevel'] = ($zeile['keeptypelevel'] == 1 ? true : false);
@ -490,7 +492,7 @@ class Admin {
$this->userrights->setSession($_SESSION['is_admin'], $_SESSION['right_waiter'], $_SESSION['right_kitchen'],
$_SESSION['right_bar'], $_SESSION['right_supply'], $_SESSION['right_paydesk'], $_SESSION['right_statistics'],
$_SESSION['right_bill'], $_SESSION['right_products'], $_SESSION['right_reservation'], $_SESSION['right_rating'],
$_SESSION['right_changeprice'], $_SESSION['right_manager'], $_SESSION['right_closing']);
$_SESSION['right_changeprice'], $_SESSION['right_customers'],$_SESSION['right_manager'], $_SESSION['right_closing']);
$assoc = array ("0" => "roombtnsize","1" => "tablebtnsize","2" => "prodbtnsize");
@ -719,7 +721,7 @@ class Admin {
return;
}
$configItems = join(",",array("'decpoint'","'version'","'cancelunpaidcode'","'tax'","'togotax'","'taxaustrianormal'","'taxaustriaerm1'","'taxaustriaerm2'","'taxaustriaspecial'","'currency'","'workflowconfig'","'prominentsearch'","'discount1'","'discount2'","'discount3'","'waitergopayprint'","'cashenabled'"));
$configItems = join(",",array("'decpoint'","'version'","'cancelunpaidcode'","'tax'","'togotax'","'taxaustrianormal'","'taxaustriaerm1'","'taxaustriaerm2'","'taxaustriaspecial'","'currency'","'workflowconfig'","'prominentsearch'","'discount1'","'discount2'","'discount3'","'waitergopayprint'","'cashenabled'","'restaurantmode'"));
$sql = "select name,setting FROM %config% WHERE name in ($configItems)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
@ -811,6 +813,7 @@ class Admin {
$printandqueuejobs = CommonUtils::getConfigValue($pdo,"printandqueuejobs",0);
$cashenabled = CommonUtils::getConfigValue($pdo,"cashenabled",1);
$beepcooked = CommonUtils::getConfigValue($pdo,"beepcooked",0);
$restaurantmode = CommonUtils::getConfigValue($pdo,"restaurantmode",1);
$smtphost = "";
$smtpauth = 1;
@ -864,7 +867,7 @@ class Admin {
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "hs3refresh" => $hs3refresh,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "beepcooked" => $beepcooked
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "beepcooked" => $beepcooked,"restaurantmode" => $restaurantmode
);
if ($forHtml) {
@ -889,7 +892,7 @@ class Admin {
$rights = array($_SESSION['is_admin'],$_SESSION['right_waiter'],$_SESSION['right_kitchen'],
$_SESSION['right_bar'],$_SESSION['right_supply'],$_SESSION['right_paydesk'],
$_SESSION['right_statistics'],$_SESSION['right_bill'],$_SESSION['right_products'],
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_manager'],$_SESSION['right_closing']);
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_customers'],$_SESSION['right_manager'],$_SESSION['right_closing']);
$right_rating = $_SESSION['right_rating'];
if (self::isOnlyRatingUser($rights, $right_rating, true)) {
@ -936,6 +939,7 @@ class Admin {
"products.html" => 'right_products',
"reservation.html" => 'right_reservation',
"rating.html" => 'right_rating',
"customers.html" => 'right_customers',
"waiterdesktop.php" => 'right_waiter'
);
@ -956,7 +960,7 @@ class Admin {
$view = "preferences.html";
}
echo json_encode($view . "?v=1.2.22");
echo json_encode($view . "?v=1.3.0");
}
}
@ -1151,35 +1155,37 @@ class Admin {
$bontxt = array("Kassenbons","Receipts","Tiques");
$stattxt = array("Statistik","Statistics","Estadisticas");
$ratingtxt = array("Bewertung","Rating","Valoración");
$customerstxt = array("Gäste","Guests","Clientes");
$logout = array("Abmelden","Log out","Adios");
$rights = array($_SESSION['is_admin'],$_SESSION['right_waiter'],$_SESSION['right_kitchen'],
$_SESSION['right_bar'],$_SESSION['right_supply'],$_SESSION['right_paydesk'],
$_SESSION['right_statistics'],$_SESSION['right_bill'],$_SESSION['right_products'],
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_manager'],
$_SESSION['right_closing']);
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_customers'],
$_SESSION['right_manager'],$_SESSION['right_closing']);
$right_rating = $_SESSION['right_rating'];
if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.2.22"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.0"); };
} else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.2.22"); };
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.0"); };
}
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.2.22"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.2.22"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.2.22"); };
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.0"); };
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.0"); };
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.0"); };
if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.2.22"); };
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.0"); };
}
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.2.22"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.2.22"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.2.22"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.2.22"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.2.22"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.2.22"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.2.22");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.2.22");
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.0"); };
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.0"); };
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.0"); };
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.0"); };
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.0"); };
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.0"); };
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.0"); };
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.0");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.0");
}
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1188,7 +1194,7 @@ class Admin {
$waiterMessage = $this->getMessage(null, "waitermessage");
}
// CAUTION: change version also in config.txt!!!
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.2.22",
$mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.0",
"user" => $currentUser,
"menu" => $mainMenu,
"waitermessage" => $waiterMessage,
@ -1222,6 +1228,16 @@ class Admin {
}
}
private function getGuestInfo($pdo) {
try {
$sql = "SELECT %customers%.id as id,%customers%.id as object,CONCAT(IFNULL(name,''),' - ',IFNULL(room,'')) as guest FROM %customers%,%vacations% where %customers%.id=%vacations%.customerid AND ((checkin <= CURDATE()) AND (CURDATE() <= checkout)) GROUP BY id";
$guests = CommonUtils::fetchSqlAll($pdo, $sql, null);
return(array("status" => "OK","guests" => $guests));
} catch (Exception $ex) {
return(array("status" => "ERROR"));
}
}
function getUserList() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT * FROM %user% WHERE active='1' ORDER BY is_admin";
@ -1354,8 +1370,9 @@ class Admin {
}
$hotelinfo = $this->getHotelInfo($pdo);
$internalguests = $this->getGuestInfo($pdo);
echo json_encode(array("payments" => $retArray, "hotelinterface" => $hotelinfo["hotelinterface"],"guests" => $hotelinfo["guests"]));
echo json_encode(array("payments" => $retArray, "hotelinterface" => $hotelinfo["hotelinterface"],"guests" => $hotelinfo["guests"],"internalguests" => $internalguests["guests"]));
}
function sendJsonValueFromConfigTable($pdo,$whichValue) {
@ -1455,6 +1472,7 @@ class Admin {
"printandqueuejobs" => array("dbcol" => "printandqueuejobs","checknum" => 0),
"cashenabled" => array("dbcol" => "cashenabled","checknum" => 0),
"beepcooked" => array("dbcol" => "beepcooked","checknum" => 0),
"restaurantmode" => array("dbcol" => "restaurantmode","checknum" => 0),
"smtphost" => array("dbcol" => "smtphost","checknum" => 0),
"smtpauth" => array("dbcol" => "smtpauth","checknum" => 1),
"smtpuser" => array("dbcol" => "smtpuser","checknum" => 0),
@ -1840,11 +1858,11 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->writeCsvHeader("datenexport-benutzer.csv");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Tageserfassungsrecht; Managerrechte; Aktiviert\n");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Gästerechte; Tageserfassungsrecht; Managerrechte; Aktiviert\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "userid,username,is_admin,right_waiter,right_kitchen,right_bar,right_supply,";
$sql .= "right_paydesk,right_statistics,right_bill,right_products,right_rating,right_changeprice,right_closing,right_manager,active,";
$sql .= "right_paydesk,right_statistics,right_bill,right_products,right_rating,right_changeprice,right_customers,right_closing,right_manager,active,";
$sql .= "description ";
$sql .= " FROM %hist%, %histuser%, %histactions% ";
$sql .= " WHERE (refid=%histuser%.id) ";
@ -1872,13 +1890,14 @@ class Admin {
$val13 = ($zeile['right_products'] == '1' ? "Ja" : "Nein");
$val14 = ($zeile['right_rating'] == '1' ? "Ja" : "Nein");
$val15 = ($zeile['right_changeprice'] == '1' ? "Ja" : "Nein");
$val16 = ($zeile['right_closing'] == '1' ? "Ja" : "Nein");
$val17 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val18 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val19 = $zeile['description'];
$val16 = ($zeile['right_customers'] == '1' ? "Ja" : "Nein");
$val17 = ($zeile['right_closing'] == '1' ? "Ja" : "Nein");
$val18 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val19 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val20 = $zeile['description'];
echo "$val1; $val2; $val3; $val4; $val5; $val6; $val7; $val8; $val9; $val10;";
echo "$val11;$val12;$val13;$val14;$val15;$val16;$val17;$val18;$val19\n";
echo "$val11;$val12;$val13;$val14;$val15;$val16;$val17;$val18;$val19;$val20\n";
}
}
@ -1913,12 +1932,14 @@ class Admin {
private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","queueextras");
"user","reservations","customers","groups","groupcustomer","vacations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
private function getAllWithLogsTablesToBackupRestore() {
return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config",
"user","reservations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","queueextras");
"user","reservations","customers","groups","groupcustomer","vacations","bill","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras");
}
public function backup($theType,$remoteaccesscode) {
@ -2288,6 +2309,12 @@ class Admin {
self::doSql($pdo, "DELETE FROM %resttables% WHERE removed is not null", null);
self::doSql($pdo, "DELETE FROM %room% WHERE removed is not null", null);
self::doSql($pdo, "DELETE FROM %reservations%", null);
self::doSql($pdo, "DELETE FROM %groupcustomer%", null);
self::doSql($pdo, "DELETE FROM %vacations%", null);
self::doSql($pdo, "DELETE FROM %groups%", null);
self::doSql($pdo, "DELETE FROM %customers%", null);
echo json_encode(array("status" => "OK"));
} catch(Exception $e) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG . " - Error message: $e"));

View File

@ -351,6 +351,7 @@ class Bill {
$currentTime = date('Y-m-d H:i:s');
$pdo = $this->dbutils->openDbAndReturnPdo();
CommonUtils::log($pdo, "QUEUE", "Cash action with money '$money' at billtime '$currentTime'");
$pdo->beginTransaction();
$sql = "SELECT sum(brutto) as bruttosum FROM %bill% WHERE closingid is null AND paymentid='1'";
@ -378,6 +379,7 @@ class Bill {
if (trim($money) == '') {
$money = '0.00';
}
CommonUtils::log($pdo, "QUEUE", "Calc bill signature for cash money '$money' at billtime '$currentTime'");
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, $money, $money, 0.0, $userId);
$sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tax`,`tableid`, `status`, `paymentid`,`userid`,`ref`,`reason`,`signature`) VALUES ( ?, ? , ?,?,?, ?, 'c', ?,?,?,?,?)";
@ -554,7 +556,7 @@ class Bill {
$ids[] = $anId["queueid"];
}
$sql = "SELECT brutto,netto,tableid,paymentid,tax,reservationid,guestinfo FROM %bill% WHERE id=?";
$sql = "SELECT brutto,netto,tableid,paymentid,tax,reservationid,guestinfo,intguestid,intguestpaid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($billid));
$row = $stmt->fetchObject();
@ -566,14 +568,14 @@ class Bill {
return;
}
$this->recreateBill($pdo, $ids, $row->brutto, $row->netto, $row->tableid, $row->paymentid, $row->tax, 1-$isNowHost,$row->reservationid,$row->guestinfo);
$this->recreateBill($pdo, $ids, $row->brutto, $row->netto, $row->tableid, $row->paymentid, $row->tax, 1-$isNowHost,$row->reservationid,$row->guestinfo,$row->intguestid,$row->intguestpaid);
$pdo->commit();
echo json_encode(array("status" => "OK", "code" => OK));
}
function recreateBill($pdo,$ids_array,$brutto,$netto,$tableid,$paymentId,$tax,$host,$reservationid,$guestinfo) {
function recreateBill($pdo,$ids_array,$brutto,$netto,$tableid,$paymentId,$tax,$host,$reservationid,$guestinfo,$intguestid,$intguestpaid) {
$userid = $this->getUserId();
@ -600,9 +602,9 @@ class Bill {
// now calculate the signature for the bill entry
$signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, $brutto, $netto, '0.00', $userid);
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`signature`) VALUES (?,?,?,?,?,?,?,NULL,NULL,?,?,?,?)";
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`intguestid`,`intguestpaid`,`signature`) VALUES (?,?,?,?,?,?,?,NULL,NULL,?,?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billInsertSql));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$tableid,$paymentId,$userid,$host,$reservationid,$guestinfo,$signature));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$tableid,$paymentId,$userid,$host,$reservationid,$guestinfo,$intguestid,$intguestpaid,$signature));
$newBillId = $pdo->lastInsertId();
// now declare them all to be paid:
@ -663,7 +665,7 @@ class Bill {
}
// is the bill already closed? In this case no cancel is allowed!
$sql = "SELECT brutto,netto,tax,tableid,closingid,status,paymentid,reservationid,guestinfo FROM %bill% WHERE id=?";
$sql = "SELECT brutto,netto,tax,tableid,closingid,status,paymentid,reservationid,guestinfo,intguestid,intguestpaid FROM %bill% WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($billid));
$row =$stmt->fetchObject();
@ -680,10 +682,10 @@ class Bill {
$paymentid = $row->paymentid;
$reservationid = $row->reservationid;
$guestinfo = $row->guestinfo;
$intguestpaid = $row->intguestpaid;
}
if (!is_null($closingId) || ($status == 's') || ($status == 'x')) {
// no cancel possible anymore!
if ($doOwnTransaction) {
$pdo->rollBack();
}
@ -697,6 +699,16 @@ class Bill {
return false;
}
if (!is_null($intguestpaid)) {
if ($doOwnTransaction) {
$pdo->rollBack();
}
if ($doEcho) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_BILL_CUSTOMER_PAID, "msg" => ERROR_BILL_CUSTOMER_PAID_MSG));
}
return false;
}
// is bill correct with signature?
$commonUtils = new CommonUtils();
$correct = $commonUtils->verifyBill($pdo, $billid);
@ -764,9 +776,9 @@ class Bill {
$stmt->execute(array($row->brutto + $row->prevbrutto + $stornval,$row->netto + $row->prevnetto + $stornonettoval,$refIdOfStornoEntry));
// 3. mark bill as part of storno
$sql = "UPDATE %bill% SET status='x', closingid=null, ref=? WHERE id=?";
$sql = "UPDATE %bill% SET status='x', closingid=null, ref=?, intguestid=?,intguestpaid=? WHERE id=?";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($refIdOfStornoEntry,$billid));
$stmt->execute(array($refIdOfStornoEntry,null,null,$billid));
if (!is_null($reason) && ($reason != "")) {
$sql = "UPDATE %bill% SET reason=? WHERE id=?";

View File

@ -12,6 +12,7 @@ require_once ('printqueue.php');
require_once ('feedback.php');
require_once ('reservation.php');
require_once ('rating.php');
require_once ('customers.php');
require_once ('commonutils.php');
require_once ('utilities/Logger.php');
@ -65,6 +66,9 @@ if ($module == 'admin') {
} else if ($module == 'rating') {
$rating = new Rating();
$rating->handleCommand($command);
} else if ($module == 'customers') {
$rating = new Customers();
$rating->handleCommand($command);
}

560
webapp/php/customers.php Normal file
View File

@ -0,0 +1,560 @@
<?php
// Datenbank-Verbindungsparameter
require_once ('dbutils.php');
require_once ('commonutils.php');
require_once ('admin.php');
require_once ('reports.php');
require_once ('utilities/pdfexport.php');
require_once ('utilities/Emailer.php');
require_once ('3rdparty/phpexcel/classes/PHPExcel.php');
class Customers {
private static $rights = array(
"createNewCustomer" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"deleteCustomer" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"changeCustomer" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"getCustomers" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"createNewGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"getGroups" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"changeGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"deleteGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"getVacations" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"newVacation" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"delVacation" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"getCustomersForReserv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("reservation")),
"getBills" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"pay" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"unpay" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"printbill" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"payallbills" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"printallbills" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers")),
"emailGroup" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("customers"))
);
private static function checkRights($command) {
if(session_id() == '') {
session_start();
}
if (!array_key_exists($command, self::$rights)) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_FOUND, "msg" => ERROR_COMMAND_NOT_FOUND_MSG));
return false;
}
$cmdRights = self::$rights[$command];
if ($cmdRights["loggedin"] == 1) {
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
}
if ($cmdRights["isadmin"] == 1) {
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
} else {
if ($_SESSION['is_admin'] == 0) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_ADMIN, "msg" => ERROR_COMMAND_NOT_ADMIN_MSG));
return false;
}
}
}
if (!is_null($cmdRights["rights"])) {
foreach($cmdRights["rights"] as $aRight) {
if ($aRight == 'customers') {
if ($_SESSION['right_customers'] == 1) {
return true;
}
}
if ($aRight == 'reservation') {
if ($_SESSION['right_reservation'] == 1) {
return true;
}
}
}
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
return true;
}
function __construct() {
//
}
function handleCommand($command) {
if (!self::checkRights($command)) {
return false;
}
$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']));
} 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"]));
} else if ($command == 'getCustomers') {
echo json_encode($this->getCustomers($pdo,$_POST['search'],$_POST['date'],$_POST['onlyopenbills']));
} else if ($command == 'createNewGroup') {
echo json_encode($this->createNewGroup($pdo,$_POST['name'],$_POST['remark']));
} else if ($command == 'getGroups') {
echo json_encode($this->getGroups($pdo,$_POST['search']));
} else if ($command == 'changeGroup') {
echo json_encode($this->changeGroup($pdo,$_POST["id"],$_POST['name'],$_POST['remark']));
} else if ($command == 'deleteGroup') {
echo json_encode($this->deleteGroup($pdo,$_POST['id']));
} else if ($command == 'getCustomersForReserv') {
echo json_encode($this->getCustomersForReserv($pdo,$_POST['search']));
} else if ($command == 'getVacations') {
echo json_encode($this->getVacations($pdo,$_GET['cusid']));
} else if ($command == 'newVacation') {
echo json_encode($this->newVacation($pdo,$_POST['id'],$_POST['checkin'],$_POST['checkout'],$_POST['room'],$_POST['remark']));
} else if ($command == 'delVacation') {
echo json_encode($this->delVacation($pdo,$_POST['id']));
} else if ($command == 'getBills') {
echo json_encode($this->getBills($pdo,$_GET['cusid']));
} else if ($command == 'pay') {
echo json_encode($this->pay($pdo,$_POST['id']));
} else if ($command == 'unpay') {
echo json_encode($this->unpay($pdo,$_POST['id']));
} else if ($command == 'printbill') {
echo json_encode($this->printBill($pdo,$_POST['id']));
} else if ($command == 'payallbills') {
echo json_encode($this->payallbills($pdo,$_POST['id']));
} 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"]));
} else {
echo "Command not supported.";
}
}
// for internal request
private function hasCurrentUserCustomersRights() {
session_start();
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
// no user logged in
return false;
} else {
return ($_SESSION['right_customers']);
}
}
private function createNewCustomer($pdo,$name,$email,$addr,$remark,$phone,$mobil,$www,$checkin,$checkout,$room) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
if ($checkin == '') {
$checkin = null;
}
if ($checkout == '') {
$checkout = null;
}
if ($room == '') {
$room = null;
}
try {
$pdo->beginTransaction();
$sql = "SELECT count(id) as countid from %customers% WHERE name=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($name));
$number = $row->countid;
if ($row->countid > 0) {
$code = 1;
} else {
$code = 0;
}
$sql = "INSERT INTO %customers% (name,email,address,remark,phone,mobil,www,created,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($name,$email,$addr,$remark,$phone,$mobil,$www,$currentTime,$currentTime));
$cusid = $pdo->lastInsertId();
self::addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,null);
$pdo->commit();;
return array("status" => "OK","code" => $code, "value" => $number);
} catch (Exception $e) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
private static function addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,$remark) {
if ($checkin == '') {
$checkin = null;
}
if ($checkout == '') {
$checkout = null;
}
if (!is_null($checkin) || !is_null($checkout)) {
$sql = "INSERT INTO %vacations% (customerid,checkin,checkout,room,remark) VALUES(?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($cusid,$checkin,$checkout,$room,$remark));
}
}
private function createNewGroup($pdo,$name,$remark) {
date_default_timezone_set(DbUtils::getTimeZone());
$currentTime = date('Y-m-d H:i:s');
try {
$sql = "SELECT count(id) as countid from %groups% WHERE name=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($name));
if ($row->countid > 0) {
return array("status" => "ERROR","msg" => "Group name already exists","code" => 1);
}
$sql = "INSERT INTO %groups% (name,remark,created) VALUES(?,?,?)";
CommonUtils::execSql($pdo, $sql, array($name,$remark,$currentTime));
return array("status" => "OK");
} catch (Exception $e) {
return array("status" => "ERROR","msg" => $e->getMessage(),"code" => 2);
}
}
private function changeCustomer($pdo,$id,$name,$email,$addr,$remark,$phone,$mobil,$www,$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 = "DELETE FROM %groupcustomer% WHERE customerid=?";
CommonUtils::execSql($pdo, $sql, array($id));
if ($groups != '') {
foreach($groups as $aGroupId) {
$sql = "INSERT INTO %groupcustomer% (customerid,groupid) VALUES(?,?)";
CommonUtils::execSql($pdo, $sql, array($id,$aGroupId));
}
}
return array("status" => "OK");
} catch (Exception $e) {
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
private function newVacation($pdo,$cusid,$checkin,$checkout,$room,$remark) {
try {
self::addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,$remark);
return array("status" => "OK","cusid" => $cusid);
} catch (Exception $e) {
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
private function delVacation($pdo,$id) {
try {
$pdo->beginTransaction();
$sql = "SELECT count(id) as countid FROM %vacations% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
if ($row->countid != 1) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => "Vacations entry not found");
} else {
$sql = "SELECT customerid FROM %vacations% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
$cusid = $row->customerid;
$sql = "DELETE FROM %vacations% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($id));
$pdo->commit();
return array("status" => "OK","cusid" => $cusid);
}
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function payOrUnpay($pdo,$id,$value) {
try {
$pdo->beginTransaction();
$sql = "SELECT count(id) as countid FROM %bill% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
if ($row->countid != 1) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => "Bill entry not found");
} else {
$sql = "SELECT intguestid FROM %bill% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
$cusid = $row->intguestid;
$sql = "UPDATE %bill% SET intguestpaid=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($value,$id));
$pdo->commit();
return array("status" => "OK","cusid" => $cusid);
}
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private function pay($pdo,$id) {
return (self::payOrUnpay($pdo, $id, 1));
}
private function unpay($pdo,$id) {
return (self::payOrUnpay($pdo, $id, null));
}
private function printBill($pdo,$billid) {
if(session_id() == '') {
session_start();
}
$printer = $_SESSION['receiptprinter'];
// now get receipt info from bill table
CommonUtils::log($pdo, "PRINTQUEUE", "Insert bill with id=$billid for printer=$printer into queue for customer.");
$printInsertSql = "INSERT INTO `%printjobs%` (`id` , `content`,`type`,`printer`) VALUES ( NULL,?,?,?)";
CommonUtils::execSql($pdo, $printInsertSql, array((string)($billid),'3',$printer));
return array("status" => "OK");
}
private function printallbills($pdo,$cusid) {
$sql = "SELECT id FROM %bill% WHERE intguestid=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($cusid));
foreach($result as $aBill) {
$this->printBill($pdo, $aBill["id"]);
}
return array("status" => "OK");
}
private function payallbills($pdo,$cusid) {
try {
$pdo->beginTransaction();
$sql = "UPDATE %bill% SET intguestpaid=? WHERE intguestid=?";
CommonUtils::execSql($pdo, $sql, array(1,$cusid));
$pdo->commit();
return array("status" => "OK","cusid" => $cusid);
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private function deleteCustomer($pdo,$id) {
try {
$sql = "SELECT count(id) as countid FROM %bill% WHERE intguestid=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($id));
if ($row->countid > 0) {
return array("status" => "ERROR","msg" => "Der Gast hat zugewiesene Rechnungen");
}
$pdo->beginTransaction();
$sql = "DELETE FROM %groupcustomer% WHERE customerid=?";
CommonUtils::execSql($pdo, $sql, array($id));
$sql = "DELETE FROM %vacations% WHERE customerid=?";
CommonUtils::execSql($pdo, $sql, array($id));
$sql = "DELETE FROM %customers% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($id));
$pdo->commit();
return array("status" => "OK");
} catch (Exception $e) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
private function getCustomersForReserv($pdo,$search) {
if ($search == '') {
return array("status" => "OK","msg" => array());
}
$s = '%' . $search . '%';
try {
$allcustomers = array();
$sql = "SELECT id,name,email,address,remark,phone,mobil FROM %customers% WHERE (name like ?) OR (mobil like ?) OR (phone like ?) ORDER BY name";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($s,$s,$s));
foreach($result as $aCustomer) {
$id = $aCustomer["id"];
$name = $aCustomer["name"];
$email = $aCustomer["email"];
$phone = $aCustomer["phone"];
$mobil = $aCustomer["mobil"];
$finalPhone = "";
$summary = $aCustomer["name"];
if ($phone != "") {
$summary .= " - " . $phone;
$finalPhone = $phone;
}
if ($mobil != "") {
$summary .= " - " . $mobil;
$finalPhone = $mobil;
}
if ($email != "") {
$summary .= " - " . $email;
}
$allcustomers[] = array("summary" => $summary,"id" => $id,"name" => $name,"email" => $email,"phone" => $finalPhone);
}
return array("status" => "OK","msg" => $allcustomers);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function isCustomerPresent($pdo,$cusid,$date) {
if ($date == '') {
return true;
}
$sql = "SELECT count(id) as countid FROM %vacations% WHERE customerid=? AND (checkin is not null OR checkout is not null) AND (IFNULL(checkin,'$date') <= ? AND IFNULL(checkout,'$date') >= ?)";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($cusid,$date,$date));
if ($row->countid == 0) {
return false;
} else {
return true;
}
}
private function getCustomers($pdo,$search,$date,$onlyOpenBills) {
$s = '%' . $search . '%';
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";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($s,$s));
foreach ($result as $aCustomer) {
if (!self::isCustomerPresent($pdo,$aCustomer["id"],$date)) {
continue;
}
$sql = "SELECT groupid,name FROM %groupcustomer%,%groups% WHERE groupid=%groups%.id AND customerid=? ORDER BY name";
$assgroups = CommonUtils::fetchSqlAll($pdo, $sql, array($aCustomer["id"]));
if ($onlyOpenBills == 1) {
$sql = "SELECT count(id) as countid FROM %bill% WHERE intguestid=? AND intguestpaid is null";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($aCustomer["id"]));
if ($row->countid == 0) {
continue;
}
}
$sql = "SELECT SUM(brutto) as openbillsum FROM %bill% WHERE intguestid=? AND intguestpaid is null";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($aCustomer["id"]));
$aCust = array("id" => $aCustomer["id"],
"name" => $aCustomer["name"],
"email" => $aCustomer["email"],
"address" => $aCustomer["address"],
"remark" => $aCustomer["remark"],
"phone" => $aCustomer["phone"],
"mobil" => $aCustomer["mobil"],
"www" => $aCustomer["www"],
"created" => $aCustomer["created"],
"lastmodified" => $aCustomer["lastmodified"],
"groups" => $assgroups,
"openbillsum" => $row->openbillsum
);
$allcustomers[] = $aCust;
}
return array("status" => "OK","msg" => $allcustomers);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private function getVacations($pdo,$cusid) {
$sql = "SELECT id,IFNULL(checkin,'') as checkin,IFNULL(checkout,'') as checkout,IFNULL(room,'') as room,IFNULL(remark,'') as remark FROM %vacations% WHERE customerid=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($cusid));
return array("status" => "OK","msg" => array("vacations" => $result,"cusid" => $cusid));
}
private function getBills($pdo,$cusid) {
$sql = "SELECT id,billdate,brutto,IFNULL(guestinfo,'') as guestinfo,IFNULL(intguestpaid,'0') as paid FROM %bill% WHERE intguestid=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($cusid));
return array("status" => "OK","msg" => array("bills" => $result,"cusid" => $cusid));
}
private function getGroups($pdo,$search) {
$s = '%' . $search . '%';
try {
$sql = "SELECT id,name,remark,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created FROM %groups% WHERE name like ? ORDER BY name";
$resultFiltered = CommonUtils::fetchSqlAll($pdo, $sql, array($s));
$resultFoundGroups = array();
foreach ($resultFiltered as $aFilteredGroup) {
$groupid = $aFilteredGroup["id"];
$sql = "SELECT %customers%.name as name from %customers%,%groupcustomer% WHERE %groupcustomer%.groupid=? AND %groupcustomer%.customerid=%customers%.id ORDER by name";
$customersInGroup = CommonUtils::fetchSqlAll($pdo, $sql, array($groupid));
$resultFoundGroups[] = array(
"id" => $groupid,
"name" => $aFilteredGroup["name"],
"remark" => $aFilteredGroup["remark"],
"created" => $aFilteredGroup["created"],
"customers" => $customersInGroup);
}
$sql = "SELECT id,name FROM %groups% ORDER BY name";
$resultAll = CommonUtils::fetchSqlAll($pdo, $sql, array($s));
$result = array("filtered" => $resultFoundGroups,"all" => $resultAll);
return array("status" => "OK","msg" => $result);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private function changeGroup($pdo,$id,$name,$remark) {
try {
$sql = "UPDATE %groups% SET name=?,remark=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($name,$remark,$id));
return array("status" => "OK");
} catch (Exception $e) {
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
private function deleteGroup($pdo,$id) {
try {
$sql = "DELETE FROM %groupcustomer% WHERE groupid=?";
CommonUtils::execSql($pdo, $sql, array($id));
$sql = "DELETE FROM %groups% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($id));
return array("status" => "OK");
} catch (Exception $e) {
return array("status" => "ERROR","msg" => $e->getMessage());
}
}
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";
$customersInGroup = CommonUtils::fetchSqlAll($pdo, $sql, array($grpid));
$emails = array();
foreach ($customersInGroup as $aCustomer) {
$email = $aCustomer["email"];
if (!is_null($email)) {
$email = trim($email);
if ($email != '') {
$emails[] = $email;
}
}
}
$ok = true;
foreach($emails as $anEmail) {
if (!Emailer::sendEmail($pdo, $text, $anEmail, $subject)) {
$ok = false;
}
}
if ($ok) {
return array("status" => "OK");
} else {
return array("status" => "ERROR","msg" => 'Not all emails could be sent');
}
}
}

View File

@ -11,6 +11,10 @@ define ('DB_PRODTYPE_TABLE', TAB_PREFIX . 'prodtype');
define ('DB_TABLEMAPS_TABLE', TAB_PREFIX . 'tablemaps');
define ('DB_TABLEPOS_TABLE', TAB_PREFIX . 'tablepos');
define ('DB_BILL_TABLE', TAB_PREFIX . 'bill');
define ('DB_CUSTOMERS_TABLE', TAB_PREFIX . 'customers');
define ('DB_GROUPS_TABLE', TAB_PREFIX . 'groups');
define ('DB_GROUPCUSTOMER_TABLE', TAB_PREFIX . 'groupcustomer');
define ('DB_VACATIONS_TABLE', TAB_PREFIX . 'vacations');
define ('DB_PRICELEVEL_TABLE', TAB_PREFIX . 'pricelevel');
define ('DB_CONFIG_TABLE', TAB_PREFIX . 'config');
define ('DB_CLOSING_TABLE', TAB_PREFIX . 'closing');
@ -112,6 +116,10 @@ class DbUtils {
$out = str_replace("%room%",$prefix . 'room',$out);
$out = str_replace("%resttables%",$prefix . 'resttables',$out);
$out = str_replace("%bill%",$prefix . 'bill',$out);
$out = str_replace("%customers%",$prefix . 'customers',$out);
$out = str_replace("%groups%",$prefix . 'groups',$out);
$out = str_replace("%groupcustomer%",$prefix . 'groupcustomer',$out);
$out = str_replace("%vacations%", $prefix .'vacations',$out);
$out = str_replace("%tablemaps%",$prefix . "tablemaps",$out);
$out = str_replace("%tablepos%",$prefix . "tablepos",$out);
@ -177,6 +185,7 @@ class DbUtils {
array("col" => 'right_reservation', "hist" => 1, "new" => 'rReservation', "update" => 'rReservation'),
array("col" => 'right_rating', "hist" => 1, "new" => 'rRating', "update" => 'rRating'),
array("col" => 'right_changeprice', "hist" => 1, "new" => 'rChangeprice', "update" => 'rChangeprice'),
array("col" => 'right_customers', "hist" => 1, "new" => 'rCustomers', "update" => 'rCustomers'),
array("col" => 'right_manager', "hist" => 1, "new" => 'rManager', "update" => 'rManager'),
array("col" => 'right_closing', "hist" => 1, "new" => 'rClosing', "update" => 'rClosing'),
array("col" => 'active', "hist" => 1, "new" => null ,"default" => 1, "update" => null),

View File

@ -97,4 +97,6 @@ define ( 'ERROR_COMMAND_NOT_ADMIN_MSG', 'Benutzer besitzt keine Admin-Rechte');
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');

View File

@ -102,7 +102,7 @@ class QueueContent {
$this->getJsonProductsOfTableToPay($_GET['tableid']);
} else if ($command == 'declarePaidCreateBillReturnBillId') {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->declarePaidCreateBillReturnBillId($pdo,$_POST['ids'],$_POST['tableid'],$_POST['paymentid'],$_POST['declareready'],$_POST['host'],false,$_POST['reservationid'],$_POST['guestinfo']);
$this->declarePaidCreateBillReturnBillId($pdo,$_POST['ids'],$_POST['tableid'],$_POST['paymentid'],$_POST['declareready'],$_POST['host'],false,$_POST['reservationid'],$_POST['guestinfo'],$_POST['intguestid']);
} else {
echo "Command not supported.";
}
@ -1633,8 +1633,11 @@ class QueueContent {
* Create bill
* Return a bill id
*/
function declarePaidCreateBillReturnBillId($pdo,$ids,$tableid,$paymentId,$declareready,$host,$calledInternally = false,$reservationid,$guestinfo) {
function declarePaidCreateBillReturnBillId($pdo,$ids,$tableid,$paymentId,$declareready,$host,$calledInternally = false,$reservationid,$guestinfo,$intguestid) {
if ($intguestid == '') {
$intguestid = null;
}
if ($reservationid != "") {
$reservationid = substr($reservationid, 0, 30);
}
@ -1734,9 +1737,9 @@ class QueueContent {
// now calculate the signature for the bill entry
$signature = $this->commonUtils->calcSignatureForBill($pdo,$currentTime, $brutto, $netto, '0.00', $userid);
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`prevbrutto`,`prevnetto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`signature`) VALUES (?,?,?,?,?,?,?,?,?,NULL,NULL,?,?,?,?)";
$billInsertSql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`prevbrutto`,`prevnetto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`intguestid`,`signature`) VALUES (?,?,?,?,?,?,?,?,?,NULL,NULL,?,?,?,?,?)";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($billInsertSql));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$newprevbrutto,$newprevnetto,$tableid,$paymentId,$userid,$host,$reservationid,$guestinfo,$signature));
$stmt->execute(array($billid,$currentTime,$brutto,$netto,$newprevbrutto,$newprevnetto,$tableid,$paymentId,$userid,$host,$reservationid,$guestinfo,$intguestid,$signature));
// now declare them all to be paid:
for ($i=0;$i<count($ids_array);$i++) {

View File

@ -99,6 +99,10 @@ class Basedb {
$out = str_replace("%tablemaps%",$this->prefix . "tablemaps",$out);
$out = str_replace("%tablepos%",$this->prefix . "tablepos",$out);
$out = str_replace("%bill%",$this->prefix . "bill",$out);
$out = str_replace("%customers%",$this->prefix . "customers",$out);
$out = str_replace("%groups%",$this->prefix . "groups",$out);
$out = str_replace("%groupcustomer%",$this->prefix . "groupcustomer",$out);
$out = str_replace("%vacations%",$this->prefix . "vacations",$out);
$out = str_replace("%pricelevel%",$this->prefix . "pricelevel",$out);
$out = str_replace("%config%",$this->prefix . "config",$out);
$out = str_replace("%closing%",$this->prefix . "closing",$out);
@ -159,6 +163,11 @@ class Basedb {
$this->doSQLcatch($pdo, "drop TABLE `%room%`");
$this->doSQLcatch($pdo, "drop TABLE `%payment%`");
$this->doSQLcatch($pdo, "drop TABLE `%groupcustomer%`");
$this->doSQLcatch($pdo, "drop TABLE `%vacations%`");
$this->doSQLcatch($pdo, "drop TABLE `%groups%`");
$this->doSQLcatch($pdo, "drop TABLE `%customers%`");
$this->doSQLcatch($pdo, "drop TABLE `%logo%`");
$this->doSQLcatch($pdo, "drop TABLE `%log%`");
}
@ -197,6 +206,11 @@ class Basedb {
$this->doSQL($pdo, "drop TABLE `%payment%`");
$this->doSQL($pdo, "drop TABLE `%logo%`");
$this->doSQL($pdo, "drop TABLE `%log%`");
$this->doSQL($pdo, "drop TABLE `%groupcustomer%`");
$this->doSQL($pdo, "drop TABLE `%vacations%`");
$this->doSQL($pdo, "drop TABLE `%groups%`");
$this->doSQL($pdo, "drop TABLE `%customers%`");
}
function createLogTable($pdo) {
@ -246,6 +260,7 @@ class Basedb {
`right_reservation` INT (1) NOT NULL,
`right_rating` INT (1) NOT NULL,
`right_changeprice` INT (1) NOT NULL,
`right_customers` INT (1) NOT NULL,
`lastmodule` VARCHAR ( 30 ) NULL,
`ordervolume` INT (2) NULL,
`language` INT (2) NULL,
@ -497,11 +512,80 @@ class Basedb {
`reason` VARCHAR ( 150 ) NULL,
`reservationid` VARCHAR( 30 ) NULL,
`guestinfo` VARCHAR( 30 ) NULL,
`intguestid` INT(10) NULL,
`intguestpaid` INT(2) NULL,
`signature`blob NULL,
FOREIGN KEY (closingid) REFERENCES %closing%(id),
FOREIGN KEY (paymentid) REFERENCES %payment%(id),
FOREIGN KEY (userid) REFERENCES %user%(id),
FOREIGN KEY (ref) REFERENCES %bill%(id)
FOREIGN KEY (ref) REFERENCES %bill%(id),
FOREIGN KEY (intguestid) REFERENCES %customers%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createCustomersTable($pdo)
{
$sql = "
CREATE TABLE `%customers%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR(50) NULL,
`address` VARCHAR(200) NULL,
`email` VARCHAR(50) NULL,
`phone` VARCHAR(30) NULL,
`mobil` VARCHAR(30) NULL,
`www` VARCHAR(50) NULL,
`remark` VARCHAR(500) NULL,
`created` DATETIME NULL,
`lastmodified` DATETIME NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createGroupsTable($pdo)
{
$sql = "
CREATE TABLE `%groups%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR(50) NULL,
`remark` VARCHAR(200) NULL,
`created` DATETIME NULL
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createGroupCustomerTable($pdo)
{
$sql = "
CREATE TABLE `%groupcustomer%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`groupid` INT(10) NOT NULL,
`customerid` INT(10) NOT NULL,
FOREIGN KEY (groupid) REFERENCES %groups%(id),
FOREIGN KEY (customerid) REFERENCES %customers%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
$stmt->execute();
}
function createVacationsTable($pdo)
{
$sql = "
CREATE TABLE `%vacations%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`customerid` INT(10) NOT NULL,
`checkin` DATE NULL,
`checkout` DATE NULL,
`room` VARCHAR(50) NULL,
`remark` VARCHAR(200) NULL,
FOREIGN KEY (customerid) REFERENCES %customers%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare($this->resolveTablenamesInSqlString($sql));
@ -621,6 +705,7 @@ class Basedb {
`right_reservation` INT (1) NOT NULL,
`right_rating` INT (1) NOT NULL,
`right_changeprice` INT (1) NOT NULL,
`right_customers` INT (1) NOT NULL,
`active` INT (2) NOT NULL,
FOREIGN KEY (userid) REFERENCES %user%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb
@ -785,6 +870,10 @@ class Basedb {
$this->createPriceLevelTable($pdo);
$this->createClosingTable($pdo);
$this->createRatingsTable($pdo);
$this->createCustomersTable($pdo);
$this->createGroupsTable($pdo);
$this->createGroupCustomerTable($pdo);
$this->createVacationsTable($pdo);
$this->createBillTable($pdo);
$this->createQueueTable($pdo);
$this->createBillProductsTable($pdo);
@ -799,7 +888,7 @@ class Basedb {
$this->createExtrasTable($pdo);
$this->createExtrasprodsTable($pdo);
$this->createQueueExtrasTable($pdo);
}
}
}
}
?>

View File

@ -17,14 +17,15 @@ define ( 'R_RAT', 1024);
define ( 'R_MAN', 2048);
define ( 'R_CP', 4096);
define ( 'R_CL', 8192);
define ( 'R_CUS', 16384);
class Userrights {
function setSession($isAdm,$rWait,$rKit,$rBar,$rSupply,$rPay,$rStat,$rBill,$rProd,$rRes,$rRat,$rChangePrice,$rMan,$rClos) {
function setSession($isAdm,$rWait,$rKit,$rBar,$rSupply,$rPay,$rStat,$rBill,$rProd,$rRes,$rRat,$rChangePrice,$rCustomers,$rMan,$rClos) {
$ret = R_ADM * ($isAdm ? 1:0) | R_WAI * ($rWait ? 1:0) | R_KIT * ($rKit ? 1:0) | R_BAR * ($rBar ? 1:0) | R_SUP * ($rSupply ? 1:0) | R_PAY * ($rPay ? 1:0);
$ret |= R_STA * ($rStat ? 1:0) | R_BIL * ($rBill ? 1:0) | R_PRO * ($rProd ? 1:0) | R_RES * ($rRes ? 1:0) | R_RAT * ($rRat ? 1:0) |
R_CP * ($rChangePrice ? 1:0) | R_MAN * (($rMan ? 1:0) | R_CL * (($rClos ? 1:0)));
R_CP * ($rChangePrice ? 1:0) | R_CUS * ($rCustomers ? 1:0) | R_MAN * (($rMan ? 1:0) | R_CL * (($rClos ? 1:0)));
$_SESSION['allrights'] = $ret;
}

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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<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.2.22">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.3.0">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -25,6 +25,8 @@
</head>
<body>
<style>
.schbtn {
@ -47,7 +49,7 @@
}
</style>
<body>
<script>
var RES_TITLE = ["Reservierung","Reservation","Reserva"];
@ -76,13 +78,18 @@ var RES_EMAIL_IMPOSSIBLE = ["(Eine Email-Reservierungsbestätigung ist erst nach
var RES_NOT_SEND = ["Nicht senden","Do not send","No enviar"];
var RES_SEND_EMAIL = ["Senden","Send","Enviar"];
var RES_TO = ["An","To","A"];
var RES_CUS_LABEL = ["Kunden aus Datenbank auswählen","Choose customer from data base","Elegir cliente del base de datos"];
var RES_CUSTOMERS = ["Kunden","Customers","Clientes"];
var RES_NO_CUS_FOUND = ["Kein Kunde gefunden","No customer found","Ningún cliente en base de datos"];
var RES_HINT_CUS_CHOOSE = ["Oder manuell eingeben:","or type in manually:","o insertar por teclado:"];
var lang = (-1);
var reservationnote = "";
var companyinfo = "";
var emailIsPossible = false;
var emailTemplate = "";
// REM* ther list of customers that are filtered by the server when the user types in the name in the search field
var filteredCustomers = [];
function setLanguage(language) {
lang = language;
@ -95,6 +102,7 @@ function setLanguage(language) {
$("#personstxt").html(RES_NO_PERSONS[lang]);
$("#durationtxt").html(RES_DURATION[lang]);
$("#nametxt").html(RES_NAME[lang]);
$("#customertxt").html(RES_CUS_LABEL[lang]);
$("#emailtxt").html(RES_EMAIL[lang]);
$("#teltxt").html(RES_TEL[lang]);
$("#remarktxt").html(RES_REMARK[lang]);
@ -119,6 +127,8 @@ function setLanguage(language) {
$("#sendemailtxtbtn").html(RES_SEND_EMAIL[lang]);
$("#sendemailtotxt").html(RES_TO[lang]);
$("#reshintchoosecustomer").html(RES_HINT_CUS_CHOOSE[lang]);
var langtxt = "de";
if (lang == 1) {
langtxt = "en";
@ -369,6 +379,7 @@ function insertReservations(answer) {
$("#dayschedule").trigger("create");
bindHourButton();
bindCustomerField();
bindChangeButton();
}
}
@ -410,6 +421,67 @@ function bindHourButton() {
});
}
function bindCustomerField() {
$("#customer").off("keyup").on("keyup", function (e) {
startCusSearch();
});
}
function startCusSearch() {
var cusdata = { search: $("#customer").val().trim() }
doAjax("POST","php/contenthandler.php?module=customers&command=getCustomersForReserv",cusdata, handleGetCustomerResult, "Kundenabfrage unmöglich",true);
}
function handleGetCustomerResult(answer) {
if (answer.status != "OK") {
alert("Error: " + answer.msg);
return;
}
filteredCustomers = answer.msg;
var txt = '<ul data-role="listview" id="cuslist" data-divider-theme="a" data-inset="true">';
txt += '<li data-role="list-divider" data-theme="b" data-role="heading">' + RES_CUSTOMERS[lang] + '</li>';
if (filteredCustomers.length === 0) {
txt += '<li id="nocusentry" data-theme="d" data-icon=""><a href="#">' + RES_NO_CUS_FOUND[lang] + '</a></li>';
} else {
for (var i=0;i<filteredCustomers.length;i++) {
var aCus = filteredCustomers[i];
txt += '<li id="cus_' + aCus.id + '" data-theme="f" data-icon="" class="cuslistelem"><a href="#">' + toHtml(aCus.summary) + '</a></li>';
}
}
txt += '</ul>';
$("#customerlist").html(txt);
$("#customerlist").trigger("create");
bindCusElem();
}
function bindCusElem() {
$(".cuslistelem").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
// REM* find customer in filteredCustomers
var cusid = this.id.split("_")[1];
for (var i=0;i<filteredCustomers.length;i++) {
var aCus = filteredCustomers[i];
if (aCus.id == cusid) {
// REM* found! -> copy customer values into the fields
$("#guestname").val(aCus.name);
$("#email").val(aCus.email);
$("#telno").val(aCus.phone);
// REM* now clean the search stuff
$("#customer").val("");
$("#customerlist").html('');
}
}
});
}
function txtToHtml(txt) {
return (txt.replace(/"/g, '&quot;').replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/'/g, "&#39;"));
}
@ -525,6 +597,8 @@ $(document).on("pageinit", "#res-page", function () {
var currentHour = String(new Date().getHours());
$("#timefieldse").val(currentHour);
$("#timefieldse").selectmenu('refresh', true);
$("#customer").val("");
});
$(document).on("pagebeforeshow", "#changeres-page", function () {
@ -632,6 +706,14 @@ $(document).on("pagebeforeshow", "#changeres-page", function () {
</div> <!-- fieldcontain for number of guests -->
<div data-role="fieldcontain">
<label for="customer" class="select" style="width: 100%;"><span id="customertxt">Kunde</span>: </label>
<input type="text" id="customer" value="" data-mini="true" placeholder="Name / Telefon"/>
</div> <!-- fieldcontain name -->
<div id="customerlist"></div>
<p id="reshintchoosecustomer">Oder manuell eingeben:
<p><div data-role="fieldcontain">
<label for="guestname" class="select" style="width: 100%;"><span id="nametxt">Name</span>: </label>
<input type="text" id="guestname" value="" data-mini="true" />
</div> <!-- fieldcontain name -->

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