From 396e62d807a85a0ef947d4f39cc8899fd170dca7 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Wed, 24 Sep 2014 19:03:56 +0530 Subject: [PATCH] CRM-15366 - Gift Membership Bug Fixes https://issues.civicrm.org/jira/browse/CRM-15366 --- CRM/Contribute/Form/Contribution/Confirm.php | 11 ++++++++--- CRM/Member/Form/Membership.php | 4 ++++ templates/CRM/Member/Form/Membership.tpl | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 0d23c3bbd6..f30d26b1d6 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1182,7 +1182,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // a better fix would be to set the values in the respective forms rather than require // a function being shared by two forms to deal with their respective values // moving it to the BAO & not taking the $form as a param would make sense here. - if(!isset($params['is_email_receipt'])){ + if(!isset($params['is_email_receipt']) && !empty($form->_values['is_email_receipt'])){ $params['is_email_receipt'] = CRM_Utils_Array::value( 'is_email_receipt', $form->_values ); } $recurringContributionID = self::processRecurringContribution($form, $params, $contactID, $financialType, $online); @@ -1271,8 +1271,12 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } if (isset($params['amount'])) { + $isMonetary = NULL; + if (!empty($form->_values['is_monetary'])) { + $isMonetary = $form->_values['is_monetary']; + } $contribParams = self::getContributionParams( - $params, $contactID, $financialType->id, $online, $contributionPageId, $nonDeductibleAmount, $campaignId, $form->_values['is_monetary'], $pending, $result, $receiptDate, + $params, $contactID, $financialType->id, $online, $contributionPageId, $nonDeductibleAmount, $campaignId, $isMonetary, $pending, $result, $receiptDate, $recurringContributionID, $isTest, $addressID, $contribSoftContactId, $lineItems ); $contribution = CRM_Contribute_BAO_Contribution::add($contribParams); @@ -1458,7 +1462,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // CRM-14354: For an auto-renewing membership with an additional contribution, // if separate payments is not enabled, make sure only the membership fee recurs - if ($form->_membershipBlock['is_separate_payment'] === '0' + if (!empty($form->_membershipBlock) + && $form->_membershipBlock['is_separate_payment'] === '0' && isset($params['selectMembership']) && $form->_values['is_allow_other_amount'] == '1' ) { diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index c3df268fbc..d3fea7053d 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1525,6 +1525,10 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } $membershipParams = array_merge($membershipTypeValues[$memType], $params); + //CRM-15320 + if (!empty($softParams) && empty($paymentParams['is_recur'])) { + $membershipParams['soft_credit'] = $softParams; + } $membership = CRM_Member_BAO_Membership::create($membershipParams, $ids); $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams); unset($params['lineItems']); diff --git a/templates/CRM/Member/Form/Membership.tpl b/templates/CRM/Member/Form/Membership.tpl index bc88ff4c1a..defcaf9011 100644 --- a/templates/CRM/Member/Form/Membership.tpl +++ b/templates/CRM/Member/Form/Membership.tpl @@ -180,8 +180,8 @@ - - + + -- 2.25.1
{$form.soft_credit_type.label}{$form.soft_credit_type.html}{$form.soft_credit_type_id.label}{$form.soft_credit_type_id.html}
{$form.soft_credit_contact_id.label}