Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: 3.4.5
-
Fix Version/s: 4.1.0
-
Component/s: CiviMember
-
Labels:None
Description
When a member (who does not have a current membership, but does have one or more expired memberships) renews their membership through an Online Membership Renewal contribution page, the expired membership is updated, rather than a new membership being created. Overwriting the expired record causes a gap in the membership history.
In CRM/Member/BAO/Membership.php, the code excludes pending memberships, but not expired members, when checking to see if there is a current membership. Added additional code, as below, resulted in a new membership record being created, rather than an expired one being updated.
CRM/Member/BAO/Membership.php, in the getContactMembership function, around Ln 840
ORIGINAL CODE
//avoid pending membership as current membership: CRM-3027
require_once 'CRM/Member/PseudoConstant.php';
$pendingStatusId = array_search( 'Pending', CRM_Member_PseudoConstant::membershipStatus( ) );
$dao->whereAdd( "status_id != $pendingStatusId" );
//ADDED LINES
//avoid expired membership as current membership
$expiredStatusId = array_search( 'Expired', CRM_Member_PseudoConstant::membershipStatus( ) );
$dao->whereAdd( "status_id != $expiredStatusId" );