Skip to content

Commit

Permalink
Merge pull request #22451 from MegaphoneJon/member-count-fix
Browse files Browse the repository at this point in the history
Crash when adding a relationship when CiviMember is disabled
  • Loading branch information
eileenmcnaughton authored Jan 11, 2022
2 parents 6f8e83d + b83d85d commit daa551a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions CRM/Contact/BAO/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2735,10 +2735,16 @@ public static function getCountComponent($component, $contactId, $tableName = NU
return CRM_Core_BAO_Note::getContactNoteCount($contactId);

case 'contribution':
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
}
return FALSE;

case 'membership':
return CRM_Member_BAO_Membership::getContactMembershipCount((int) $contactId, TRUE);
if (array_key_exists('CiviMember', CRM_Core_Component::getEnabledComponents())) {
return CRM_Member_BAO_Membership::getContactMembershipCount((int) $contactId, TRUE);
}
return FALSE;

case 'participant':
return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
Expand Down

0 comments on commit daa551a

Please sign in to comment.