Fix PHP notice
authorMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 14 Jun 2022 17:53:47 +0000 (18:53 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 14 Jun 2022 17:54:50 +0000 (18:54 +0100)
CRM/Contribute/Page/Tab.php
templates/CRM/Contribute/Form/Selector.tpl

index f8ab5c536e1c52402169fde3b970876f5f65f7bb..3cb0cb85bdc54ab61d0d0181bd5d70ff59e4c155 100644 (file)
@@ -326,6 +326,8 @@ class CRM_Contribute_Page_Tab extends CRM_Core_Page {
   private function buildRecurringContributionsArray($recurContributions) {
     $liveRecurringContributionCount = 0;
     foreach ($recurContributions as $recurId => $recurDetail) {
+      // API3 does not return "installments" if it is not set. But we need it set to avoid PHP notices on ContributionRecurSelector.tpl
+      $recurContributions[$recurId]['installments'] = $recurDetail['installments'] ?? NULL;
       // Is recurring contribution active?
       $recurContributions[$recurId]['is_active'] = !in_array(CRM_Contribute_PseudoConstant::contributionStatus($recurDetail['contribution_status_id'], 'name'), CRM_Contribute_BAO_ContributionRecur::getInactiveStatuses());
       if ($recurContributions[$recurId]['is_active']) {
index d522a3fc87ea5e8602d1e9a85813c59dcb7695e7..29c9490be2d25bca08d80b5918d2ff4c24ad2685 100644 (file)
@@ -51,7 +51,7 @@
           {if $row.amount_level}<br/>({$row.amount_level}){/if}
           {if $row.contribution_recur_id && $row.is_template}
             <br/>{ts}(Recurring Template){/ts}
-          {elseif $row.contribution_recur_id }
+          {elseif $row.contribution_recur_id}
             <br/>{ts}(Recurring){/ts}
           {/if}
         </td>