Skip to content

Commit

Permalink
Show disabled membership types on contact tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Jan 27, 2021
1 parent 7049cd0 commit 165e4a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,11 +1575,16 @@ public static function buildMembershipTypeValues($form, $membershipTypeID = [],
* @return null|string
*/
public static function getContactMembershipCount($contactID, $activeOnly = FALSE) {
CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($membershipTypes);
// @todo Move this check to financialtypeacls extension
$membershipTypes = \Civi\Api4\MembershipType::get(FALSE)
->execute()
->indexBy('id')
->column('name');
$addWhere = " AND membership_type_id IN (0)";
if (!empty($membershipTypes)) {
$addWhere = " AND membership_type_id IN (" . implode(',', array_keys($membershipTypes)) . ")";
}

$select = "SELECT count(*) FROM civicrm_membership ";
$where = "WHERE civicrm_membership.contact_id = {$contactID} AND civicrm_membership.is_test = 0 ";

Expand Down
6 changes: 5 additions & 1 deletion CRM/Member/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class CRM_Member_Page_Tab extends CRM_Core_Page {
*/
public function browse() {
$links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($membershipTypes);
// @todo Move this check to financialtypeacls extension
$membershipTypes = \Civi\Api4\MembershipType::get(FALSE)
->execute()
->indexBy('id')
->column('name');
$addWhere = "membership_type_id IN (0)";
if (!empty($membershipTypes)) {
$addWhere = "membership_type_id IN (" . implode(',', array_keys($membershipTypes)) . ")";
Expand Down

0 comments on commit 165e4a0

Please sign in to comment.