From 0829c6977408ac4bca633cf1ea20f1914d059037 Mon Sep 17 00:00:00 2001 From: Tyrell Cook Date: Wed, 8 Apr 2015 17:29:45 -0400 Subject: [PATCH] Add a check for when there is no membership id --- CRM/Member/BAO/Membership.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 30d77c26d1..bd9daf1219 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1056,6 +1056,17 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty $membership['status_id'], 'is_current_member', 'id' ); + $ownerMemberId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', + $membership['id'], + 'owner_membership_id', 'id' + ); + if ($ownerMemberId) { + $membership['id'] = $membership['membership_id'] = $ownerMemberId; + $membership['membership_contact_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', + $membership['id'], + 'contact_id', 'id' + ); + } return $membership; } -- 2.25.1