-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
CRM-20008 fix pending flow. #10030
CRM-20008 fix pending flow. #10030
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4548,43 +4548,52 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re | |
} | ||
$dao->free(); | ||
|
||
$membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType( | ||
$membershipParams['membership_type_id'], | ||
$primaryContributionID | ||
); | ||
$dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL); | ||
if ($currentMembership) { | ||
/* | ||
* Fixed FOR CRM-4433 | ||
* In BAO/Membership.php(renewMembership function), we skip the extend membership date and status | ||
* when Contribution mode is notify and membership is for renewal ) | ||
*/ | ||
CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeDate); | ||
|
||
// @todo - we should pass membership_type_id instead of null here but not | ||
// adding as not sure of testing | ||
$dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'], | ||
$changeDate, NULL, $membershipParams['num_terms'] | ||
); | ||
|
||
$dates['join_date'] = $currentMembership['join_date']; | ||
if (CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', CRM_Utils_Array::value('contribution_status_id', $input)) === 'Pending') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice work!! Yeah, makes sense to add coverage for the whole process. |
||
$membershipParams['num_terms'] = 0; | ||
} | ||
else { | ||
$membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but the else block is just formatting |
||
$membershipParams['membership_type_id'], | ||
$primaryContributionID | ||
); | ||
// @todo remove all this stuff in favour of letting the api call further down handle in | ||
// (it is a duplication of what the api does). | ||
$dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL); | ||
if ($currentMembership) { | ||
/* | ||
* Fixed FOR CRM-4433 | ||
* In BAO/Membership.php(renewMembership function), we skip the extend membership date and status | ||
* when Contribution mode is notify and membership is for renewal ) | ||
*/ | ||
CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeDate); | ||
|
||
// @todo - we should pass membership_type_id instead of null here but not | ||
// adding as not sure of testing | ||
$dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'], | ||
$changeDate, NULL, $membershipParams['num_terms'] | ||
); | ||
|
||
$dates['join_date'] = $currentMembership['join_date']; | ||
} | ||
|
||
//get the status for membership. | ||
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dates['start_date'], | ||
$dates['end_date'], | ||
$dates['join_date'], | ||
'today', | ||
TRUE, | ||
$membershipParams['membership_type_id'], | ||
$membershipParams | ||
); | ||
//get the status for membership. | ||
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($dates['start_date'], | ||
$dates['end_date'], | ||
$dates['join_date'], | ||
'today', | ||
TRUE, | ||
$membershipParams['membership_type_id'], | ||
$membershipParams | ||
); | ||
|
||
$membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New'); | ||
//we might be renewing membership, | ||
//so make status override false. | ||
$membershipParams['is_override'] = FALSE; | ||
unset($dates['end_date']); | ||
$membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New'); | ||
//we might be renewing membership, | ||
//so make status override false. | ||
$membershipParams['is_override'] = FALSE; | ||
} | ||
//CRM-17723 - reset static $relatedContactIds array() | ||
// @todo move it to Civi Statics. | ||
$var = TRUE; | ||
CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE); | ||
civicrm_api3('Membership', 'create', $membershipParams); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change is just indentation - the if -else block