Skip to content

Commit

Permalink
[REF] minor fix - move last of processing before receipting
Browse files Browse the repository at this point in the history
The moved items are in the middle of a long chunk that just deals with receipting  & message setting
  • Loading branch information
eileenmcnaughton committed Jul 28, 2021
1 parent e2ffbae commit 31cfa7b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,9 @@ public function submit(): void {
CRM_Member_BAO_Membership::recordMembershipContribution($params);
}
}

$this->updateContributionOnMembershipTypeChange($params);

if (($this->_action & CRM_Core_Action::UPDATE)) {
$this->addStatusMessage($this->getStatusMessageForUpdate());
}
Expand Down Expand Up @@ -1384,18 +1387,17 @@ public function submit(): void {
$receiptSent = TRUE;
}

// finally set membership id if already not set
if (!$this->_id) {
$this->_id = $this->getMembershipID();
}

$this->updateContributionOnMembershipTypeChange($params);
if ($receiptSent && $mailSend) {
$this->addStatusMessage(ts('A membership confirmation and receipt has been sent to %1.', [1 => $this->_contributorEmail]));
}

CRM_Core_Session::setStatus($this->getStatusMessage(), ts('Complete'), 'success');
$this->setStatusMessage();

// finally set membership id if already not set
if (!$this->_id) {
$this->_id = $this->getMembershipID();
}
}

/**
Expand Down Expand Up @@ -1555,8 +1557,8 @@ protected function getStatusMessageForCreate(): string {
protected function setStatusMessage() {
//CRM-15187
// display message when membership type is changed
if (($this->_action & CRM_Core_Action::UPDATE) && $this->_id && !in_array($this->_memType, $this->_memTypeSelected)) {
$lineItem = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'membership');
if (($this->_action & CRM_Core_Action::UPDATE) && $this->getMembershipID() && !in_array($this->_memType, $this->_memTypeSelected)) {
$lineItem = CRM_Price_BAO_LineItem::getLineItems($this->getMembershipID(), 'membership');
$maxID = max(array_keys($lineItem));
$lineItem = $lineItem[$maxID];
$membershipTypeDetails = $this->allMembershipTypeDetails[$this->getMembership()['membership_type_id']];
Expand Down

0 comments on commit 31cfa7b

Please sign in to comment.