Skip to content

Commit

Permalink
Merge pull request civicrm#16047 from eileenmcnaughton/521
Browse files Browse the repository at this point in the history
dev/membership#21 Fix regression causing transfer of membership to another contact if they paid
  • Loading branch information
seamuslee001 authored Dec 9, 2019
2 parents 76ade0b + 753ca46 commit a1552cd
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,23 +327,6 @@ public function setDefaultValues() {
$scTypes = CRM_Core_OptionGroup::values("soft_credit_type");
$defaults['soft_credit_type_id'] = CRM_Utils_Array::value(ts('Gift'), array_flip($scTypes));

if (!empty($defaults['record_contribution']) && !$this->_mode) {
$contributionParams = ['id' => $defaults['record_contribution']];
$contributionIds = [];

//keep main object campaign in hand.
$memberCampaignId = CRM_Utils_Array::value('campaign_id', $defaults);

CRM_Contribute_BAO_Contribution::getValues($contributionParams, $defaults, $contributionIds);

//get back original object campaign id.
$defaults['campaign_id'] = $memberCampaignId;

// Contribution::getValues() over-writes the membership record's source field value - so we need to restore it.
if (!empty($defaults['membership_source'])) {
$defaults['source'] = $defaults['membership_source'];
}
}
//CRM-13420
if (empty($defaults['payment_instrument_id'])) {
$defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
Expand Down

0 comments on commit a1552cd

Please sign in to comment.