further fixes for webtest
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 31 Dec 2015 10:44:49 +0000 (16:14 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 31 Dec 2015 10:44:49 +0000 (16:14 +0530)
CRM/Contribute/BAO/Contribution.php
CRM/Member/BAO/Membership.php
CRM/Member/Selector/Search.php

index 4b94af05e2c4fe4e33e84b459a1bc91e3b158b5b..7d699680ad88143def7284863676443bdaf8c87f 100644 (file)
@@ -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);
           }
         }
       }
index 6c9efce8c0c19355c85cec87f70b683235f3c5da..62d397c05d1cecaabe841ec6b4b179c608a6d33d 100644 (file)
@@ -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'])) {
index 6bfb3a6a581394d5baa6efa6188710acb718c911..bcbc30b2b44f85aeab04b2e1bb9b30201e44a85e 100644 (file)
@@ -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,