Minor code cleanup to contribution pages
authorMatthew Wire <mjw@mjwconsult.co.uk>
Sat, 30 Jan 2021 17:26:19 +0000 (17:26 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Mon, 1 Feb 2021 21:07:19 +0000 (21:07 +0000)
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionBase.php
CRM/Price/BAO/PriceSet.php

index 223d2c7805dec9bba81f725a05601d0d9b6aff6d..6209a86596c3d3d36f74d20d829a5ab3a27c7ffd 100644 (file)
@@ -371,7 +371,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     // If we configured price set for contribution page
     // we are not allow membership signup as well as any
     // other contribution amount field, CRM-5095
-    if (isset($this->_priceSetId) && $this->_priceSetId) {
+    if (!empty($this->_priceSetId)) {
       $this->add('hidden', 'priceSetId', $this->_priceSetId);
       // build price set form.
       $this->set('priceSetId', $this->_priceSetId);
index 94eaf37d03fb5cd8f517ed8ad77ef1747dd70da7..9749d03e47fe2512ce0023f88993eb4798a7e680 100644 (file)
@@ -207,6 +207,14 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    */
   public $paymentInstrumentID;
 
+  /**
+   * The contribution ID - is an option in the URL if you are making a payment against an existing contribution (an
+   * "invoice payment").
+   *
+   * @var int
+   */
+  public $_ccid;
+
   /**
    * Is the price set quick config.
    * @return bool
index 4795d8dbd2ea0ff3d2d1a4e539a1a62fc3c2b283..7abeda7d0f2f5bd28f8f600129868f7557f02097 100644 (file)
@@ -843,9 +843,9 @@ WHERE  id = %1";
     // Mark which field should have the auto-renew checkbox, if any. CRM-18305
     if (!empty($form->_membershipTypeValues) && is_array($form->_membershipTypeValues)) {
       $autoRenewMembershipTypes = [];
-      foreach ($form->_membershipTypeValues as $membershiptTypeValue) {
-        if ($membershiptTypeValue['auto_renew']) {
-          $autoRenewMembershipTypes[] = $membershiptTypeValue['id'];
+      foreach ($form->_membershipTypeValues as $membershipTypeValue) {
+        if ($membershipTypeValue['auto_renew']) {
+          $autoRenewMembershipTypes[] = $membershipTypeValue['id'];
         }
       }
       foreach ($form->_priceSet['fields'] as $field) {