OrderSprinter 1.5.2

This commit is contained in:
Geno 2020-11-19 23:11:33 +01:00
parent 37fdb1055d
commit 3cb517f30d
46 changed files with 1794 additions and 539 deletions

View File

@ -9,8 +9,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" href="css/gueststyle.css?v=1.5.1" /> <link rel="stylesheet" href="css/gueststyle.css?v=1.5.2" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.5.1" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css?v=1.5.2" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.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/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-1.11.3.min.js"></script> <script src="php/3rdparty/jquery-1.11.3.min.js"></script>
@ -105,7 +105,7 @@
<div data-role="footer" data-theme="b" id="thefooter1"> <div data-role="footer" data-theme="b" id="thefooter1">
<div class="ui-grid-a"> <div class="ui-grid-a">
<div class="ui-block-a">&nbsp;&nbsp;OrderSprinter</div> <div class="ui-block-a">&nbsp;&nbsp;OrderSprinter</div>
<div class="ui-block-b grid_right" id="versioninfo">1.5.1&nbsp;&nbsp;</div> <div class="ui-block-b grid_right" id="versioninfo">1.5.2&nbsp;&nbsp;</div>
</div><!-- /grid-a --> </div><!-- /grid-a -->
</div> </div>
</div> </div>

View File

@ -90,10 +90,10 @@ if (isset($_POST['code'])) {
} else { } else {
echo "<html>"; echo "<html>";
echo "<head><title>Installation Gastsystem</title>"; echo "<head><title>Installation Gastsystem</title>";
echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.5.1">'; echo '<link rel="stylesheet" type="text/css" href="css/gueststyle.css?v=1.5.2">';
echo "</head>"; echo "</head>";
echo "<body><div class=surround>"; echo "<body><div class=surround>";
echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.5.1</span><br><br>"; echo "<span class=headerline>Installation OrderSprinter-Gastsystem 1.5.2</span><br><br>";
echo "<form action='install.php' method='post'><input class=installfield name=code id=code type=text placeholder='Installationscode' />"; echo "<form action='install.php' method='post'><input class=installfield name=code id=code type=text placeholder='Installationscode' />";
echo "<br><input type=submit value='Installation starten' class=installbtn />"; echo "<br><input type=submit value='Installation starten' class=installbtn />";
echo "</form></div></html>"; echo "</form></div></html>";

View File

@ -85,7 +85,7 @@ class Installer {
} }
Database::dropTables($pdo); Database::dropTables($pdo);
Database::createEmptyTables($pdo, $prefix); Database::createEmptyTables($pdo, $prefix);
Database::setVersion($pdo,$prefix,"1.5.1"); Database::setVersion($pdo,$prefix,"1.5.2");
Database::setAccessPassword($pdo,$prefix,$adminpass); Database::setAccessPassword($pdo,$prefix,$adminpass);
Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour
return array("status" => "OK","msg" => "Installation successful"); 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 http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -13,8 +13,8 @@
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" /> <link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script> <script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script> <script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js?v=1.5.1"></script> <script src="utilities.js?v=1.5.2"></script>
<script src="kitchenbar.js?v=1.5.1"></script> <script src="kitchenbar.js?v=1.5.2"></script>
<style> <style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook #tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook
@ -109,7 +109,7 @@ function initializeEverything() {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="headerline" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="headerline" style="background-color:black;">
<h1>Bar <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1>Bar <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -464,7 +464,7 @@ $(document).on("pageinit", "#bill-page", function () {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="billtitletxt">Kassenbons</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="billtitletxt">Kassenbons</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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"><span id="modulstxt2">Hauptmenü</span></a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch"><span id="modulstxt2">Hauptmenü</span></a>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@ -125,7 +125,7 @@ $(document).on("pageinit", "#info-page", function () {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="reportttitletxt">Gäste</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="reportttitletxt">Gäste</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -214,7 +214,7 @@
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1>OrderSprinter <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1>OrderSprinter <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -123,8 +123,8 @@ function Groundplan() {
instance.rooms.forEach(function(aRoom,i) { instance.rooms.forEach(function(aRoom,i) {
roomdata[roomdata.length] = aRoom.exportObject(); roomdata[roomdata.length] = aRoom.exportObject();
}); });
var d = JSON.stringify(roomdata);
var data = { rooms: roomdata}; var data = { rooms:d};
doAjax("POST","php/contenthandler.php?module=roomtables&command=setRoomInfo",data,instance.responseFromServer.bind(instance),"Raumplan nicht änderbar",true); doAjax("POST","php/contenthandler.php?module=roomtables&command=setRoomInfo",data,instance.responseFromServer.bind(instance),"Raumplan nicht änderbar",true);
}); });
@ -399,6 +399,7 @@ function Room(jsonRoom) {
var htmlId = "#table_" + this.roomid + "_" + tableid + "_"; var htmlId = "#table_" + this.roomid + "_" + tableid + "_";
var tablename = $(htmlId + "tablename").val(); var tablename = $(htmlId + "tablename").val();
var name = $(htmlId + "name").val(); var name = $(htmlId + "name").val();
var area = $(htmlId + "area").val();
var code = $(htmlId + "code").val(); var code = $(htmlId + "code").val();
var active = $(htmlId + "active").val(); var active = $(htmlId + "active").val();
var allowoutorder = $(htmlId + "allowoutorder").val(); var allowoutorder = $(htmlId + "allowoutorder").val();
@ -406,6 +407,7 @@ function Room(jsonRoom) {
var table = this.getTableWithId(tableid); var table = this.getTableWithId(tableid);
table.tablename = tablename; table.tablename = tablename;
table.name = name; table.name = name;
table.area = area;
table.active = active; table.active = active;
table.code = code; table.code = code;
table.allowoutorder = allowoutorder; table.allowoutorder = allowoutorder;
@ -444,6 +446,7 @@ function Room(jsonRoom) {
var sort = this.getMaxSorting() + 1; var sort = this.getMaxSorting() + 1;
var tbltablename = $("#newtablename_" + this.roomid).val().trim(); var tbltablename = $("#newtablename_" + this.roomid).val().trim();
var tblname = $("#newname_" + this.roomid).val().trim(); var tblname = $("#newname_" + this.roomid).val().trim();
var tblarea = $("#newarea_" + this.roomid).val();
var tblactive = $("#newactive_" + this.roomid).val(); var tblactive = $("#newactive_" + this.roomid).val();
var tblcode = $("#newcode_" + this.roomid).val(); var tblcode = $("#newcode_" + this.roomid).val();
var tblallowoutorder = $("#newallowoutorder_" + this.roomid).val(); var tblallowoutorder = $("#newallowoutorder_" + this.roomid).val();
@ -455,6 +458,7 @@ function Room(jsonRoom) {
roomid: this.roomid, roomid: this.roomid,
tablename: tbltablename, tablename: tbltablename,
name: tblname, name: tblname,
area: tblarea,
active: tblactive, active: tblactive,
code: tblcode, code: tblcode,
allowoutorder: tblallowoutorder, allowoutorder: tblallowoutorder,
@ -494,9 +498,9 @@ function Room(jsonRoom) {
}; };
this.getMaxPropValue = function(startmax,property) { this.getMaxPropValue = function(startmax,property) {
var max = startmax; var max = parseInt(startmax);
for (var i=0;i<this.tables.length;i++) { for (var i=0;i<this.tables.length;i++) {
var maxValOfEntry = this.tables[i][property]; var maxValOfEntry = parseInt(this.tables[i][property]);
if (maxValOfEntry > max) { if (maxValOfEntry > max) {
max = maxValOfEntry; max = maxValOfEntry;
} }
@ -533,13 +537,14 @@ function Room(jsonRoom) {
}; };
} }
function Resttable(json,roomid,classname) { function Resttable(json,roomid,theClassname) {
this.id = ""; this.id = "";
this.roomid = ""; this.roomid = "";
this.tablename = ""; this.tablename = "";
this.name = ""; this.name = "";
this.area = 0;
this.active = 1; this.active = 1;
this.code = ""; this.code = "";
this.allowoutorder = ""; this.allowoutorder = "";
@ -547,15 +552,16 @@ function Resttable(json,roomid,classname) {
this.classname = ""; this.classname = "";
if (json != null) { if (json != null) {
this.id = json.id, this.id = json.id;
this.roomid = roomid, this.roomid = roomid;
this.tablename = json.tablename, this.tablename = json.tablename;
this.name = json.name, this.name = json.name;
this.active = json.active, this.area = json.area;
this.code = json.code, this.active = json.active;
this.allowoutorder = json.allowoutorder, this.code = json.code;
this.sorting = json.sorting, this.allowoutorder = json.allowoutorder;
this.classname = classname this.sorting = json.sorting;
this.classname = theClassname;
} }
this.render = function() { this.render = function() {
@ -564,6 +570,7 @@ function Resttable(json,roomid,classname) {
txt += "<tr><td>" + createGenericInputField(htmlId + "_tablename",this.tablename,"tablevalue_" + roomid); txt += "<tr><td>" + createGenericInputField(htmlId + "_tablename",this.tablename,"tablevalue_" + roomid);
txt += "<td>" + createGenericInputField(htmlId + "_name",this.name,"tablevalue_" + roomid); txt += "<td>" + createGenericInputField(htmlId + "_name",this.name,"tablevalue_" + roomid);
txt += "<td>" + createGenericSelectBox(htmlId + "_active",[{name: "Ja",value: 1},{name: "Nein", value: 0}],this.active,"tablevalue_" + roomid); txt += "<td>" + createGenericSelectBox(htmlId + "_active",[{name: "Ja",value: 1},{name: "Nein", value: 0}],this.active,"tablevalue_" + roomid);
txt += "<td>" + createGenericSelectBox(htmlId + "_area",this.createAreaValueArr(),this.area,"tablevalue_" + roomid);
txt += "<td>" + createGenericInputField(htmlId + "_code",this.code,"tablevalue_" + roomid); txt += "<td>" + createGenericInputField(htmlId + "_code",this.code,"tablevalue_" + roomid);
txt += "<td>" + createGenericSelectBox(htmlId + "_allowoutorder",[{name: "Ja",value: 1},{name: "Nein", value: 0}],this.allowoutorder,"tablevalue_" + roomid); txt += "<td>" + createGenericSelectBox(htmlId + "_allowoutorder",[{name: "Ja",value: 1},{name: "Nein", value: 0}],this.allowoutorder,"tablevalue_" + roomid);
txt += "<td style='text-align:center;'><img id='" + htmlId + "_up' class='" + this.classname + "_up' src='img/higher.png' />"; txt += "<td style='text-align:center;'><img id='" + htmlId + "_up' class='" + this.classname + "_up' src='img/higher.png' />";
@ -572,8 +579,18 @@ function Resttable(json,roomid,classname) {
return txt; return txt;
}; };
this.createAreaValueArr = function() {
var vals = [];
vals[vals.length] = {name: ' ', value: 0};
for (var i=0;i<26;i++) {
var character = String.fromCharCode(65 + i);
vals[vals.length] = {name: character, value: (i+1)};
}
return vals;
};
this.renderHeader = function() { this.renderHeader = function() {
var txt = "<tr><th>Tischname (intern)<th>Tischname (extern)<th>Aktiv<th>Code<th>Gastbestellung<th>" + GEN_DIRECTION[lang] + "<th>" + GEN_DEL[lang] + "</tr>"; var txt = "<tr><th>Tischname (intern)<th>Tischname (extern)<th>Aktiv<th>Bereich<th>Code<th>Gastbestellung<th>" + GEN_DIRECTION[lang] + "<th>" + GEN_DEL[lang] + "</tr>";
return txt; return txt;
}; };
@ -582,6 +599,7 @@ function Resttable(json,roomid,classname) {
txt += "<td>" + createGenericInputField("newtablename_" + id,""); txt += "<td>" + createGenericInputField("newtablename_" + id,"");
txt += "<td>" + createGenericInputField("newname_" + id,""); txt += "<td>" + createGenericInputField("newname_" + id,"");
txt += "<td>" + createGenericSelectBox("newactive_" + id,[{name: "Ja",value: 1},{name: "Nein", value: 0}],1); txt += "<td>" + createGenericSelectBox("newactive_" + id,[{name: "Ja",value: 1},{name: "Nein", value: 0}],1);
txt += "<td>" + createGenericSelectBox("newarea_" + id,this.createAreaValueArr(),0);
txt += "<td>" + createGenericInputField("newcode_" + id,""); txt += "<td>" + createGenericInputField("newcode_" + id,"");
txt += "<td>" + createGenericSelectBox("newallowoutorder_" + id,[{name: "Ja",value: 1},{name: "Nein", value: 0}],0); txt += "<td>" + createGenericSelectBox("newallowoutorder_" + id,[{name: "Ja",value: 1},{name: "Nein", value: 0}],0);
txt += "<td>&nbsp;"; txt += "<td>&nbsp;";
@ -595,6 +613,7 @@ function Resttable(json,roomid,classname) {
roomid: this.roomid, roomid: this.roomid,
tablename: this.tablename, tablename: this.tablename,
name: this.name, name: this.name,
area: this.area,
active: this.active, active: this.active,
code: this.code, code: this.code,
allowoutorder: this.allowoutorder, allowoutorder: this.allowoutorder,

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />

View File

@ -39,7 +39,7 @@ $(document).on("pageinit", "#help-page", function () {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1>OrderSprinter Hilfe <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1>OrderSprinter Hilfe <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

BIN
webapp/img/tasksstatus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

View File

@ -9,8 +9,8 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.5.2">
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" /> <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/orderstyle/jquery.mobile.icons.min.css" />
@ -229,7 +229,7 @@ function handleResultOfInstallCheck(is_installed) {
if (is_installed == "Yes") { if (is_installed == "Yes") {
useInstallation(); useInstallation();
} else { } else {
setTimeout(function(){document.location.href = "install.html?v=1.5.1"},500); setTimeout(function(){document.location.href = "install.html?v=1.5.2"},500);
} }
} }

View File

@ -727,7 +727,7 @@ $(document).ready(function() {
<tr id=updateline> <tr id=updateline>
<td>&nbsp;</td> <td>&nbsp;</td>
<td align=center> <td align=center>
<button id="updatebtn">Update -> 1.5.1</button> <button id="updatebtn">Update -> 1.5.2</button>
<span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span> <span id="updateinprogresstxt" style="display:none;">Update... bitte warten.</span>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>

View File

@ -413,7 +413,7 @@ $zones[] = $timezone_identifiers[$i];
echo json_encode($zones); echo json_encode($zones);
} else if ($command == 'update') { } else if ($command == 'update') {
set_time_limit(60*30); set_time_limit(60*30);
$installerVersion = "1.5.1"; $installerVersion = "1.5.2";
$admin = new InstallAdmin(); $admin = new InstallAdmin();
$pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); $pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']);

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -13,8 +13,8 @@
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" /> <link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-2.0.3.min.js"></script> <script src="php/3rdparty/jquery-2.0.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script> <script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
<script src="utilities.js?v=1.5.1"></script> <script src="utilities.js?v=1.5.2"></script>
<script src="kitchenbar.js?v=1.5.1"></script> <script src="kitchenbar.js?v=1.5.2"></script>
<style> <style>
#tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook #tableWithEntriesToCook,#tableWithCookedEntries,#headertableToCook
@ -111,7 +111,7 @@ function initializeEverything() {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="headerline" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="headerline" style="background-color:black;">
<h1><span id="moduleheadline">Küche</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="moduleheadline">Küche</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -13,10 +13,10 @@
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" /> <link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-1.11.3.min.js"></script> <script src="php/3rdparty/jquery-1.11.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script> <script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
<script src="utilities.js"></script> <script src="utilities.js?v=1.5.2"></script>
<script src="elements/tablemap.js"></script> <script src="elements/tablemap.js?v=1.5.2"></script>
<script src="elements/roommap.js"></script> <script src="elements/roommap.js?v=1.5.2"></script>
<script src="elements/groundplan.js"></script> <script src="elements/groundplan.js?v=1.5.2"></script>
<link href="php/3rdparty/hayageek_uploadfile.css" rel="stylesheet"> <link href="php/3rdparty/hayageek_uploadfile.css" rel="stylesheet">
<script src="php/3rdparty/hayageek_jquery_uploadfile.js"></script> <script src="php/3rdparty/hayageek_jquery_uploadfile.js"></script>
@ -58,6 +58,7 @@ var MAN_NEW_ROLE = ["Neue Rolle","New Role","Nuevo Derechos"];
var MAN_ROLE = ["Rolle","Role","Derechos"]; var MAN_ROLE = ["Rolle","Role","Derechos"];
var MAN_ROLE_NAME = ["Name","Name","Nombre"]; var MAN_ROLE_NAME = ["Name","Name","Nombre"];
var MAN_ROLES = ["Rollen","Rolen","Derechos"]; var MAN_ROLES = ["Rollen","Rolen","Derechos"];
var MAN_AREA = ["Tischbereich","Table area","Region de las mesas"];
var MAN_ADMIN = ["Administrator","Administrator","Administrador"]; var MAN_ADMIN = ["Administrator","Administrator","Administrador"];
var MAN_WAITER = ["Kellner","Waiter","Camarero"]; var MAN_WAITER = ["Kellner","Waiter","Camarero"];
var MAN_KITCHEN = ["Küche","Kitchen","Cocina"]; var MAN_KITCHEN = ["Küche","Kitchen","Cocina"];
@ -75,7 +76,10 @@ var MAN_MANAGER = ["Verwaltung","Administration","Administración"];
var MAN_CLOSINGRIGHT = ["Tageserfassung","Closing","Cerrar día"]; var MAN_CLOSINGRIGHT = ["Tageserfassung","Closing","Cerrar día"];
var MAN_DASHRIGHT = ["Dashboard","Dashboard","Dashboard"]; var MAN_DASHRIGHT = ["Dashboard","Dashboard","Dashboard"];
var MAN_TIMETRACKINGRIGHT = ["Zeiterfassung","Time Tracking","Tiempos de Trabajo"]; var MAN_TIMETRACKINGRIGHT = ["Zeiterfassung","Time Tracking","Tiempos de Trabajo"];
var MAN_TASKS = ["Aufgaben:","Tasks:","Tareas:"];
var MAN_TIMEMANAGERRIGHT = ["Zeitmanagement","Time management","Administrar Tiempos de Trabajo"]; var MAN_TIMEMANAGERRIGHT = ["Zeitmanagement","Time management","Administrar Tiempos de Trabajo"];
var MAN_TASKSRIGHT = ["Aufgaben","Tasks","Tareas"];
var MAN_TASKSMANAGERRIGHT = ["Aufgabenmanagement","Tasks management","Administrar tareas"];
var MAN_USER_NAME = ["Benutzername","User name","Nombre de usario"]; var MAN_USER_NAME = ["Benutzername","User name","Nombre de usario"];
var MAN_USER_PASS = ["Passwort","Password","Contraseña"]; var MAN_USER_PASS = ["Passwort","Password","Contraseña"];
var MAN_YES = ["Ja","Yes","Si"]; var MAN_YES = ["Ja","Yes","Si"];
@ -353,6 +357,9 @@ var MAN_RETURNTOORDER = ["Rücksprung Bestellung","Go back to order","Volver a o
var MAN_BEEP_COOKED = ["Signalton, wenn neues Produkt serviert werden kann","Audio signal if new product can be served","Señal audio si un producto nuevo esta cocinado"]; var MAN_BEEP_COOKED = ["Signalton, wenn neues Produkt serviert werden kann","Audio signal if new product can be served","Señal audio si un producto nuevo esta cocinado"];
var MAN_BEEP_ORDERED = ["Signalton in Küchen-/Baransicht","Audio signal in kitchen and bar view","Señal audio si un producto nuevo tiene que ser preparado"]; var MAN_BEEP_ORDERED = ["Signalton in Küchen-/Baransicht","Audio signal in kitchen and bar view","Señal audio si un producto nuevo tiene que ser preparado"];
var MAN_DEFAULTVIEW = ["Vorauswahl","Preselection View","Vista estandardo"]; var MAN_DEFAULTVIEW = ["Vorauswahl","Preselection View","Vista estandardo"];
var MAN_TASK_ALLASSIGN = ["Aufgabenzuweisung an andere Benutzer","Task assignment to other users","Asignar tareas a otras personas"];
var MAN_TASK_OWNEREMPTY = ["Benutzer für Auffüllen-Aufgabe","User for refill task","Usario de tarea de sustituir productos"];
var MAN_TASK_IF_EMPTY = ["Aufgabe bei leerem Warenbestand erstellen","Create task before empty inventory","Crear tarea si no ya hay productos"];
var MAN_CLOSSHOWCI = ["Betriebsinfo auf Tagesabschlussbon","Print company info on closing receipt","Imprimir info del café en el cerramiento"]; var MAN_CLOSSHOWCI = ["Betriebsinfo auf Tagesabschlussbon","Print company info on closing receipt","Imprimir info del café en el cerramiento"];
var MAN_CLOSSHOWPAYTAXES = ["Individuelle Steuerbeträge pro Zahlungsweg auf Tagesabschluss","Print each tax per payment way on closing","Imprimir cada impuesto por cada camino de pagar en el cerramiento"]; var MAN_CLOSSHOWPAYTAXES = ["Individuelle Steuerbeträge pro Zahlungsweg auf Tagesabschluss","Print each tax per payment way on closing","Imprimir cada impuesto por cada camino de pagar en el cerramiento"];
var MAN_CLOSSHOWPRODS = ["Produktstatistik auf Tagesabschlussbon","Product statistics on closung","Statistica de productos en el cerramiento"]; var MAN_CLOSSHOWPRODS = ["Produktstatistik auf Tagesabschlussbon","Product statistics on closung","Statistica de productos en el cerramiento"];
@ -420,9 +427,10 @@ var MAN_DAYNAMES = [
var MAN_CATEGORY = ["Kategorie","Category","Categoria"]; var MAN_CATEGORY = ["Kategorie","Category","Categoria"];
var MAN_FOOD_CAT = ["Speisen","Food","Comidas"]; var MAN_FOOD_CAT = ["Speisen","Food","Comidas"];
var MAN_DRINKS_CAT = ["Getränke","Drinks","Bebidas"]; var MAN_DRINKS_CAT = ["Getränke","Drinks","Bebidas"];
var MAN_CHANGE_ROLE_AREA = ["Rolle und Tischbereich ändern","Change role and area","Cambiar region y role"];
var lang = 0; var lang = 0;
var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1,0,1,0,0,1,1, 1,1,1,1,1,1,1,1,1,1, 1,2,3, 1,0, 1,0,1, 1,1,0,0, 0,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,1, 1,1,1,1,1,1,1,1,1,1, 1,2,3, 1,0, 1,0,1, 1,1,0,0, 0,0,0, 0,0,0];
var numberOfClosings = 0; var numberOfClosings = 0;
@ -433,6 +441,7 @@ var adminIsLoggedIn = false;
var managerIsLoggedIn = false; var managerIsLoggedIn = false;
var defaulttmp = ''; var defaulttmp = '';
var rolesOnceExtended = false; var rolesOnceExtended = false;
var activeusers = [];
var generalValuesSettings = [ var generalValuesSettings = [
["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"], ["usstval","MwSt","i",2,"Mehrwertsteuer ist kein Zahlenwert"],
@ -542,7 +551,10 @@ var generalValuesSettings = [
["forceprint",MAN_FORCE_PRINT[lang],"s",46], ["forceprint",MAN_FORCE_PRINT[lang],"s",46],
["printextras",MAN_PRINT_EXTRAS[lang],"s",47], ["printextras",MAN_PRINT_EXTRAS[lang],"s",47],
["beepordered",MAN_BEEP_ORDERED[lang],"s",48], ["beepordered",MAN_BEEP_ORDERED[lang],"s",48],
["defaultview",MAN_DEFAULTVIEW[lang],"s",49] ["defaultview",MAN_DEFAULTVIEW[lang],"s",49],
["taskallassign",MAN_TASK_ALLASSIGN[lang],"s",50],
["taskownerempty",MAN_TASK_OWNEREMPTY[lang],"s",51],
["taskifempty",MAN_TASK_IF_EMPTY[lang],"s",52]
]; ];
var predef = ""; var predef = "";
@ -677,6 +689,7 @@ function setLanguage(l) {
$("#generalsectiontxt").html(MAN_GENSECTION_TXT[l]); $("#generalsectiontxt").html(MAN_GENSECTION_TXT[l]);
$("#mobilviewsectiontxt").html(MAN_MOBILSECTION_TXT[l]); $("#mobilviewsectiontxt").html(MAN_MOBILSECTION_TXT[l]);
$("#timetrackingtxt").html(MAN_TIMETRACKING[l]); $("#timetrackingtxt").html(MAN_TIMETRACKING[l]);
$("#tasktxt").html(MAN_TASKS[l]);
$("#desktopviewsectiontxt").html(MAN_DESKTOP_SECTION_TXT[l]); $("#desktopviewsectiontxt").html(MAN_DESKTOP_SECTION_TXT[l]);
$("#specialsettingssectiontxt").html(MAN_SPECIAL_SETTINGS_TXT[l]); $("#specialsettingssectiontxt").html(MAN_SPECIAL_SETTINGS_TXT[l]);
$("#guestsystemsectiontxt").html(MAN_GUEST_SYSTEM_TXT[l]); $("#guestsystemsectiontxt").html(MAN_GUEST_SYSTEM_TXT[l]);
@ -753,7 +766,7 @@ function getSpeisekarte() {
} }
function getGeneralConfigItems() { function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItems", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten",true); doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItemsAndUsers", null, insertGeneralConfigItems, "Fehler Konfigurationsdaten",true);
} }
function saveValueIntoForm(aValue, decpoint, formid) { function saveValueIntoForm(aValue, decpoint, formid) {
@ -777,6 +790,7 @@ function insertGeneralConfigItems(configResult) {
saveValueIntoForm(values.taxaustriaspecial,decpoint,"#taxaustriaspecialval"); saveValueIntoForm(values.taxaustriaspecial,decpoint,"#taxaustriaspecialval");
version = values.version; version = values.version;
activeusers = values.activeusers;
$("#companyinfo").val(values.companyinfo); $("#companyinfo").val(values.companyinfo);
$("#hosttext").val(values.hosttext); $("#hosttext").val(values.hosttext);
@ -808,6 +822,11 @@ function insertGeneralConfigItems(configResult) {
$("#partOfAddRecPrinter").html(createAddRecPrinterPart(values.addreceipttoprinter)); $("#partOfAddRecPrinter").html(createAddRecPrinterPart(values.addreceipttoprinter));
$("#partOfWorkflowConfig").html(createWorkflowConfigPart(values.workflowconfig)); $("#partOfWorkflowConfig").html(createWorkflowConfigPart(values.workflowconfig));
$("#partOfDefaultView").html(createDefaultViewPart(values.defaultview)); $("#partOfDefaultView").html(createDefaultViewPart(values.defaultview));
$("#partOfTaskallasssign").html(createYesNo("taskallassign",MAN_TASK_ALLASSIGN, values.taskallassign));
$("#partOfTaskifempty").html(createYesNo("taskifempty",MAN_TASK_IF_EMPTY, values.taskifempty));
$("#partOfTaskownerempty").html(createTaskOwnerEmptyPart(values.taskownerempty));
$("#partOfDashslot1").html(createDashslotPart(1,values.dashslot1)); $("#partOfDashslot1").html(createDashslotPart(1,values.dashslot1));
$("#partOfDashslot2").html(createDashslotPart(2,values.dashslot2)); $("#partOfDashslot2").html(createDashslotPart(2,values.dashslot2));
$("#partOfDashslot3").html(createDashslotPart(3,values.dashslot3)); $("#partOfDashslot3").html(createDashslotPart(3,values.dashslot3));
@ -930,6 +949,10 @@ function insertGeneralConfigItems(configResult) {
generalVals[48] = values.beepordered; generalVals[48] = values.beepordered;
generalVals[49] = values.defaultview; generalVals[49] = values.defaultview;
generalVals[50] = values.taskallassign;
generalVals[51] = values.taskownerempty;
generalVals[52] = values.taskifempty;
defaulttmp = values.defaulttmp; defaulttmp = values.defaulttmp;
$("#smtphost").val(values.smtphost); $("#smtphost").val(values.smtphost);
@ -1196,6 +1219,23 @@ function createDefaultViewPart(item) {
return html; return html;
} }
function createTaskOwnerEmptyPart(item) {
var allValues = [];
allValues[0] = {
id:0,
text: "System"
};
for (var i=0;i<activeusers.length;i++) {
var anActiveUser = activeusers[i];
allValues[allValues.length] = {
id:anActiveUser.id,
text:anActiveUser.username
};
}
var txt = createLabelWithOption("","taskownerempty","",MAN_TASK_OWNEREMPTY[lang],allValues,item);
return txt;
}
function createSMTPAuth(smtpauth) { function createSMTPAuth(smtpauth) {
var html = '<div class="ui-field-contain">'; var html = '<div class="ui-field-contain">';
html += '<label for="smtpauth">' + MAN_SMTPAUTH[lang] + ':</label>'; html += '<label for="smtpauth">' + MAN_SMTPAUTH[lang] + ':</label>';
@ -1314,7 +1354,7 @@ function initRestoreFileUpload() {
} else { } else {
alert("Import war erfolgreich."); alert("Import war erfolgreich.");
setTimeout(function(){ setTimeout(function(){
document.location.href = "index.html?v=1.5.1"; document.location.href = "index.html?v=1.5.2";
},250); },250);
} }
}, },
@ -1854,9 +1894,9 @@ function handleUpdateCheckResult(answer) {
var millis=getMillis(); var millis=getMillis();
setTimeout(function(){ setTimeout(function(){
document.location.href = "install.html?v=1.5.1&mode=onlyupdate&n=" + millis; document.location.href = "install.html?v=1.5.2&mode=onlyupdate&n=" + millis;
},250); },250);
document.location.href = "install.html?v=1.5.1&mode=onlyupdate&n=" + millis; document.location.href = "install.html?v=1.5.2&mode=onlyupdate&n=" + millis;
} }
function handleUpdateReplace(answer) { function handleUpdateReplace(answer) {
@ -2009,6 +2049,15 @@ function bindSelectionsWithActions() {
$("#configpart").trigger("create"); $("#configpart").trigger("create");
bindSelectionsWithActions(); bindSelectionsWithActions();
}); });
$("#taskownerempty").off("change").on("change", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var newSel = $("#taskownerempty").find(":selected").val();
$("#partOfTaskownerempty").html(createTaskOwnerEmptyPart(newSel));
setVisibilityDueToWorkflow();
$("#configpart").trigger("create");
bindSelectionsWithActions();
});
$("#dashslot1").off("change").on("change", function (e) { $("#dashslot1").off("change").on("change", function (e) {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
e.preventDefault(); e.preventDefault();
@ -2389,15 +2438,6 @@ function getClosings(month,year) {
doAjax("GET","php/contenthandler.php?module=closing&command=getClosings",data,displayReceivedClosings,"Keine Abschluesse erhalten",true); doAjax("GET","php/contenthandler.php?module=closing&command=getClosings",data,displayReceivedClosings,"Keine Abschluesse erhalten",true);
} }
function createLabelWithTextField(aLabel,displayedName,defaultText) {
var labelid = aLabel;
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<input type="text" id="' + labelid + '" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;color:black;" />';
text += '</div>';
return text;
}
function createButtonWithTextField(id,displayedName,defaultText) { function createButtonWithTextField(id,displayedName,defaultText) {
var text = '<div class="ui-field-contain">'; var text = '<div class="ui-field-contain">';
text += '<input id="userpassword_' + id + '" type="text" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;color:black;" />'; text += '<input id="userpassword_' + id + '" type="text" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;color:black;" />';
@ -2406,26 +2446,6 @@ function createButtonWithTextField(id,displayedName,defaultText) {
return text; return text;
} }
function createLabelWithOption(prefix,id,aLabel,displayedName,allValues,theValue) {
var labelid = prefix + aLabel + "_" + id;
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<select name="' + labelid + '" id="' + labelid + '" data-theme="f">';
for (var i=0;i<allValues.length;i++) {
var aValue = allValues[i];
if (aValue.id == theValue) {
text += '<option value="' + aValue.id + '" selected>' + aValue.text + '</option>';
} else {
text += '<option value="' + aValue.id + '" >' + aValue.text + '</option>';
}
}
text += '</select></div>';
return text;
}
function createYesNoArr() { function createYesNoArr() {
var yesnoarr = [ var yesnoarr = [
{id:1,text:MAN_YES[lang]}, {id:1,text:MAN_YES[lang]},
@ -2446,12 +2466,23 @@ function createRolesArr(roles) {
return rolesArr; return rolesArr;
} }
function createTableAreaValueArr() {
var vals = [];
vals[vals.length] = {text: ' ', id: 0};
for (var i=0;i<26;i++) {
var character = String.fromCharCode(65 + i);
vals[vals.length] = {text: character, id: (i+1)};
}
return vals;
};
/* /*
* Creates a table for a user with the info about the user, i.e. * Creates a table for a user with the info about the user, i.e.
* the username and the rights that the user has to work in the * the username and the rights that the user has to work in the
* various modules. * various modules.
*/ */
function createCollapsibeOfUser(id,username,roleid,forNewUser,roles) { function createCollapsibeOfUser(id,username,roleid,area,forNewUser,roles) {
var collapsiblePart = '<div data-role="collapsible" id="userdef_' + id + '"'; var collapsiblePart = '<div data-role="collapsible" id="userdef_' + id + '"';
if (forNewUser) { if (forNewUser) {
collapsiblePart += ' data-theme="d" data-content-theme="d">'; collapsiblePart += ' data-theme="d" data-content-theme="d">';
@ -2468,11 +2499,12 @@ function createCollapsibeOfUser(id,username,roleid,forNewUser,roles) {
var rolesArr = createRolesArr(roles); var rolesArr = createRolesArr(roles);
collapsiblePart += createLabelWithOption("userlabel_",id,"userrole",MAN_ROLE[lang],rolesArr,roleid); collapsiblePart += createLabelWithOption("userlabel_",id,"userrole",MAN_ROLE[lang],rolesArr,roleid);
collapsiblePart += createLabelWithOption("userlabel_",id,"userarea",MAN_AREA[lang],createTableAreaValueArr(),area);
if (forNewUser) { if (forNewUser) {
collapsiblePart += '<button data-theme="f" data-icon="plus" id="CreateNewUser">' + MAN_CREATE[lang] + '</button>'; collapsiblePart += '<button data-theme="f" data-icon="plus" id="CreateNewUser">' + MAN_CREATE[lang] + '</button>';
} else { } else {
collapsiblePart += '<button data-theme="f" data-icon="check" class="userUpdateButton" id="userupdatebtn_' + id + '">Rolle ändern</button>'; collapsiblePart += '<button data-theme="f" data-icon="check" class="userUpdateButton" id="userupdatebtn_' + id + '">' + MAN_CHANGE_ROLE_AREA[lang] + '</button>';
collapsiblePart += createButtonWithTextField("changepasswordbtn_"+id, "Passwort ändern", "Anderes Passwort"); collapsiblePart += createButtonWithTextField("changepasswordbtn_"+id, "Passwort ändern", "Anderes Passwort");
collapsiblePart += '<button data-theme="d" data-icon="minus" class="userDeleteButton" id="deleteuserbtn_' + id + '">Löschen</button>'; collapsiblePart += '<button data-theme="d" data-icon="minus" class="userDeleteButton" id="deleteuserbtn_' + id + '">Löschen</button>';
} }
@ -2481,7 +2513,7 @@ function createCollapsibeOfUser(id,username,roleid,forNewUser,roles) {
return collapsiblePart; return collapsiblePart;
} }
function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rTimetracking, rTimeManager, rManager,forNewRole) { function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rPay,rStat,rBill,rProd,rReservation,rRating,rChangeprice,rCustomers,rClosing, rDash, rTimetracking, rTimeManager, rTasks, rTasksManagement, rManager,forNewRole) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"'; var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
if (forNewRole) { if (forNewRole) {
collapsiblePart += ' data-theme="d" data-content-theme="d">'; collapsiblePart += ' data-theme="d" data-content-theme="d">';
@ -2511,6 +2543,9 @@ function createCollapsibeOfRole(id,name,isAdmin,rWaiter,rKitchen,rBar,rSupply,rP
collapsiblePart += createLabelWithOption("rolelabel_",id,"dash",MAN_DASHRIGHT[lang],possibleValues,rDash); collapsiblePart += createLabelWithOption("rolelabel_",id,"dash",MAN_DASHRIGHT[lang],possibleValues,rDash);
collapsiblePart += createLabelWithOption("rolelabel_",id,"timetracking",MAN_TIMETRACKINGRIGHT[lang],possibleValues,rTimetracking); collapsiblePart += createLabelWithOption("rolelabel_",id,"timetracking",MAN_TIMETRACKINGRIGHT[lang],possibleValues,rTimetracking);
collapsiblePart += createLabelWithOption("rolelabel_",id,"timemanager",MAN_TIMEMANAGERRIGHT[lang],possibleValues,rTimeManager); collapsiblePart += createLabelWithOption("rolelabel_",id,"timemanager",MAN_TIMEMANAGERRIGHT[lang],possibleValues,rTimeManager);
collapsiblePart += createLabelWithOption("rolelabel_",id,"tasks",MAN_TASKSRIGHT[lang],possibleValues,rTasks);
collapsiblePart += createLabelWithOption("rolelabel_",id,"tasksmanagement",MAN_TASKSMANAGERRIGHT[lang],possibleValues,rTasksManagement);
collapsiblePart += createLabelWithOption("rolelabel_",id,"manager",MAN_MANAGER[lang],possibleValues,rManager); collapsiblePart += createLabelWithOption("rolelabel_",id,"manager",MAN_MANAGER[lang],possibleValues,rManager);
if (forNewRole) { if (forNewRole) {
@ -2537,6 +2572,7 @@ function fillUserListIntoGui(answer) {
"userid_" + userid, "userid_" + userid,
username, username,
aUser.roleid, aUser.roleid,
aUser.tablearea,
false, false,
roles roles
); );
@ -2545,6 +2581,7 @@ function fillUserListIntoGui(answer) {
"userid_newuser_newuser", "userid_newuser_newuser",
MAN_NEW_USER[lang], MAN_NEW_USER[lang],
0, 0,
0,
true,roles); true,roles);
$("#userlist").html(userPart); $("#userlist").html(userPart);
@ -2588,13 +2625,15 @@ function fillRoleListIntoGui(answer) {
aRole.right_dash, aRole.right_dash,
aRole.right_timetracking, aRole.right_timetracking,
aRole.right_timemanager, aRole.right_timemanager,
aRole.right_tasks,
aRole.right_tasksmanagement,
aRole.right_manager, aRole.right_manager,
false false
); );
} }
rolesPart += createCollapsibeOfRole( rolesPart += createCollapsibeOfRole(
"roleid_newrole",MAN_NEW_ROLE[lang], "roleid_newrole",MAN_NEW_ROLE[lang],
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true); 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,true);
$("#rolescontentpart").html(rolesPart); $("#rolescontentpart").html(rolesPart);
$("#rolescontentpart").trigger("create"); $("#rolescontentpart").trigger("create");
@ -2641,15 +2680,17 @@ function collectRoleInfo(roleid) {
["rStat", "#rolelabel_stat", true,true], ["rStat", "#rolelabel_stat", true,true],
["rBill", "#rolelabel_bill", true,true], ["rBill", "#rolelabel_bill", true,true],
["rProducts", "#rolelabel_products", true,true], ["rProducts", "#rolelabel_products", true,true],
["rReservation","#rolelabel_reservation", true,true], ["rReservation", "#rolelabel_reservation", true,true],
["rRating", "#rolelabel_rating", true,true], ["rRating", "#rolelabel_rating", true,true],
["rChangeprice","#rolelabel_changeprice", true,true], ["rChangeprice", "#rolelabel_changeprice", true,true],
["rCustomers", "#rolelabel_customers", true,true], ["rCustomers", "#rolelabel_customers", true,true],
["rManager", "#rolelabel_manager", true,true], ["rManager", "#rolelabel_manager", true,true],
["rClosing", "#rolelabel_closingright", true,true], ["rClosing", "#rolelabel_closingright", true,true],
["rDash", "#rolelabel_dash", true,true], ["rDash", "#rolelabel_dash", true,true],
["rTimetracking","#rolelabel_timetracking",true,true], ["rTimetracking", "#rolelabel_timetracking", true,true],
["rTimemanager", "#rolelabel_timemanager", true,true] ["rTimemanager", "#rolelabel_timemanager", true,true],
["rTasks", "#rolelabel_tasks", true,true],
["rTasksmanagement", "#rolelabel_tasksmanagement",true,true]
]; ];
var data = {}; var data = {};
@ -2707,11 +2748,13 @@ function dynamicUserBinding() {
var username = $("#userlabel_username_new").val(); var username = $("#userlabel_username_new").val();
var password = $("#userlabel_password_new").val(); var password = $("#userlabel_password_new").val();
var roleid = $("#userlabel_userrole_userid_newuser_newuser").val(); var roleid = $("#userlabel_userrole_userid_newuser_newuser").val();
var area = $("#userlabel_userarea_userid_newuser_newuser").val();
var data = { var data = {
name: username.trim(), name: username.trim(),
password: password, password: password,
roleid: roleid roleid: roleid,
area: area
}; };
if ((data["name"].length == 0) || (data["password"].length == 0)) { if ((data["name"].length == 0) || (data["password"].length == 0)) {
@ -2727,9 +2770,11 @@ function dynamicUserBinding() {
var userid = this.id.split("_")[2]; var userid = this.id.split("_")[2];
var roleid = $("#userlabel_userrole_userid_" + userid).val(); var roleid = $("#userlabel_userrole_userid_" + userid).val();
var area = $("#userlabel_userarea_userid_" + userid).val();
var data = { var data = {
userid: userid, userid: userid,
roleid: roleid roleid: roleid,
area: area
}; };
doAjax("POST","php/contenthandler.php?module=admin&command=updateUser",data,askAndFillUserListNoData,"Benutzerdaten"); doAjax("POST","php/contenthandler.php?module=admin&command=updateUser",data,askAndFillUserListNoData,"Benutzerdaten");
@ -2746,6 +2791,8 @@ function dynamicUserBinding() {
}); });
$(".changepassword").off("click").on("click", function (e) { $(".changepassword").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var userid = this.id.split("_")[3]; var userid = this.id.split("_")[3];
var newPassword = $("#userpassword_changepasswordbtn_userid_" + userid).val(); var newPassword = $("#userpassword_changepasswordbtn_userid_" + userid).val();
@ -3057,49 +3104,6 @@ function handleGoLive(answer) {
} }
} }
function roomfield_apply() {
var n = $("#maxrooms_val").val();
var m = $("#maxtables_val").val();
try {
n = parseInt(n);
m = parseInt(m);
if ((n>0) && (n<30) && (m>0) && (m<30)) {
var room_index, table_index, r_id, t_id;
var rooms = [];
for (room_index = 0; room_index < n; room_index++) {
r_id = "#r_" + room_index.toString();
var roominfo = [];
var roomname = $(r_id).val();
var roomabbr = $("#rabbr_" + room_index).val();
var selectedPrinter = $("#roomprinter_" + room_index).find(":selected").val();
if ((roomname.replace(/ /,"")) != "") {
roominfo[0] = roomname;
roominfo[1] = roomabbr.trim();
roominfo[2] = selectedPrinter;
var tablesOfRoom = [];
for (table_index = 0; table_index < m; table_index++) {
t_id = "#t_" + room_index.toString() + "_" + table_index.toString();
var aTableName = $(t_id).val();
if ((aTableName.replace(/ /,"")) != "") {
tablesOfRoom.push(aTableName);
}
}
if (tablesOfRoom.length > 0) {
roominfo[3] = tablesOfRoom;
} else {
continue;
}
rooms.push(roominfo);
}
}
doAjax("POST","php/contenthandler.php?module=roomtables&command=setRoomInfo",{rooms:rooms},askForCurrentRoomField,"Raumplan nicht änderbar");
}
} catch(e) {}
}
function createSpooledPrintJobButton(id,text) { function createSpooledPrintJobButton(id,text) {
var txt = '<button type="submit" data-theme="d" class="spooledprintjob" data-icon="delete" id="' + id + '">' + text + '</button>'; var txt = '<button type="submit" data-theme="d" class="spooledprintjob" data-icon="delete" id="' + id + '">' + text + '</button>';
return txt; return txt;
@ -3236,7 +3240,7 @@ $(document).on("pageinit", "#admin-page", function () {
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" class="noprint" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" class="noprint" style="background-color:black;">
<h1>Administration <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1>Administration <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>
@ -3633,6 +3637,11 @@ $(document).on("pageinit", "#admin-page", function () {
<input type="text" value="" data-mini="true" placeholder="0" id="minaftergo" data-theme="c" class="genConfigEl"/> <input type="text" value="" data-mini="true" placeholder="0" id="minaftergo" data-theme="c" class="genConfigEl"/>
</div> </div>
<br><b><u><span id="tasktxt">Aufgaben</span></u></b><br><br>
<div id="partOfTaskallasssign"></div>
<div id="partOfTaskifempty"></div>
<div id="partOfTaskownerempty"></div>
<br><b><u><span id="mobilviewsectiontxt">MOBILANSICHT</span></u></b><br><br> <br><b><u><span id="mobilviewsectiontxt">MOBILANSICHT</span></u></b><br><br>
<div id="partOfProminentSearch"></div> <div id="partOfProminentSearch"></div>

File diff suppressed because one or more lines are too long

View File

@ -52,6 +52,7 @@ class Admin {
"setUserReceiptPrinter" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "setUserReceiptPrinter" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"setBtnSize" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "setBtnSize" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getGeneralConfigItems" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "getGeneralConfigItems" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getGeneralConfigItemsAndUsers" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getWaiterSettings" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "getWaiterSettings" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getPayPrintType" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "getPayPrintType" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
"getPayments" => array("loggedin" => 1, "isadmin" => 0, "rights" => null), "getPayments" => array("loggedin" => 1, "isadmin" => 0, "rights" => null),
@ -62,6 +63,7 @@ class Admin {
"ftpbackup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "ftpbackup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"backup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "backup" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"restore" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "restore" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"restoreDemoFromZip" => array("loggedin" => 0, "isadmin" => 0, "rights" => null),
"golive" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "golive" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"drop" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "drop" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
"fill" => array("loggedin" => 1, "isadmin" => 1, "rights" => null), "fill" => array("loggedin" => 1, "isadmin" => 1, "rights" => null),
@ -223,6 +225,8 @@ class Admin {
$this->deletelogo(); $this->deletelogo();
} else if ($command == 'getGeneralConfigItems') { } else if ($command == 'getGeneralConfigItems') {
$this->getGeneralConfigItems(true,null); $this->getGeneralConfigItems(true,null);
} else if ($command == 'getGeneralConfigItemsAndUsers') {
$this->getGeneralConfigItemsAndUsers(true,null);
} else if ($command == 'getWaiterSettings') { } else if ($command == 'getWaiterSettings') {
$this->getWaiterSettings(); $this->getWaiterSettings();
// from here on admin rights are needed // from here on admin rights are needed
@ -248,6 +252,10 @@ class Admin {
} else if ($command == 'restore') { } else if ($command == 'restore') {
$this->restore(); $this->restore();
return; return;
} else if ($command == 'restoreDemoFromZip') {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$this->restoreDemoFromZip($pdo);
return;
} else if ($command == 'golive') { } else if ($command == 'golive') {
$this->golive(); $this->golive();
return; return;
@ -403,9 +411,12 @@ class Admin {
Guestsync::sync($pdo); Guestsync::sync($pdo);
$tasksForMe = Tasks::areThereTasksForMe($pdo);
$TIMEOUT = 20; $TIMEOUT = 20;
$active = json_encode(array("status" => "OK","msg" => 1)); $active = json_encode(array("status" => "OK","msg" => 1, "tasksforme" => $tasksForMe));
$notActive = json_encode(array("status" => "OK","msg" => 0)); $notActive = json_encode(array("status" => "OK","msg" => 0, "tasksforme" => $tasksForMe));
// check printmode // check printmode
$printMode = CommonUtils::getConfigValue($pdo, 'payprinttype', "s"); $printMode = CommonUtils::getConfigValue($pdo, 'payprinttype', "s");
@ -553,7 +564,8 @@ class Admin {
$zeile['right_bar'],$zeile['right_supply'],$zeile['right_paydesk'], $zeile['right_bar'],$zeile['right_supply'],$zeile['right_paydesk'],
$zeile['right_statistics'],$zeile['right_bill'],$zeile['right_products'], $zeile['right_statistics'],$zeile['right_bill'],$zeile['right_products'],
$zeile['right_reservation'],$zeile['right_changeprice'],$zeile['right_customers'],$zeile['right_manager'], $zeile['right_reservation'],$zeile['right_changeprice'],$zeile['right_customers'],$zeile['right_manager'],
$zeile['right_closing'],$zeile['right_dash'],$zeile['right_timetracking'],$zeile['right_timemanager']); $zeile['right_closing'],$zeile['right_dash'],$zeile['right_timetracking'],$zeile['right_timemanager'],
$zeile['right_tasks'],$zeile['right_tasksmanagement']);
$right_rating = $zeile['right_rating']; $right_rating = $zeile['right_rating'];
if (self::isOnlyRatingUser($rights,$right_rating, 1)) { if (self::isOnlyRatingUser($rights,$right_rating, 1)) {
@ -576,6 +588,8 @@ class Admin {
$_SESSION['right_dash'] = false; $_SESSION['right_dash'] = false;
$_SESSION['right_timetracking'] = false; $_SESSION['right_timetracking'] = false;
$_SESSION['right_timemanager'] = false; $_SESSION['right_timemanager'] = false;
$_SESSION['right_tasks'] = false;
$_SESSION['right_tasksmanagement'] = false;
$_SESSION['keeptypelevel'] = false; $_SESSION['keeptypelevel'] = false;
} else { } else {
$_SESSION['is_admin'] = ($zeile['is_admin'] == 1 ? true : false); $_SESSION['is_admin'] = ($zeile['is_admin'] == 1 ? true : false);
@ -602,6 +616,9 @@ class Admin {
$_SESSION['right_dash'] = ($zeile['right_dash'] == 1 ? true : false); $_SESSION['right_dash'] = ($zeile['right_dash'] == 1 ? true : false);
$_SESSION['right_timetracking'] = ($zeile['right_timetracking'] == 1 ? true : false); $_SESSION['right_timetracking'] = ($zeile['right_timetracking'] == 1 ? true : false);
$_SESSION['right_timemanager'] = ($zeile['right_timemanager'] == 1 ? true : false); $_SESSION['right_timemanager'] = ($zeile['right_timemanager'] == 1 ? true : false);
$_SESSION['right_tasks'] = ($zeile['right_tasks'] == 1 ? true : false);
$_SESSION['right_tasksmanagement'] = ($zeile['right_tasksmanagement'] == 1 ? true : false);
$_SESSION['keeptypelevel'] = ($zeile['keeptypelevel'] == 1 ? true : false); $_SESSION['keeptypelevel'] = ($zeile['keeptypelevel'] == 1 ? true : false);
} }
@ -1030,10 +1047,123 @@ class Admin {
} }
public function getGeneralConfigItems($forHtml,$pdo) { private function getGeneralConfigItemsAndUsers($forHtml,$pdo) {
return $this->getGeneralConfigItems($forHtml, $pdo, true);
}
public function getGeneralConfigItems($forHtml,$pdo,$includeUserInfo = false) {
$userLoggedIn = $this->isUserAlreadyLoggedInForPhp(); $userLoggedIn = $this->isUserAlreadyLoggedInForPhp();
if ($userLoggedIn || (!$forHtml)) { if ($userLoggedIn || (!$forHtml)) {
$items = array(
array("companyinfo",null,false),
array("hosttext",null,false),
array("rectemplate",null,false),
array("foodtemplate",null,false),
array("drinktemplate",null,false),
array("canceltemplate",null,false),
array("decpoint",null,false),
array("version",null,false),
array("payprinttype",null,false),
array("cancelunpaidcode",null,false),
array("cancelguestcode",null,false),
array("tax",null,false),
array("togotax",null,false),
array("taxaustrianormal",null,false),
array("taxaustriaerm1",null,false),
array("taxaustriaerm2",null,false),
array("taxaustriaspecial",null,false),
array("serverurl",null,false),
array("guesturl",null,false),
array("guestcode",null,false),
array("dailycode",null,false),
array("email",null,false),
array("bigfontworkreceipt",null,false),
array("prominentsearch",null,false),
array("guestjobprint",null,false),
array("askdaycode",null,false),
array("showdaycode",null,false),
array("asktablecode",null,false),
array("guesttimeout",5,false),
array("discount1",null,false),
array("discount2",null,false),
array("discount3",null,false),
array("austria",null,false),
array("digigopaysetready",1,false),
array("waitergopayprint",0,false),
array("oneprodworkrecf",0,false),
array("oneprodworkrecd",0,false),
array("digiprintwork",1,false),
array("groupworkitemsf",1,false),
array("groupworkitemsd",1,false),
array("receiveremail","",false),
array("smtpsecure",1,false),
array("smtpauth",1,false),
array("emailbadrating","",false),
array("emailratingcontact","",false),
array("billlanguage",null,false),
array("hotelinterface",0,false),
array("hsinfile",null,false),
array("hsoutfile",null,false),
array("hscurrency",null,false),
array("currency",null,false),
array("receiptfontsize",null,false),
array("reservationnote",null,false),
array("paymentconfig",0,false),
array("workflowconfig",0,false),
array("dashslot1",1,false),
array("dashslot2",2,false),
array("dashslot3",3,false),
array("addreceipttoprinter","",false),
array("printandqueuejobs",0,false),
array("cashenabled",1,false),
array("returntoorder",1,false),
array("beepcooked",0,false),
array("beepordered",0,false),
array("taskallassign",0,false),
array("taskifempty",0,false),
array("taskownerempty",0,false),
array("closshowci",1,false),
array("closshowpaytaxes",1,false),
array("closshowprods",1,false),
array("showpayment2",1,false),
array("showpayment3",1,false),
array("showpayment4",1,false),
array("showpayment5",1,false),
array("showpayment6",1,false),
array("showpayment7",1,false),
array("showpayment8",1,false),
array("restaurantmode",1,false),
array("defaultview",0,false),
array("dblog",1,false),
array("printextras",0,false),
array("forceprint",0,false),
array("priceinlist",0,false),
array("startprodsearch",3,false),
array("discountname1","",true),
array("discountname2","",true),
array("discountname3","",true),
array("memorylimit",256,false),
array("minbeforecome",0,false),
array("minaftergo",0,false),
array("updateurl","",false),
array("tmpdir","",false),
array("hs3refresh",60,false),
array("paydeskid","",false),
array("aeskey","",false),
array("certificatesn","",false),
array("rksvserver","",false),
array("webimpressum","",false)
);
if (is_null($pdo)) { if (is_null($pdo)) {
$pdo = $this->dbutils->openDbAndReturnPdo(); $pdo = $this->dbutils->openDbAndReturnPdo();
} }
@ -1041,124 +1171,37 @@ class Admin {
$sql = "SELECT count(id) as countid FROM %config% WHERE name=?"; $sql = "SELECT count(id) as countid FROM %config% WHERE name=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$companyInfo = CommonUtils::getConfigValueStmt($pdo,$stmt,"companyinfo",null); $retVal = array();
$hosttext = CommonUtils::getConfigValueStmt($pdo,$stmt,"hosttext",null); foreach($items as $anItem) {
$rectemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"rectemplate",null); $v = CommonUtils::getConfigValueStmt($pdo, $stmt, $anItem[0], $anItem[1]);
$foodtemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"foodtemplate",null); if ($anItem[2]) {
$drinktemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"drinktemplate",null); $v = trim($v);
$canceltemplate = CommonUtils::getConfigValueStmt($pdo,$stmt,"canceltemplate",null); }
$decpoint = CommonUtils::getConfigValueStmt($pdo,$stmt,"decpoint",null); $retVal[$anItem[0]] = $v;
$version = CommonUtils::getConfigValueStmt($pdo,$stmt,"version",null); }
$payprinttype = CommonUtils::getConfigValueStmt($pdo,$stmt,"payprinttype",null);
$cancelunpaidcode = CommonUtils::getConfigValueStmt($pdo,$stmt,"cancelunpaidcode",null);
$cancelguestcode = CommonUtils::getConfigValueStmt($pdo,$stmt,"cancelguestcode",null);
$tax = CommonUtils::getConfigValueStmt($pdo,$stmt,"tax",null);
$togotax = CommonUtils::getConfigValueStmt($pdo,$stmt,"togotax",null);
$taxaustrianormal = CommonUtils::getConfigValueStmt($pdo,$stmt,"taxaustrianormal",null);
$taxaustriaerm1 = CommonUtils::getConfigValueStmt($pdo,$stmt,"taxaustriaerm1",null);
$taxaustriaerm2 = CommonUtils::getConfigValueStmt($pdo,$stmt,"taxaustriaerm2",null);
$taxaustriaspecial = CommonUtils::getConfigValueStmt($pdo,$stmt,"taxaustriaspecial",null);
$serverurl = CommonUtils::getConfigValueStmt($pdo,$stmt,"serverurl",null);
$guesturl = CommonUtils::getConfigValueStmt($pdo,$stmt,"guesturl",null);
$guestcode = CommonUtils::getConfigValueStmt($pdo,$stmt,"guestcode",null);
$dailycode = CommonUtils::getConfigValueStmt($pdo,$stmt,"dailycode",null);
$email = CommonUtils::getConfigValueStmt($pdo,$stmt,"email",null);
$bigfontworkreceipt = CommonUtils::getConfigValueStmt($pdo,$stmt,"bigfontworkreceipt",null);
$prominentsearch = CommonUtils::getConfigValueStmt($pdo,$stmt,"prominentsearch",null);
$guestjobprint = CommonUtils::getConfigValueStmt($pdo,$stmt,"guestjobprint",null);
$askdaycode = CommonUtils::getConfigValueStmt($pdo,$stmt,"askdaycode",null);
$showdaycode = CommonUtils::getConfigValueStmt($pdo,$stmt,"showdaycode",null);
$asktablecode = CommonUtils::getConfigValueStmt($pdo,$stmt,"asktablecode",null);
$guesttimeout = CommonUtils::getConfigValueStmt($pdo,$stmt,"guesttimeout",5);
$discount1 = CommonUtils::getConfigValueStmt($pdo,$stmt,"discount1",null);
$discount2 = CommonUtils::getConfigValueStmt($pdo,$stmt,"discount2",null);
$discount3 = CommonUtils::getConfigValueStmt($pdo,$stmt,"discount3",null);
$austria = CommonUtils::getConfigValueStmt($pdo,$stmt,"austria",null);
$digigopaysetready = CommonUtils::getConfigValueStmt($pdo,$stmt,"digigopaysetready",1);
$waitergopayprint = CommonUtils::getConfigValueStmt($pdo,$stmt,"waitergopayprint",0);
$oneprodworkrecf = CommonUtils::getConfigValueStmt($pdo,$stmt,"oneprodworkrecf",0);
$oneprodworkrecd = CommonUtils::getConfigValueStmt($pdo,$stmt,"oneprodworkrecd",0);
$digiprintwork = CommonUtils::getConfigValueStmt($pdo,$stmt,"digiprintwork",1);
$groupworkitemsf = CommonUtils::getConfigValueStmt($pdo,$stmt,"groupworkitemsf",1);
$groupworkitemsd = CommonUtils::getConfigValueStmt($pdo,$stmt,"groupworkitemsd",1);
$receiveremail = CommonUtils::getConfigValueStmt($pdo,$stmt,"receiveremail","");
$emailbadrating = CommonUtils::getConfigValueStmt($pdo,$stmt,"emailbadrating","");
$emailratingcontact = CommonUtils::getConfigValueStmt($pdo,$stmt,"emailratingcontact","");
$billlanguage = CommonUtils::getConfigValueStmt($pdo,$stmt,"billlanguage",null);
$hotelinterface = CommonUtils::getConfigValueStmt($pdo,$stmt,"hotelinterface",0);
$hsinfile = CommonUtils::getConfigValueStmt($pdo,$stmt,"hsinfile",null);
$hsoutfile = CommonUtils::getConfigValueStmt($pdo,$stmt,"hsoutfile",null);
$hscurrency = CommonUtils::getConfigValueStmt($pdo,$stmt,"hscurrency",null);
$currency = CommonUtils::getConfigValueStmt($pdo,$stmt,"currency",null);
$receiptfontsize = CommonUtils::getConfigValueStmt($pdo,$stmt,"receiptfontsize",null);
$reservationnote = CommonUtils::getConfigValueStmt($pdo,$stmt,"reservationnote",null);
$paymentconfig = CommonUtils::getConfigValueStmt($pdo,$stmt,"paymentconfig",0);
$workflowconfig = CommonUtils::getConfigValueStmt($pdo,$stmt,"workflowconfig",0);
$dashslot1 = CommonUtils::getConfigValueStmt($pdo,$stmt,"dashslot1",1);
$dashslot2 = CommonUtils::getConfigValueStmt($pdo,$stmt,"dashslot2",2);
$dashslot3 = CommonUtils::getConfigValueStmt($pdo,$stmt,"dashslot3",3);
$addreceipttoprinter = CommonUtils::getConfigValueStmt($pdo,$stmt,"addreceipttoprinter","");
$printandqueuejobs = CommonUtils::getConfigValueStmt($pdo,$stmt,"printandqueuejobs",0);
$cashenabled = CommonUtils::getConfigValueStmt($pdo,$stmt,"cashenabled",1);
$returntoorder = CommonUtils::getConfigValueStmt($pdo,$stmt,"returntoorder",1);
$beepcooked = CommonUtils::getConfigValueStmt($pdo,$stmt,"beepcooked",0);
$beepordered = CommonUtils::getConfigValueStmt($pdo,$stmt,"beepordered",0);
$closshowci = CommonUtils::getConfigValueStmt($pdo,$stmt,"closshowci",1);
$closshowpaytaxes = CommonUtils::getConfigValueStmt($pdo,$stmt,"closshowpaytaxes",1);
$closshowprods = CommonUtils::getConfigValueStmt($pdo,$stmt,"closshowprods",1);
$showpayment2 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment2",1);
$showpayment3 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment3",1);
$showpayment4 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment4",1);
$showpayment5 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment5",1);
$showpayment6 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment6",1);
$showpayment7 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment7",1);
$showpayment8 = CommonUtils::getConfigValueStmt($pdo,$stmt,"showpayment8",1);
$restaurantmode = CommonUtils::getConfigValueStmt($pdo,$stmt,"restaurantmode",1);
$defaultview = CommonUtils::getConfigValueStmt($pdo,$stmt,"defaultview",0);
$dblog = CommonUtils::getConfigValueStmt($pdo,$stmt,"dblog",1);
$printextras = CommonUtils::getConfigValueStmt($pdo,$stmt,"printextras",0);
$forceprint = CommonUtils::getConfigValueStmt($pdo,$stmt,"forceprint",0);
$priceinlist = CommonUtils::getConfigValueStmt($pdo,$stmt,"priceinlist",0);
$startprodsearch = CommonUtils::getConfigValueStmt($pdo,$stmt,"startprodsearch",3);
$smtphost = ""; $smtphost = "";
$smtpauth = 1;
$smtpuser = ""; $smtpuser = "";
$smtppass = ""; $smtppass = "";
$smtpsecure = 1;
$smtpport = ""; $smtpport = "";
$ftphost = "";
$ftpuser = "";
$ftppass = "";
if ( (isset($_SESSION['is_admin']) && ($_SESSION['is_admin'] == 1)) || (isset($_SESSION['right_manager']) && ($_SESSION['right_manager']))) { if ( (isset($_SESSION['is_admin']) && ($_SESSION['is_admin'] == 1)) || (isset($_SESSION['right_manager']) && ($_SESSION['right_manager']))) {
$smtphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtphost",""); $smtphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtphost","");
$smtpauth = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpauth",1);
$smtpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpuser",""); $smtpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpuser","");
$smtppass = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtppass",""); $smtppass = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtppass","");
$smtpsecure = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpsecure",1);
$smtpport = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpport",""); $smtpport = CommonUtils::getConfigValueStmt($pdo,$stmt,"smtpport","");
}
$discountname1 = trim(CommonUtils::getConfigValueStmt($pdo,$stmt, "discountname1", ''));
$discountname2 = trim(CommonUtils::getConfigValueStmt($pdo,$stmt, "discountname2", ''));
$discountname3 = trim(CommonUtils::getConfigValueStmt($pdo,$stmt, "discountname3", ''));
$memorylimit = CommonUtils::getConfigValueStmt($pdo,$stmt,"memorylimit",256);
$minbeforecome = CommonUtils::getConfigValueStmt($pdo,$stmt,"minbeforecome",0);
$minaftergo = CommonUtils::getConfigValueStmt($pdo,$stmt,"minaftergo",0);
$updateurl = CommonUtils::getConfigValueStmt($pdo,$stmt,"updateurl","");
$tmpdir = CommonUtils::getConfigValueStmt($pdo,$stmt,"tmpdir","");
$ftphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftphost",""); $ftphost = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftphost","");
$ftpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftpuser",""); $ftpuser = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftpuser","");
$ftppass = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftppass",""); $ftppass = CommonUtils::getConfigValueStmt($pdo,$stmt,"ftppass","");
}
$hs3refresh = CommonUtils::getConfigValueStmt($pdo,$stmt, "hs3refresh", 60);
$paydeskid = CommonUtils::getConfigValueStmt($pdo,$stmt,"paydeskid","");
$aeskey = CommonUtils::getConfigValueStmt($pdo,$stmt,"aeskey","");
$certificatesn = CommonUtils::getConfigValueStmt($pdo,$stmt,"certificatesn","");
$rksvserver = CommonUtils::getConfigValueStmt($pdo,$stmt,"rksvserver","");
$webimpressum = CommonUtils::getConfigValueStmt($pdo,$stmt,"webimpressum","");
$userlang = 0; // of no interest, if not called from web $userlang = 0; // of no interest, if not called from web
$receiptprinter = 1; // of no interest, if not called from web $receiptprinter = 1; // of no interest, if not called from web
@ -1174,42 +1217,52 @@ class Admin {
date_default_timezone_set(DbUtils::getTimeZone()); date_default_timezone_set(DbUtils::getTimeZone());
$now = getdate(); $now = getdate();
$retVal = array("companyinfo" => $companyInfo, "rectemplate" => $rectemplate, "foodtemplate" => $foodtemplate, "drinktemplate" => $drinktemplate, "canceltemplate" => $canceltemplate, $retVal["userlanguage"] = $userlang;
"version" => $version, "decpoint" => $decpoint, $retVal["receiptprinter"] = $receiptprinter;
"serverurl" => $serverurl, "guesturl" => $guesturl, "guestcode" => $guestcode, "dailycode" => $dailycode, $retVal["rightchangeprice"] = $right_changeprice;
"email" => $email, "receiveremail" => $receiveremail, "billlanguage" => $billlanguage,
"hotelinterface" => $hotelinterface, "hsinfile" => $hsinfile, "hsoutfile" => $hsoutfile, "hscurrency" => $hscurrency,
"payprinttype" => $payprinttype, "tax" => $tax, "togotax" => $togotax, "currency" => $currency,
"taxaustrianormal" => $taxaustrianormal, "taxaustriaerm1" => $taxaustriaerm1, "taxaustriaerm2" => $taxaustriaerm2, "taxaustriaspecial" => $taxaustriaspecial,
"userlanguage" => $userlang, "receiptprinter" => $receiptprinter,
"receiptfontsize" => $receiptfontsize, "reservationnote" => $reservationnote, "paymentconfig" => $paymentconfig,
"workflowconfig" => $workflowconfig, "emailratingcontact" => $emailratingcontact,"emailbadrating" => $emailbadrating, "guestjobprint" => $guestjobprint,
"askdaycode" => $askdaycode, "asktablecode" => $asktablecode, "guesttimeout" => $guesttimeout, "showdaycode" => $showdaycode,
"rightchangeprice" => $right_changeprice, "bigfontworkreceipt" => $bigfontworkreceipt, "prominentsearch" => $prominentsearch,"groupworkitemsf" => $groupworkitemsf,"groupworkitemsd" => $groupworkitemsd,
"sday" => $now["mday"],"smonth" => $now["mon"], "syear" => $now["year"], "shour" => $now["hours"], "smin" => $now["minutes"],
"smtphost" => $smtphost,"smtpauth" => $smtpauth,"smtpuser" => $smtpuser,"smtppass" => $smtppass,"smtpsecure" => $smtpsecure,"smtpport" => $smtpport,
"webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3,
"austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkrecf" => $oneprodworkrecf, "oneprodworkrecd" => $oneprodworkrecd,
"digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "updateurl" => $updateurl, "tmpdir" => $tmpdir, "hs3refresh" => $hs3refresh,
"minbeforecome" => $minbeforecome, "minaftergo" => $minaftergo,
"paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter,
"printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"beepordered" => $beepordered, "restaurantmode" => $restaurantmode,
"discountname1" => $discountname1,"discountname2" => $discountname2,"discountname3" => $discountname3, "dblog" => $dblog,"startprodsearch" => $startprodsearch,
"closshowci" => $closshowci, "closshowpaytaxes" => $closshowpaytaxes, "closshowprods" => $closshowprods,"hosttext" => $hosttext, "forceprint" => $forceprint, "printextras" => $printextras,
"showpayment2" => $showpayment2,
"showpayment3" => $showpayment3,
"showpayment4" => $showpayment4,
"showpayment5" => $showpayment5,
"showpayment6" => $showpayment6,
"showpayment7" => $showpayment7,
"showpayment8" => $showpayment8,
"dashslot1" => $dashslot1,"dashslot2" => $dashslot2,"dashslot3" => $dashslot3,
"priceinlist" => $priceinlist,
"defaulttmp" => $defaultTmp,
"ftphost" => $ftphost,"ftpuser" => $ftpuser, "ftppass" => $ftppass,
"defaultview" => $defaultview
);
$retVal["sday"] = $now["mday"];
$retVal["smonth"] = $now["mon"];
$retVal["syear"] = $now["year"];
$retVal["shour"] = $now["hours"];
$retVal["smin"] = $now["minutes"];
$retVal["smtphost"] = $smtphost;
$retVal["smtpuser"] = $smtpuser;
$retVal["smtppass"] = $smtppass;
$retVal["smtpport"] = $smtpport;
$retVal["ftphost"] = $ftphost;
$retVal["ftpuser"] = $ftpuser;
$retVal["ftppass"] = $ftppass;
$retVal["defaulttmp"] = $defaultTmp;
$taskownerempty = $retVal["taskownerempty"];
if ($taskownerempty == "") {
$taskownerempty = 0;
}
if (is_null($taskownerempty)) {
$taskownerempty = 0;
}
$sql = "SELECT active FROM %user% WHERE id=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql,array($taskownerempty));
if (count($result) > 0) {
$active = $result[0]["active"];
if ($active != 1) {
$taskownerempty = 0;
}
}
$retVal["taskownerempty"] = $taskownerempty;
if ($includeUserInfo) {
$sql = "SELECT U.id as id,username,is_admin,right_manager FROM %user% U,%roles% R WHERE active='1' ";
$sql .= " AND U.roleid=R.id AND (R.right_tasks=? OR R.right_tasksmanagement=?) ";
$sql .= " ORDER BY is_admin,right_manager";
$activeUsers = CommonUtils::fetchSqlAll($pdo, $sql,array(1,1));
$retVal["activeusers"] = $activeUsers;
}
if ($forHtml) { if ($forHtml) {
echo json_encode(array("status" => "OK", "msg" => $retVal)); echo json_encode(array("status" => "OK", "msg" => $retVal));
@ -1282,7 +1335,8 @@ class Admin {
"customers.html" => 'right_customers', "customers.html" => 'right_customers',
"waiterdesktop.php" => 'right_waiter', "waiterdesktop.php" => 'right_waiter',
"dash.php" => 'right_dash', "dash.php" => 'right_dash',
"timetracking.html" => 'right_timetracking' "timetracking.html" => 'right_timetracking',
"tasks.html" => 'right_tasks'
); );
$valid = false; $valid = false;
@ -1301,7 +1355,7 @@ class Admin {
$view = "preferences.html"; $view = "preferences.html";
} }
echo json_encode($view . "?v=1.5.1"); echo json_encode($view . "?v=1.5.2");
} }
} }
@ -1490,6 +1544,7 @@ class Admin {
$waiterdesktxt = array("Kellneransicht","Waiter's View","Vista de camareros"); $waiterdesktxt = array("Kellneransicht","Waiter's View","Vista de camareros");
$kitchentxt = array("K&uuml;che","Kitchen","Cocina"); $kitchentxt = array("K&uuml;che","Kitchen","Cocina");
$timetrackingtxt = array("Zeiterfassung","Time tracking","Tiempos"); $timetrackingtxt = array("Zeiterfassung","Time tracking","Tiempos");
$taskstxt = array("Aufgaben","Tasks","Tareas");
$waitertxt = array("Bestellung","Orderdesk","Camarero"); $waitertxt = array("Bestellung","Orderdesk","Camarero");
$paydesktxt = array("Kasse","Paydesk","Caja"); $paydesktxt = array("Kasse","Paydesk","Caja");
$settingtxt = array("Einstellungen","Preferences","Propriedades"); $settingtxt = array("Einstellungen","Preferences","Propriedades");
@ -1508,33 +1563,37 @@ class Admin {
$_SESSION['right_bar'],$_SESSION['right_supply'],$_SESSION['right_paydesk'], $_SESSION['right_bar'],$_SESSION['right_supply'],$_SESSION['right_paydesk'],
$_SESSION['right_statistics'],$_SESSION['right_bill'],$_SESSION['right_products'], $_SESSION['right_statistics'],$_SESSION['right_bill'],$_SESSION['right_products'],
$_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_customers'], $_SESSION['right_reservation'],$_SESSION['right_changeprice'],$_SESSION['right_customers'],
$_SESSION['right_manager'],$_SESSION['right_closing'],$_SESSION['right_dash'],$_SESSION['right_timetracking'],$_SESSION['right_timemanager']); $_SESSION['right_manager'],$_SESSION['right_closing'],$_SESSION['right_dash'],
$_SESSION['right_timetracking'],$_SESSION['right_timemanager'],
$_SESSION['right_tasks'],$_SESSION['right_tasksmanagement']);
$right_rating = $_SESSION['right_rating']; $right_rating = $_SESSION['right_rating'];
if (!self::isOnlyRatingUser($rights, $right_rating, true)) { if (!self::isOnlyRatingUser($rights, $right_rating, true)) {
if ($_SESSION['modus'] == 0) { if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.5.1"); } if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.5.2"); }
} else { } else {
if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.5.1"); } if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.5.2"); }
} }
if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.5.1"); } if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.5.2"); }
if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.5.1"); } if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.5.2"); }
if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.5.1"); } if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.5.2"); }
if ($_SESSION['modus'] == 0) { if ($_SESSION['modus'] == 0) {
if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.5.1"); } if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.5.2"); }
} }
if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.5.1"); } if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.5.2"); }
if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.5.1"); } if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.5.2"); }
if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.5.1"); } if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.5.2"); }
if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.5.1"); } if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.5.2"); }
if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.5.1"); } if ($_SESSION['right_tasks'] || $_SESSION['right_tasksmanagement']) { $mainMenu[] = array("name" => $taskstxt[$lang], "link" => "tasks.html?v=1.5.2"); }
if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.5.1"); } if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.5.2"); }
if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.5.1"); } if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.5.2"); }
if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.5.1"); } if ($_SESSION['right_dash']) { $mainMenu[] = array("name" => $dashtxt[$lang], "link" => "dash.php?v=1.5.2"); }
$mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.5.1"); if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.5.2"); }
if ($_SESSION['right_timetracking'] || $_SESSION['right_timemanager']) { $mainMenu[] = array("name" => $timetrackingtxt[$lang], "link" => "timetracking.html?v=1.5.1"); } $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.5.2");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.5.1"); if ($_SESSION['right_timetracking'] || $_SESSION['right_timemanager']) { $mainMenu[] = array("name" => $timetrackingtxt[$lang], "link" => "timetracking.html?v=1.5.2"); }
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.5.1");
$mainMenu[] = array("name" => "Hilfe", "link" => "help.php?v=1.5.2");
$mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.5.2");
} }
$mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php"); $mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php");
@ -1698,7 +1757,7 @@ class Admin {
} }
function getRoleListCore($pdo) { function getRoleListCore($pdo) {
$sql = "SELECT * from %roles% ORDER BY is_admin,right_manager,right_waiter DESC,right_kitchen DESC,right_bar DESC,right_paydesk DESC,right_bill DESC,right_supply DESC"; $sql = "SELECT * from %roles% ORDER BY is_admin,right_manager,right_waiter DESC,right_kitchen DESC,right_bar DESC,right_paydesk DESC,right_bill DESC,right_supply DESC,right_tasks DESC,right_tasksmanagement DESC";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(); $stmt->execute();
$roles = $stmt->fetchAll(PDO::FETCH_ASSOC); $roles = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -1707,7 +1766,7 @@ class Admin {
function getUserList() { function getUserList() {
$pdo = DbUtils::openDbAndReturnPdoStatic(); $pdo = DbUtils::openDbAndReturnPdoStatic();
$sql = "SELECT *,%user%.id as id,is_admin,right_manager FROM %user%,%roles% WHERE active='1' AND %user%.roleid=%roles%.id ORDER BY is_admin,right_manager,right_waiter DESC,right_kitchen DESC,right_bar DESC,right_paydesk DESC,right_bill DESC,right_supply DESC"; $sql = "SELECT *,%user%.id as id,is_admin,right_manager,IFNULL(%user%.area,'0') as tablearea FROM %user%,%roles% WHERE active='1' AND %user%.roleid=%roles%.id ORDER BY is_admin,right_manager,right_waiter DESC,right_kitchen DESC,right_bar DESC,right_paydesk DESC,right_bill DESC,right_supply DESC,right_tasks DESC,right_tasksmanagement DESC,username";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(); $stmt->execute();
$users = $stmt->fetchAll(PDO::FETCH_ASSOC); $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
@ -1830,6 +1889,10 @@ class Admin {
$username = $_POST['name']; $username = $_POST['name'];
$password = $_POST['password']; $password = $_POST['password'];
$roleid = $_POST['roleid']; $roleid = $_POST['roleid'];
$area = $_POST['area'];
if ($area == 0) {
$area = null;
}
$sql = "SELECT count(id) as countid FROM %user% WHERE active='1' AND username=?"; $sql = "SELECT count(id) as countid FROM %user% WHERE active='1' AND username=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -1853,9 +1916,9 @@ class Admin {
} else { } else {
$password_hash = md5($password); $password_hash = md5($password);
$sql = "INSERT INTO %user% (username,userpassword,roleid,language,showplusminus,keeptypelevel,extrasapplybtnpos,prefertablemap,preferimgdesk,preferimgmobile,active) VALUES(?,?,?,?,?,?,?,?,?,?,?)"; $sql = "INSERT INTO %user% (username,userpassword,roleid,area,language,showplusminus,keeptypelevel,extrasapplybtnpos,prefertablemap,preferimgdesk,preferimgmobile,active) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($username,$password_hash,$roleid,$lang,1,1,1,1,1,1,1)); $stmt->execute(array($username,$password_hash,$roleid,$area,$lang,1,1,1,1,1,1,1));
$lastId = $pdo->lastInsertId(); $lastId = $pdo->lastInsertId();
@ -2034,6 +2097,9 @@ class Admin {
"returntoorder" => array("dbcol" => "returntoorder","checknum" => 0), "returntoorder" => array("dbcol" => "returntoorder","checknum" => 0),
"beepcooked" => array("dbcol" => "beepcooked","checknum" => 0), "beepcooked" => array("dbcol" => "beepcooked","checknum" => 0),
"beepordered" => array("dbcol" => "beepordered","checknum" => 0), "beepordered" => array("dbcol" => "beepordered","checknum" => 0),
"taskallassign" => array("dbcol" => "taskallassign","checknum" => 0),
"taskifempty" => array("dbcol" => "taskifempty","checknum" => 0),
"taskownerempty" => array("dbcol" => "taskownerempty","checknum" => 0),
"closshowci" => array("dbcol" => "closshowci","checknum" => 0), "closshowci" => array("dbcol" => "closshowci","checknum" => 0),
"closshowpaytaxes" => array("dbcol" => "closshowpaytaxes","checknum" => 0), "closshowpaytaxes" => array("dbcol" => "closshowpaytaxes","checknum" => 0),
@ -2224,6 +2290,10 @@ class Admin {
$theUserId = $_POST['userid']; $theUserId = $_POST['userid'];
$roleid = $_POST['roleid']; $roleid = $_POST['roleid'];
$area = $_POST['area'];
if ($area == 0) {
$area = null;
}
$is_admin_role = self::isRoleAdmin($pdo, $roleid); $is_admin_role = self::isRoleAdmin($pdo, $roleid);
$isRoleOfUserAdmin = self::isRoleOfUserAdmin($pdo, $theUserId); $isRoleOfUserAdmin = self::isRoleOfUserAdmin($pdo, $theUserId);
@ -2231,8 +2301,8 @@ class Admin {
if (!$this->isCurrentUserAdmin() && ($is_admin_role || $isRoleOfUserAdmin)) { if (!$this->isCurrentUserAdmin() && ($is_admin_role || $isRoleOfUserAdmin)) {
echo json_encode("noadmin"); echo json_encode("noadmin");
} else { } else {
$sql = "UPDATE %user% SET roleid=? WHERE id=?"; $sql = "UPDATE %user% SET roleid=?,area=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($roleid,$theUserId)); CommonUtils::execSql($pdo, $sql, array($roleid,$area,$theUserId));
HistFiller::updateUserInHist($pdo,$theUserId); HistFiller::updateUserInHist($pdo,$theUserId);
echo json_encode("OK"); echo json_encode("OK");
} }
@ -2453,11 +2523,12 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic(); $pdo = DbUtils::openDbAndReturnPdoStatic();
$this->writeCsvHeader("datenexport-benutzer.csv"); $this->writeCsvHeader("datenexport-benutzer.csv");
echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Gästerechte; Tageserfassungsrecht; Dashboardrechte; Zeiterfassung; Zeitmanagement; Managerrechte; Aktiviert\n"); echo("Eintragsid; Datum ; Benutzerid; Benutzername; Adminrechte; Kellnerrechte;Kuechenrechte; Barrechte; Bereitstellungsrechte; Kassenrechte; Reportrechte; Kassenbonrechte; Angebotsrechte; Beurteilungsrechte; Preisänderungsrechte; Gästerechte; Tageserfassungsrecht; Dashboardrechte; Zeiterfassung; Zeitmanagement; Aufgaben; Aufgabenmanagement; Managerrechte; Tischbereich; Aktiviert\n");
$sql = "SELECT DISTINCT %hist%.id as id,date,"; $sql = "SELECT DISTINCT %hist%.id as id,date,";
$sql .= "IFNULL(userid,'') as userid,IFNULL(username,'') as username,is_admin,right_waiter,right_kitchen,right_bar,right_supply,"; $sql .= "IFNULL(userid,'') as userid,IFNULL(username,'') as 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_customers,right_closing,right_dash,right_timetracking,right_timemanager,right_manager,active,"; $sql .= "right_paydesk,right_statistics,right_bill,right_products,right_rating,right_changeprice,right_customers,right_closing,right_dash,right_timetracking,right_timemanager,right_tasks,right_tasksmanagement,right_manager,active,";
$sql .= "IFNULL(area,'-') as area,";
$sql .= "description "; $sql .= "description ";
$sql .= " FROM %hist%, %histuser%, %histactions% "; $sql .= " FROM %hist%, %histuser%, %histactions% ";
$sql .= " WHERE (refid=%histuser%.id) "; $sql .= " WHERE (refid=%histuser%.id) ";
@ -2465,37 +2536,46 @@ class Admin {
$sql .= " AND (action=%histactions%.id) "; $sql .= " AND (action=%histactions%.id) ";
$sql .= " ORDER BY date,id"; $sql .= " ORDER BY date,id";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $result = CommonUtils::fetchSqlAll($pdo, $sql,null);
$stmt->execute();
$result = $stmt->fetchAll();
foreach($result as $zeile) { foreach($result as $zeile) {
$val1 = $zeile['id']; $vals = array();
$val2 = $zeile['date'];
$val3 = $zeile['userid'];
$val4 = $zeile['username'];
$val5 = ($zeile['is_admin'] == '1' ? "Ja" : "Nein");
$val6 = ($zeile['right_waiter'] == '1' ? "Ja" : "Nein");
$val7 = ($zeile['right_kitchen'] == '1' ? "Ja" : "Nein");
$val8 = ($zeile['right_bar'] == '1' ? "Ja" : "Nein");
$val9 = ($zeile['right_supply'] == '1' ? "Ja" : "Nein");
$val10 = ($zeile['right_paydesk'] == '1' ? "Ja" : "Nein");
$val11 = ($zeile['right_statistics'] == '1' ? "Ja" : "Nein");
$val12 = ($zeile['right_bill'] == '1' ? "Ja" : "Nein");
$val13 = ($zeile['right_products'] == '1' ? "Ja" : "Nein");
$val14 = ($zeile['right_rating'] == '1' ? "Ja" : "Nein");
$val15 = ($zeile['right_changeprice'] == '1' ? "Ja" : "Nein");
$val16 = ($zeile['right_customers'] == '1' ? "Ja" : "Nein");
$val17 = ($zeile['right_closing'] == '1' ? "Ja" : "Nein");
$val18 = ($zeile['right_dash'] == '1' ? "Ja" : "Nein");
$val19 = ($zeile['right_timetracking'] == '1' ? "Ja" : "Nein");
$val20 = ($zeile['right_timemanager'] == '1' ? "Ja" : "Nein");
$val21 = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$val22 = ($zeile['active'] == '1' ? "Ja" : "Nein");
$val23 = $zeile['description'];
echo "$val1; $val2; $val3; $val4; $val5; $val6; $val7; $val8; $val9; $val10;"; $vals[] = $zeile['id'];
echo "$val11;$val12;$val13;$val14;$val15;$val16;$val17;$val18;$val19;$val20; $val21; $val22; $val23\n"; $vals[] = $zeile['date'];
$vals[] = $zeile['userid'];
$vals[] = $zeile['username'];
$vals[] = ($zeile['is_admin'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_waiter'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_kitchen'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_bar'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_supply'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_paydesk'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_statistics'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_bill'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_products'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_rating'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_changeprice'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_customers'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_closing'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_dash'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_timetracking'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_timemanager'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_tasks'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_tasksmanagement'] == '1' ? "Ja" : "Nein");
$vals[] = ($zeile['right_manager'] == '1' ? "Ja" : "Nein");
$area = $zeile["area"];
$character = $area;
if ($area != '-') {
$character = chr(intval($area) + 64);
}
$vals[] = $character;
$vals[] = ($zeile['active'] == '1' ? "Ja" : "Nein");
$vals[] = $zeile['description'];
$valsTxt = join(';', $vals);
echo "$valsTxt\n";
} }
} }
@ -2535,13 +2615,13 @@ class Admin {
private function getAllTablesToBackupRestore() { private function getAllTablesToBackupRestore() {
return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config", return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist", "roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras"); "extras","extrasprods","queueextras","tasks","taskhist");
} }
private function getAllWithLogsTablesToBackupRestore() { private function getAllWithLogsTablesToBackupRestore() {
return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config", return array("log","closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","prodimages","products","config",
"roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist", "roles","user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","times","records","recordsqueue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist",
"extras","extrasprods","queueextras"); "extras","extrasprods","queueextras","tasks","taskhist");
} }
public function ftpbackup($theType,$remoteaccesscode) { public function ftpbackup($theType,$remoteaccesscode) {
@ -2648,7 +2728,7 @@ class Admin {
foreach($result as $row) { foreach($result as $row) {
$fieldContent = array(); $fieldContent = array();
foreach($fields as $field) { foreach($fields as $field) {
if (in_array($field,$binaryFields)) { if (in_array($field,$binaryFields) && (!is_null($row[$field]))) {
$aFieldEntry = array("f" => $field,"v" => base64_encode($row[$field])); $aFieldEntry = array("f" => $field,"v" => base64_encode($row[$field]));
} else { } else {
$aFieldEntry = array("f" => $field,"v" => $row[$field]); $aFieldEntry = array("f" => $field,"v" => $row[$field]);
@ -2800,13 +2880,15 @@ class Admin {
$pdo = DbUtils::openDbAndReturnPdoStatic(); $pdo = DbUtils::openDbAndReturnPdoStatic();
if (CommonUtils::strEndsWith($origname, '.zip')) { if (CommonUtils::strEndsWith($origname, '.zip')) {
if ($zipExtension) { if ($zipExtension) {
$this->restoreFromZip($pdo); $zipFile = $_FILES['userfile']['tmp_name'];
$this->restoreFromZip($pdo,$zipFile);
} else { } else {
echo json_encode(array("status" => "ERROR","msg" => "PHP-Zip-Extension ist nicht installiert.")); echo json_encode(array("status" => "ERROR","msg" => "PHP-Zip-Extension ist nicht installiert."));
exit(); exit();
} }
} else { } else {
$this->restoreFromJson($pdo); $content = file_get_contents($_FILES['userfile']['tmp_name']);
$this->restoreFromJson($pdo,$content);
} }
} }
@ -2900,10 +2982,12 @@ class Admin {
} }
private function restoreFromJson($pdo) { private function restoreDemoFromZip($pdo) {
$binaryFields = array("signature","img","setting","content"); // TO BE RELACED BY DEMO
}
$content = file_get_contents($_FILES['userfile']['tmp_name']); private function restoreFromJson($pdo,$content) {
$binaryFields = array("signature","img","setting","content");
$basedb = new Basedb(); $basedb = new Basedb();
$basedb->setPrefix(TAB_PREFIX); $basedb->setPrefix(TAB_PREFIX);
@ -2957,7 +3041,7 @@ class Admin {
foreach ($row as $field) { foreach ($row as $field) {
$fieldname = $field[$fieldKey]; $fieldname = $field[$fieldKey];
$cols[] = $fieldname; $cols[] = $fieldname;
if (in_array($fieldname, $binaryFields)) { if (in_array($fieldname, $binaryFields) && (!is_null($field[$valueKey])) ) {
$vals[] = base64_decode($field[$valueKey]); $vals[] = base64_decode($field[$valueKey]);
} else { } else {
$vals[] = $field[$valueKey]; $vals[] = $field[$valueKey];
@ -2998,14 +3082,13 @@ class Admin {
$this->completeImportProcess($pdo); $this->completeImportProcess($pdo);
} }
private function restoreFromZip($pdo) { private function restoreFromZip($pdo,$zipFile) {
$tmpdir = CommonUtils::getConfigValue($pdo, 'tmpdir', ''); $tmpdir = CommonUtils::getConfigValue($pdo, 'tmpdir', '');
if ($tmpdir == '') { if ($tmpdir == '') {
echo json_encode(array("status" => "ERROR","msg" => "Zip-Files können nur importiert werden, wenn ein PHP Temp. Directory konfiguriert ist.")); echo json_encode(array("status" => "ERROR","msg" => "Zip-Files können nur importiert werden, wenn ein PHP Temp. Directory konfiguriert ist."));
exit(); exit();
} }
$zip = new ZipArchive; $zip = new ZipArchive;
$zipFile = $_FILES['userfile']['tmp_name'];
$jsonFiles = array(); $jsonFiles = array();
if ($zip->open($zipFile) == TRUE) { if ($zip->open($zipFile) == TRUE) {
@ -3071,7 +3154,7 @@ class Admin {
try { try {
$fieldname = $field['f']; $fieldname = $field['f'];
$cols[] = $fieldname; $cols[] = $fieldname;
if (in_array($fieldname, $binaryFields)) { if (in_array($fieldname, $binaryFields) && (!is_null($field['v']))) {
$vals[] = base64_decode($field['v']); $vals[] = base64_decode($field['v']);
} else { } else {
$vals[] = $field['v']; $vals[] = $field['v'];
@ -3195,6 +3278,9 @@ class Admin {
} }
try { try {
self::doSql($pdo, "DELETE FROM %taskhist%", null);
self::doSql($pdo, "DELETE FROM %tasks%", null);
self::doSql($pdo, "DELETE FROM %customerlog%", null); self::doSql($pdo, "DELETE FROM %customerlog%", null);
self::doSql($pdo, "DELETE FROM %times%", null); self::doSql($pdo, "DELETE FROM %times%", null);

View File

@ -292,7 +292,7 @@ class CommonUtils {
} }
} }
public static function getRowSqlObject($pdo,$sql,$params) { public static function getRowSqlObject($pdo,$sql,$params = null) {
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
if (is_null($params)) { if (is_null($params)) {
$stmt->execute(); $stmt->execute();
@ -301,7 +301,7 @@ class CommonUtils {
} }
return ($stmt->fetchObject()); return ($stmt->fetchObject());
} }
public static function fetchSqlAll($pdo,$sql,$params) { public static function fetchSqlAll($pdo,$sql,$params = null) {
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
if (is_null($params)) { if (is_null($params)) {
$stmt->execute(); $stmt->execute();

View File

@ -19,8 +19,10 @@ require_once ('updater.php');
require_once ('workreceipts.php'); require_once ('workreceipts.php');
require_once ('utilities/Logger.php'); require_once ('utilities/Logger.php');
require_once ('utilities/roles.php'); require_once ('utilities/roles.php');
require_once ('utilities/permissions.php');
require_once ('guestsync.php'); require_once ('guestsync.php');
require_once ('timetracking.php'); require_once ('timetracking.php');
require_once ('tasks.php');
$module = $_GET["module"]; $module = $_GET["module"];
$command = $_GET["command"]; $command = $_GET["command"];
@ -82,6 +84,8 @@ if ($module == 'admin') {
Guestsync::handleCommand($command); Guestsync::handleCommand($command);
} else if ($module == 'timetracking') { } else if ($module == 'timetracking') {
Timetracking::handleCommand($command); Timetracking::handleCommand($command);
} else if ($module == 'tasks') {
Tasks::handleCommand($command);
} }

View File

@ -118,6 +118,8 @@ class DbUtils {
$out = str_replace("%recordsqueue%",$prefix . 'recordsqueue', $out); $out = str_replace("%recordsqueue%",$prefix . 'recordsqueue', $out);
$out = str_replace("%records%",$prefix . 'records', $out); $out = str_replace("%records%",$prefix . 'records', $out);
$out = str_replace("%times%",$prefix . 'times', $out); $out = str_replace("%times%",$prefix . 'times', $out);
$out = str_replace("%tasks%",$prefix . 'tasks', $out);
$out = str_replace("%taskhist%",$prefix . 'taskhist', $out);
return (str_replace("%prodtype%",$prefix . 'prodtype',$out)); return (str_replace("%prodtype%",$prefix . 'prodtype',$out));
} }
@ -163,7 +165,10 @@ class DbUtils {
array("col" => 'right_dash', "hist" => 1, "new" => 'rDash', "update" => 'rDash'), array("col" => 'right_dash', "hist" => 1, "new" => 'rDash', "update" => 'rDash'),
array("col" => 'right_timetracking',"hist" => 1, "new" => 'rTimetracking', "update" => 'rTimetracking'), array("col" => 'right_timetracking',"hist" => 1, "new" => 'rTimetracking', "update" => 'rTimetracking'),
array("col" => 'right_timemanager', "hist" => 1, "new" => 'rTimemanager', "update" => 'rTimemanager'), array("col" => 'right_timemanager', "hist" => 1, "new" => 'rTimemanager', "update" => 'rTimemanager'),
array("col" => 'right_tasks', "hist" => 1, "new" => 'rTasks', "update" => 'rTasks'),
array("col" => 'right_tasksmanagement',"hist" => 1,"new" => 'rTasksmanagement', "update" => 'rTasksmanagement'),
array("col" => 'active', "hist" => 1, "new" => null ,"default" => 1, "update" => null), array("col" => 'active', "hist" => 1, "new" => null ,"default" => 1, "update" => null),
array("col" => 'area', "hist" => 1, "new" => null ,"default" => null, "update" => null),
array("col" => 'lastmodule', "hist" => 0, "new" => null ,"default" => null, "update" => null), array("col" => 'lastmodule', "hist" => 0, "new" => null ,"default" => null, "update" => null),
array("col" => 'ordervolume', "hist" => 0, "new" => null ,"default" => null, "update" => null), array("col" => 'ordervolume', "hist" => 0, "new" => null ,"default" => null, "update" => null),
array("col" => 'language', "hist" => 0, "new" => null, "update" => null), array("col" => 'language', "hist" => 0, "new" => null, "update" => null),

View File

@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) {
if (strlen($status) > 150) { if (strlen($status) > 150) {
$status = substr($status, 0,149); $status = substr($status, 0,149);
} }
$version = "1.5.1"; $version = "1.5.2";
$arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion); $arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion);
} else { } else {

View File

@ -959,8 +959,11 @@ class QueueContent {
if (!is_null($row->amount)) { if (!is_null($row->amount)) {
$amount = max(($row->amount -1),0); $amount = max(($row->amount -1),0);
$sql = "UPDATE %products% SET amount=? WHERE id=?"; $sql = "UPDATE %products% SET amount=? WHERE id=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); CommonUtils::execSql($pdo, $sql, array($amount,$productid));
$stmt->execute(array($amount,$productid));
if ($amount < 11) {
Tasks::createTaskForEmptyInventory($pdo, $productid);
}
} }
$productname = $row->longname; $productname = $row->longname;

View File

@ -61,7 +61,14 @@ class Roomtables {
} }
public static function getUnpaidTablesCore($pdo,$roomid) { public static function getUnpaidTablesCore($pdo,$roomid) {
$tablesSql = "SELECT id,tableno FROM %resttables% WHERE %resttables%.roomid =? AND removed is null ORDER BY sorting"; $userarea = self::getUserArea($pdo);
$areaWhere = " ";
if (!is_null($userarea)) {
$area = intval($userarea);
$areaWhere = " AND R.area='$area' ";
}
$tablesSql = "SELECT id,tableno FROM %resttables% R WHERE R.roomid=? AND removed is null $areaWhere ORDER BY sorting";
$stmt = $pdo->prepare(DbUtils::substTableAlias($tablesSql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($tablesSql));
$stmt->execute(array($roomid)); $stmt->execute(array($roomid));
@ -148,14 +155,20 @@ class Roomtables {
* get only the rooms (for paydesk, because tables are dynamic due to their pay status) * get only the rooms (for paydesk, because tables are dynamic due to their pay status)
*/ */
function getRooms() { function getRooms() {
$pdo = DbUtils::openDbAndReturnPdoStatic();
$userarea = self::getUserArea($pdo);
$sql = "SELECT id,roomname FROM %room% WHERE removed is null ORDER BY sorting"; $sql = "SELECT id,roomname FROM %room% WHERE removed is null ORDER BY sorting";
$pdo = $this->dbutils->openDbAndReturnPdo(); $result = CommonUtils::fetchSqlAll($pdo, $sql, null);
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute();
$result = $stmt->fetchAll();
$roomArr = array(); $roomArr = array();
foreach($result as $row) { foreach($result as $row) {
$tablesToLookAt = $this->hasUserResponsibleTablesInRoom($pdo, $row['id'], $userarea);
if (!$tablesToLookAt) {
continue;
}
$roomEntry = array("id" => $row['id'], "name" => $row['roomname']); $roomEntry = array("id" => $row['id'], "name" => $row['roomname']);
$roomArr[] = $roomEntry; $roomArr[] = $roomEntry;
} }
@ -174,8 +187,34 @@ class Roomtables {
return $row->pricesum; return $row->pricesum;
} }
private function hasUserResponsibleTablesInRoom($pdo,$roomid,$userarea) {
if (is_null($userarea)) {
return true;
}
$sql = "SELECT count(id) as countid FROM %resttables% R WHERE R.roomid=? AND R.area=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($roomid,$userarea));
$countid = $row->countid;
if ($countid > 0) {
return true;
} else {
return false;
}
}
private static function getUserArea($pdo) {
if(session_id() == '') {
session_start();
}
$userid = $_SESSION['userid'];
$sql = "SELECT area FROM %user% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
return $row->area;
}
private function getAllTablesAndRooms($pdo) private function getAllTablesAndRooms($pdo)
{ {
$userarea = self::getUserArea($pdo);
$queue = new QueueContent(); $queue = new QueueContent();
$sql = "SELECT id,roomname FROM %room% WHERE removed is null ORDER BY sorting"; $sql = "SELECT id,roomname FROM %room% WHERE removed is null ORDER BY sorting";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -187,11 +226,25 @@ class Roomtables {
foreach($dbresult as $zeile) { foreach($dbresult as $zeile) {
$roomid = $zeile['id']; $roomid = $zeile['id'];
$tablesToLookAt = $this->hasUserResponsibleTablesInRoom($pdo, $roomid, $userarea);
if (!$tablesToLookAt) {
continue;
}
$tablesArray = array(); $tablesArray = array();
$sql = "SELECT %resttables%.id as id,%resttables%.tableno as name,%resttables%.sorting as sorting,IFNULL(SUM(IF(%queue%.ordertime is not null AND %queue%.paidtime is null AND %queue%.isclosed is null,%queue%.price,0.00)),0.00) as pricesum FROM %resttables% "; $areaWhere = " ";
$sql .= " LEFT OUTER JOIN %queue% ON %queue%.tablenr=%resttables%.id WHERE %resttables%.removed is null AND active='1' AND "; if (!is_null($userarea)) {
$sql .= " %resttables%.roomid=? GROUP BY %resttables%.id,name ORDER BY %resttables%.sorting"; $area = intval($userarea);
$areaWhere = " AND R.area='$area' ";
}
$sql = "SELECT R.id as id,R.tableno as name,R.sorting as sorting,";
$sql .= " IFNULL(SUM(IF(Q.ordertime is not null AND Q.paidtime is null AND Q.isclosed is null,Q.price,0.00)),0.00) as pricesum FROM %resttables% R";
$sql .= " LEFT OUTER JOIN %queue% Q ON Q.tablenr=R.id WHERE R.removed is null AND active='1' AND ";
$sql .= " R.roomid=? $areaWhere GROUP BY R.id,name ";
$sql .= " ORDER BY R.sorting";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
@ -245,7 +298,9 @@ class Roomtables {
} }
function setRoomInfo($rooms) { function setRoomInfo($roomsAsJson) {
$rooms = json_decode($roomsAsJson, true);
$pdo = DbUtils::openDbAndReturnPdoStatic(); $pdo = DbUtils::openDbAndReturnPdoStatic();
$pdo->beginTransaction(); $pdo->beginTransaction();
@ -277,23 +332,32 @@ class Roomtables {
$sql = "UPDATE %room% SET removed=?,roomname=?,abbreviation=?,printer=?,sorting=? WHERE id=?"; $sql = "UPDATE %room% SET removed=?,roomname=?,abbreviation=?,printer=?,sorting=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$name,$abbreviation,$printer,$sorting,$roomid)); CommonUtils::execSql($pdo, $sql, array(null,$name,$abbreviation,$printer,$sorting,$roomid));
} }
if (isset($aRoom["tables"])) {
$tables = $aRoom["tables"]; $tables = $aRoom["tables"];
foreach($tables as $t) { foreach($tables as $t) {
$tableid = $t["id"]; $tableid = $t["id"];
$tablename = $t["tablename"]; $tablename = $t["tablename"];
$name = $t["name"]; $name = $t["name"];
$code = "";
if (isset($t["code"])) {
$code = $t["code"]; $code = $t["code"];
}
$area = $t["area"];
if ($area == 0) {
$area = null;
}
$sorting = $t["sorting"]; $sorting = $t["sorting"];
$active = $t["active"]; $active = $t["active"];
$allowoutorder = $t["allowoutorder"]; $allowoutorder = $t["allowoutorder"];
if (!is_numeric($tableid)) { if (!is_numeric($tableid)) {
$sql = "INSERT INTO %resttables% (tableno,roomid,code,name,active,allowoutorder,sorting) VALUES(?,?,?,?,?,?,?)"; $sql = "INSERT INTO %resttables% (tableno,roomid,code,name,area,active,allowoutorder,sorting) VALUES(?,?,?,?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($tablename,$roomid,$code,$name,$active,$allowoutorder,$sorting)); CommonUtils::execSql($pdo, $sql, array($tablename,$roomid,$code,$name,$area,$active,$allowoutorder,$sorting));
} else { } else {
$sql = "UPDATE %resttables% SET removed=?,tableno=?,roomid=?,code=?,name=?,active=?,allowoutorder=?,sorting=? WHERE id=?"; $sql = "UPDATE %resttables% SET removed=?,tableno=?,roomid=?,code=?,name=?,area=?,active=?,allowoutorder=?,sorting=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(null,$tablename,$roomid,$code,$name,$active,$allowoutorder,$sorting,$tableid)); CommonUtils::execSql($pdo, $sql, array(null,$tablename,$roomid,$code,$name,$area,$active,$allowoutorder,$sorting,$tableid));
}
} }
} }
} }
@ -357,7 +421,7 @@ class Roomtables {
$printer = $row['printer']; $printer = $row['printer'];
$roomsorting = $row['sorting']; $roomsorting = $row['sorting'];
$sql = "SELECT id,tableno,IFNULL(code,'') as code,IFNULL(name,'') as name,IFNULL(allowoutorder,0) as allowoutorder,IFNULL(sorting,1) as sorting,IFNULL(active,1) as active FROM %resttables% WHERE roomid=? AND $where ORDER BY 'sorting'"; $sql = "SELECT id,tableno,IFNULL(code,'') as code,IFNULL(name,'') as name,IFNULL(allowoutorder,0) as allowoutorder,IFNULL(sorting,1) as sorting,IFNULL(active,1) as active,IFNULL(area,0) as area FROM %resttables% WHERE roomid=? AND $where ORDER BY 'sorting'";
$stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql)); $stmt = $pdo->prepare($this->dbutils->resolveTablenamesInSqlString($sql));
$stmt->execute(array($row['id'])); $stmt->execute(array($row['id']));
$numberOfTables = $stmt->rowCount(); $numberOfTables = $stmt->rowCount();
@ -366,7 +430,7 @@ class Roomtables {
$tableArr = array(); $tableArr = array();
foreach($tableresult as $aTable) { foreach($tableresult as $aTable) {
$tableArr[] = array("id" => $aTable['id'], "tablename" => $aTable['tableno'],"name" => $aTable['name'],"code" => $aTable['code'],"allowoutorder" => $aTable['allowoutorder'],"active" => $aTable['active'],"sorting" => $aTable['sorting']); $tableArr[] = array("id" => $aTable['id'], "tablename" => $aTable['tableno'],"name" => $aTable['name'],"code" => $aTable['code'],"area" => $aTable['area'],"allowoutorder" => $aTable['allowoutorder'],"active" => $aTable['active'],"sorting" => $aTable['sorting']);
} }
$roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "abbreviation" => $abbreviation, "printer" => $printer, "sorting" => $roomsorting, "tables" => $tableArr, "noOfTables" => $numberOfTables); $roomArr[] = array("roomid" => $roomid, "roomname" => $roomname, "abbreviation" => $abbreviation, "printer" => $printer, "sorting" => $roomsorting, "tables" => $tableArr, "noOfTables" => $numberOfTables);
} }

View File

@ -102,8 +102,20 @@ class TableMap {
} }
public static function getTableMapCore($pdo,$roomid) { public static function getTableMapCore($pdo,$roomid) {
if(session_id() == '') {
session_start();
}
$userid = $_SESSION['userid'];
$sql = "SELECT area FROM %user% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($userid));
$userarea = $row->area;
$areaWhere = " ";
if (!is_null($userarea)) {
$area = intval($userarea);
$areaWhere = " AND area='$area' ";
}
$sql = "SELECT id,tableno as name,active FROM %resttables% WHERE roomid=? AND removed is null AND active='1'"; $sql = "SELECT id,tableno as name,active FROM %resttables% WHERE roomid=? AND removed is null AND active='1' $areaWhere ";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute(array($roomid)); $stmt->execute(array($roomid));
$tables = $stmt->fetchAll(); $tables = $stmt->fetchAll();

375
webapp/php/tasks.php Normal file
View File

@ -0,0 +1,375 @@
<?php
require_once ('dbutils.php');
require_once ('commonutils.php');
require_once ('queuecontent.php');
class Tasks {
private static $rights = array(
"gettaskinfoforuser" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasks","tasksmanagement")),
"createtask" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasks","tasksmanagement")),
"changetask" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasks","tasksmanagement")),
"gettasks" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasks","tasksmanagement")),
"gethistory" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasks","tasksmanagement")),
"delete" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("tasksmanagement"))
);
private static $STATUS_NEW = 1;
private static $STATUS_OPEN = 2;
private static $STATUS_DONE = 3;
private static $ACTION_CREATE = 0;
private static $ACTION_CHANGE = 1;
private static $ACTION_REMOVE = 2;
private static $ACTION_MOD_OWNER = 'o';
private static $ACTION_MOD_STATUS = 's';
private static $ACTION_MOD_PRIO = 'p';
private static $ACTION_MOD_SUMMARY = 't';
private static $ACTION_MOD_DESCRIPTION = 'd';
public static function handleCommand($command) {
$pdo = DbUtils::openDbAndReturnPdoStatic();
if (!Permissions::checkRights($command, self::$rights)) {
return false;
}
$ret = array("status" => "ERROR", "msg" => "Falsches Kommando");
if ($command == 'gettaskinfoforuser') {
$ret = self::gettaskinfoforuser($pdo);
} else if ($command == 'createtask') {
$ret = self::createtask($pdo,$_POST['summary'],$_POST['description'],$_POST['prio'],$_POST['owner']);
} else if ($command == 'changetask') {
$ret = self::changetask($pdo,$_POST["id"],$_POST['summary'],$_POST['description'],$_POST['prio'],$_POST['owner'],$_POST["status"]);
} else if ($command == 'gettasks') {
$ret = self::gettasks($pdo,$_GET["filter"]);
} else if ($command == 'gethistory') {
$ret = self::gethistory($pdo,$_GET["id"]);
} else if ($command == 'delete') {
$ret = self::delete($pdo,$_POST["id"]);
}
echo json_encode($ret);
}
public static function areThereTasksForMe($pdo) {
if (session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
return 0;
}
if (!$_SESSION['right_tasks'] && !$_SESSION['right_tasksmanagement']) {
return 0;
}
// use intval to avoid SQL injection
$curuser = intval($_SESSION['userid']);
$sql = "SELECT count(id) as countid FROM %tasks% WHERE owner=? AND status != ?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($curuser,self::$STATUS_DONE));
$count = $row->countid;
if ($count > 0) {
return 1;
} else {
return 0;
}
}
private static function mayCurUserAssignToAll($pdo) {
$userMayAssignToAll = 0;
$isTasksManager = self::isCurrentUserTasksManagement();
if (!$isTasksManager) {
$taskallassign = CommonUtils::getConfigValue($pdo, "taskallassign", 0);
if ($taskallassign == 1) {
$userMayAssignToAll = 1;
}
} else {
$userMayAssignToAll = 1;
}
return $userMayAssignToAll;
}
private static function gettaskinfoforuser($pdo) {
$userMayAssignToAll = self::mayCurUserAssignToAll($pdo);
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
$curuser = array("id" => "-1","username" => "");
} else {
$curuser = array("id" => $_SESSION['userid'],"username" => $_SESSION['currentuser']);
}
return array("status" => "OK","msg" => array("taskallassign" => $userMayAssignToAll,"curuser" => $curuser));
}
private static function gettasks($pdo,$filter) {
if (session_id() == '') {
session_start();
}
$usermaydelete = 0;
if ($_SESSION['right_tasksmanagement']) {
$usermaydelete = 1;
}
// use intval to avoid SQL injection
$curuser = intval($_SESSION['userid']);
try {
$sql = "SELECT T.id as id,";
$sql .= " submitter,IFNULL((SELECT username FROM %user% UU WHERE UU.id=submitter),'System') as submittername,";
$sql .= " (SELECT (IF( (SELECT count(id) as countid FROM %user% UU WHERE UU.id=owner AND UU.active='1') = '0','0',owner))) as owner, ";
$sql .= " IFNULL((SELECT username FROM %user% UU WHERE UU.id=owner AND UU.active='1'),'System') as ownername,";
$sql .= " productid,IFNULL((SELECT longname FROM %products% P WHERE productid=P.id),'') as productname, ";
$sql .= " submitdate,lastdate,status,prio,summary,description ";
$sql .= "FROM %tasks% T ";
switch ($filter) {
case 0:
$where = "";
break;
case 1:
$where = " WHERE owner='$curuser' ";
break;
case 2:
$where = " WHERE status != '" . self::$STATUS_DONE . "' ";
break;
case 3:
$where = " WHERE owner='$curuser' AND status != '" . self::$STATUS_DONE . "' ";
break;
case 4:
$where = " WHERE (owner is null OR (0=(SELECT count(id) as countid FROM %user% US WHERE US.id=owner AND US.active='1'))) AND status != '" . self::$STATUS_DONE . "' ";
break;
default:
$where = "";
break;
}
$sql .= " $where ";
$sql .= " ORDER BY prio,lastdate";
$result = CommonUtils::fetchSqlAll($pdo, $sql);
return array("status" => "OK","msg" => $result,"usermaydelete" => $usermaydelete);
} catch (Exception $ex) {
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
public static function createTaskForEmptyInventory($pdo,$prodid) {
$taskifempty = CommonUtils::getConfigValue($pdo, "taskifempty", 0);
if (($taskifempty == 0) || (is_null($taskifempty))) {
return;
}
//`productid` INT( 10 ) NULL ,
$sql = "SELECT count(id) as countid FROM %tasks% WHERE productid=? AND status != ?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($prodid,self::$STATUS_DONE));
$opentasks = $result[0]["countid"];
if ($opentasks == 0) {
$sql = "SELECT longname FROM %products% WHERE id=?";
$pres = CommonUtils::fetchSqlAll($pdo, $sql, array($prodid));
if (count($pres) == 0) {
return;
}
$prodname = $pres[0]["longname"];
$owner = CommonUtils::getConfigValue($pdo, "taskownerempty", 0);
$submitter = 0;
$prio = 1;
$summary = "Warenbestand '$prodname' geht zur Neige";
$description = "Der Warenbestand des Produkts '$prodname' geht zur Neige. Dies ist eine automatisch erzeugte Aufgabe.";
self::insertNewTask($pdo, $prio, $submitter, $owner, $summary, $description, $prodid,false);
}
}
private static function insertNewTask($pdo,$prio,$submitter,$owner,$summary,$description,$prodid,$useTransaction) {
date_default_timezone_set(DbUtils::getTimeZone());
$submitdate = date('Y-m-d H:i:s');
if ($submitter == 0) {
$submitter = null;
}
if ($owner == 0) {
$owner = null;
}
if (strlen($summary) > 100) {
$summary = substr($summary, 0, 100);
}
if (strlen($description) > 500) {
$description = substr($description,0,500);
}
if ($useTransaction) {
$pdo->beginTransaction();
}
$sql = "INSERT INTO %tasks% (submitdate,lastdate,submitter,owner,prio,status,summary,description,productid) VALUES(?,?,?,?,?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($submitdate,$submitdate,$submitter,$owner,$prio,self::$STATUS_NEW,$summary,$description,$prodid));
$taskid = $pdo->lastInsertId();
$sql = "INSERT INTO %taskhist% (date,taskid,userid,action,fields) VALUES(?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($submitdate,$taskid,$submitter,self::$ACTION_CREATE,''));
if ($useTransaction) {
$pdo->commit();
}
}
private static function isUserLoggedIn($pdo) {
if (session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
return false;
} else {
return true;
}
}
private static function mayUserChangeToThisOwner($pdo,$newOwner) {
$taskInfo = self::gettaskinfoforuser($pdo);
$curid = $taskInfo["msg"]["curuser"]["id"];
if ($curid != $newOwner) {
if ($taskInfo["msg"]["taskallassign"] != 1) {
return false;
}
}
return true;
}
private static function createtask($pdo,$summary,$description,$prio,$owner) {
if (!self::isUserLoggedIn($pdo)) {
return array("status" => "ERROR","msg" => "Benutzer ist nicht eingeloggt!");
}
if (!self::mayUserChangeToThisOwner($pdo, $owner)) {
return array("status" => "ERROR","msg" => "Benutzer darf keinem anderem Benutzer eine Aufgabe zuweisen!");
}
self::insertNewTask($pdo, $prio, $_SESSION['userid'], $owner, $summary, $description, null,true);
return array("status" => "OK");
}
private static function changetask($pdo,$id,$summary,$description,$prio,$owner,$status) {
if (!self::isUserLoggedIn($pdo)) {
return array("status" => "ERROR","msg" => "Benutzer ist nicht eingeloggt!");
}
if (!self::mayUserChangeToThisOwner($pdo, $owner)) {
return array("status" => "ERROR","msg" => "Benutzer darf keinem anderem Benutzer eine Aufgabe zuweisen!");
}
if (strlen($summary) > 100) {
$summary = substr($summary, 0, 100);
}
if (strlen($description) > 500) {
$description = substr($description,0,500);
}
if ($owner == 0) {
$owner = null;
}
$pdo->beginTransaction();
try {
$sql = "SELECT username FROM %user% WHERE id=?";
$row = CommonUtils::getRowSqlObject($pdo, $sql, array($owner));
$ownername = $row->username;
if (is_null($ownername)) {
$ownername = "System";
}
$changedFields = array();
$checkFields = array(
array("owner",$owner,self::$ACTION_MOD_OWNER),
array("status",$status,self::$ACTION_MOD_STATUS),
array("summary",$summary,self::$ACTION_MOD_SUMMARY),
array("description",$description,self::$ACTION_MOD_DESCRIPTION),
array("prio",$prio,self::$ACTION_MOD_PRIO)
);
foreach($checkFields as $aCheckField) {
if (self::willFieldBeChanged($pdo, $id, $aCheckField[0], $aCheckField[1])) {
if (($aCheckField[2] == 's') || ($aCheckField[2] == 'p')) {
$log = $aCheckField[2] . ":" . $aCheckField[1];
} else if ($aCheckField[2] == 'o') {
$ownername = str_replace(",", "", $ownername);
$log = $aCheckField[2] . ":" . $ownername;
} else {
$log = $aCheckField[2];
}
$changedFields[] = $log;
}
}
date_default_timezone_set(DbUtils::getTimeZone());
$date = date('Y-m-d H:i:s');
$userid = $_SESSION['userid'];
$sql = "INSERT INTO %taskhist% (date,taskid,userid,action,fields) VALUES(?,?,?,?,?)";
CommonUtils::execSql($pdo, $sql, array($date,$id,$userid,self::$ACTION_CHANGE,join(',',$changedFields)));
$sql = "UPDATE %tasks% SET lastdate=?,owner=?,status=?,summary=?,description=?,prio=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($date,$owner,$status,$summary,$description,$prio,$id));
$pdo->commit();
return array("status" => "OK","taskid" => $id,"lastchange" => $date);
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function delete($pdo,$taskid) {
$pdo->beginTransaction();
try {
$sql = "DELETE FROM %taskhist% WHERE taskid=?";
CommonUtils::execSql($pdo, $sql, array($taskid));
$sql = "DELETE FROM %tasks% WHERE id=?";
CommonUtils::execSql($pdo, $sql, array($taskid));
$pdo->commit();
return array("status" => "OK","taskid" => $taskid);
} catch (Exception $ex) {
$pdo->rollBack();
return array("status" => "ERROR","msg" => $ex->getMessage());
}
}
private static function gethistory($pdo,$id) {
$sql = "SELECT date,taskid,userid,IFNULL(username,'System') as username,action,fields FROM %taskhist% H ";
$sql .= "LEFT JOIN %user% U ON H.userid=U.id ";
$sql .= "WHERE taskid=? ";
$sql .= "ORDER BY date DESC";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($id));
return array("status" => "OK","msg" => $result);
}
private static function willFieldBeChanged($pdo,$taskid,$field,$newcontent) {
$sql = "SELECT $field as val FROM %tasks% WHERE id=?";
$result = CommonUtils::fetchSqlAll($pdo, $sql, array($taskid));
if (count($result) == 0) {
return true;
}
$oldcontent = $result[0]["val"];
if ($oldcontent != $newcontent) {
return true;
} else {
return false;
}
}
private static function isCurrentUserTasksManagement() {
if (session_id() == '') {
session_start();
}
if (!isset($_SESSION['angemeldet']) || !$_SESSION['angemeldet']) {
return false;
}
if ($_SESSION['right_tasksmanagement']) {
return true;
} else {
return false;
}
}
}

View File

@ -20,55 +20,11 @@ class Timetracking {
"exportTimesCsv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager")) "exportTimesCsv" => array("loggedin" => 1, "isadmin" => 0, "rights" => array("timemanager"))
); );
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'] == false) {
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 == 'timetracking') {
if (($_SESSION['is_admin']) || ($_SESSION['right_timetracking'])) {
return true;
}
} else if ($aRight == 'timemanager') {
if ($_SESSION['right_timemanager']) {
return true;
}
}
}
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
return true;
}
public static function handleCommand($command) { public static function handleCommand($command) {
$pdo = DbUtils::openDbAndReturnPdoStatic(); $pdo = DbUtils::openDbAndReturnPdoStatic();
if (!self::checkRights($command)) { if (!Permissions::checkRights($command, self::$rights)) {
return false; return false;
} }

View File

@ -94,6 +94,23 @@ class Basedb {
return DbUtils::substTableAlias($sqlString); return DbUtils::substTableAlias($sqlString);
} }
public static function getAllColsOfATable($pdo,$dbname,$tablename,$excludeArr) {
$sql = "SELECT `COLUMN_NAME` as colname
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='$dbname'
AND `TABLE_NAME`='$tablename'";
$result = CommonUtils::fetchSqlAll($pdo, $sql,null);
$cols = array();
foreach($result as $r) {
$colname = $r["colname"];
if (!in_array($colname, $excludeArr)) {
$cols[] = $r["colname"];
}
}
return $cols;
}
function dropTables($pdo) { function dropTables($pdo) {
$this->doSQLcatch($pdo, "DROP TABLE `%hsout%`"); $this->doSQLcatch($pdo, "DROP TABLE `%hsout%`");
$this->doSQLcatch($pdo, "DROP TABLE `%hsin%`"); $this->doSQLcatch($pdo, "DROP TABLE `%hsin%`");
@ -106,6 +123,8 @@ class Basedb {
$this->doSQLcatch($pdo, "DROP TABLE `%histuser%`"); $this->doSQLcatch($pdo, "DROP TABLE `%histuser%`");
$this->doSQLcatch($pdo, "DROP TABLE `%histactions%`"); $this->doSQLcatch($pdo, "DROP TABLE `%histactions%`");
$this->doSQLcatch($pdo, "drop TABLE `%taskhist%`");
$this->doSQLcatch($pdo, "drop TABLE `%tasks%`");
$this->doSQLcatch($pdo, "drop TABLE `%queueextras%`"); $this->doSQLcatch($pdo, "drop TABLE `%queueextras%`");
$this->doSQLcatch($pdo, "drop TABLE `%extrasprods%`"); $this->doSQLcatch($pdo, "drop TABLE `%extrasprods%`");
$this->doSQLcatch($pdo, "drop TABLE `%extras%`"); $this->doSQLcatch($pdo, "drop TABLE `%extras%`");
@ -790,6 +809,42 @@ class Basedb {
$stmt->execute(); $stmt->execute();
} }
function createTasksTable($pdo) {
$sql = "
CREATE TABLE `%tasks%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`submitdate` DATETIME NOT NULL ,
`lastdate` DATETIME NULL ,
`submitter` INT (10) NULL,
`owner` INT (10) NULL,
`status` INT(1) NULL,
`prio` INT(1) NULL,
`summary` VARCHAR(100) NULL,
`description` VARCHAR(500) NULL,
`productid` INT( 10 ) NULL ,
FOREIGN KEY (submitter) REFERENCES %user%(id),
FOREIGN KEY (owner) REFERENCES %user%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
function createTaskHistTable($pdo) {
$sql = "
CREATE TABLE `%taskhist%` (
`id` INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`date` DATETIME NOT NULL ,
`taskid` INT(10) NOT NULL ,
`userid` INT (10) NULL,
`action` INT(1) NOT NULL,
`fields` VARCHAR(100) NULL,
FOREIGN KEY (userid) REFERENCES %user%(id)
) CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE = InnoDb ;
";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql));
$stmt->execute();
}
function getPrivkey($pdo) { function getPrivkey($pdo) {
$sql = "SELECT signature FROM %work% WHERE item=?"; $sql = "SELECT signature FROM %work% WHERE item=?";
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); $stmt = $pdo->prepare(DbUtils::substTableAlias($sql));

View File

@ -0,0 +1,57 @@
<?php
class Permissions {
public static function checkRights($command,$rights) {
if (session_id() == '') {
session_start();
}
if (!array_key_exists($command, $rights)) {
echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_NOT_FOUND, "msg" => ERROR_COMMAND_NOT_FOUND_MSG));
return false;
}
$cmdRights = $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'] == false) {
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 == 'timetracking') {
if (($_SESSION['is_admin']) || ($_SESSION['right_timetracking'])) {
return true;
}
} else if ($aRight == 'timemanager') {
if ($_SESSION['right_timemanager']) {
return true;
}
} else if ($aRight == 'tasks') {
if (($_SESSION['is_admin']) || ($_SESSION['right_tasks'])) {
return true;
}
} else if ($aRight == 'tasksmanagement') {
if ($_SESSION['right_tasksmanagement']) {
return true;
}
}
}
echo json_encode(array("status" => "ERROR", "code" => ERROR_NOT_AUTHOTRIZED, "msg" => ERROR_NOT_AUTHOTRIZED_MSG));
return false;
}
return true;
}
}

View File

@ -1,86 +1,146 @@
<?php <?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of roles
*
* @author stefan
*/
class Roles { class Roles {
private static function createNewRoleEntry($pdo,$rolename) {
$cols = Basedb::getAllColsOfATable($pdo, MYSQL_DB, '%roles%',array('id','name'));
$quests = array('?');
$vals = array($rolename);
$colnames = array('name');
foreach($cols as $aCol) {
$quests[] = '?';
$vals[] = 0;
$colnames[] = $aCol;
}
$colnamesStr = join(',',$colnames);
$questsStr = join(',', $quests);
$sql = "INSERT INTO %roles% ($colnamesStr) values($questsStr)";
CommonUtils::execSql($pdo, $sql, $vals);
return $pdo->lastInsertId();
}
private static function setPermission($pdo,$roleid,$permissionsArr) {
foreach ($permissionsArr as $perm) {
$sql = "UPDATE %roles% SET $perm=? WHERE id=?";
CommonUtils::execSql($pdo, $sql, array(1,$roleid));
}
}
public static function insertAdminRole($pdo) { public static function insertAdminRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Admin");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'is_admin',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_statistics',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_products',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_manager',
$stmt->execute(array("Admin",1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1)); 'right_closing',
$id = $pdo->lastInsertId(); 'right_dash',
return $id; 'right_timetracking',
'right_timemanager',
'right_tasks',
'right_tasksmanagement');
self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
public static function insertDigiManagerRole($pdo) { public static function insertDigiManagerRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Manager");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'right_waiter',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_kitchen',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_bar',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_supply',
$stmt->execute(array("Manager",0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)); 'right_paydesk',
$id = $pdo->lastInsertId(); 'right_statistics',
return $id; 'right_bill',
'right_products',
'right_manager',
'right_closing',
'right_dash',
'right_reservation',
'right_rating',
'right_changeprice',
'right_customers',
'right_timetracking',
'right_timemanager',
'right_tasks',
'right_tasksmanagement');
self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
public static function insertWorkManagerRole($pdo) { public static function insertWorkManagerRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Manager");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'right_waiter',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_paydesk',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_statistics',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_bill',
$stmt->execute(array("Manager",0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1)); 'right_products',
$id = $pdo->lastInsertId(); 'right_manager',
return $id; 'right_closing',
'right_dash',
'right_reservation',
'right_rating',
'right_changeprice',
'right_customers',
'right_timetracking',
'right_timemanager',
'right_tasks',
'right_tasksmanagement');
self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
public static function insertDigiWaiterRole($pdo) { public static function insertDigiWaiterRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Kellner");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'right_waiter',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_kitchen',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_bar',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_supply',
$stmt->execute(array("Kellner",0,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0,1,0)); 'right_paydesk',
$id = $pdo->lastInsertId(); 'right_bill',
return $id; 'right_closing',
'right_reservation',
'right_changeprice',
'right_timetracking',
'right_tasks'
);
self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
public static function insertWorkWaiterRole($pdo) { public static function insertWorkWaiterRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Kellner");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'right_waiter',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_kitchen',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_bar',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_supply',
$stmt->execute(array("Kellner",0,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,0)); 'right_paydesk',
$id = $pdo->lastInsertId(); 'right_bill',
return $id; 'right_closing',
'right_reservation',
'right_changeprice',
'right_timetracking',
'right_tasks'
);
self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
public static function insertCookRole($pdo) { public static function insertCookRole($pdo) {
$sql = "INSERT INTO %roles% (name," $roleid = self::createNewRoleEntry($pdo, "Koch");
. "is_admin,right_waiter,right_kitchen,right_bar,right_supply,right_paydesk," $permissionsYes = array(
. "right_statistics,right_bill,right_products,right_manager,right_closing," 'right_kitchen',
. "right_dash,right_reservation,right_rating,right_changeprice,right_customers,right_timetracking,right_timemanager) VALUES(" 'right_bar',
. "?,?,?,?,? ,?,?,?,?,?, ?,?,?,?,?, ?,?,?,?)"; 'right_supply',
$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); 'right_timetracking',
$stmt->execute(array("Koch",0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,0)); 'right_tasks'
$id = $pdo->lastInsertId(); );
return $id; self::setPermission($pdo, $roleid, $permissionsYes);
return $roleid;
} }
} }

View File

@ -95,5 +95,3 @@ class Userrights {
} }
} }
} }
?>

View File

@ -898,6 +898,41 @@ class Version {
} }
} }
public static function upd_1501_1502($pdo, $prefix, $dbname) {
try {
self::execSql($pdo, "ALTER TABLE %roles% ADD right_tasks INT(1) NULL AFTER right_timetracking");
self::execSql($pdo, "ALTER TABLE %roles% ADD right_tasksmanagement INT(1) NULL AFTER right_tasks");
self::execSql($pdo, "ALTER TABLE %histuser% ADD right_tasks INT(1) NULL AFTER right_timetracking");
self::execSql($pdo, "ALTER TABLE %histuser% ADD right_tasksmanagement INT(1) NULL AFTER right_tasks");
self::execSqlWithParam($pdo, "UPDATE %roles% SET right_tasks=?,right_tasksmanagement=?", array(0,0));
self::execSqlWithParam($pdo, "UPDATE %histuser% SET right_tasks=?,right_tasksmanagement=?", array(0,0));
self::execSqlWithParam($pdo, "UPDATE %roles% SET right_tasksmanagement=? WHERE right_manager=? OR is_admin=?", array(1, 1, 1));
self::execSqlWithParam($pdo, "UPDATE %histuser% SET right_tasksmanagement=? WHERE right_manager=? OR is_admin=?", array(1, 1, 1));
self::execSql($pdo, "OPTIMIZE TABLE %roles%");
self::execSql($pdo, "OPTIMIZE TABLE %histuser%");
$basedb = new BaseDb(); $basedb->createTasksTable($pdo);
$basedb = new BaseDb(); $basedb->createTaskHistTable($pdo);
self::execSql($pdo, "ALTER TABLE %resttables% ADD area INT(1) NULL AFTER name");
self::execSql($pdo, "OPTIMIZE TABLE %resttables%");
self::execSql($pdo, "ALTER TABLE %user% ADD area INT(1) NULL AFTER roleid");
self::execSql($pdo, "OPTIMIZE TABLE %user%");
self::execSql($pdo, "ALTER TABLE %histuser% ADD area INT(1) NULL AFTER right_customers");
self::execSql($pdo, "OPTIMIZE TABLE %histuser%");
self::insertOrUpdateConfigItem($pdo, 'taskallassign', '0');
self::insertOrUpdateConfigItem($pdo, 'taskifempty', 0);
self::insertOrUpdateConfigItem($pdo, 'taskownerempty', 0);
return array(true);
} catch (PDOException $e) {
return array(false,$e);
}
}
public static $updateOrder = array( public static $updateOrder = array(
"1.3.0" => array("upd_1300_1301","1.3.1"), "1.3.0" => array("upd_1300_1301","1.3.1"),
"1.3.1" => array("upd_1301_1302","1.3.2"), "1.3.1" => array("upd_1301_1302","1.3.2"),
@ -946,7 +981,8 @@ class Version {
"1.4.16" => array("upd_1416_1417","1.4.17"), "1.4.16" => array("upd_1416_1417","1.4.17"),
"1.4.17" => array("upd_1417_1418","1.4.18"), "1.4.17" => array("upd_1417_1418","1.4.18"),
"1.4.18" => array("upd_1418_1500","1.5.0"), "1.4.18" => array("upd_1418_1500","1.5.0"),
"1.5.0" => array("upd_1500_1501","1.5.1") "1.5.0" => array("upd_1500_1501","1.5.1"),
"1.5.1" => array("upd_1501_1502","1.5.2")
); );
// RE;* also for install process no check is required // RE;* also for install process no check is required

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.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 http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -1190,7 +1190,7 @@ function setLanguage(language) {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="prodtitletxt">Angebot</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="prodtitletxt">Angebot</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -7,7 +7,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.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 http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -221,7 +221,7 @@ function setLanguage(language) {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="reportttitletxt">Statistik</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="reportttitletxt">Statistik</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -609,7 +609,7 @@ $(document).on("pagebeforeshow", "#changeres-page", function () {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="restitletxt">Reservierung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="restitletxt">Reservierung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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"><span id="modulstxt2">Hauptmenü</span></a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch"><span id="modulstxt2">Hauptmenü</span></a>
</div> </div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -285,7 +285,7 @@ function initializeEverything() {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" style="background-color:black;">
<h1><span id="supplyheadline">Bereitstellung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="supplyheadline">Bereitstellung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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">Hauptmenü</a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
</div> </div>

455
webapp/tasks.html Normal file
View File

@ -0,0 +1,455 @@
<html>
<head>
<title>Ansicht Aufgaben</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=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
<script src="php/3rdparty/jquery-1.11.3.min.js"></script>
<script src="php/3rdparty/jquery.mobile-1.4.5.min.js"></script>
<script src="utilities.js?v=1.5.2"></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>
<link rel="stylesheet" href="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.css" />
<script src="php/3rdparty/jquerymobiledatepicker/jquery.mobile.datepicker.js"></script>
</head>
<body>
<script>
var TASKS_UPDATE = ["Aktualisieren","Update","Actualizar"];
var TASK_OVERVIEW_TXT = ["Übersicht","Overview","Resumen"];
var TASKS_NEW_TASK = ["Neue Aufgabe","New task","Tarea nueva"];
var TASK_CHANGE = ["Ändern","Change","Modificar"];
var TASK_DELETE = ["Löschen","Delete","Removar"];
var TASKS_CREATE = ["Erstellen","Create","Crear"];
var TASKS_SUMMARY = ["Thema","Topic","Tema"];
var TASKS_DESCRIPTION = ["Beschreibung","Description","Descripcion"];
var TASK_PRIO = ["Priorität","Priroty","Prio"];
var TASK_PRIO_LEVELS = [
["1 - sehr wichtig","2 - wichtig", "3 - normal","4 - unwichtig","5 - sehr unwichtig"],
["1 - very important","2 - important","3 - normal","4 - unimportant","5 - irrelevant"],
["1 - muy importante","2 - importante","3 - normal", "4 - sin importancia","5 - irrelevante"]
];
var TASK_OWNER = ["Verantwortlich","Owner","Responsible"];
var TASK_SUBMITDATE = ["Erstellung","Creation","Creado"];
var TASK_LASTDATE = ["Letzte Änderung","Last change","Modificado"];
var TASK_SUBMITTER = ["Ersteller","Creator","Creador"];
var TASK_STATUS = ["Status","Status","Status"];
var TASK_STATUS_LEVELS = [
["Neu","In Arbeit","Erledigt"],
["New","Open","Closed"],
["Nuevo","Abuerto","Completado"]
];
var TASKS_HISTORY = ["Historie","History","Historia"];
var TASKS_DATE = ["Datum","Date","Fecha"];
var TASKS_USER = ["Benutzer","User","Usario"];
var TASKS_ACTION = ["Aktion","Action","Evento"];
var TASKS_FIELDS = ["Felder","Fields","Propriedades"];
var TASKS_FILTER = ["Filter","Filter","Filtro"];
var TASK_FILTER_ALL = ["Zeige alle","Show all","Mostrar toto"];
var TASK_FILTER_OWN = ["Nur eigene","Only own items","Solo para mi"];
var TASK_FILTER_ALL_NON_COMPLETED = ["Alle nicht erledigten","All non completed","Todo las tareas que no son completadas"];
var TASK_FILTER_OWN_NON_COMPLETED = ["Nur eigene nicht erledigte","Only own incomplete tasks","Tareas no complatedas para mi"];
var TASK_FILTER_SYSTEM_AND_OPEN = ["Nicht erledigt mit Verantwortung: System","Not completed with responsibility: System","No completada, para System"];
var lang = 0;
var activeusers = [];
var taskallassign = 0;
var curuser = null;
var selectedfilter = 1;
function setLanguage(language) {
lang = language;
$("#overviewtxt").html(TASK_OVERVIEW_TXT[lang]);
initNewTaskArea();
initFilter();
gettasks();
}
function initFilter() {
var txt = "";
var values = [
{id:0, text:TASK_FILTER_ALL[lang]},
{id:1, text:TASK_FILTER_OWN[lang]},
{id:2, text:TASK_FILTER_ALL_NON_COMPLETED[lang]},
{id:3, text:TASK_FILTER_OWN_NON_COMPLETED[lang]},
{id:4, text:TASK_FILTER_SYSTEM_AND_OPEN[lang]}
];
txt += createLabelWithOption("","taskoverviewfilter","",TASKS_FILTER[lang],values,selectedfilter);
$("#filterarea").html(txt);
$("#filterarea").trigger("create");
bindFilterChange();
}
function bindFilterChange() {
$("#taskoverviewfilter").off("change").on("change", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
selectedfilter = $("#taskoverviewfilter").find(":selected").val();
gettasks();
initFilter();
});
}
function getGeneralConfigItems() {
doAjax("GET", "php/contenthandler.php?module=admin&command=getGeneralConfigItemsAndUsers", null, insertGenConfigStartRest, "Fehler Konfigurationsdaten");
}
function insertGenConfigStartRest(configResult) {
if (configResult.status == "OK") {
var values = configResult.msg;
activeusers = values.activeusers;
setLanguage(values.userlanguage);
} else {
setTimeout(function(){document.location.href = "index.html";},250); // not logged in
}
}
function createNewTaskArea(id,name) {
var collapsiblePart = '<div data-role="collapsible" id="' + id + '"';
collapsiblePart += ' data-theme="c" data-content-theme="c">';
collapsiblePart += '<h3>'+ toHtml(name) + '</h3>';
collapsiblePart += '<form>';
collapsiblePart += createLabelWithTextField("userlabel_summary_new",TASKS_SUMMARY[lang],TASKS_SUMMARY[lang]);
collapsiblePart += createLabelWithTextArea("userlabel_description_new",TASKS_DESCRIPTION[lang]);
collapsiblePart += createLabelWithOption("","userlabel_prio_new","",TASK_PRIO[lang],getPrioArray(),3);
collapsiblePart += createLabelWithOption("","userlabel_owner_new","",TASK_OWNER[lang],createTaskOwnerList(),curuser.id);
collapsiblePart += '<button data-theme="f" data-icon="plus" id="CreateNewTask">' + TASKS_CREATE[lang] + '</button>';
collapsiblePart += '</form>';
collapsiblePart += '</div>';
return collapsiblePart;
}
function getPrioArray() {
var rets = [];
for (var i=0;i<5;i++) {
rets[rets.length] = {id: (i+1), text: TASK_PRIO_LEVELS[lang][i] };
}
return rets;
}
function getStatusArray() {
var rets = [];
for (var i=0;i<3;i++) {
rets[rets.length] = {id: (i+1), text: TASK_STATUS_LEVELS[lang][i] };
}
return rets;
}
function createTaskOwnerList() {
var allValues = [];
if (taskallassign == 0) {
allValues[0] = {
id:curuser.id,
text: curuser.username
};
} else {
allValues[0] = {
id:0,
text: "System"
};
for (var i=0;i<activeusers.length;i++) {
var anActiveUser = activeusers[i];
allValues[allValues.length] = {
id:anActiveUser.id,
text:anActiveUser.username
};
}
}
return allValues;
}
function initNewTaskArea() {
doAjax("GET", "php/contenthandler.php?module=tasks&command=gettaskinfoforuser", null, continueNewTaskArea, null);
}
function continueNewTaskArea(answer) {
if (answer.status == "OK") {
taskallassign = answer.msg.taskallassign;
curuser = answer.msg.curuser;
var txt = createNewTaskArea("newtask",TASKS_NEW_TASK[lang]);
$("#newtaskarea").html(txt);
$("#newtaskarea").trigger("create");
bindNewTaskBtn();
}
}
function bindNewTaskBtn() {
$("#CreateNewTask").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var summary = $("#userlabel_summary_new").val();
var description = $("#userlabel_description_new").val();
var prio = $("#userlabel_prio_new").find(":selected").val();
var owner = $("#userlabel_owner_new").find(":selected").val();
var data = {
summary: summary,
description: description,
prio: prio,
owner: owner
};
doAjax("POST", "php/contenthandler.php?module=tasks&command=createtask", data, handleNewTask, null);
});
}
function handleNewTask(answer) {
if (answer.status != "OK") {
alert("Fehler: " + answer.msg);
} else {
initNewTaskArea();
gettasks();
}
}
function gettasks() {
doAjax("GET", "php/contenthandler.php?module=tasks&command=gettasks", {filter: selectedfilter}, handleGetTasks, null);
}
function handleGetTasks(answer) {
if (answer.status != "OK") {
alert("Fehler: " + answer.msg);
return;
}
var usermaydelete = answer.usermaydelete;
var txt = "";
var tasks = answer.msg;
tasks.forEach(function (task,index) {
txt += '<div id="taskitemcollapsible_' + task.id + '" class="taskitemcollapsible" data-role="collapsible" ';
txt += ' data-theme="e" data-content-theme="e">';
txt += '<h3>'+ toHtml(task.summary) + ' (' + TASK_STATUS_LEVELS[lang][parseInt(task.status)-1] + ')</h3>';
txt += '<form>';
txt += '<p><b>' + TASK_SUBMITDATE[lang] + ":</b> " + task.submitdate;
txt += '<p><b>' + TASK_LASTDATE[lang] + ":</b> <span id='lastdate_" + task.id + "'>" + task.lastdate + "</span>";
txt += '<p><b>' + TASK_SUBMITTER[lang] + ":</b> " + task.submittername;
txt += createLabelWithOption("",task.id,"taskitemstatus",TASK_STATUS[lang],getStatusArray(),task.status);
txt += createLabelWithOption("",task.id,"taskitemowner",TASK_OWNER[lang],createTaskOwnerList(),task.owner);
txt += createLabelWithOption("",task.id,"taskitemprio",TASK_PRIO[lang],getPrioArray(),task.prio);
txt += createLabelWithTextFieldWithValue("taskitemsummary_" + task.id,TASKS_SUMMARY[lang],toHtml(task.summary));
txt += createLabelWithTextAreaWithValue("taskitemdescription_" + task.id,TASKS_DESCRIPTION[lang],toHtml(task.description));
txt += '<p><h4>' + TASKS_HISTORY[lang] + '</h4>';
txt += '<div id="taskhist_' + task.id + '">';
txt += ' <img src="php/3rdparty/images/ajax-loader.gif" />';
txt += '</div>';
txt += '<button data-theme="f" data-icon="check" class="changetask" id="Changeask_' + task.id + '">' + TASK_CHANGE[lang] + '</button>';
if (usermaydelete == 1) {
txt += '<button data-theme="d" data-icon="delete" class="deletetask" id="deletetask_' + task.id + '">' + TASK_DELETE[lang] + '</button>';
}
txt += '</form>';
txt += "</div>";
});
txt += '<button data-theme="f" data-icon="check" id="update">' + TASKS_UPDATE[lang] + '</button>';
$("#result").html(txt);
$("#result").trigger("create");
bindChangeBtn();
}
function bindChangeBtn() {
$(".changetask").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id.split("_")[1];
var status = $("#taskitemstatus_" + id).find(":selected").val();
var owner = $("#taskitemowner_" + id).find(":selected").val();
var summary = $("#taskitemsummary_" + id).val();
var description = $("#taskitemdescription_" + id).val();
var prio = $("#taskitemprio_" + id).val();
var data = {
id: id,
status: status,
owner: owner,
prio: prio,
summary: summary,
description: description
};
doAjax("POST", "php/contenthandler.php?module=tasks&command=changetask", data, handleChangeTask, null);
});
$(".taskitemcollapsible").off("collapsibleexpand").on("collapsibleexpand", function (e) {
var id = this.id.split("_")[1];
requestHistForTask(id);
});
$(".deletetask").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var id = this.id.split("_")[1];
doAjax("POST", "php/contenthandler.php?module=tasks&command=delete", {id:id}, handleDeleteTask, null);
});
$("#update").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
gettasks();
});
}
function requestHistForTask(taskid) {
doAjax("GET", "php/contenthandler.php?module=tasks&command=gethistory", {id:taskid}, handleGetHistory, null);
}
function handleDeleteTask(answer) {
if (answer.status == "OK") {
gettasks();
} else {
alert("Fehler: " + answer.msg);
}
}
function handleChangeTask(answer) {
if (answer.status != "OK") {
alert("Fehler: " + answer.msg);
} else {
var lastChange = answer.lastchange;
$("#lastdate_" + answer.taskid).html(lastChange);
requestHistForTask(answer.taskid);
}
}
function translateAction(action) {
if (action == 0) {
return TASKS_CREATE[lang];
} else if (action == 1) {
return TASK_CHANGE[lang];
} else if (action == 2) {
return TASK_DELETE[lang];
} else {
return "?";
}
}
function translateFields(fields) {
if (fields == "") {
return "";
}
var farr = fields.split(",");
var txt = [];
farr.forEach(function(f,i) {
var fparts = f.split(":",2);
switch(fparts[0]) {
case 'o':
txt[txt.length] = TASK_OWNER[lang] + "->" + toHtml(fparts[1]);
break;
case 's':
txt[txt.length] = TASK_STATUS[lang] + "->" + TASK_STATUS_LEVELS[lang][parseInt(fparts[1])-1];
break;
case 'p':
txt[txt.length] = TASK_PRIO[lang] + "->" + TASK_PRIO_LEVELS[lang][parseInt(fparts[1])-1];
break;
case 't':
txt[txt.length] = TASKS_SUMMARY[lang];
break;
case 'd':
txt[txt.length] = TASKS_DESCRIPTION[lang];
break;
default:
}
});
return txt.join(", ");
}
function handleGetHistory(answer) {
if (answer.status == "OK") {
var entries = answer.msg;
if (entries.length > 0) {
var taskid = entries[0]["taskid"];
var txt = "<table class='viewtable' >";
txt += "<tr><th>" + TASKS_DATE[lang] + "<th>" + TASKS_USER[lang] + "<th>" + TASKS_ACTION[lang] + "<th>" + TASKS_FIELDS[lang] + "</tr>";
entries.forEach(function(entry,i) {
txt += "<tr>";
txt += "<td>" + entry.date;
txt += "<td>" + entry.username;
txt += "<td>" + translateAction(entry.action);
txt += "<td>" + translateFields(entry.fields);
txt += "</tr>";
});
txt += "</table>";
$("#taskhist_" + taskid).html(txt);
}
}
}
$(document).on("pageinit", "#time-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
$.ajaxSetup({ cache: false });
getGeneralConfigItems();
});
</script>
<div data-role="page" id="time-page" data-theme="c">
<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-theme="b" data-role="heading">Hauptmenü</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="timetitletxt">Aufgaben</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"><span id="modulstxt2">Hauptmenü</span></a>
</div>
</div>
<div data-role="content" id="fullcontent">
<div id="overviewarea">
<div data-role="collapsible" id="overviewcollapsibke" data-theme="c" data-content-theme="c">
<h3><span id='overviewtxt'>Übersicht</span></h3>
<div id="filterarea"></div>
<div id="result"></div>
</div>
</div>
<div id="newtaskarea">
<img src="php/3rdparty/images/ajax-loader.gif" />
</div>
</div>
<div data-role="footer" data-theme="b" id="thefooterr" style="background-color:black;">
<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> <!-- first page -->
</body>
</html>

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="Stefan Pichel"> <meta name="author" content="Stefan Pichel">
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.1"> <link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.2">
<link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" /> <link rel="stylesheet" href="php/contenthandler.php?module=admin&command=getmobilecss" />
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" /> <link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
@ -395,7 +395,7 @@ $(document).on("pageinit", "#time-page", function () {
</ul> </ul>
</div><!-- /panel --> </div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;"> <div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
<h1><span id="timetitletxt">Zeiterfassung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1> <h1><span id="timetitletxt">Zeiterfassung</span> <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" 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"> <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"><span id="modulstxt2">Hauptmenü</span></a> <a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch"><span id="modulstxt2">Hauptmenü</span></a>
</div> </div>

View File

@ -52,8 +52,15 @@ function setPrinterStatus(answer) {
if (answer.status === "OK") { if (answer.status === "OK") {
if (answer.msg === 0) { if (answer.msg === 0) {
$(".printerstatus").show(); $(".printerstatus").show();
return; } else {
$(".printerstatus").hide();
} }
if (answer.tasksforme === 1) {
$(".tasksstatus").show();
} else {
$(".tasksstatus").hide();
}
return;
} }
$(".printerstatus").hide(); $(".printerstatus").hide();
} }
@ -269,3 +276,57 @@ function checkConnection() {
} }
img.src = "img/gray.png?t=" + (+new Date); img.src = "img/gray.png?t=" + (+new Date);
} }
function createLabelWithTextField(labelid,displayedName,defaultText) {
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<input type="text" id="' + labelid + '" value="" data-mini="true" placeholder="' + defaultText + '" style="background-color:white;color:black;" />';
text += '</div>';
return text;
}
function createLabelWithTextFieldWithValue(labelid,displayedName,content) {
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<input type="text" id="' + labelid + '" data-mini="true" value="' + content + '" style="background-color:white;color:black;" />';
text += '</div>';
return text;
}
function createLabelWithTextArea(labelid,displayedName) {
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<textarea id="' + labelid + '" name="' + labelid + '" cols="40" rows="8" style="background-color:white;color:black;"></textarea>';
text += '</div>';
return text;
}
function createLabelWithTextAreaWithValue(labelid,displayedName,content) {
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<textarea id="' + labelid + '" name="' + labelid + '" cols="40" rows="8" style="background-color:white;color:black;">';
text += content;
text += '</textarea>';
text += '</div>';
return text;
}
function createLabelWithOption(prefix,id,aLabel,displayedName,allValues,theValue) {
var labelid = id;
if ((prefix != "") || (aLabel != "")) {
labelid = prefix + aLabel + "_" + id;
}
var text = '<div class="ui-field-contain">';
text += '<label for="' + labelid + '">' + displayedName + '</label>';
text += '<select name="' + labelid + '" id="' + labelid + '" data-theme="f">';
for (var i=0;i<allValues.length;i++) {
var aValue = allValues[i];
if (aValue.id == theValue) {
text += '<option value="' + aValue.id + '" selected>' + aValue.text + '</option>';
} else {
text += '<option value="' + aValue.id + '" >' + aValue.text + '</option>';
}
}
text += '</select></div>';
return text;
}

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ function sendNewOrders(b){var a=getTableid();if(neworders.length!=0){var c={tabl
<body> <body>
<div class="tableospage"> <div class="tableospage">
<span class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>) <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></span> <span class="header">Kellneransicht (<span id="panelmodetxt">Bestellung</span>) <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tasksstatus.png" class="tasksstatus" style="display:none;" /></span>
</div> </div>
<?php <?php
if (file_exists("customer/mywaiterdesktop.txt")) { if (file_exists("customer/mywaiterdesktop.txt")) {