From b2c73ed9057d2cb2265dd9eaaf805836bd8022d9 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 24 Jun 2020 15:07:52 -0600 Subject: [PATCH] Calendar: better fix for spurious history log entries --- calendar/inc/class.calendar_boupdate.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index 7be30a1c76..e2de437821 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -1380,7 +1380,7 @@ class calendar_boupdate extends calendar_bo foreach($timestamps as $ts) { // we convert here from user-time to timestamps in server-time! - if (isset($event[$ts])) $save_event[$ts] = $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0; + if (isset($event[$ts])) $event[$ts] = $event[$ts] ? $this->date2ts($event[$ts],true) : 0; } // convert tzid name to integer tz_id, of set user default if (empty($event['tzid']) || !($event['tz_id'] = calendar_timezones::tz2id($event['tzid']))) @@ -1494,6 +1494,13 @@ class calendar_boupdate extends calendar_bo // Update history $tracking = new calendar_tracking($this); if (empty($event['id']) && !empty($cal_id)) $event['id']=$cal_id; + // we run all dates through date2ts, to adjust to server-time and the possible date-formats + // This is done here to avoid damaging the actual event when saving, but the old event is in server-time + foreach($timestamps as $ts) + { + // we convert here from user-time to timestamps in server-time! + if (isset($save_event[$ts])) $save_event[$ts] = $save_event[$ts] ? $this->date2ts($save_event[$ts],true) : 0; + } $tracking->track($save_event, $old_event); return $cal_id;