Skip to content

Commit

Permalink
Merge pull request #22622 from demeritcowboy/unused-tz
Browse files Browse the repository at this point in the history
dev/core#2122 - prevent E_NOTICEs and blank dates being converted to current datetime
  • Loading branch information
eileenmcnaughton authored Jan 25, 2022
2 parents 3202de2 + 7a6c7fe commit 591a74e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CRM/Event/Page/ManageEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,15 @@ public function browse() {
}
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);

// avoid enotices
foreach (CRM_Event_BAO_Event::tz_fields as $field) {
$manageEvent[$dao->id][$field . '_with_tz'] = NULL;
}
if (!is_null($dao->event_tz) && $dao->event_tz != CRM_Core_Config::singleton()->userSystem->getTimeZoneString()) {
foreach (CRM_Event_BAO_Event::tz_fields as $field) {
$manageEvent[$dao->id][$field . '_with_tz'] = CRM_Utils_Date::convertTimeZone($dao->{$field} ?? '', $dao->event_tz);
if (!empty($dao->{$field})) {
$manageEvent[$dao->id][$field . '_with_tz'] = CRM_Utils_Date::convertTimeZone($dao->{$field}, $dao->event_tz);
}
}
}
$manageEvent[$dao->id]['event_tz'] = $dao->event_tz ? CRM_Core_SelectValues::timezone()[$dao->event_tz] : FALSE;
Expand Down

0 comments on commit 591a74e

Please sign in to comment.