From f8d3033b72be8cddac73af4055f073477b2d6ead Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 31 Dec 2015 16:14:49 +0530 Subject: [PATCH] further fixes for webtest --- CRM/Contribute/BAO/Contribution.php | 16 +++------------- CRM/Member/BAO/Membership.php | 6 +----- CRM/Member/Selector/Search.php | 21 +++++++++------------ 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 4b94af05e2..7d699680ad 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4319,20 +4319,10 @@ LIMIT 1;"; //we might be renewing membership, //so make status override false. $membershipParams['is_override'] = FALSE; - //CRM-17723 - avoid updating related membership from the api as the - //static $relatedContactIds array() in CRM_Member_BAO_Membership::createdRelatedMemberships() - //already contains these ids from previous call leading to deletion of related memberships. - $membershipParams['reset'] = TRUE; + //CRM-17723 - reset static $relatedContactIds array() + $var = TRUE; + CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE); civicrm_api3('Membership', 'create', $membershipParams); - - // unset/format unwanted keys - $removeKeys = array('id', 'contact_id', 'reset'); - $membershipParams = array_diff_key($membershipParams, array_flip($removeKeys)); - if (!empty($membershipParams['status_id']) && is_string($membershipParams['status_id'])) { - $membershipParams['status_id'] = array_search($membershipParams['status_id'], CRM_Member_PseudoConstant::membershipStatus()); - } - //update related Memberships. - CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $membershipParams); } } } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 6c9efce8c0..62d397c05d 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -401,11 +401,7 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { $transaction->commit(); - $reset = FALSE; - if (!empty($params['reset'])) { - $reset = TRUE; - } - self::createRelatedMemberships($params, $membership, $reset); + self::createRelatedMemberships($params, $membership); // do not add to recent items for import, CRM-4399 if (empty($params['skipRecentView'])) { diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php index 6bfb3a6a58..bcbc30b2b4 100644 --- a/CRM/Member/Selector/Search.php +++ b/CRM/Member/Selector/Search.php @@ -390,18 +390,14 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C } $isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported($row['membership_id']); - if (!isset($result->owner_membership_id)) { - $links = self::links('all', - $this->_isPaymentProcessor, - $this->_accessContribution, - $this->_key, - $this->_context, - $isCancelSupported - ); - } - else { - $links = self::links('view'); - } + $links = self::links('all', + $this->_isPaymentProcessor, + $this->_accessContribution, + $this->_key, + $this->_context, + $isCancelSupported + ); + // check permissions $finTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $result->membership_type_id, 'financial_type_id'); $finType = CRM_Contribute_PseudoConstant::financialType($finTypeId); @@ -430,6 +426,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C ); } else { + $links = self::links('view'); $row['action'] = CRM_Core_Action::formLink($links, $mask, array( 'id' => $result->membership_id, -- 2.25.1