$numTerms = CRM_Core_DAO::singleValueQuery("
SELECT membership_num_terms FROM civicrm_line_item li
LEFT JOIN civicrm_price_field_value v ON li.price_field_value_id = v.id
- WHERE entity_id = %1 AND entity_table = 'civicrm_contribution' AND membership_type_id = %2",
+ WHERE contribution_id = %1 AND membership_type_id = %2",
array(1 => array($this->id, 'Integer') , 2 => array($membershipTypeID, 'Integer'))
);
// default of 1 is precautionary
// else fall back to using current membership type
$dao->free();
+ $num_terms = $contribution->getNumTermsByContributionAndMembershipType($membership->membership_type_id);
if ($currentMembership) {
/*
* Fixed FOR CRM-4433
*/
CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, $changeToday);
- $num_terms = $contribution->getNumTermsByContributionAndMembershipType($membership->membership_type_id);
// @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($membership->id,
$dates['join_date'] = CRM_Utils_Date::customFormat($currentMembership['join_date'], $format);
}
else {
- $dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membership->membership_type_id);
+ $dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membership->membership_type_id, NULL, NULL, NULL, $num_terms);
}
//get the status for membership.