From 5a53dd1fe163afcffc0ce9187fcf62fe5dad5b05 Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 26 Jul 2017 16:55:32 +0530 Subject: [PATCH] CRM-20952 Refreshed event tab on payment made to contribution ---------------------------------------- * CRM-20952: Refresh membership tab on edits to membership payments https://issues.civicrm.org/jira/browse/CRM-20952 --- CRM/Contribute/Form/AdditionalPayment.php | 10 ++++++++-- CRM/Contribute/Form/Contribution.php | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index 84fbcc5be1..5b2f0cebf0 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -380,11 +380,17 @@ 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')) { - $memPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_contributionId)); - if ($memPaymentCount > 0) { + $membershipPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_contributionId)); + if ($membershipPaymentCount) { $this->ajaxResponse['updateTabs']['#tab_member'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactID); } } + if ($this->_contributionId && CRM_Core_Permission::access('CiviEvent')) { + $participantPaymentCount = civicrm_api3('ParticipantPayment', 'getCount', array('contribution_id' => $this->_contributionId)); + if ($participantPaymentCount) { + $this->ajaxResponse['updateTabs']['#tab_participant'] = CRM_Contact_BAO_Contact::getCountComponent('participant', $this->_contactID); + } + } $statusMsg = ts('The payment record has been processed.'); // send email diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 9f53559b77..7f2be11723 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1074,11 +1074,17 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->_id = $contribution->id; } if (!empty($this->_id) && CRM_Core_Permission::access('CiviMember')) { - $memPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_id)); - if ($memPaymentCount > 0) { + $membershipPaymentCount = civicrm_api3('MembershipPayment', 'getCount', array('contribution_id' => $this->_id)); + if ($membershipPaymentCount) { $this->ajaxResponse['updateTabs']['#tab_member'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactID); } } + if (!empty($this->_id) && CRM_Core_Permission::access('CiviEvent')) { + $participantPaymentCount = civicrm_api3('ParticipantPayment', 'getCount', array('contribution_id' => $this->_id)); + if ($participantPaymentCount) { + $this->ajaxResponse['updateTabs']['#tab_participant'] = CRM_Contact_BAO_Contact::getCountComponent('participant', $this->_contactID); + } + } } /** -- 2.25.1