From 67bd66cf9535fd92e939e17666fc255857a8ac10 Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 19 Oct 2020 10:41:47 -0600 Subject: [PATCH] * Infolog: Responsible user in a different timezone would adjust the due date when saving After clicking 'Apply' responsible user could be given fully editable dialog in some cases (due to notifications) --- infolog/inc/class.infolog_bo.inc.php | 14 +++++++++++++- infolog/inc/class.infolog_ui.inc.php | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index 575c6047ab..eed3e88833 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -807,9 +807,18 @@ class infolog_bo $set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set in_array($values['info_status'],array('done','billed','cancelled')); + // Old is in server time, so change it to user time or we might move all the dates if tz are different + if($user2server) + { + $this->time2time($old); + } + $values = $old; - // only overwrite explicitly allowed fields + + // This one stays in the timezone it's in or we fail the modified check $values['info_datemodified'] = $values_in['info_datemodified']; + + // only overwrite explicitly allowed fields foreach ($this->responsible_edit as $name) { if (isset($values_in[$name])) $values[$name] = $values_in[$name]; @@ -1052,6 +1061,9 @@ class infolog_bo $this->tracking->track($to_write,$old,$this->user,$values['info_status'] == 'deleted' || $old['info_status'] == 'deleted', null,$skip_notification); + // Clear access cache after notifications, it may get modified as notifications switches user + unset(static::$access_cache[$info_id]); + if ($info_from_set) $values['info_from'] = ''; // Change new values back to user time before sending them back diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index bd3a5210ac..de9aea79d5 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1805,7 +1805,7 @@ class infolog_ui $button = 'apply'; // need to store infolog first } } - //Validate the enddate must be grather than startdate + //Validate the enddate must be greater than startdate if (!empty($content['info_enddate']) && !empty($content['info_startdate'])) { $duration_date = $content['info_enddate']-$content['info_startdate'];