Assign line items consistently
authorEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 24 Nov 2023 06:54:46 +0000 (19:54 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Fri, 24 Nov 2023 22:17:49 +0000 (11:17 +1300)
CRM/Contribute/Form/Contribution/Main.php

index a0ae222c762969affff0b57002ac94ad773b49f0..77052dbb16d26c3f0446417be729cc8752ece4d4 100644 (file)
@@ -1297,6 +1297,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
 
     $priceSetID = $this->getPriceSetID();
     if (!empty($this->_ccid)) {
+      // @todo - verify that this is the same as `$this->>getLineItems()` which it should be & consolidate
       $this->set('lineItem', [$this->getPriceSetID() => $this->getExistingContributionLineItems()]);
     }
     elseif ($priceSetID) {
@@ -1336,7 +1337,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
           $params['amount'] = $proceFieldAmount;
         }
       }
-      $this->set('lineItem', $lineItem);
+      $this->set('lineItem', [$this->getPriceSetID() => $this->getLineItems()]);
     }
 
     if ($params['amount'] != 0 && (($this->_values['is_pay_later'] &&