Due date is m/d/y despite admin panel settings – osTicket Forums

PHP

due date is m/d/y despite admin panel settings – osTicket Forums.

Changes  made to allow d-m-Y dates rather than m/d/Y

** note, you have to use ‘-‘ as the separator rather than ‘/’ as the php function strtotime (which is used to check the dates) will not work otherwise.

1) change to /scp/js/calendar.js
replace function lcs with code below

PHP Code:
function lcs(ielem) {
updobj=ielem;
getObj('fc').style.left=Left(ielem)+'px';
getObj('fc').style.top=Top(ielem)+ielem.offsetHeight+'px';
getObj('fc').style.display='';}
// First check date is valid
curdt=ielem.value;
curdtarr=curdt.split(‘-‘);
isdt=true;
for(var
k=0;k<curdtarr.length;k++) {
if (
isNaN(curdtarr[k]))
isdt=false;
}
if (
isdt&(curdtarr.length==3)) {
ccm=curdtarr[1]-1;
ccy=curdtarr[2];
prepcalendar(curdtarr[0],curdtarr[1]-1,curdtarr[2
]);
}

 

2) change to /scp/js/calendar.js
replace function prepcalendar with code below

PHP Code:
function prepcalendar(hd,cm,cy) {
now=new Date();
sd=now.getDate();
td=new Date();
td.setDate(1);
td.setFullYear(cy);
td.setMonth(cm);
cd=td.getDay();
getObj('mns').innerHTML=mn[cm]+ ' ' + cy;
marr=((cy%4)==0)?mnl:mnn;
for(var
d=1;d<=42;d++) {
f_cps(getObj('v'+parseInt(d)));
if ((
d >= (cd -(-1))) && (d<=cd-(-marr[cm]))) {
dip=((d-cd < sd)&&(cm==sccm)&&(cy==sccy));
htd=((hd!='')&&(d-cd==hd));
if (
0 && dip)
f_cpps(getObj('v'+parseInt(d)));
else if (
htd)
f_hds(getObj('v'+parseInt(d)));
else
f_cps(getObj('v'+parseInt(d)));getObj('v'+parseInt(d)).innerHTML=d-cd;
calvalarr[d]=''+(d-cd)+ '-'+(cm-(-1))+'-'+cy;
}
else {
getObj('v'+d).innerHTML='&nbsp;';
getObj('v'+parseInt(d)).onmouseover=null;
getObj('v'+parseInt(d)).onmouseout=null;
getObj('v'+parseInt(d)).style.cursor='default';
}
}
}
getObj(‘v’+parseInt(d)).onmouseover=cs_over;
getObj(‘v’+parseInt(d)).onmouseout=cs_out;
getObj(‘v’+parseInt(d)).onclick=cs_click
;

 

3) change to /include/staff/editticket.inc.php

PHP Code:
change
'duedate' =>$ticket->getDueDate()?(Format::userdate('m/d/Y',Misc::db2gmtime($ticket->getDueDate()))):'',
to
'duedate' =>$ticket->getDueDate()?(Format::userdate('d-m-Y',Misc::db2gmtime($ticket->getDueDate()))):'',

4) in /include/class.ticket.php

PHP Code:

in function update, change
$fields
['duedate']  = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date - must be MM/DD/YY');
to
$fields
['duedate']  = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date');

in function create, change
$fields
['duedate'] = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date - must be MM/DD/YY');
to $fields['duedate'] = array('type'=>'date', 'required'=>0, 'error'=>'Invalid date');

Bad Behavior has blocked 295 access attempts in the last 7 days.