From: Tyrell Cook Date: Wed, 8 Apr 2015 21:29:45 +0000 (-0400) Subject: Add a check for when there is no membership id X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0829c6977408ac4bca633cf1ea20f1914d059037;p=civicrm-core.git Add a check for when there is no membership id --- 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; }