From 7c113627c643171a1d000d50137d359746b2dd83 Mon Sep 17 00:00:00 2001 From: eileenmcnaughton Date: Mon, 29 Jun 2015 21:55:10 +0000 Subject: [PATCH] stop trying to retrieve value from non-existant parameter --- CRM/Contribute/Form/Contribution/Confirm.php | 11 ++++++++--- CRM/Member/BAO/Membership.php | 20 +++----------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index a234d0fa4b..68e654c637 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1545,15 +1545,20 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $isProcessSeparateMembershipTransaction = $this->isSeparateMembershipTransaction($this->_id, $this->_values['amount_block_is_active']); if ($this->_values['amount_block_is_active']) { - $contributionTypeId = $this->_values['financial_type_id']; + $financialTypeID = $this->_values['financial_type_id']; } else { - $contributionTypeId = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams)); + $financialTypeID = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams)); + } + + if (CRM_Utils_Array::value('membership_source', $this->_params)) { + $membershipParams['contribution_source'] = $this->_params['membership_source']; } CRM_Member_BAO_Membership::postProcessMembership($membershipParams, $contactID, - $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $contributionTypeId, + $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID, $membershipLineItems, $isPayLater, $isPending); + $this->assign('membership_assign', TRUE); $this->set('membershipTypeID', $membershipParams['selectMembership']); } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 14d0d7e547..1d2b3839af 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1123,7 +1123,7 @@ AND civicrm_membership.is_test = %2"; * * @param bool $isProcessSeparateMembershipTransaction * - * @param int $defaultContributionTypeID + * @param int $financialTypeID * @param array $membershipLineItems * Line items specific to membership payment that is separate to contribution. * @param bool $isPayLater @@ -1134,23 +1134,11 @@ AND civicrm_membership.is_test = %2"; public static function postProcessMembership( $membershipParams, $contactID, &$form, $premiumParams, $customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID, - $isProcessSeparateMembershipTransaction, $defaultContributionTypeID, $membershipLineItems, $isPayLater, $isPending) { + $isProcessSeparateMembershipTransaction, $financialTypeID, $membershipLineItems, $isPayLater, $isPending) { $result = $membershipContribution = NULL; $isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE); $errors = $createdMemberships = $paymentResult = array(); - //@todo move this into the calling function & pass in the correct financialTypeID - if (isset($paymentParams['financial_type'])) { - $financialTypeID = $paymentParams['financial_type']; - } - else { - $financialTypeID = $defaultContributionTypeID; - } - - if (CRM_Utils_Array::value('membership_source', $form->_params)) { - $membershipParams['contribution_source'] = $form->_params['membership_source']; - } - if ($isPaidMembership) { if ($isProcessSeparateMembershipTransaction) { // If we have 2 transactions only one can use the invoice id. @@ -2013,9 +2001,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND public static function processSecondaryFinancialTransaction($contactID, &$form, $tempParams, $isTest, $lineItems, $minimumFee, $financialTypeID) { $financialType = new CRM_Financial_DAO_FinancialType(); $financialType->id = $financialTypeID; - if (!$financialType->find(TRUE)) { - CRM_Core_Error::fatal(ts("Could not find a system table")); - } + $financialType->find(TRUE); $tempParams['amount'] = $minimumFee; $tempParams['invoiceID'] = md5(uniqid(rand(), TRUE)); -- 2.25.1