Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] minor fix - move last of processing before receipting #20969

Merged
merged 1 commit into from
Jul 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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