From be03a7fb5fb169bea8fa2a63efacba5fbbfcbe89 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Wed, 15 Jan 2020 14:48:55 +0000 Subject: [PATCH] Don't hide disabled memberships from the contact membership tab --- CRM/Member/BAO/Membership.php | 9 ++------- CRM/Member/Page/Tab.php | 8 -------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 18689c86aac3..0f879ed2cc7c 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -1587,11 +1587,6 @@ public static function buildMembershipTypeValues($form, $membershipTypeID = [], * @return null|string */ public static function getContactMembershipCount($contactID, $activeOnly = FALSE) { - CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($membershipTypes); - $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 "; @@ -1601,7 +1596,7 @@ public static function getContactMembershipCount($contactID, $activeOnly = FALSE $where .= " and civicrm_membership_status.is_current_member = 1"; } - $query = $select . $where . $addWhere; + $query = $select . $where; return CRM_Core_DAO::singleValueQuery($query); } @@ -2190,7 +2185,7 @@ public static function getMembershipContributionId($membershipId, $all = FALSE) * @throws \CiviCRM_API3_Exception * @throws \CRM_Core_Exception */ - public static function updateAllMembershipStatus($params) { + public static function updateAllMembershipStatus($params = []) { if (empty($params['only_active_membership_types'])) { $params['only_active_membership_types'] = TRUE; } diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index 8301a964a757..7eb4816688c9 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -33,17 +33,9 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { * called when action is browse. */ public function browse() { - $links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution); - CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($membershipTypes); - $addWhere = "membership_type_id IN (0)"; - if (!empty($membershipTypes)) { - $addWhere = "membership_type_id IN (" . implode(',', array_keys($membershipTypes)) . ")"; - } - $membership = []; $dao = new CRM_Member_DAO_Membership(); $dao->contact_id = $this->_contactId; - $dao->whereAdd($addWhere); $dao->find(); //CRM--4418, check for view, edit, delete