Skip to content

Commit

Permalink
Don't hide disabled memberships from the contact membership tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Apr 5, 2020
1 parent 48852df commit be03a7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
9 changes: 2 additions & 7 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ";

Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 0 additions & 8 deletions CRM/Member/Page/Tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be03a7f

Please sign in to comment.