From 47a631bd4787ad7fac6540e159b47134e1a7c7ff Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 28 Jul 2019 18:33:50 +1000 Subject: [PATCH] bugfix sunday display 23:59:59 --- html/email_job.html | 9 +++++++-- js/bts_timesheet.js | 2 ++ ts.php | 17 +++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/html/email_job.html b/html/email_job.html index 2dda8dd..747f0b5 100644 --- a/html/email_job.html +++ b/html/email_job.html @@ -2,12 +2,17 @@ Dear {{display_name}}, Below is your job arrangement for the current week, please click the link to view your jobs +Please confirm your jobs after you open the link. + https://acaresydney.com.au/task/{{user_login}}/start-{{job_start}}/finish-{{job_finish}}/ -If you have any questions, please call Helen directly or email +If you receive multiple emails (duplicates), please do not worry, the link in each email will always get you up to date job information. It's always wise to check the latest email. +If you have any questions, please call Helen directly or email helen@acaresydney.com.au +Office hotline: 02 8103 5092 Kind Regards Team of -AcareSydney WebOffice \ No newline at end of file +AcareSydney WebOffice +Hotline 02 8103 5092 \ No newline at end of file diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js index 0e7314a..185d431 100644 --- a/js/bts_timesheet.js +++ b/js/bts_timesheet.js @@ -1382,6 +1382,8 @@ } }).fail(function(){ el.append('' + 'Network Error occured' + ''); + //clear staff pending list, stop further processing + s = []; }).always(function(){//next staff if (staff.length >0){ s = staff.pop(); diff --git a/ts.php b/ts.php index f98858f..61d6d74 100644 --- a/ts.php +++ b/ts.php @@ -389,9 +389,11 @@ class AcareOffice{ $message = str_ireplace("{{user_login}}", $staff->user_login, $message); $message = str_ireplace("{{job_start}}", $start, $message); $message = str_ireplace("{{job_finish}}", $finish, $message); - $headers = ['Bcc: patrick@biukop.com.au']; - //wp_mail("sp@lawipac.com", "Your Job arrangement 22 July ~ 28 July", $message, $headers); - wp_mail($staff->user_email, "Your Job arrangement $start ~ $finish", $message, $headers); + $headers = ['Bcc: patrick@biukop.com.au, timesheet@acaresydney.com.au']; + $subject = $staff->display_name . " Job arrangement $start ~ $finish"; + //wp_mail("sp@lawipac.com", $subject, $message, $headers); + //wp_mail("timesheet@acaresydney.com.au", $subject, $message, $headers); + wp_mail($staff->user_email, $subject, $message, $headers); } public function bts_staff_item($attr){ @@ -675,15 +677,18 @@ class AcareOffice{ //ajax browse job with different filters function list_job(){ check_ajax_referer('acaresydney'); - $start = $_POST['start']; - $finish = $_POST['finish']; + $start = $_POST['start'] . " 00:00:00"; + $finish = $_POST['finish']. " 23:59:59"; + $response = array( 'status'=>'success', 'jobs' => [], ); $sql = "SELECT * FROM $this->table_name WHERE start>='%s' and start <='%s' order by start ASC ,staff ASC"; - $jobs = $this->db->get_results($this->db->prepare ($sql, array($start, $finish))); + $query = $this->db->prepare ($sql, array($start, $finish)); + $response['sql'] = $query; + $jobs = $this->db->get_results($query); if (! empty($jobs)){ $response['status'] = 'success';