Fix ites into CRM-16850, CRM-16867, CRM-16808 lookup membership type to see if autore...
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 20 Jul 2015 11:12:49 +0000 (23:12 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Wed, 22 Jul 2015 09:55:52 +0000 (21:55 +1200)
i

Currntly paypal express still giving errors per CRM-16850 when is_recur
box is not present & expect other issues as is_recur is implicit when
membership_type is_renew`

CRM/Contribute/Form/ContributionBase.php
CRM/Core/Payment.php

index 7b960b2b0aafd3bf8949c24fa64475a2d5054846..f21168234445608e66fba0c4567422697efee589 100644 (file)
@@ -1049,6 +1049,16 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    * Arguably the form should start to build $this->_params in the pre-process main page & use that array consistently throughout.
    */
   protected function setRecurringMembershipParams() {
+    if (!empty($this->_params['priceSetId']) && !empty($this->_params['selectMembership'])) {
+      // @todo the price_x fields will ALWAYS allow us to determine the membership - so we should ignore
+      // 'selectMembership' and calculate from the price_x fields so we have one method that always works
+      // this is lazy & only catches when selectMembership is set, but the worst of all worlds would be to fix
+      // this with an else (calculate for price set).
+      $membershipTypes = CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet($this->_params['priceSetId']);
+      if (in_array($this->_params['selectMembership'], $membershipTypes['autorenew'])) {
+        $this->_params['auto_renew'] = TRUE;
+      }
+    }
     if ((!empty($this->_params['selectMembership']) || !empty($this->_params['priceSetId'])) && !empty($this->_paymentProcessor['is_recur']) &&
       CRM_Utils_Array::value('auto_renew', $this->_params) && empty($this->_params['is_recur']) && empty($this->_params['frequency_interval'])
     ) {
index d07478e7129301c65d817dfae571d7db083b312c..7420fe4f6a572e155c050e0d3668bb17b9b0e988 100644 (file)
@@ -45,7 +45,8 @@ abstract class CRM_Core_Payment {
    *
    * @var string
    */
-   protected $_component;
+  protected $_component;
+
   /**
    * How are we getting billing information.
    *