CRM-16189, fixed buutton link for record payment
authorPradeep Nayak <pradpnayak@gmail.com>
Mon, 26 Sep 2016 12:45:56 +0000 (18:15 +0530)
committerEdsel <edsel.lopez@jmaconsulting.biz>
Mon, 19 Dec 2016 09:28:23 +0000 (14:58 +0530)
----------------------------------------
* CRM-16189:
  https://issues.civicrm.org/jira/browse/CRM-16189

CRM/Contribute/Selector/Search.php

index efb4b786ced6b13e25c088c4e086af6c0c4c50e8..d692af8c4f1aeb7ecde7952a7e83e7709fcf6284 100644 (file)
@@ -441,25 +441,18 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C
         'id' => $result->contribution_id,
         'cid' => $result->contact_id,
         'cxt' => $this->_context,
-        'compId' => $result->contribution_id,
-        'comp' => 'contribution',
       );
 
-      if ($row['contribution_status_name'] == 'Partially paid' || $isPayLater) {
-        $links[CRM_Core_Action::ADD] = array(
-          'name' => ts('Record Payment'),
-          'url' => 'civicrm/payment',
-          'qs' => 'reset=1&id=%%compId%%&cid=%%cid%%&action=add&component=%%comp%%',
-          'title' => ts('Record Payment'),
-        );
-      }
-
-      if ($row['contribution_status_name'] == 'Pending refund') {
+      if (in_array($row['contribution_status_name'], array('Partially paid', 'Pending refund')) || $isPayLater) {
+        $buttonName = ts('Record Payment');
+        if ($row['contribution_status_name'] == 'Pending refund') {
+          $buttonName = ts('Record Refund');
+        }
         $links[CRM_Core_Action::ADD] = array(
-          'name' => ts('Record Refund'),
+          'name' => $buttonName,
           'url' => 'civicrm/payment',
-          'qs' => 'reset=1&id=%%pid%%&cid=%%cid%%&action=add&component=event',
-          'title' => ts('Record Refund'),
+          'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=contribution',
+          'title' => $buttonName,
         );
       }