Merge pull request #20239 from eileenmcnaughton/act
authordemeritcowboy <demeritcowboy@hotmail.com>
Tue, 18 May 2021 20:53:10 +0000 (16:53 -0400)
committerGitHub <noreply@github.com>
Tue, 18 May 2021 20:53:10 +0000 (16:53 -0400)
[REF] Cleanup BAO_ActionSchedule::getlist() signature

CRM/Admin/Page/ScheduleReminders.php
CRM/Core/BAO/ActionSchedule.php
CRM/Event/Form/ManageEvent/ScheduleReminders.php

index 524031760ea710e3e1738a9cda55a41b998c88fa..2eb555d1753750684eb88cab6b59be7ccb73b841 100644 (file)
@@ -126,27 +126,25 @@ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic {
     // Get list of configured reminders
     $reminderList = CRM_Core_BAO_ActionSchedule::getList();
 
-    if (is_array($reminderList)) {
-      // Add action links to each of the reminders
-      foreach ($reminderList as & $format) {
-        $action = array_sum(array_keys($this->links()));
-        if ($format['is_active']) {
-          $action -= CRM_Core_Action::ENABLE;
-        }
-        else {
-          $action -= CRM_Core_Action::DISABLE;
-        }
-        $format['action'] = CRM_Core_Action::formLink(
-          self::links(),
-          $action,
-          ['id' => $format['id']],
-          ts('more'),
-          FALSE,
-          'actionSchedule.manage.action',
-          'ActionSchedule',
-          $format['id']
-        );
+    // Add action links to each of the reminders
+    foreach ($reminderList as & $format) {
+      $action = array_sum(array_keys($this->links()));
+      if ($format['is_active']) {
+        $action -= CRM_Core_Action::ENABLE;
       }
+      else {
+        $action -= CRM_Core_Action::DISABLE;
+      }
+      $format['action'] = CRM_Core_Action::formLink(
+        self::links(),
+        $action,
+        ['id' => $format['id']],
+        ts('more'),
+        FALSE,
+        'actionSchedule.manage.action',
+        'ActionSchedule',
+        $format['id']
+      );
     }
 
     $this->assign('rows', $reminderList);
index 85dbd6e92106a648f2b21b983c21840cc5b0ee22..e804f3bc76573eae34d21b9ce1368627c62484b9 100644 (file)
@@ -102,9 +102,6 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
   /**
    * Retrieve list of Scheduled Reminders.
    *
-   * @param bool $namesOnly
-   *   Return simple list of names.
-   *
    * @param \Civi\ActionSchedule\Mapping|null $filterMapping
    *   Filter by the schedule's mapping type.
    * @param int $filterValue
@@ -114,7 +111,8 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
    *   (reference)   reminder list
    * @throws \CRM_Core_Exception
    */
-  public static function &getList($namesOnly = FALSE, $filterMapping = NULL, $filterValue = NULL) {
+  public static function getList($filterMapping = NULL, $filterValue = NULL): array {
+    $list = [];
     $query = "
 SELECT
        title,
index 36b4619f513f55e0e221af7c9df00535935e3e0f..7e1144afc271cc2ddbdb2e05e89ee031bc4a40df 100644 (file)
@@ -35,32 +35,30 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage
     $mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings([
       'id' => ($this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID),
     ]));
-    $reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id);
-    if ($reminderList && is_array($reminderList)) {
-      // Add action links to each of the reminders
-      foreach ($reminderList as & $format) {
-        $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
-        if ($format['is_active']) {
-          $action += CRM_Core_Action::DISABLE;
-        }
-        else {
-          $action += CRM_Core_Action::ENABLE;
-        }
-        $scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
-        $links = $scheduleReminder->links();
-        $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
-        $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
-        $format['action'] = CRM_Core_Action::formLink(
-          $links,
-          $action,
-          ['id' => $format['id']],
-          ts('more'),
-          FALSE,
-          'actionSchedule.manage.action',
-          'ActionSchedule',
-          $this->_id
-        );
+    $reminderList = CRM_Core_BAO_ActionSchedule::getList($mapping, $this->_id);
+    // Add action links to each of the reminders
+    foreach ($reminderList as & $format) {
+      $action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
+      if ($format['is_active']) {
+        $action += CRM_Core_Action::DISABLE;
       }
+      else {
+        $action += CRM_Core_Action::ENABLE;
+      }
+      $scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
+      $links = $scheduleReminder->links();
+      $links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
+      $links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
+      $format['action'] = CRM_Core_Action::formLink(
+        $links,
+        $action,
+        ['id' => $format['id']],
+        ts('more'),
+        FALSE,
+        'actionSchedule.manage.action',
+        'ActionSchedule',
+        $this->_id
+      );
     }
 
     $this->assign('rows', $reminderList);