Avoid PHP notice on 'Manage Contribution Pages' screen
authorBradley Taylor <hello@brad-taylor.co.uk>
Sat, 29 Jan 2022 15:54:19 +0000 (15:54 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Sat, 29 Jan 2022 15:54:19 +0000 (15:54 +0000)
CRM/Contribute/Page/ContributionPage.php

index ebb64417a5cbb2a2f12c5f94c9099f882cabc362..23d8536c9c3585d4d83f59e38089391bbc963472 100644 (file)
@@ -456,9 +456,10 @@ ORDER BY is_active desc, title asc
     //get configure actions links.
     $configureActionLinks = self::configureActionLinks();
 
+    $contributions = [];
     while ($dao->fetch()) {
-      $contribution[$dao->id] = [];
-      CRM_Core_DAO::storeValues($dao, $contribution[$dao->id]);
+      $contributions[$dao->id] = [];
+      CRM_Core_DAO::storeValues($dao, $contributions[$dao->id]);
 
       // form all action links
       $action = array_sum(array_keys(self::actionLinks()));
@@ -486,7 +487,7 @@ ORDER BY is_active desc, title asc
 
       //build the configure links.
       $sectionsInfo = CRM_Utils_Array::value($dao->id, $contriPageSectionInfo, []);
-      $contribution[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo),
+      $contributions[$dao->id]['configureActionLinks'] = CRM_Core_Action::formLink(self::formatConfigureLinks($sectionsInfo),
         $action,
         array('id' => $dao->id),
         ts('Configure'),
@@ -497,7 +498,7 @@ ORDER BY is_active desc, title asc
       );
 
       //build the contributions links.
-      $contribution[$dao->id]['contributionLinks'] = CRM_Core_Action::formLink(self::contributionLinks(),
+      $contributions[$dao->id]['contributionLinks'] = CRM_Core_Action::formLink(self::contributionLinks(),
         $action,
         array('id' => $dao->id),
         ts('Contributions'),
@@ -508,7 +509,7 @@ ORDER BY is_active desc, title asc
       );
 
       //build the online contribution links.
-      $contribution[$dao->id]['onlineContributionLinks'] = CRM_Core_Action::formLink(self::onlineContributionLinks(),
+      $contributions[$dao->id]['onlineContributionLinks'] = CRM_Core_Action::formLink(self::onlineContributionLinks(),
         $action,
         array('id' => $dao->id),
         ts('Links'),
@@ -519,7 +520,7 @@ ORDER BY is_active desc, title asc
       );
 
       //build the normal action links.
-      $contribution[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(),
+      $contributions[$dao->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(),
         $action,
         array('id' => $dao->id),
         ts('more'),
@@ -530,12 +531,10 @@ ORDER BY is_active desc, title asc
       );
 
       //show campaigns on selector.
-      $contribution[$dao->id]['campaign'] = $allCampaigns[$dao->campaign_id] ?? NULL;
+      $contributions[$dao->id]['campaign'] = $allCampaigns[$dao->campaign_id] ?? NULL;
     }
 
-    if (isset($contribution)) {
-      $this->assign('rows', $contribution);
-    }
+    $this->assign('rows', $contributions);
   }
 
   public function search() {