Merge pull request #17143 from mattwire/donthidedisabledmemberships
authorMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 29 May 2020 11:04:15 +0000 (12:04 +0100)
committerGitHub <noreply@github.com>
Fri, 29 May 2020 11:04:15 +0000 (12:04 +0100)
dev/membership#24 Don't hide disabled memberships from the contact membership tab

CRM/Member/BAO/Membership.php
CRM/Member/Page/Tab.php

index df5e17a48d3cd6e45c4d338f5531315dd2cc3a96..90e68000ee0ad2dd91485636b5d845c73ada3744 100644 (file)
@@ -1579,11 +1579,6 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
    * @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 ";
 
@@ -1593,7 +1588,7 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
       $where .= " and civicrm_membership_status.is_current_member = 1";
     }
 
-    $query = $select . $where . $addWhere;
+    $query = $select . $where;
     return CRM_Core_DAO::singleValueQuery($query);
   }
 
index 6818490f1784aa640fea28f2aa75d84234cb15e1..7c4ad24d143ac0f18572ff28cba266b88e0a7206 100644 (file)
@@ -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