diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index 81b27c6..2e38020 100644 Binary files a/printserver/OrderSprinterPrintserver.exe and b/printserver/OrderSprinterPrintserver.exe differ diff --git a/spider/install/installer.php b/spider/install/installer.php index 2e590b8..42f1b78 100644 --- a/spider/install/installer.php +++ b/spider/install/installer.php @@ -85,7 +85,7 @@ class Installer { } Database::dropTables($pdo); Database::createEmptyTables($pdo, $prefix); - Database::setVersion($pdo,$prefix,"1.3.2"); + Database::setVersion($pdo,$prefix,"1.3.3"); Database::setAccessPassword($pdo,$prefix,$adminpass); Database::setRefreshRate($pdo,$prefix,"5"); // default: 5 times per hour return array("status" => "OK","msg" => "Installation successful"); diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe index 81b27c6..2e38020 100644 Binary files a/webapp/OrderSprinterPrintserver.exe and b/webapp/OrderSprinterPrintserver.exe differ diff --git a/webapp/bar.html b/webapp/bar.html index 8e70ac5..7e4a4b6 100644 --- a/webapp/bar.html +++ b/webapp/bar.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/bill.html b/webapp/bill.html index 07700b7..f148e12 100644 --- a/webapp/bill.html +++ b/webapp/bill.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/customers.html b/webapp/customers.html index 1ab4f8e..ce9e32f 100644 --- a/webapp/customers.html +++ b/webapp/customers.html @@ -38,6 +38,8 @@ var CUS_REMARK_LABEL = ["Bemerkung:","Remark:","Comentario:"]; var CUS_PHONE_LABEL = ["Telefon","Phone","Telefono"]; var CUS_MOBIL_LABEL = ['Mobil','Mobile','Móvil']; var CUS_WWW_LABEL = ['Webseite','Home page', ' Página web']; +var CUS_HELLO_LABEL = ["Anrede (für Emails)","Saludation (for emails)","Encabezamiento (email)"]; +var CUS_REGARDS_LABEL = ["Gruß (Email-Abschluss)","Greeting (end of email)","Abrazo (Email)"]; var CUS_ROOM_LABEL = ['Zimmer','Room','Habitación']; var CUS_NEW_CUS_BTN = ["Gast anlegen","Create guest","Crear cliente"]; var CUS_EMPTY_NAME = ["Gästenamen nicht angegeben","Name of the guest not specified","Ningún nombre del cliente"]; @@ -76,10 +78,13 @@ var CUS_PRINT_ALL = ["Alle Bons drucken","Print all receipts","Imprimir todos lo var CUS_FILTER_OPEN_BILLS = ["Filter Gäste mit offenen Rechnungen","Filter on customers with ooen bills","Filtrar clientes con tiquets non-pagados"]; var CUS_LOGBTN = ["Rechnungslog (csv)","Log of payments (csv)","Protocolo de los pagos (csv)"]; var CUS_SEND_EMAIL = ["Email an alle Gruppenmitglieder senden","Send email to all group members","Enviar email a todos los miembros"]; -var CUS_EMAIL_WARNING = ["Emails lassen sich nur versenden, wenn die Email-Konfiguration vorgenommen wurde","Emails can only be sent if the email configuration was done","Sólo puede enviar emails si la configuración es completada"]; +var CUS_EMAIL_WARNING = ["Emails lassen sich nur versenden, wenn die Email-Konfiguration vorgenommen wurde.","Emails can only be sent if the email configuration was done.","Sólo puede enviar emails si la configuración es completada."]; var CUS_STORNO_QUEST_TITLE = ["Storno?","Cancel?","Contrapartida?"]; var CUS_STORNO_QUEST_TEXT = ["Bon als vom Gast unbezahlt deklarieren?","Cancel the payment of the guest?","Contrapartida del tique por el cliente?"]; var CUS_YES = ["Ja","Yes","Si"]; +var CUS_PLACEHOLDER_HINT = ["Im Text können die Platzhalter {NAME}, {ANREDE}, {GRUSS} verwendet werden.", + "You can use {NAME}, {ANREDE}, {GRUSS} as placeholder for the name, the salutation or the greeting in the text.", + "En el texto se puede usar {NAME}, {ANREDE}, {GRUSS} para sustituir nombre, encabezamiento o abrazo."]; var l = 0; @@ -93,6 +98,8 @@ function setLanguage(language) { $("#newcusphonelabel").html(CUS_PHONE_LABEL[l]); $("#newcusmobillabel").html(CUS_MOBIL_LABEL[l]); $("#newcuswwwlabel").html(CUS_WWW_LABEL[l]); + $("#newcushellolabel").html(CUS_HELLO_LABEL[l] + ":"); + $("#newcusregardslabel").html(CUS_REGARDS_LABEL[l] + ":"); $("#newcusroomlabel").html(CUS_ROOM_LABEL[l]); $("#newcustomerbtn").html(CUS_NEW_CUS_BTN[l]); $("#customersearchlabel").html(CUS_SEARCH_LABEL[l]); @@ -125,7 +132,7 @@ $(document).on("pageinit", "#info-page", function () {
-
+
@@ -182,6 +189,16 @@ $(document).on("pageinit", "#info-page", function () {
+
+ + +
+ +
+ + +
+
diff --git a/webapp/elements/customers.js b/webapp/elements/customers.js index ffa9872..fd94423 100644 --- a/webapp/elements/customers.js +++ b/webapp/elements/customers.js @@ -1 +1 @@ -var allgroups=[];var customers=[];var decpoint=".";var currency="";var payments=[];function getGeneralConfigItemsCus(){$("#customersearch").val("");$("#groupsearch").val("");clearNewCustomerFields();clearNewGroupFields();doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertConfigDoRest,"Fehler Konfigurationsdaten");doAjax("GET","php/contenthandler.php?module=customers&command=getPaymentsForGuest",null,insertPayments,"Fehler Zahlungswege",true);customizeDatePicker("#newcustomercheckin",null);customizeDatePicker("#newcustomercheckout",null);customizeDatePicker("#customerdate","")}function insertConfigDoRest(b){if(b.status==="OK"){var a=b.msg;$("#customersearch").val("");setLanguage(a.userlanguage);decpoint=a.decpoint;currency=a.currency;bindGroupsOrCustomerBtns();showCustomersArea();startSearch()}else{setTimeout(function(){document.location.href="index.html"},250)}}function insertPayments(d){if(d.status=="OK"){var c=d.msg;payments=[];for(var b=0;b";return a}function showCustomersArea(){$("#customersarea").show();$("#groupsarea").hide();$("#customersbtn").buttonMarkup({theme:"f"});$("#customersbtn").buttonMarkup({icon:"arrow-d"});$("#groupsbtn").buttonMarkup({theme:"c"});$("#groupsbtn").buttonMarkup({icon:"arrow-r"})}function showGroupsArea(){$("#customersarea").hide();$("#groupsarea").show();$("#customersbtn").buttonMarkup({theme:"c"});$("#customersbtn").buttonMarkup({icon:"arrow-r"});$("#groupsbtn").buttonMarkup({theme:"f"});$("#groupsbtn").buttonMarkup({icon:"arrow-d"})}function bindGroupsOrCustomerBtns(){$("#customersbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showCustomersArea()});$("#groupsbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showGroupsArea()});$("#newcustomerbtn").off("click").on("click",function(h){h.stopImmediatePropagation();h.preventDefault();var b=$("#newcustomername").val().trim();var k=$("#newcustomeremail").val().trim();var m=$("#newcustomeraddress").val().trim();var g=$("#newcustomerremark").val().trim();var i=$("#newcustomerphone").val().trim();var j=$("#newcustomermobil").val().trim();var c=$("#newcustomerwww").val().trim();var a=$("#newcustomerroom").val().trim();if(b===""){alert(CUS_EMPTY_NAME[l])}else{var f=getCheckinouts("#newcustomercheckin","#newcustomercheckout");if(!f.valid){alert(CUS_CHECKIN_AFTER_OUT[l]);return}var d={name:b,email:k,addr:m,remark:g,phone:i,mobil:j,www:c,checkin:f.checkin,checkout:f.checkout,room:a};if(!cusCheckTextLengths(d)){return}doAjax("POST","php/contenthandler.php?module=customers&command=createNewCustomer",d,handleCreateCustomerResult,"Gast anlegen unmöglich",true)}});$("#customersearch").off("keyup").on("keyup",function(a){startSearch()});$("#groupsearch").off("keyup").on("keyup",function(a){startSearch()});$("#newgroupbtn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var a=$("#newgroupname").val().trim();var d=$("#newgroupremark").val().trim();if(a===""){alert(GROUP_EMPTY_NAME[l])}else{var b={name:a,remark:d};doAjax("POST","php/contenthandler.php?module=customers&command=createNewGroup",b,handleCreateGroupResult,"Gruppe anlegen unmöglich",true)}});$("#customerlog").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();window.open("php/contenthandler.php?module=customers&command=exportLog","_blank")})}function bindOnDynamicCustomersBtn(){$(".applycustomer").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var j=this.id.split("_")[1];var a=[];for(var b=0;b200){cusAlertTextLength("Bemerkung");return false}var c=$("#cusfield_cusfield_newroom_"+a).val();if(c.length>50){cusAlertTextLength("Zimmer");return false}var b={id:a,checkin:g.checkin,checkout:g.checkout,room:c,remark:f};doAjax("POST","php/contenthandler.php?module=customers&command=newVacation",b,handleChangeVacationResult,"Aufenthalt anlegen unmöglich",true)});$(".delvacation").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=delVacation",{id:b},handleChangeVacationResult,"Aufenthalt löschen unmöglich",true)});$(".unpaybill").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];$("#stornocode").val("");$("#stornoreason").val("");areYouSureCancel(CUS_STORNO_QUEST_TITLE[l],CUS_STORNO_QUEST_TEXT[l],CUS_YES[l],function(){var c={id:a,code:$("#stornocode").val(),remark:$("#stornoreason").val()};doAjax("POST","php/contenthandler.php?module=customers&command=unpay",c,handleChangeBillResult,"Deklaration als unbezahlt unmöglich",true)})});$(".paymentpay").off("click").on("click",function(d){d.stopImmediatePropagation();d.preventDefault();var g=this.id;var c=g.split("_");var a=c[2];var f=c[3];var b=c[4];if(b!="all"){doAjax("POST","php/contenthandler.php?module=customers&command=pay",{id:b,paymentid:f},handleChangeBillResult,"Deklaration als bezahlt unmöglich",true)}else{doAjax("POST","php/contenthandler.php?module=customers&command=payallbills",{id:a,paymentid:f},handleChangeBillResult,"Deklaration alle unmöglich",true)}});$(".printbill").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=printbill",{id:a},null,"Drucken unmöglich",true)});$(".printallbills").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=printallbills",{id:a},null,"Drucken alle unmöglich",true)})}function updateVacationsOfCustomer(a){doAjax("GET","php/contenthandler.php?module=customers&command=getVacations",{cusid:a},handleVacationsResult,null,true)}function updateBillsOfCustomer(a){doAjax("GET","php/contenthandler.php?module=customers&command=getBills",{cusid:a},handleBillsResult,null,true)}function handleVacationsResult(e){if(e.status==="OK"){var f=e.msg.vacations;var b=e.msg.cusid;var a="";for(var d=0;d0){if(d){a+="
"+CUS_DECLARE_ALL_PAY[l]+":
";for(var c=0;cCheck-in: "+d;a+="

Check-out: "+c;a+="

"+CUS_ROOM_LABEL[l]+": "+f;a+="

"+CUS_REMARK_LABEL[l]+g;a+=createDeleteButton(h+"_delvacation",CUS_DEL[l],"d","delvacation");a+="

";return a}function renderABill(h,b,c,f,g,i){var a=f.replace(".",decpoint)+" "+currency;var e="c";if(i==1){e="f"}var d=createCollapsibleStartGeneral("billentry_"+h,c+" - "+a,e,"billentry",true);d+="

"+CUS_BILLID[l]+": "+b;d+="

"+CUS_BILLDATE[l]+": "+c;d+="

"+CUS_BILLBRUTTO[l]+": "+c;if(i==0){d+=createPaymentsArea(h,b,CUS_DECLAREPAY[l])}else{d+=createApplyButton(b+"_unpaybill",CUS_DECLAREUNPAY[l],"d","unpaybill")}d+=createApplyButton(b+"_printbill",CUS_PRINTBILL[l],"f","printbill");d+="

";return d}function handleEmailResult(a){if(a.status==="OK"){alert("Aktion abgeschlossen")}else{alert("Error: "+a.msg)}}function handleChangeVacationResult(b){if(b.status==="OK"){var a=b.cusid;$("#cusfield_newcheckin_"+a).val("");$("#cusfield_newcheckout_"+a).val("");$("#cusfield_cusfield_newroom_"+a).val("");$("#cusfield_vacremark_"+a).val("");updateVacationsOfCustomer(a)}else{alert("Error: "+b.msg)}}function handleChangeBillResult(b){if(b.status==="OK"){var a=b.cusid;updateBillsOfCustomer(a)}else{alert("Error: "+b.msg)}}function deleteCustomerCore(b){var a={id:b};doAjax("POST","php/contenthandler.php?module=customers&command=deleteCustomer",a,handleDeleteCustomerResult,"Gast löschen unmöglich",true)}function deleteGroupCore(b){var a={id:b};doAjax("POST","php/contenthandler.php?module=customers&command=deleteGroup",a,handleDeleteGroupResult,"Gruppe löschen unmöglich",true)}function areYouSureCus(c,b,a,d){$("#sure .sure-1").text(c);$("#sure .sure-2").text(b);$("#sure .sure-do").text(a).off("click.sure").on("click.sure",function(){d()});$(this).off("click.sure");$.mobile.changePage("#sure")}function startSearch(){var a={search:$("#groupsearch").val().trim()};doAjax("POST","php/contenthandler.php?module=customers&command=getGroups",a,handleGetGroupsResult,"Gästeabfrage unmöglich",true)}function startCustomerSearch(){var c=$("#customersearch").val().trim();var a=getDate("#customerdate");var d="";if((a!=null)&&(a!="")){d=a.year+"-"+a.month+"-"+a.day}var b=0;if($("#customeropenbills").is(":checked")){b=1}var e={search:c,date:d,onlyopenbills:b};doAjax("POST","php/contenthandler.php?module=customers&command=getCustomers",e,handleGetCustomerResult,"Gästeabfrage unmöglich",true)}function clearNewCustomerFields(){$("#newcustomername").val("");$("#newcustomeremail").val("");$("#newcustomeraddress").val("");$("#newcustomerremark").val("");$("#newcustomerphone").val("");$("#newcustomermobil").val("");$("#newcustomerwww").val("");$("#newcustomercheckin").val("");$("#newcustomercheckout").val("");$("#newcustomerroom").val("")}function handleCreateCustomerResult(a){if(a.status==="OK"){clearNewCustomerFields();if(a.code==1){var b=CUS_ALREADY_CUS_NAME[l];b=b.replace("%number%",a.value);alert(b)}startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function clearNewGroupFields(){$("#newgroupname").val("");$("#newgroupremark").val("")}function handleCreateGroupResult(a){if(a.status==="OK"){clearNewGroupFields();startSearch()}else{if(a.code==1){alert(CUS_GROUP_EXISTS[l])}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}}function handleChangeCustomerResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleDeleteCustomerResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleDeleteGroupResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleChangeGroupResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function createInputTextField(f,d,e,b,c){var a='
';a+=' ";a+=' ';a+="
";return a}function createTextAreaField(f,d,e,b,c){var a='
';a+=' ";a+=' ";a+="
";return a}function createDateTimePicker(d,b,c){var a='
';a+=' ";a+=' ';a+="
";return a}function createCollapsibleStartNew(d,b,c){var a='
';a+="

"+toHtml(b)+"

";return a}function createCollapsibleStartGeneral(g,c,e,f,b){var d=" ";if(b===false){d=' style="display:none;" '}var a='
";a+="

"+toHtml(c)+"

";return a}function createApplyButton(e,b,d,c){var a='";return a}function createDeleteButton(e,b,d,c){var a='";return a}function createApplyDeleteButtons(d,c,b){var a='
';a+='
'+createApplyButton(d,CUS_APPLY[l],"f",c)+"
";a+='
'+createDeleteButton(d,CUS_DEL[l],"d",b)+"
";a+="
";return a}function renderACustomer(d){var b=d.id;var c="";if((d.openbillsum!=null)&&(d.openbillsum!="")){c=" ("+d.openbillsum;c=c.replace(".",decpoint)+" "+currency+")"}var a=createCollapsibleStartNew(b,d.name+c,"c");a+="

";a+=createInputTextField(b,"cus","name","Name",d.name);a+=createTextAreaField(b,"cus","address",CUS_ADR_LABEL[l],d.address);a+=createInputTextField(b,"cus","phone",CUS_PHONE_LABEL[l],d.phone);a+=createInputTextField(b,"cus","mobil",CUS_MOBIL_LABEL[l],d.mobil);a+=createInputTextField(b,"cus","email","E-Mail",d.email);a+=createInputTextField(b,"cus","www",CUS_WWW_LABEL[l],d.www);a+=createTextAreaField(b,"cus","remark",CUS_REMARK_LABEL[l],d.remark);a+=createGroupList(d);a+="

";a+=CUS_CREATED[l]+": "+d.created+"
";a+=CUS_LAST_MODIFIED[l]+": "+d.lastmodified;a+="
";a+=createApplyDeleteButtons(b,"applycustomer","deletecustomer");a+="

";a+=createCollapsibleStartGeneral("allbills_"+b,CUS_BILLS[l],"e","billscollapsible",true);a+='

';a+="
";a+=createCollapsibleStartGeneral("allvacations_"+b,CUS_VACATIONS[l],"e","vacationcollapsible",true);a+='

';a+=createCollapsibleStartGeneral("newvacations_"+b,CUS_NEWVACATIONS[l],"c","newvacationscollapsible",true);a+=createDateTimePicker("cusfield_newcheckin_"+b,"Check-in","a");a+=createDateTimePicker("cusfield_newcheckout_"+b,"Check-out","a");a+=createInputTextField(b,"cus","cusfield_newroom",CUS_ROOM_LABEL[l],"");a+=createInputTextField(b,"cus","vacremark",CUS_REMARK_LABEL[l],"");a+=createApplyButton(b+"_newvacation",CUS_APPLY[l],"f","newvacation");a+="
";a+="";return a}function renderCustomers(b){var a="";for(var c=0;c
";a+=createInputTextField(b,"grp","name","Name",e.name);a+=createTextAreaField(b,"grp","remark",CUS_REMARK_LABEL[l],e.remark);var c=e.customers;if(c.length>0){a+="

";a+=CUS_CONTAINED_IN_GRP[l]+":
";for(var d=0;d"}a+="
"}a+="

";a+=CUS_CREATED[l]+": "+e.created+"
";a+="
";a+=createApplyDeleteButtons(b,"applygroup","deletegroup");a+=createCollapsibleStartGeneral("groupemail_"+b,"Email","e","groupemailentry",true);a+=createInputTextField(b,"grpemailsubject","grpemailsubject","Subject","");a+=createTextAreaField(b,"grpemailtext","grpemailtext","Text","");a+=createApplyButton(b+"_groupsendemail",CUS_SEND_EMAIL[l],"f","groupsendemail");a+="

"+CUS_EMAIL_WARNING[l]+"";a+="";a+="

";a+="";return a}function renderGroups(b){var a="";for(var c=0;c';e+='
  • '+CUS_GRP_ASS_LIST[l]+"
  • ";for(var d=0;d'+toHtml(c.name)+""}e+="";return e}function cusAlertTextLength(a){alert(CUS_ALERT_TEXT_LEN[l]+a)}function cusCheckTextLengths(a){if(a.name.length>50){cusAlertTextLength("Name");return false}if(a.addr.length>200){cusAlertTextLength(CUS_ADR_LABEL[l]);return false}if(a.phone.length>30){cusAlertTextLength(CUS_PHONE_LABEL[l]);return false}if(a.mobil.length>30){cusAlertTextLength(CUS_MOBIL_LABEL[l]);return false}if(a.email.length>50){cusAlertTextLength("Email");return false}if(a.www.length>50){cusAlertTextLength(CUS_WWW_LABEL[l]);return false}if(a.remark.length>500){cusAlertTextLength(CUS_REMARK_LABEL[l]);return false}return true}function customizeDatePicker(e,b){var d="de";if(l==1){d="en"}else{if(l==2){d="es"}}var a=new Date().getFullYear();var c=(a-10)+":"+(a+3);$(e).datepicker($.datepicker.regional[d]).datepicker("option",{changeMonth:true,changeYear:true,yearRange:c});if((b!=null)&&(b!="")){$(e).datepicker("setDate",new Date(b))}else{$(e).val("")}}function getDate(d){var c=$(d).val();if((c==undefined)||(c.trim()=="")){return null}var a=$(d).datepicker("getDate");var b={day:("0"+a.getDate()).slice(-2),month:("0"+(a.getMonth()+1)).slice(-2),year:a.getFullYear(),date:a};return b}function getCheckinouts(b,h){var d=getDate(b);var c=getDate(h);var a="";if((d!=null)&&(d!="")){a=d.year+"-"+d.month+"-"+d.day}var f="";if((c!=null)&&(c!="")){f=c.year+"-"+c.month+"-"+c.day}var e=true;if((d!=null)&&(d!="")&&(c!=null)&&(c!="")){if(d.date>c.date){e=false}}var g={checkin:a,checkout:f,valid:e};return g}function areYouSureCancel(c,b,a,d){$("#cancelsure .sure-1").text(c);$("#cancelsure .sure-2").text(b);$("#cancelsure .sure-do").text(a).off("click.cancelsure").on("click.cancelsure",function(f){f.stopImmediatePropagation();f.preventDefault();$("#nocancelbtn").off("click");$("#cancelsure").dialog("close");$.mobile.changePage("#info-page");d();$(this).off("click.cancelsure")});$("#nocancelbtn").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();$("#cancelsure .sure-do").text(a).off("click.cancelsure");$("#cancelsure").dialog("close");$.mobile.changePage("#info-page")});$.mobile.changePage("#cancelsure");setTimeout(function(){$("#stornocode").val("");$("#stornoreason").val("")},1000)}; \ No newline at end of file +var allgroups=[];var customers=[];var decpoint=".";var currency="";var payments=[];function getGeneralConfigItemsCus(){$("#customersearch").val("");$("#groupsearch").val("");clearNewCustomerFields();clearNewGroupFields();doAjax("GET","php/contenthandler.php?module=admin&command=getGeneralConfigItems",null,insertConfigDoRest,"Fehler Konfigurationsdaten");doAjax("GET","php/contenthandler.php?module=customers&command=getPaymentsForGuest",null,insertPayments,"Fehler Zahlungswege",true);customizeDatePicker("#newcustomercheckin",null);customizeDatePicker("#newcustomercheckout",null);customizeDatePicker("#customerdate","")}function insertConfigDoRest(b){if(b.status==="OK"){var a=b.msg;$("#customersearch").val("");setLanguage(a.userlanguage);decpoint=a.decpoint;currency=a.currency;bindGroupsOrCustomerBtns();showCustomersArea();startSearch()}else{setTimeout(function(){document.location.href="index.html"},250)}}function insertPayments(d){if(d.status=="OK"){var c=d.msg;payments=[];for(var b=0;b";return a}function showCustomersArea(){$("#customersarea").show();$("#groupsarea").hide();$("#customersbtn").buttonMarkup({theme:"f"});$("#customersbtn").buttonMarkup({icon:"arrow-d"});$("#groupsbtn").buttonMarkup({theme:"c"});$("#groupsbtn").buttonMarkup({icon:"arrow-r"})}function showGroupsArea(){$("#customersarea").hide();$("#groupsarea").show();$("#customersbtn").buttonMarkup({theme:"c"});$("#customersbtn").buttonMarkup({icon:"arrow-r"});$("#groupsbtn").buttonMarkup({theme:"f"});$("#groupsbtn").buttonMarkup({icon:"arrow-d"})}function bindGroupsOrCustomerBtns(){$("#customersbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showCustomersArea()});$("#groupsbtn").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();showGroupsArea()});$("#newcustomerbtn").off("click").on("click",function(i){i.stopImmediatePropagation();i.preventDefault();var b=$("#newcustomername").val().trim();var m=$("#newcustomeremail").val().trim();var o=$("#newcustomeraddress").val().trim();var g=$("#newcustomerremark").val().trim();var j=$("#newcustomerphone").val().trim();var k=$("#newcustomermobil").val().trim();var c=$("#newcustomerwww").val().trim();var n=$("#newcustomerhello").val().trim();var h=$("#newcustomerregards").val().trim();var a=$("#newcustomerroom").val().trim();if(b===""){alert(CUS_EMPTY_NAME[l])}else{var f=getCheckinouts("#newcustomercheckin","#newcustomercheckout");if(!f.valid){alert(CUS_CHECKIN_AFTER_OUT[l]);return}var d={name:b,email:m,addr:o,remark:g,phone:j,mobil:k,www:c,hello:n,regards:h,checkin:f.checkin,checkout:f.checkout,room:a};if(!cusCheckTextLengths(d)){return}doAjax("POST","php/contenthandler.php?module=customers&command=createNewCustomer",d,handleCreateCustomerResult,"Gast anlegen unmöglich",true)}});$("#customersearch").off("keyup").on("keyup",function(a){startSearch()});$("#groupsearch").off("keyup").on("keyup",function(a){startSearch()});$("#newgroupbtn").off("click").on("click",function(c){c.stopImmediatePropagation();c.preventDefault();var a=$("#newgroupname").val().trim();var d=$("#newgroupremark").val().trim();if(a===""){alert(GROUP_EMPTY_NAME[l])}else{var b={name:a,remark:d};doAjax("POST","php/contenthandler.php?module=customers&command=createNewGroup",b,handleCreateGroupResult,"Gruppe anlegen unmöglich",true)}});$("#customerlog").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();window.open("php/contenthandler.php?module=customers&command=exportLog","_blank")})}function bindOnDynamicCustomersBtn(){$(".applycustomer").off("click").on("click",function(g){g.stopImmediatePropagation();g.preventDefault();var j=this.id.split("_")[1];var a=[];for(var b=0;b200){cusAlertTextLength("Bemerkung");return false}var c=$("#cusfield_cusfield_newroom_"+a).val();if(c.length>50){cusAlertTextLength("Zimmer");return false}var b={id:a,checkin:g.checkin,checkout:g.checkout,room:c,remark:f};doAjax("POST","php/contenthandler.php?module=customers&command=newVacation",b,handleChangeVacationResult,"Aufenthalt anlegen unmöglich",true)});$(".delvacation").off("click").on("click",function(a){a.stopImmediatePropagation();a.preventDefault();var b=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=delVacation",{id:b},handleChangeVacationResult,"Aufenthalt löschen unmöglich",true)});$(".unpaybill").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];$("#stornocode").val("");$("#stornoreason").val("");areYouSureCancel(CUS_STORNO_QUEST_TITLE[l],CUS_STORNO_QUEST_TEXT[l],CUS_YES[l],function(){var c={id:a,code:$("#stornocode").val(),remark:$("#stornoreason").val()};doAjax("POST","php/contenthandler.php?module=customers&command=unpay",c,handleChangeBillResult,"Deklaration als unbezahlt unmöglich",true)})});$(".paymentpay").off("click").on("click",function(d){d.stopImmediatePropagation();d.preventDefault();var g=this.id;var c=g.split("_");var a=c[2];var f=c[3];var b=c[4];if(b!="all"){doAjax("POST","php/contenthandler.php?module=customers&command=pay",{id:b,paymentid:f},handleChangeBillResult,"Deklaration als bezahlt unmöglich",true)}else{doAjax("POST","php/contenthandler.php?module=customers&command=payallbills",{id:a,paymentid:f},handleChangeBillResult,"Deklaration alle unmöglich",true)}});$(".printbill").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=printbill",{id:a},null,"Drucken unmöglich",true)});$(".printallbills").off("click").on("click",function(b){b.stopImmediatePropagation();b.preventDefault();var a=this.id.split("_")[1];doAjax("POST","php/contenthandler.php?module=customers&command=printallbills",{id:a},null,"Drucken alle unmöglich",true)})}function updateVacationsOfCustomer(a){doAjax("GET","php/contenthandler.php?module=customers&command=getVacations",{cusid:a},handleVacationsResult,null,true)}function updateBillsOfCustomer(a){doAjax("GET","php/contenthandler.php?module=customers&command=getBills",{cusid:a},handleBillsResult,null,true)}function handleVacationsResult(e){if(e.status==="OK"){var f=e.msg.vacations;var b=e.msg.cusid;var a="";for(var d=0;d0){if(d){a+="
    "+CUS_DECLARE_ALL_PAY[l]+":
    ";for(var c=0;cCheck-in: "+d;a+="

    Check-out: "+c;a+="

    "+CUS_ROOM_LABEL[l]+": "+f;a+="

    "+CUS_REMARK_LABEL[l]+g;a+=createDeleteButton(h+"_delvacation",CUS_DEL[l],"d","delvacation");a+="";return a}function renderABill(h,b,c,f,g,i){var a=f.replace(".",decpoint)+" "+currency;var e="c";if(i==1){e="f"}var d=createCollapsibleStartGeneral("billentry_"+h,c+" - "+a,e,"billentry",true);d+="

    "+CUS_BILLID[l]+": "+b;d+="

    "+CUS_BILLDATE[l]+": "+c;d+="

    "+CUS_BILLBRUTTO[l]+": "+c;if(i==0){d+=createPaymentsArea(h,b,CUS_DECLAREPAY[l])}else{d+=createApplyButton(b+"_unpaybill",CUS_DECLAREUNPAY[l],"d","unpaybill")}d+=createApplyButton(b+"_printbill",CUS_PRINTBILL[l],"f","printbill");d+="";return d}function handleEmailResult(a){if(a.status==="OK"){alert("Aktion abgeschlossen")}else{alert("Error: "+a.msg)}}function handleChangeVacationResult(b){if(b.status==="OK"){var a=b.cusid;$("#cusfield_newcheckin_"+a).val("");$("#cusfield_newcheckout_"+a).val("");$("#cusfield_cusfield_newroom_"+a).val("");$("#cusfield_vacremark_"+a).val("");updateVacationsOfCustomer(a)}else{alert("Error: "+b.msg)}}function handleChangeBillResult(b){if(b.status==="OK"){var a=b.cusid;updateBillsOfCustomer(a)}else{alert("Error: "+b.msg)}}function deleteCustomerCore(b){var a={id:b};doAjax("POST","php/contenthandler.php?module=customers&command=deleteCustomer",a,handleDeleteCustomerResult,"Gast löschen unmöglich",true)}function deleteGroupCore(b){var a={id:b};doAjax("POST","php/contenthandler.php?module=customers&command=deleteGroup",a,handleDeleteGroupResult,"Gruppe löschen unmöglich",true)}function areYouSureCus(c,b,a,d){$("#sure .sure-1").text(c);$("#sure .sure-2").text(b);$("#sure .sure-do").text(a).off("click.sure").on("click.sure",function(){d()});$(this).off("click.sure");$.mobile.changePage("#sure")}function startSearch(){var a={search:$("#groupsearch").val().trim()};doAjax("POST","php/contenthandler.php?module=customers&command=getGroups",a,handleGetGroupsResult,"Gästeabfrage unmöglich",true)}function startCustomerSearch(){var c=$("#customersearch").val().trim();var a=getDate("#customerdate");var d="";if((a!=null)&&(a!="")){d=a.year+"-"+a.month+"-"+a.day}var b=0;if($("#customeropenbills").is(":checked")){b=1}var e={search:c,date:d,onlyopenbills:b};doAjax("POST","php/contenthandler.php?module=customers&command=getCustomers",e,handleGetCustomerResult,"Gästeabfrage unmöglich",true)}function clearNewCustomerFields(){$("#newcustomername").val("");$("#newcustomeremail").val("");$("#newcustomeraddress").val("");$("#newcustomerremark").val("");$("#newcustomerphone").val("");$("#newcustomermobil").val("");$("#newcustomerwww").val("");$("#newcustomerhello").val("");$("#newcustomerregards").val("");$("#newcustomercheckin").val("");$("#newcustomercheckout").val("");$("#newcustomerroom").val("")}function handleCreateCustomerResult(a){if(a.status==="OK"){clearNewCustomerFields();if(a.code==1){var b=CUS_ALREADY_CUS_NAME[l];b=b.replace("%number%",a.value);alert(b)}startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function clearNewGroupFields(){$("#newgroupname").val("");$("#newgroupremark").val("")}function handleCreateGroupResult(a){if(a.status==="OK"){clearNewGroupFields();startSearch()}else{if(a.code==1){alert(CUS_GROUP_EXISTS[l])}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}}function handleChangeCustomerResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleDeleteCustomerResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleDeleteGroupResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function handleChangeGroupResult(a){if(a.status==="OK"){startSearch()}else{alert(CUS_ACTION_FAILED[l]+": "+a.msg)}}function createInputTextField(f,d,e,b,c){var a='

    ';a+=' ";a+=' ';a+="
    ";return a}function createTextAreaField(f,d,e,b,c){var a='
    ';a+=' ";a+=' ";a+="
    ";return a}function createDateTimePicker(d,b,c){var a='
    ';a+=' ";a+=' ';a+="
    ";return a}function createCollapsibleStartNew(d,b,c){var a='
    ';a+="

    "+toHtml(b)+"

    ";return a}function createCollapsibleStartGeneral(g,c,e,f,b){var d=" ";if(b===false){d=' style="display:none;" '}var a='
    ";a+="

    "+toHtml(c)+"

    ";return a}function createApplyButton(e,b,d,c){var a='";return a}function createDeleteButton(e,b,d,c){var a='";return a}function createApplyDeleteButtons(d,c,b){var a='
    ';a+='
    '+createApplyButton(d,CUS_APPLY[l],"f",c)+"
    ";a+='
    '+createDeleteButton(d,CUS_DEL[l],"d",b)+"
    ";a+="
    ";return a}function renderACustomer(d){var b=d.id;var c="";if((d.openbillsum!=null)&&(d.openbillsum!="")){c=" ("+d.openbillsum;c=c.replace(".",decpoint)+" "+currency+")"}var a=createCollapsibleStartNew(b,d.name+c,"c");a+="

    ";a+=createInputTextField(b,"cus","name","Name",d.name);a+=createTextAreaField(b,"cus","address",CUS_ADR_LABEL[l],d.address);a+=createInputTextField(b,"cus","phone",CUS_PHONE_LABEL[l],d.phone);a+=createInputTextField(b,"cus","mobil",CUS_MOBIL_LABEL[l],d.mobil);a+=createInputTextField(b,"cus","email","E-Mail",d.email);a+=createInputTextField(b,"cus","www",CUS_WWW_LABEL[l],d.www);a+=createInputTextField(b,"cus","hello",CUS_HELLO_LABEL[l],d.hello);a+=createTextAreaField(b,"cus","regards",CUS_REGARDS_LABEL[l],d.regards);a+=createTextAreaField(b,"cus","remark",CUS_REMARK_LABEL[l],d.remark);a+=createGroupList(d);a+="

    ";a+=CUS_CREATED[l]+": "+d.created+"
    ";a+=CUS_LAST_MODIFIED[l]+": "+d.lastmodified;a+="
    ";a+=createApplyDeleteButtons(b,"applycustomer","deletecustomer");a+="

    ";a+=createCollapsibleStartGeneral("allbills_"+b,CUS_BILLS[l],"e","billscollapsible",true);a+='

    ';a+="
    ";a+=createCollapsibleStartGeneral("allvacations_"+b,CUS_VACATIONS[l],"e","vacationcollapsible",true);a+='

    ';a+=createCollapsibleStartGeneral("newvacations_"+b,CUS_NEWVACATIONS[l],"c","newvacationscollapsible",true);a+=createDateTimePicker("cusfield_newcheckin_"+b,"Check-in","a");a+=createDateTimePicker("cusfield_newcheckout_"+b,"Check-out","a");a+=createInputTextField(b,"cus","cusfield_newroom",CUS_ROOM_LABEL[l],"");a+=createInputTextField(b,"cus","vacremark",CUS_REMARK_LABEL[l],"");a+=createApplyButton(b+"_newvacation",CUS_APPLY[l],"f","newvacation");a+="
    ";a+="";return a}function renderCustomers(b){var a="";for(var c=0;c
    ";a+=createInputTextField(b,"grp","name","Name",e.name);a+=createTextAreaField(b,"grp","remark",CUS_REMARK_LABEL[l],e.remark);var c=e.customers;if(c.length>0){a+="

    ";a+=CUS_CONTAINED_IN_GRP[l]+":
    ";for(var d=0;d"}a+="
    "}a+="

    ";a+=CUS_CREATED[l]+": "+e.created+"
    ";a+="
    ";a+=createApplyDeleteButtons(b,"applygroup","deletegroup");a+=createCollapsibleStartGeneral("groupemail_"+b,"Email","e","groupemailentry",true);a+=createInputTextField(b,"grpemailsubject","grpemailsubject","Subject","");a+=createInputTextField(b,"grpemailbcc","grpemailbcc","BCC","");a+=createTextAreaField(b,"grpemailtext","grpemailtext","Text","");a+="

    "+CUS_PLACEHOLDER_HINT[l]+" "+CUS_EMAIL_WARNING[l]+"";a+="

    "+createApplyButton(b+"_groupsendemail",CUS_SEND_EMAIL[l],"f","groupsendemail");a+="";a+="

    ";a+="";return a}function renderGroups(b){var a="";for(var c=0;c';e+='
  • '+CUS_GRP_ASS_LIST[l]+"
  • ";for(var d=0;d'+toHtml(c.name)+""}e+="";return e}function cusAlertTextLength(a){alert(CUS_ALERT_TEXT_LEN[l]+a)}function cusCheckTextLengths(a){if(a.name.length>50){cusAlertTextLength("Name");return false}if(a.addr.length>200){cusAlertTextLength(CUS_ADR_LABEL[l]);return false}if(a.phone.length>30){cusAlertTextLength(CUS_PHONE_LABEL[l]);return false}if(a.mobil.length>30){cusAlertTextLength(CUS_MOBIL_LABEL[l]);return false}if(a.email.length>50){cusAlertTextLength("Email");return false}if(a.www.length>50){cusAlertTextLength(CUS_WWW_LABEL[l]);return false}if(a.remark.length>500){cusAlertTextLength(CUS_REMARK_LABEL[l]);return false}return true}function customizeDatePicker(e,b){var d="de";if(l==1){d="en"}else{if(l==2){d="es"}}var a=new Date().getFullYear();var c=(a-10)+":"+(a+3);$(e).datepicker($.datepicker.regional[d]).datepicker("option",{changeMonth:true,changeYear:true,yearRange:c});if((b!=null)&&(b!="")){$(e).datepicker("setDate",new Date(b))}else{$(e).val("")}}function getDate(d){var c=$(d).val();if((c==undefined)||(c.trim()=="")){return null}var a=$(d).datepicker("getDate");var b={day:("0"+a.getDate()).slice(-2),month:("0"+(a.getMonth()+1)).slice(-2),year:a.getFullYear(),date:a};return b}function getCheckinouts(b,h){var d=getDate(b);var c=getDate(h);var a="";if((d!=null)&&(d!="")){a=d.year+"-"+d.month+"-"+d.day}var f="";if((c!=null)&&(c!="")){f=c.year+"-"+c.month+"-"+c.day}var e=true;if((d!=null)&&(d!="")&&(c!=null)&&(c!="")){if(d.date>c.date){e=false}}var g={checkin:a,checkout:f,valid:e};return g}function areYouSureCancel(c,b,a,d){$("#cancelsure .sure-1").text(c);$("#cancelsure .sure-2").text(b);$("#cancelsure .sure-do").text(a).off("click.cancelsure").on("click.cancelsure",function(f){f.stopImmediatePropagation();f.preventDefault();$("#nocancelbtn").off("click");$("#cancelsure").dialog("close");$.mobile.changePage("#info-page");d();$(this).off("click.cancelsure")});$("#nocancelbtn").off("click").on("click",function(f){f.stopImmediatePropagation();f.preventDefault();$("#cancelsure .sure-do").text(a).off("click.cancelsure");$("#cancelsure").dialog("close");$.mobile.changePage("#info-page")});$.mobile.changePage("#cancelsure");setTimeout(function(){$("#stornocode").val("");$("#stornoreason").val("")},1000)}; \ No newline at end of file diff --git a/webapp/feedback.html b/webapp/feedback.html index e3346bf..7e27a70 100644 --- a/webapp/feedback.html +++ b/webapp/feedback.html @@ -4,7 +4,7 @@ - + diff --git a/webapp/index.html b/webapp/index.html index 154fdb4..d7903dc 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -9,8 +9,8 @@ - - + + @@ -203,7 +203,7 @@ function handleResultOfInstallCheck(is_installed) { if (is_installed == "Yes") { useInstallation(); } else { - setTimeout(function(){document.location.href = "install.html?v=1.3.2"},500); + setTimeout(function(){document.location.href = "install.html?v=1.3.3"},500); } } diff --git a/webapp/install.html b/webapp/install.html index cbbe255..b2e40cb 100644 --- a/webapp/install.html +++ b/webapp/install.html @@ -679,7 +679,7 @@ $(document).ready(function() {   - +   diff --git a/webapp/install/installer.php b/webapp/install/installer.php index 3afc783..aecb969 100644 --- a/webapp/install/installer.php +++ b/webapp/install/installer.php @@ -64,7 +64,7 @@ return $pdo; } function checkPhpStatus() { -$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib"); +$extensions = array("gd","mysqli","openssl","pdo_mysql","PDO","session","zlib","curl"); $missing = array(); $extensions_status = 1; @@ -1832,6 +1832,39 @@ return false; } } +function updateUserTable1302_1303($prefix, $version, $dbname) { +$pdo = $this->pdo; +try { +if ($version != "1.3.2") { +$ret = $this->updateUserTable1301_1302($prefix, $version, $dbname); +if (!$ret) { +echo "Version update v1.3.1 to 1.3.2 not successful."; +return false; +} +} + +DbUtils::overrulePrefix($prefix); + +$sql = "ALTER TABLE %customers% ADD hello VARCHAR(100) NULL AFTER www"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$sql = "ALTER TABLE %customers% ADD regards VARCHAR(100) NULL AFTER hello"; +$stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); +$stmt->execute(); +$this->execSql($pdo, "OPTIMIZE TABLE %customers%"); + +$sql = "INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL,?,?)"; +$stmt = $pdo->prepare($this->basedb->resolveTablenamesInSqlString($sql)); +$stmt->execute(array('rksvserver','')); + +$this->updateVersion($pdo, '1.3.3'); +return true; +} catch (PDOException $e) { +echo "Error in v1.3.2 to 1.3.3: $e"; +return false; +} +} + function setVersion($prefix,$theVersion) { $pdo = $this->pdo; @@ -1958,7 +1991,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'billlanguage', $billlanguage)"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'currency', '$currency')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'receiptfontsize', '12')"); -$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.2')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'version', '1.3.3')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paymentconfig', '0')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'remoteaccesscode', null)"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'decpoint', '$decpoint')"); @@ -1985,6 +2018,7 @@ $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VAL $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'paydeskid', 'OrderSprinter-1')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'aeskey', '0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'certificatesn', '1234567')"); +$this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'rksvserver', '')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'digigopaysetready', '1')"); $this->basedb->doSQL($pdo,"INSERT INTO `%config%` (`id` , `name`, `setting`) VALUES (NULL , 'waitergopayprint', '0')"); @@ -2340,7 +2374,7 @@ $zones[] = $timezone_identifiers[$i]; } echo json_encode($zones); } else if ($command == 'update') { -$installerVersion = "1.3.2"; +$installerVersion = "1.3.3"; $admin = new InstallAdmin(); $pdo = $admin->openDbAndReturnPdo($_POST['host'],$_POST['db'],$_POST['user'],$_POST['password']); @@ -2371,7 +2405,7 @@ $supportedVersions = array("1.0.22","1.0.23","1.0.24","1.0.25","1.0.26","1.0.27" "1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.1.6","1.1.7","1.1.8", "1.1.9","1.1.10","1.1.11","1.1.12","1.1.13","1.1.14","1.1.15","1.1.16","1.1.17", "1.1.18","1.1.19","1.1.20","1.1.21","1.1.22","1.1.23","1.1.24","1.1.25","1.1.26","1.1.27","1.1.28","1.1.29","1.1.30", "1.2.0","1.2.1","1.2.2", "1.2.3", "1.2.4","1.2.5","1.2.6","1.2.7","1.2.8","1.2.9","1.2.10","1.2.11","1.2.12","1.2.13","1.2.14","1.2.15","1.2.16","1.2.17", -"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1" +"1.2.18","1.2.19","1.2.20","1.2.21","1.2.22","1.3.0","1.3.1","1.3.2" ); if (!in_array($version, $supportedVersions)) { @@ -2379,7 +2413,7 @@ echo json_encode("Quellversion nicht unterstützt"); return; } -$ret = $admin->updateUserTable1301_1302($_POST['prefix'], $version, $_POST['db']); +$ret = $admin->updateUserTable1302_1303($_POST['prefix'], $version, $_POST['db']); if(session_id() == '') { session_start(); diff --git a/webapp/kitchen.html b/webapp/kitchen.html index 4c6ddd1..f9ddbc4 100644 --- a/webapp/kitchen.html +++ b/webapp/kitchen.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/manager.html b/webapp/manager.html index 35c0807..1c8d60b 100644 --- a/webapp/manager.html +++ b/webapp/manager.html @@ -5,7 +5,7 @@ - + @@ -193,6 +193,7 @@ var MAN_REST_INFO = ["Der Import dauert eine Weile...","The import takes a while var MAN_UPLOAD_FILE = ["Diese Datei hochladen (importieren): ", "Upload this file: ","Importar este file: "]; var MAN_BAK_REST_HEAD = ["Sicherung und Import","Backup and Restore","Exportar y Importar"]; var MAN_BAK_BTN = ["Sicherung (Konfiguration)","Backup (Configuration)","Exportar (configuración)"]; +var MAN_BAK_GUEST_BTN = ["Sicherung (Konfiguration + Gäste)","Backup (Configuration + guests)","Exportar (configuración y clientes)"]; var MAN_BAK_BTN_ALL = ["Sicherung (Alles ohne Logs)","Backup (all without logs)","Exportar (todo sin protocolo)"]; var MAN_BAK_BTN_ALL_LOGS = ["Sicherung (Alles mit Logs)","Backup (all with logs)","Exportar (todo y protocolo)"]; var MAN_RESTORE_BTN = ["Importieren","Restore","Importar"]; @@ -308,6 +309,7 @@ var MAN_AESKEY = ["AES256 Schlüssel","AES256 Key","AES256 LLave"]; var MAN_AESKEY_WRONG_LENGTH = ["Ein AES256-Schlüssel muss in Hex-Darstellung 64 Zeichen haben.","An AES256 key requires to have 64 characters in a hex string.", "Una llave de AES256 tiene que contener 64 characteres en forma hex."]; var MAN_AESKEY_NO_HEX = ["Der AES-Schlüssel muss als Hex-Zahl angegeben werden.","The AES key must be specified as hex number","La llava AES tiene que especificado en formato hex."]; var MAN_CERTIFICATE_SN = ["Zertifikatsseriennummer", "Certificate Serial No","Certificado ID"]; +var MAN_RKSVSERVER = ["RKSV-Server-URL","RKSV server URL","RKSV-Server URL"]; var MAN_TAX = ["Steuersatz (%)","Tax (%)","Impuesto (%)"]; var MAN_CONFIRM_GO_LIVE = ["Die Umsatz- und Logdaten wurden gelöscht und nur die Konfiguration übernommen. Deswegen ist nun ein erneutes Einloggen erforderlich.", "The sales and log data is deleted and configuration is recreated. Therefore a log-in is required now.", @@ -330,6 +332,8 @@ var MAN_HSOUTFILE = ["HS/3 Datei HS3CASH.OUT","HS/3 file HS3CASH.OUT","HS/3 file var MAN_HSCURRENCY = ["HS/3 Währungsangabe","HS/3 Currency","HS/3 Moneda"]; var MAN_DEL_HINT = ["Zum Löschen anklicken","Click to delete","Click para removar"]; var MAN_FONTSIZE_HINT = ["Die Schriftgröße hat nur Einfluss, wenn kein eigenes Layout festgelegt wurde.","The font size only effects receipts if they do not use a specified layout.","El valor sólo funciona si no se usa un layout individual."]; +var MAN_INIT_AUSTRIA = ["Erstelle Startbeleg (Österreich)","Create initial receipt (Austria)","Crear tiquet inicial (Austria)"]; +var MAN_GOLIVE_WAIT_HINT = ["Bitte beachten Sie, dass diese Aktion auf langsamen Servern mehrere Minuten dauern kann. Schließen Sie diesen Dialog und warten Sie auf die Meldung, dass det Vorgang abgeschlossen wurde.","Please be aware that this action may take a while on slow servers. Please close this dialog and wait for the message that the process has completed.","Esta acción puede durar unos minutos. Por favor confirme este dialogo y espere por el mensaje que la acción esta completada."] var lang = 0; var generalVals = [12,2,0,3,0,1,1,0,0,1, 0,50,20,10,1,0,0,0,1,0,1,0,0,1,1]; @@ -393,6 +397,7 @@ var generalValuesSettings = [ ["paydeskid",MAN_PAYDESKID[lang],"i",0,""], ["aeskey",MAN_AESKEY[lang],"i",0,""], ["certificatesn",MAN_CERTIFICATE_SN[lang],"i",0,""], + ["rksvserver",MAN_RKSVSERVER[lang],"i",0,""], ["hotelinterface",MAN_HOTELINTERFACE[lang],"s",22], ["hsinfile",MAN_HSINFILE[lang],"i",0], ["hsoutfile",MAN_HSOUTFILE[lang],"i",0], @@ -462,6 +467,7 @@ function setLanguage(l) { $("#addrecprinterhint").html("

    " + MAN_ADD_RECPRINTER_DESCR[l] + "

    "); $("#aeskeytxt").html(MAN_AESKEY[l]); $("#certificatesntxt").html(MAN_CERTIFICATE_SN[l]); + $("#rksvservertxt").html(MAN_RKSVSERVER[l]); $("#emailbadratingtxt").html(MAN_EMAIL_BAD_RATING[l]); $("#emailratingcontacttxt").html(MAN_EMAIL_RATING_CONTACT[l]); @@ -471,6 +477,7 @@ function setLanguage(l) { $("#uplfiletxt").html(MAN_UPLOAD_FILE[l]); $("#bakrestxt").html(MAN_BAK_REST_HEAD[l]); $("#backupbtntxt").html(MAN_BAK_BTN[l]); + $("#backupguestsbtntxt").html(MAN_BAK_GUEST_BTN[l]); $("#backupbtntxtall").html(MAN_BAK_BTN_ALL[l]); $("#backupbtntxtalllogs").html(MAN_BAK_BTN_ALL_LOGS[l]) $("#restorebtntxt").html(MAN_RESTORE_BTN[l]); @@ -479,6 +486,7 @@ function setLanguage(l) { $("#shutdownbtntxt").html(MAN_SHUTDOWN[l]); $("#shutdownhinttxt").html(MAN_SHUTDOWN_HINT[l]); $("#optimizebtntxt").html(MAN_OPTIMIZE[l]); + // $("#initreceiptbtntxt").html(MAN_INIT_AUSTRIA[l]); $("#optimizehinttxt").html(MAN_OPTIMIZE_HINT[l]); $("#upllogotxt").html(MAN_UPLOAD_LOGO[l]); $("#dellogobtn").html(MAN_NO_LOGO_BTN[l]); @@ -691,6 +699,7 @@ function insertGeneralConfigItems(configResult) { $("#paydeskid").val(values.paydeskid); $("#aeskey").val(values.aeskey); $("#certificatesn").val(values.certificatesn); + $("#rksvserver").val(values.rksvserver); $("#partOfHotelInterface").html(createHotelInterfacePart(values.hotelinterface)); @@ -1311,6 +1320,12 @@ function binding() { window.location.href = "php/contenthandler.php?module=admin&command=backup&type=alllogs"; }); + $("#backupguests_btn").off("click").on("click", function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + window.location.href = "php/contenthandler.php?module=admin&command=backup&type=confandguests"; + }); + $("#restorebtntxt").off("click").on("click", function (e) { $("#restinfoafterclick").html(MAN_REST_INFO[lang]); }); @@ -1334,6 +1349,11 @@ function binding() { e.preventDefault(); doAjax("GET","php/contenthandler.php?module=admin&command=optimize",null,handleAnswerOptimize,"Skriptproblem"); }); +// $("#initreceiptbutton").off("click").on("click", function (e) { +// e.stopImmediatePropagation(); +// e.preventDefault(); +// doAjax("GET","php/contenthandler.php?module=bill&command=initaustriareceipt",null,handleAnswerInitReceipt,"Skriptproblem"); +// }); $("#dellogobtn").off("click").on("click", function (e) { e.stopImmediatePropagation(); @@ -1513,6 +1533,13 @@ function handleAnswerOptimize(result) { alert("Fehler " + result.code + ": " + result.msg); } } +function handleAnswerInitReceipt(answer) { + if (answer.status == "OK") { + alert("Startbeleg wurde erzeugt."); + } else { + alert("Fehler: " + answer.msg); + } +} function hasChangedData(idOfElem) { var fieldChangedAttr = $("" + idOfElem).data("changed"); if (typeof fieldChangedAttr != 'undefined') { @@ -2246,8 +2273,8 @@ function initroomfield(roomfield_json) { } function golive() { - doAjax("POST","php/contenthandler.php?module=admin&command=golive",null,handleGoLive,"Produktivbetriebsstart"); - + alert(MAN_GOLIVE_WAIT_HINT[lang]); + doAjax("POST","php/contenthandler.php?module=admin&command=golive",null,handleGoLive,"Produktivbetriebsstart"); } function handleGoLive(answer) { @@ -2724,6 +2751,10 @@ $(document).on("pageinit", "#admin-page", function () { +
    + + +
    @@ -3006,16 +3037,20 @@ $(document).on("pageinit", "#admin-page", function () {

    -

    Sicherung und Import

    +

    Sicherung und Import

    Die Datensicherung und -wiederherstellung erfordert... -
    +
    - +
    +
    + +
    +
    Die Datensicherung und -wiederherstellung erfordert... -
    +
    @@ -3037,6 +3072,7 @@ $(document).on("pageinit", "#admin-page", function () {

    +


    diff --git a/webapp/paydesk.html b/webapp/paydesk.html index c9cf8f2..5019011 100644 --- a/webapp/paydesk.html +++ b/webapp/paydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/php/admin.php b/webapp/php/admin.php index a4a84ff..f63d121 100644 --- a/webapp/php/admin.php +++ b/webapp/php/admin.php @@ -835,6 +835,7 @@ class Admin { $paydeskid = CommonUtils::getConfigValue($pdo,"paydeskid",""); $aeskey = CommonUtils::getConfigValue($pdo,"aeskey",""); $certificatesn = CommonUtils::getConfigValue($pdo,"certificatesn",""); + $rksvserver = CommonUtils::getConfigValue($pdo,"rksvserver",""); $webimpressum = CommonUtils::getConfigValue($pdo,"webimpressum",""); $userlang = 0; // of no interest, if not called from web @@ -864,7 +865,7 @@ class Admin { "webimpressum" => $webimpressum, "cancelunpaidcode" => $cancelunpaidcode, "cancelguestcode" => $cancelguestcode, "discount1" => $discount1,"discount2" => $discount2,"discount3" => $discount3, "austria" => $austria, "digigopaysetready" => $digigopaysetready, "waitergopayprint" => $waitergopayprint, "oneprodworkreceipts" => $oneprodworkreceipts, "digiprintwork" => $digiprintwork, "memorylimit" => $memorylimit, "hs3refresh" => $hs3refresh, - "paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "addreceipttoprinter" => $addreceipttoprinter, + "paydeskid" => $paydeskid, "aeskey" => $aeskey, "certificatesn" => $certificatesn, "rksvserver" => $rksvserver, "addreceipttoprinter" => $addreceipttoprinter, "printandqueuejobs" => $printandqueuejobs, "cashenabled" => $cashenabled, "returntoorder" => $returntoorder, "beepcooked" => $beepcooked,"restaurantmode" => $restaurantmode ); @@ -955,7 +956,7 @@ class Admin { $view = "preferences.html"; } - echo json_encode($view . "?v=1.3.2"); + echo json_encode($view . "?v=1.3.3"); } } @@ -1157,25 +1158,25 @@ class Admin { if (!self::isOnlyRatingUser($rights, $right_rating, true)) { if ($_SESSION['modus'] == 0) { - if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.2"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waitertxt[$lang], "link" => "waiter.html?v=1.3.3"); }; } else { - if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.2"); }; + if ($_SESSION['right_waiter']) { $mainMenu[] = array("name" => $waiterdesktxt[$lang], "link" => "waiterdesktop.php?v=1.3.3"); }; } - if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.2"); }; - if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.2"); }; - if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.2"); }; + if ($_SESSION['right_kitchen']) { $mainMenu[] = array("name" => $kitchentxt[$lang], "link" => "kitchen.html?v=1.3.3"); }; + if ($_SESSION['right_bar']) { $mainMenu[] = array("name" => "Bar", "link" => "bar.html?v=1.3.3"); }; + if ($_SESSION['right_supply']) { $mainMenu[] = array("name" => $supplytxt[$lang], "link" => "supplydesk.html?v=1.3.3"); }; if ($_SESSION['modus'] == 0) { - if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.2"); }; + if ($_SESSION['right_paydesk']) { $mainMenu[] = array("name" => $paydesktxt[$lang], "link" => "paydesk.html?v=1.3.3"); }; } - if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.2"); }; - if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.2"); }; - if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.2"); }; - if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.2"); }; - if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.2"); }; - if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.2"); }; - if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.2"); }; - $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.2"); - $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.2"); + if ($_SESSION['right_statistics']) { $mainMenu[] = array("name" => $stattxt[$lang], "link" => "reports.html?v=1.3.3"); }; + if ($_SESSION['right_bill']) { $mainMenu[] = array("name" => $bontxt[$lang], "link" => "bill.html?v=1.3.3"); }; + if ($_SESSION['right_products']) { $mainMenu[] = array("name" => $prodtxt[$lang], "link" => "products.html?v=1.3.3"); }; + if ($_SESSION['right_reservation']) { $mainMenu[] = array("name" => $restxt[$lang], "link" => "reservation.html?v=1.3.3"); }; + if ($_SESSION['right_rating']) { $mainMenu[] = array("name" => $ratingtxt[$lang], "link" => "rating.html?v=1.3.3"); }; + if ($_SESSION['right_customers']) { $mainMenu[] = array("name" => $customerstxt[$lang], "link" => "customers.html?v=1.3.3"); }; + if ($_SESSION['right_manager'] || $_SESSION['is_admin'] || $_SESSION['right_closing']) { $mainMenu[] = array("name" => $admintxt[$lang], "link" => "manager.html?v=1.3.3"); }; + $mainMenu[] = array("name" => $settingtxt[$lang], "link" => "preferences.html?v=1.3.3"); + $mainMenu[] = array("name" => "Feedback", "link" => "feedback.html?v=1.3.3"); } $mainMenu[] = array("name" => $logout[$lang], "link" => "logout.php"); @@ -1183,7 +1184,7 @@ class Admin { $waiterMessage = $this->getMessage(null, "waitermessage"); } - $mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.2", + $mainMenuAndVersion = array ("version" => "OrderSprinter 1.3.3", "user" => $currentUser, "menu" => $mainMenu, "waitermessage" => $waiterMessage, @@ -1473,7 +1474,8 @@ class Admin { "paydeskid" => array("dbcol" => "paydeskid","checknum" => 0), "aeskey" => array("dbcol" => "aeskey","checknum" => 0), - "certificatesn" => array("dbcol" => "certificatesn","checksum" => 0) + "certificatesn" => array("dbcol" => "certificatesn","checksum" => 0), + "rksvserver" => array("dbcol" => "rksvserver","checksum" => 0) ); $problem = false; foreach ($changedValues as $aChangeSet) { @@ -1912,6 +1914,10 @@ class Admin { return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods"); } + private function getConfigGuestsTablesToBackupRestore() { + return array("logo","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config","user","comments","histprod","histconfig","histuser","histactions","hist","extras","extrasprods","customers","groups","groupcustomer","vacations"); + } + private function getAllTablesToBackupRestore() { return array("closing","logo","printjobs","ratings","work","payment","room","resttables","tablepos","tablemaps","pricelevel","prodtype","products","config", "user","reservations","customers","groups","groupcustomer","vacations","bill","customerlog","queue","billproducts","hsin","hsout","comments","histprod","histconfig","histuser","histactions","hist", @@ -1958,10 +1964,14 @@ class Admin { $fileName = "backup-" . $version . "_" . $nowtime . "-all.json"; } else if ($theType == "alllogs") { $fileName = "backup-" . $version . "_" . $nowtime . "-all-logs.json"; + } else if ($theType == "confandguests") { + $fileName = "backup-" . $version . "_" . $nowtime . "-guests.json"; } if ($theType == "configuration") { $tables = $this->getConfigTablesToBackupRestore(); + } else if ($theType == "confandguests") { + $tables = $this->getConfigGuestsTablesToBackupRestore(); } else if (($theType == "all") || ($theType == "auto")) { HistFiller::insertSaveHistEntry($pdo); $tables = $this->getAllTablesToBackupRestore(); @@ -2033,7 +2043,7 @@ class Admin { } if(!file_exists($_FILES['userfile']['tmp_name'])) { - header("Location: ../infopage.html?e=manager.html=Datei_existiert_nicht._Bitte_PHP-Variable_upload_max_filesize_checken."); + header("Location: ../infopage.html?e=manager.html=Datei_existiert_nicht._Bitte_PHP-Variablen_upload_max_filesize_und_post_max_size_checken."); exit(); } @@ -2204,20 +2214,20 @@ class Admin { } private function optimize() { - try { - $pdo = DButils::openDbAndReturnPdoStatic(); - self::doSql($pdo, "OPTIMIZE TABLE %queue%", null); - self::doSql($pdo, "OPTIMIZE TABLE %billproducts%", null); - self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null); - self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", null); - self::doSql($pdo, "OPTIMIZE TABLE %log%", null); - echo json_encode(array("status" => "OK")); - } catch (Exception $ex) { - echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG)); - } + set_time_limit(60 * 10); + try { + $pdo = DButils::openDbAndReturnPdoStatic(); + self::doSql($pdo, "OPTIMIZE TABLE %queue%", null); + self::doSql($pdo, "OPTIMIZE TABLE %billproducts%", null); + self::doSql($pdo, "OPTIMIZE TABLE %extrasprods%", null); + self::doSql($pdo, "OPTIMIZE TABLE %queueextras%", null); + self::doSql($pdo, "OPTIMIZE TABLE %log%", null); + echo json_encode(array("status" => "OK")); + } catch (Exception $ex) { + echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG)); + } } - - + private static function getForeignKeyName($pdo,$fromtable,$totable,$dbname,$default = null) { $foreignKey = null; try { @@ -2238,18 +2248,21 @@ class Admin { } private function golive() { + set_time_limit(60*10); $pdo = DButils::openDbAndReturnPdoStatic(); try { $billprodref_fk = self::getForeignKeyName($pdo, 'billproducts', 'bill', MYSQL_DB); $queuebillref_fk = self::getForeignKeyName($pdo, 'queue', 'bill', MYSQL_DB); $billclosingref_fk = self::getForeignKeyName($pdo, 'bill', 'closing', MYSQL_DB); $billbillref_fk = self::getForeignKeyName($pdo, 'bill', 'bill', MYSQL_DB); + $cuslogbillref_fk = self::getForeignKeyName($pdo, 'customerlog', 'bill', MYSQL_DB); } catch (Exception $ex) { echo json_encode(array("status" => "ERROR", "code" => ERROR_COMMAND_ERROR, "msg" => ERROR_COMMAND_ERROR_MSG . " - impossible to get foreign keys: $e")); } try { - + self::doSql($pdo, "DELETE FROM %customerlog%", null); + self::doSql($pdo, "DELETE FROM %hist%", null); self::doSql($pdo, "DELETE FROM %histprod%", null); self::doSql($pdo, "DELETE FROM %histconfig%", null); @@ -2294,11 +2307,13 @@ class Admin { } self::doSql($pdo, "alter table %bill% drop foreign key $billbillref_fk", null); + self::doSql($pdo, "alter table %customerlog% drop foreign key $cuslogbillref_fk", null); self::doSql($pdo, "alter table %billproducts% drop foreign key $billprodref_fk", null); self::doSql($pdo, "alter table %queue% drop foreign key $queuebillref_fk", null); self::doSql($pdo, "ALTER TABLE %bill% DROP id", null); self::doSql($pdo, "ALTER TABLE %bill% ADD id INT (10) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST", null); self::doSql($pdo, "ALTER TABLE %bill% ADD CONSTRAINT $billbillref_fk FOREIGN KEY (ref) REFERENCES %bill%(id)", null); + self::doSql($pdo, "ALTER TABLE %customerlog% ADD CONSTRAINT $cuslogbillref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null); self::doSql($pdo, "ALTER TABLE %billproducts% ADD CONSTRAINT $billprodref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null); self::doSql($pdo, "ALTER TABLE %queue% ADD CONSTRAINT $queuebillref_fk FOREIGN KEY (billid) REFERENCES %bill%(id)", null); self::doSql($pdo, "alter table %bill% drop foreign key $billclosingref_fk", null); diff --git a/webapp/php/bill.php b/webapp/php/bill.php index f99e84c..7b20f62 100644 --- a/webapp/php/bill.php +++ b/webapp/php/bill.php @@ -116,7 +116,16 @@ class Bill { } return; } - + if ($command == 'initaustriareceipt') { + if ($this->hasCurrentUserAdminOrManagerRights()) { + $pdo = DbUtils::openDbAndReturnPdoStatic(); + $status = $this->initaustriareceipt($pdo); + echo json_encode($status); + } else { + echo json_encode(array("status" => "ERROR", "code" => ERROR_MANAGER_NOT_AUTHOTRIZED, "msg" => ERROR_MANAGER_NOT_AUTHOTRIZED_MSG)); + } + return; + } if ($this->hasCurrentUserBillRights()) { if ($command == 'getLastBillsWithContent') { $this->getLastBillsWithContent($_GET['day'],$_GET['month'],$_GET['year']); @@ -506,6 +515,55 @@ class Bill { } } + private function initaustriareceipt($pdo) { + date_default_timezone_set(DbUtils::getTimeZone()); + $currentTime = date('Y-m-d H:i:s'); + + $pdo->beginTransaction(); + + try { + // calculate next bill id + $sql = "SELECT MAX(id) as maxid FROM %bill%"; + $row = CommonUtils::getRowSqlObject($pdo, $sql); + $maxbillid = $row->maxid; + $nextbillid = 1; + $newprevbrutto = 0; + $newprevnetto = 0; + if (!is_null($maxbillid)) { + $nextbillid = intval($maxbillid) + 1; + + $sql = "SELECT brutto,netto,prevbrutto,prevnetto FROM %bill% WHERE id=?"; + $row = CommonUtils::getRowSqlObject($pdo, $sql, array(intval($maxbillid))); + $newprevbrutto = $row->prevbrutto ; + $newprevnetto = $row->prevnetto; + } + + $commonUtils = new CommonUtils(); + $commonUtils->setLastBillIdInWorkTable($pdo, $nextbillid); + + $tableid = 0; + if(session_id() == '') { + session_start(); + } + $userid = $_SESSION['userid']; + $signature = $commonUtils->calcSignatureForBill($pdo,$currentTime, '0.00', '0.00', '0.00', $userid); + + $sql = "INSERT INTO `%bill%` (`id` , `billdate`,`brutto`,`netto`,`prevbrutto`,`prevnetto`,`tableid`,`paymentid`,`userid`,`ref`,`tax`,`host`,`reservationid`,`guestinfo`,`intguestid`,`signature`,`reason`) VALUES (?,?,?,?,?,?,?,?,?,NULL,NULL,?,?,?,?,?,?)"; + CommonUtils::execSql($pdo, $sql, array($nextbillid,$currentTime,'0.00', '0.00',$newprevbrutto,$newprevnetto,$tableid,1,$userid,0,null,null,null,$signature,'STARTBELEG')); + + CommonUtils::log($pdo, "QUEUE", "Created bill STARTBELEG with id=$nextbillid from user $userid"); + + Rksv::doStartBeleg($pdo, $nextbillid, $currentTime); + + } catch (Exception $ex) { + $pdo->rollBack(); + return array("status" => "ERROR", "msg" => $ex->getMessage()); + } + $pdo->commit(); + + return array("status" => "OK"); + } + private function changeBillHost($pdo,$billid,$isNowHost) { $sql = "SELECT host,closingid FROM %bill% WHERE id=?"; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); diff --git a/webapp/php/contenthandler.php b/webapp/php/contenthandler.php index f8b0853..fb192a7 100644 --- a/webapp/php/contenthandler.php +++ b/webapp/php/contenthandler.php @@ -7,6 +7,7 @@ require_once ('products.php'); require_once ('roomtables.php'); require_once ('reports.php'); require_once ('bill.php'); +require_once ('rksv.php'); require_once ('closing.php'); require_once ('printqueue.php'); require_once ('feedback.php'); diff --git a/webapp/php/customers.php b/webapp/php/customers.php index ab6a16b..ee600df 100644 --- a/webapp/php/customers.php +++ b/webapp/php/customers.php @@ -93,11 +93,11 @@ class Customers { $pdo = DbUtils::openDbAndReturnPdoStatic(); if ($command == 'createNewCustomer') { - echo json_encode($this->createNewCustomer($pdo,$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['checkin'],$_POST['checkout'],$_POST['room'])); + echo json_encode($this->createNewCustomer($pdo,$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['hello'],$_POST['regards'],$_POST['checkin'],$_POST['checkout'],$_POST['room'])); } else if ($command == 'deleteCustomer') { echo json_encode($this->deleteCustomer($pdo,$_POST['id'])); } else if ($command == 'changeCustomer') { - echo json_encode($this->changeCustomer($pdo,$_POST["id"],$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST["groups"])); + echo json_encode($this->changeCustomer($pdo,$_POST["id"],$_POST['name'],$_POST['email'],$_POST['addr'],$_POST['remark'],$_POST['phone'],$_POST['mobil'],$_POST['www'],$_POST['hello'],$_POST['regards'],$_POST["groups"])); } else if ($command == 'getCustomers') { echo json_encode($this->getCustomers($pdo,$_POST['search'],$_POST['date'],$_POST['onlyopenbills'])); } else if ($command == 'createNewGroup') { @@ -129,7 +129,7 @@ class Customers { } else if ($command == 'printallbills') { echo json_encode($this->printallbills($pdo,$_POST['id'])); } else if ($command == 'emailGroup') { - echo json_encode($this->emailGroup($pdo,$_POST['groupid'],$_POST["subject"],$_POST["text"])); + echo json_encode($this->emailGroup($pdo,$_POST['groupid'],$_POST["subject"],$_POST["bcc"],$_POST["text"])); } else if ($command == 'getPaymentsForGuest') { echo json_encode($this->getPaymentsForGuest($pdo)); } else if ($command == 'exportLog') { @@ -150,7 +150,7 @@ class Customers { } } - private function createNewCustomer($pdo,$name,$email,$addr,$remark,$phone,$mobil,$www,$checkin,$checkout,$room) { + private function createNewCustomer($pdo,$name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$checkin,$checkout,$room) { date_default_timezone_set(DbUtils::getTimeZone()); $currentTime = date('Y-m-d H:i:s'); @@ -163,6 +163,12 @@ class Customers { if ($room == '') { $room = null; } + if ($hello == '') { + $hello = null; + } + if ($regards == '') { + $regards = null; + } try { $pdo->beginTransaction(); @@ -175,9 +181,9 @@ class Customers { $code = 0; } - $sql = "INSERT INTO %customers% (name,email,address,remark,phone,mobil,www,created,lastmodified) VALUES(?,?,?,?,?,?,?,?,?)"; + $sql = "INSERT INTO %customers% (name,email,address,remark,phone,mobil,www,hello,regards,created,lastmodified) VALUES(?,?,?,?,?,?,?,?,?,?,?)"; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); - $stmt->execute(array($name,$email,$addr,$remark,$phone,$mobil,$www,$currentTime,$currentTime)); + $stmt->execute(array($name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$currentTime,$currentTime)); $cusid = $pdo->lastInsertId(); self::addVacationsCore($pdo,$cusid,$checkin,$checkout,$room,null); @@ -220,13 +226,13 @@ class Customers { } } - private function changeCustomer($pdo,$id,$name,$email,$addr,$remark,$phone,$mobil,$www,$groups) { + private function changeCustomer($pdo,$id,$name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$groups) { date_default_timezone_set(DbUtils::getTimeZone()); $currentTime = date('Y-m-d H:i:s'); try { - $sql = "UPDATE %customers% SET name=?,email=?,address=?, remark=?, phone=?, mobil=?, www=?,lastmodified=? WHERE id=?"; - CommonUtils::execSql($pdo, $sql, array($name,$email,$addr,$remark,$phone,$mobil,$www,$currentTime,$id)); + $sql = "UPDATE %customers% SET name=?,email=?,address=?, remark=?, phone=?, mobil=?, www=?,hello=?,regards=?,lastmodified=? WHERE id=?"; + CommonUtils::execSql($pdo, $sql, array($name,$email,$addr,$remark,$phone,$mobil,$www,$hello,$regards,$currentTime,$id)); $sql = "DELETE FROM %groupcustomer% WHERE customerid=?"; CommonUtils::execSql($pdo, $sql, array($id)); @@ -463,8 +469,7 @@ class Customers { try { $allcustomers = array(); - //$sql = "SELECT id,name,email,address,remark,phone,mobil,www,IFNULL(checkin,'') as checkin,IFNULL(checkout,'') as checkout,IFNULL(room,'') as room,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name"; - $sql = "SELECT %customers%.id as id,name,email,address,remark,phone,mobil,www,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name"; + $sql = "SELECT %customers%.id as id,name,email,address,remark,phone,mobil,www,hello,regards,DATE_FORMAT(created,'%e %b %Y - %k:%i') as created,DATE_FORMAT(lastmodified,'%e %b %Y - %k:%i') as lastmodified FROM %customers% WHERE (name like ?) OR (email like ?) ORDER BY name"; $result = CommonUtils::fetchSqlAll($pdo, $sql, array($s,$s)); @@ -495,6 +500,8 @@ class Customers { "phone" => $aCustomer["phone"], "mobil" => $aCustomer["mobil"], "www" => $aCustomer["www"], + "hello" => $aCustomer["hello"], + "regards" => $aCustomer["regards"], "created" => $aCustomer["created"], "lastmodified" => $aCustomer["lastmodified"], "groups" => $assgroups, @@ -573,8 +580,8 @@ class Customers { } } - private function emailGroup($pdo,$grpid,$subject,$text) { - $sql = "SELECT %customers%.name as name ,%customers%.email as email from %customers%,%groupcustomer% WHERE %groupcustomer%.groupid=? AND %groupcustomer%.customerid=%customers%.id ORDER by name"; + private function emailGroup($pdo,$grpid,$subject,$bcc,$text) { + $sql = "SELECT %customers%.name as name,IFNULL(%customers%.hello,'') as hello,IFNULL(%customers%.regards,'') as regards ,%customers%.email as email from %customers%,%groupcustomer% WHERE %groupcustomer%.groupid=? AND %groupcustomer%.customerid=%customers%.id ORDER by name"; $customersInGroup = CommonUtils::fetchSqlAll($pdo, $sql, array($grpid)); $emails = array(); @@ -583,14 +590,22 @@ class Customers { if (!is_null($email)) { $email = trim($email); if ($email != '') { - $emails[] = $email; + $emails[] = array("email" => $email,"hello" => $aCustomer["hello"],"regards" => $aCustomer["regards"],"name" => $aCustomer["name"]); } } } $ok = true; - foreach($emails as $anEmail) { - if (!Emailer::sendEmail($pdo, $text, $anEmail, $subject)) { + foreach($emails as $anEmailEntry) { + $anEmail = $anEmailEntry["email"]; + + $name = $anEmailEntry["name"]; + $hello = $anEmailEntry["hello"]; + $regards = $anEmailEntry["regards"]; + $textToSend = str_replace("{NAME}",$name,$text); + $textToSend = str_replace("{ANREDE}",$hello,$textToSend); + $textToSend = str_replace("{GRUSS}",$regards,$textToSend); + if (!Emailer::sendEmail($pdo, $textToSend, $anEmail, $subject,$bcc)) { $ok = false; } } diff --git a/webapp/php/queuecontent.php b/webapp/php/queuecontent.php index 6b995ca..a8b2ef6 100644 --- a/webapp/php/queuecontent.php +++ b/webapp/php/queuecontent.php @@ -1702,6 +1702,8 @@ class QueueContent { $billInfo = array("billid" => $billid, "date" => $currentTime); + // Rksv::signBill($pdo, $billid); + CommonUtils::callPlugin($pdo, "createBill", "after"); CommonUtils::log($pdo, "QUEUE", "Created bill with id=$billid from user $userid"); diff --git a/webapp/php/rksv.php b/webapp/php/rksv.php new file mode 100644 index 0000000..b5e946a --- /dev/null +++ b/webapp/php/rksv.php @@ -0,0 +1,120 @@ + "OK"); + } + + $rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null); + if (is_null($rksvserver)) { + return array("status" => "ERROR","msg" => "No RKSV server configured"); + } + + $paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null); + if (is_null($paydeskid) || ($paydeskid == '')) { + return array("status" => "ERROR","msg" => "No Paydesk ID configured"); + } + + if (!extension_loaded("curl")) { + return array("status" => "ERROR","msg" => "PHP curl extension is missing"); + } + return array("status" => "OK"); + } + + public static function doStartBeleg($pdo,$billid,$billdate) { + $envStatus = self::checkEnvironment($pdo); + if ($envStatus["status"] != "OK") { + return $envStatus; + } + $rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null); + $paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null); + + $myvars = 'paydeskid=' . $paydeskid; + $myvars .= '&billid=' . $billid; + $myvars .= '&billdate=' . $billdate; + $myvars .= '&command=startbeleg'; + + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_VERBOSE, true); + curl_setopt( $ch, CURLOPT_URL, $rksvserver); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); + + try { + $response = curl_exec($ch); + } catch (Exception $ex) { + return array("status" => "ERROR","msg" => "RKSV Server call exception: " . $ex->getMessage()); + } + } + + public static function signBill($pdo,$billid) { + $envStatus = self::checkEnvironment($pdo); + if ($envStatus["status"] != "OK") { + return $envStatus; + } + + $rksvserver = CommonUtils::getConfigValue($pdo, "rksvserver", null); + $paydeskid = CommonUtils::getConfigValue($pdo, "paydeskid", null); + + $sql = "SELECT billdate,brutto FROM %bill% WHERE id=?"; + $billrow = CommonUtils::getRowSqlObject($pdo, $sql, array($billid)); + $billdate = $billrow->billdate; + + $sql = "SELECT SUM(price) as sumprice FROM %queue% WHERE billid=? AND taxaustria=?"; + $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); + + $stmt->execute(array($billid,self::$TAX_NORMAL)); + $taxnormalsum = $stmt->fetchObject()->sumprice; + $taxnormalsum = (is_null($taxnormalsum) ? '0.00' : $taxnormalsum); + + $stmt->execute(array($billid,self::$TAX_ERM1)); + $taxerm1sum = $stmt->fetchObject()->sumprice; + $taxerm1sum = (is_null($taxerm1sum) ? '0.00' : $taxerm1sum); + + $stmt->execute(array($billid,self::$TAX_ERM2)); + $taxerm2sum = $stmt->fetchObject()->sumprice; + $taxerm2sum = (is_null($taxerm2sum) ? '0.00' : $taxerm2sum); + + $stmt->execute(array($billid,self::$TAX_BESONDERS)); + $taxbessum = $stmt->fetchObject()->sumprice; + $taxbessum = (is_null($taxbessum) ? '0.00' : $taxbessum); + + $myvars = 'paydeskid=' . $paydeskid; + $myvars .= '&taxnormalsum=' . $taxnormalsum; + $myvars .= '&taxerm1sum=' . $taxerm1sum; + $myvars .= '&taxerm2sum=' . $taxerm2sum; + $myvars .= '&taxbessum=' . $taxbessum; + $myvars .= '&billid=' . $billid; + $myvars .= '&billdate=' . $billdate; + + $ch = curl_init(); + curl_setopt( $ch, CURLOPT_VERBOSE, true); + curl_setopt( $ch, CURLOPT_URL, $rksvserver); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); + + try { + $response = curl_exec($ch); + } catch (Exception $ex) { + return array("status" => "ERROR","msg" => "RKSV Server call exception: " . $ex->getMessage()); + } + } + + +} + diff --git a/webapp/php/utilities/Emailer.php b/webapp/php/utilities/Emailer.php index e36862d..2a87708 100644 --- a/webapp/php/utilities/Emailer.php +++ b/webapp/php/utilities/Emailer.php @@ -1,10 +1,16 @@ setFrom(self::getConfigItemOrDefault($pdo, "email", "")); $mail->addAddress($to); // Add a recipient + if (!is_null($bcc)) { + $mail->addBCC($bcc); + } $mail->isHTML(true); // Set email format to HTML $mail->Subject = $subject; @@ -53,7 +62,7 @@ class Emailer { $ret = $mail->send(); return $ret; } else { - return $true; + return true; } } diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php index f70ad71..7172d00 100644 --- a/webapp/php/utilities/basedb.php +++ b/webapp/php/utilities/basedb.php @@ -481,6 +481,8 @@ class Basedb { `phone` VARCHAR(30) NULL, `mobil` VARCHAR(30) NULL, `www` VARCHAR(50) NULL, + `hello` VARCHAR(100) NULL, + `regards` VARCHAR(100) NULL, `remark` VARCHAR(500) NULL, `created` DATETIME NULL, `lastmodified` DATETIME NULL diff --git a/webapp/preferences.html b/webapp/preferences.html index 69e0c63..d0cf8b2 100644 --- a/webapp/preferences.html +++ b/webapp/preferences.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/products.html b/webapp/products.html index 5fc0391..df840df 100644 --- a/webapp/products.html +++ b/webapp/products.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/rating.html b/webapp/rating.html index ef75d36..5ae5fdf 100644 --- a/webapp/rating.html +++ b/webapp/rating.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reports.html b/webapp/reports.html index 585f557..91d4840 100644 --- a/webapp/reports.html +++ b/webapp/reports.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reservation.html b/webapp/reservation.html index 6ffc9e3..2464160 100644 --- a/webapp/reservation.html +++ b/webapp/reservation.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html index 7f0251e..c7d9bbe 100644 --- a/webapp/supplydesk.html +++ b/webapp/supplydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/waiter.html b/webapp/waiter.html index 6bede63..0d2df1e 100644 --- a/webapp/waiter.html +++ b/webapp/waiter.html @@ -4,7 +4,7 @@ - +