From 1d1c862781616f28f8d2d4cc2827ae7d1f1896df Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 21 Jul 2023 20:27:35 -0700 Subject: [PATCH] (REF) Replace CRM_Utils_Array in context of date-time function calls --- CRM/Activity/Selector/Activity.php | 2 +- CRM/Event/BAO/Event.php | 6 +++--- CRM/PCP/BAO/PCP.php | 10 +++++----- CRM/PCP/Page/PCPInfo.php | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CRM/Activity/Selector/Activity.php b/CRM/Activity/Selector/Activity.php index 95d916d62a..987b07a317 100644 --- a/CRM/Activity/Selector/Activity.php +++ b/CRM/Activity/Selector/Activity.php @@ -398,7 +398,7 @@ class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements C $row = &$rows[$k]; // add class to this row if overdue - if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $row)) + if (CRM_Utils_Date::overdue($row['activity_date_time'] ?? '') && ($row['status_id'] ?? NULL) == 1 ) { $row['overdue'] = 1; diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 17f3095849..831c7f69a8 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -1954,9 +1954,9 @@ WHERE ce.loc_block_id = $locBlockId"; public static function validRegistrationDate(&$values) { // make sure that we are between registration start date and end dates // and that if the event has ended, registration is still specifically open - $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_start_date', $values)); - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_end_date', $values)); - $eventEnd = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $values)); + $startDate = CRM_Utils_Date::unixTime($values['registration_start_date'] ?? ''); + $endDate = CRM_Utils_Date::unixTime($values['registration_end_date'] ?? ''); + $eventEnd = CRM_Utils_Date::unixTime($values['end_date'] ?? ''); $now = time(); $validDate = TRUE; if ($startDate && $startDate >= $now) { diff --git a/CRM/PCP/BAO/PCP.php b/CRM/PCP/BAO/PCP.php index 294e8f2b22..92670db862 100644 --- a/CRM/PCP/BAO/PCP.php +++ b/CRM/PCP/BAO/PCP.php @@ -521,13 +521,13 @@ WHERE pcp.id = %1 AND cc.contribution_status_id = %2 AND cc.is_test = 0"; // ignore startDate for events - PCP's can be active long before event start date $startDate = 0; - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity)); + $endDate = CRM_Utils_Date::unixTime($entity['end_date'] ?? ''); } elseif ($component == 'contribute') { $urlBase = 'civicrm/contribute/transact'; //start and end date of the contribution page - $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('start_date', $entity)); - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $entity)); + $startDate = CRM_Utils_Date::unixTime($entity['start_date'] ?? ''); + $endDate = CRM_Utils_Date::unixTime($entity['end_date'] ?? ''); } // define redirect url back to contrib page or event if needed @@ -552,8 +552,8 @@ WHERE pcp.id = %1 AND cc.contribution_status_id = %2 AND cc.is_test = 0"; } // Check if we're in range for contribution page start and end dates. for events, check if after event end date elseif (($startDate && $startDate > $now) || ($endDate && $endDate < $now)) { - $customStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $entity)); - $customEndDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $entity)); + $customStartDate = CRM_Utils_Date::customFormat($entity['start_date'] ?? ''); + $customEndDate = CRM_Utils_Date::customFormat($entity['end_date'] ?? ''); if ($startDate && $endDate) { $statusMessage = ts('The Personal Campaign Page you have just visited is only active from %1 to %2. However you can still support the campaign here.', [1 => $customStartDate, 2 => $customEndDate] diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php index b5b39aadb2..c20e94e56c 100644 --- a/CRM/PCP/Page/PCPInfo.php +++ b/CRM/PCP/Page/PCPInfo.php @@ -219,12 +219,12 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page { } // make sure that we are between contribution page start and end dates OR registration start date and end dates if they are set if ($pcpBlock->entity_table == 'civicrm_event') { - $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_start_date', $pageInfo)); - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('registration_end_date', $pageInfo)); + $startDate = CRM_Utils_Date::unixTime($pageInfo['registration_start_date'] ?? ''); + $endDate = CRM_Utils_Date::unixTime($pageInfo['registration_end_date'] ?? ''); } else { - $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('start_date', $pageInfo)); - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $pageInfo)); + $startDate = CRM_Utils_Date::unixTime($pageInfo['start_date'] ?? ''); + $endDate = CRM_Utils_Date::unixTime($pageInfo['end_date'] ?? ''); } $now = time(); -- 2.25.1