From: Eileen McNaughton Date: Mon, 20 Jul 2015 11:12:49 +0000 (+1200) Subject: Fix ites into CRM-16850, CRM-16867, CRM-16808 lookup membership type to see if autore... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=fd3592551421a7577380e85f978998077d9c444e;p=civicrm-core.git Fix ites into CRM-16850, CRM-16867, CRM-16808 lookup membership type to see if autorenew is compulsory 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` --- diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 7b960b2b0a..f211682344 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -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']) ) { diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php index d07478e712..7420fe4f6a 100644 --- a/CRM/Core/Payment.php +++ b/CRM/Core/Payment.php @@ -45,7 +45,8 @@ abstract class CRM_Core_Payment { * * @var string */ - protected $_component; + protected $_component; + /** * How are we getting billing information. *