Skip to content

Commit

Permalink
prevent E_NOTICE and prevent blank dates being converted to current d…
Browse files Browse the repository at this point in the history
…ate/time
  • Loading branch information
demeritcowboy committed Jan 25, 2022
1 parent a90c387 commit 7a6c7fe
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 7a6c7fe

Please sign in to comment.