From: Kilian Saffran Date: Thu, 20 Jun 2019 20:22:29 +0000 (+0200) Subject: coworker vacdata problem X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=72752d22ccf80a1ca7d1557999dbc5cdd2aacc63;p=dks_lu.git coworker vacdata problem --- diff --git a/apps/data/db/lechatpotte.sqlite b/apps/data/db/lechatpotte.sqlite index b55d8f2..0c99976 100644 Binary files a/apps/data/db/lechatpotte.sqlite and b/apps/data/db/lechatpotte.sqlite differ diff --git a/apps/data/db/underatert.sqlite b/apps/data/db/underatert.sqlite index 9bbf391..ff7c7a9 100644 Binary files a/apps/data/db/underatert.sqlite and b/apps/data/db/underatert.sqlite differ diff --git a/apps/tmpl/creorga/modules/childs/js/child.js b/apps/tmpl/creorga/modules/childs/js/child.js index 39fd720..4fed6f4 100644 --- a/apps/tmpl/creorga/modules/childs/js/child.js +++ b/apps/tmpl/creorga/modules/childs/js/child.js @@ -56,7 +56,7 @@ function initdata() { var xcheck = $('#childs_checkservicenumber').val().replace(/\s/g,'').substring(0,8); var bday = $('#childs_birthday').val(); - var xcheckdate = xcheck.substring(6,8) + "." + xcheck.substring(4,6) +"."+xcheck.substring(0,4); + var xcheckdate = xcheck.substring(0,4)+'-' + xcheck.substring(4,6) + '-' + xcheck.substring(6,8); if (bday != xcheckdate) { $('#childs_birthday').val(xcheckdate); setborderdates(); @@ -118,9 +118,9 @@ function loadplantemplates(){ function setborderdates() { var minamonths = parent.appdb.dbquery("select minage,maxage from creche LIMIT 1;"); - var bday = encodeparam($('#childs_birthday').val(),'date').replace(/'/g,''); - var centrydate = encodeparam($('#childs_entrydate').val(),'date').replace(/'/g,''); - var cleavedate = encodeparam($('#childs_leavedate').val(),'date').replace(/'/g,''); + var bday = $('#childs_birthday').val(); + var centrydate = $('#childs_entrydate').val(); + var cleavedate = $('#childs_leavedate').val(); var dtbday = new Date(bday); var dtminentrydate = new Date(dtbday.getFullYear(),dtbday.getMonth() + parseInt(minamonths.sqldata[0].minage), dtbday.getDate()); var today = new Date(); @@ -138,8 +138,8 @@ function setborderdates() { $('#childs_leavedate').val(dtmaxleavedate.toISOString().substring(0,10)); } - centrydate = encodeparam($('#childs_entrydate').val(),'date').replace(/'/g,''); - cleavedate = encodeparam($('#childs_leavedate').val(),'date').replace(/'/g,''); + centrydate = $('#childs_entrydate').val(); + cleavedate = $('#childs_leavedate').val(); parent.appdb.dbexec("update childs set birthday=date('"+bday+"'),entrydate=date('"+centrydate+"'),leavedate=date('"+cleavedate+"') where uuid='"+pconfig.uuid+"';"); } diff --git a/apps/tmpl/creorga/modules/staff/js/coworker.js b/apps/tmpl/creorga/modules/staff/js/coworker.js index 2a525ea..7b01ad2 100644 --- a/apps/tmpl/creorga/modules/staff/js/coworker.js +++ b/apps/tmpl/creorga/modules/staff/js/coworker.js @@ -21,7 +21,7 @@ function initdata() { if (pconfig == null) { pconfig = {}; } - + //update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null; if (!pconfig.year) { pconfig.year=new Date().getFullYear(); @@ -337,7 +337,7 @@ function dlg_vacancy(uuid, type) { }; if (type == 'upd') { - var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');"; + var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, datefrom as vacdatefrom, dateto as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');"; evdata = parent.appdb.dbquery(evsql); evdata = evdata.sqldata[0]; @@ -430,12 +430,12 @@ function save_vacancy() { var savesql = ""; if (type == 'ins') { savesql = "INSERT INTO vacancycalendar (uuid, datefrom, dateto, timefrom, timeto, description, staffuuid, type,vacyear) VALUES " - +"('" + parent.appdb.generate_uuid() + "', date("+encodeparam(evsvdata.datefrom, 'date')+"), date("+encodeparam(evsvdata.dateto, 'date')+"), "+encodeparam(evsvdata.timefrom, 'text')+", strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), "+encodeparam(evsvdata.description, 'text')+", "+encodeparam(evsvdata.staffuuid, 'text')+","+evsvdata.type+","+encodeparam(evsvdata.datefrom, 'year')+");"; + +"('" + parent.appdb.generate_uuid() + "', date('"+evsvdata.datefrom+"'), date('"+evsvdata.dateto+"'), "+encodeparam(evsvdata.timefrom, 'text')+", strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), "+encodeparam(evsvdata.description, 'text')+", "+encodeparam(evsvdata.staffuuid, 'text')+","+evsvdata.type+",strftime(\"%Y\",date('"+evsvdata.datefrom+"')))"; } else { - savesql = "UPDATE vacancycalendar SET vacyear=" + encodeparam(evsvdata.datefrom, 'year') + ", datefrom = date("+encodeparam(evsvdata.datefrom, 'date')+"), dateto = date("+encodeparam(evsvdata.dateto, 'date')+"), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';"; + savesql = "UPDATE vacancycalendar SET vacyear=strftime(\"%Y\",date('"+evsvdata.datefrom+"')), datefrom = date('"+evsvdata.datefrom+"'), dateto = date('"+evsvdata.dateto+"'), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';"; } - // console.log("save vacancy"); - // console.log(savesql); + //console.log("save vacancy"); + //console.log(savesql); parent.appdb.dbexec(savesql); load_table_vacancy();