CRM-20952 Bug fixes
authorEdsel <edsel.lopez@jmaconsulting.biz>
Wed, 26 Jul 2017 07:04:31 +0000 (12:34 +0530)
committerEdsel <edsel.lopez@jmaconsulting.biz>
Wed, 26 Jul 2017 07:04:31 +0000 (12:34 +0530)
----------------------------------------
* CRM-20952: Refresh membership tab on edits to membership payments
  https://issues.civicrm.org/jira/browse/CRM-20952

CRM/Contribute/Form/AdditionalPayment.php
CRM/Contribute/Form/Contribution.php

index 15c4bb30d9d656f51dc30e0ec41186ed5325b329..84fbcc5be1262d163d7680fc45567e641f1dc445 100644 (file)
@@ -380,8 +380,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params);
     CRM_Contribute_BAO_Contribution::addPayments(array($contribution), $contributionStatusId);
     if ($this->_contributionId && CRM_Core_Permission::access('CiviMember')) {
-      $membershipPayments = civicrm_api3('MembershipPayment', 'Get', array('contribution_id' => $this->_contributionId));
-      if ($membershipPayments['count'] > 1) {
+      $memPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_contributionId));
+      if ($memPaymentCount > 0) {
         $this->ajaxResponse['updateTabs']['#tab_member'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactID);
       }
     }
index c19f6638373f560ed876cfb2ae5d37dce36f2b65..9f53559b77ef80064cffc71d8c152081fa58f74c 100644 (file)
@@ -1074,8 +1074,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->_id = $contribution->id;
     }
     if (!empty($this->_id) && CRM_Core_Permission::access('CiviMember')) {
-      $membershipPayments = civicrm_api3('MembershipPayment', 'Get', array('contribution_id' => $this->_id));
-      if ($membershipPayments['count'] > 1) {
+      $memPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_id));
+      if ($memPaymentCount > 0) {
         $this->ajaxResponse['updateTabs']['#tab_member'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactID);
       }
     }