From 428c180452090cb3e12cc53dd366c7cbeec9eb7a Mon Sep 17 00:00:00 2001 From: Sarah Gladstone Date: Mon, 28 Apr 2014 18:04:09 -0700 Subject: [PATCH] Update Membership.php --- CRM/Member/Form/Membership.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 58a63072d9..6ae17589b8 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -979,6 +979,22 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; if ($endDate) { if ($membershipDetails['duration_unit'] == 'lifetime') { + // Check if status is NOT cancelled or similar. For lifetime memberships, there is no automated + // process to update status based on end-date. The user must change the status now. + $result = civicrm_api3('MembershipStatus', 'get', array( + 'sequential' => 1, + 'is_current_member' => 0, + )); + $tmp_statuses = $result['values']; + $status_ids = array(); + foreach( $tmp_statuses as $cur_stat){ + $status_ids[] = $cur_stat['id']; + } + if( in_array( $params['status_id'] , $status_ids) == false ){ + $errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.'); + $errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership'); + } + } else { -- 2.25.1