From 9a84a13578ae92a74497fb16151f054a95a36dfd Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 6 Sep 2023 19:55:57 +1200 Subject: [PATCH] Add weight to contribution tasks --- CRM/Contribute/Selector/Search.php | 7 +++++-- CRM/Contribute/Task.php | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 53a2488e02..fc755d92d8 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -413,9 +413,10 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'url' => 'civicrm/contact/view/contribution', 'qs' => 'reset=1&action=update&id=%%id%%&cid=%%cid%%&context=%%cxt%%&mode=live', 'title' => ts('Pay with Credit Card'), + 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::ADD), ]; } - elseif (($row['contribution_status_name'] ?? NULL) == 'Pending') { + elseif (($row['contribution_status_name'] ?? NULL) === 'Pending') { $row['contribution_status'] .= ' (' . ts('Incomplete Transaction') . ')'; } @@ -433,7 +434,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C if (in_array($row['contribution_status_name'], ['Partially paid', 'Pending refund']) || $isPayLater) { $buttonName = ts('Record Payment'); - if ($row['contribution_status_name'] == 'Pending refund') { + if ($row['contribution_status_name'] === 'Pending refund') { $buttonName = ts('Record Refund'); } elseif (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) { @@ -442,6 +443,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'url' => 'civicrm/payment/add', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=contribution&mode=live', 'title' => ts('Submit Credit Card payment'), + 'weight' => 30, ]; } $links[CRM_Core_Action::ADD] = [ @@ -449,6 +451,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'url' => 'civicrm/payment', 'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=contribution', 'title' => $buttonName, + 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::ADD), ]; } $links = $links + CRM_Contribute_Task::getContextualLinks($row); diff --git a/CRM/Contribute/Task.php b/CRM/Contribute/Task.php index 52434ccba3..3fa495d852 100644 --- a/CRM/Contribute/Task.php +++ b/CRM/Contribute/Task.php @@ -50,11 +50,13 @@ class CRM_Contribute_Task extends CRM_Core_Task { 'title' => ts('Delete contributions'), 'class' => 'CRM_Contribute_Form_Task_Delete', 'result' => FALSE, + 'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DELETE), ], self::TASK_PRINT => [ 'title' => ts('Print selected rows'), 'class' => 'CRM_Contribute_Form_Task_Print', 'result' => FALSE, + 'weight' => 10, ], self::TASK_EXPORT => [ 'title' => ts('Export contributions'), @@ -63,6 +65,7 @@ class CRM_Contribute_Task extends CRM_Core_Task { 'CRM_Contribute_Export_Form_Map', ], 'result' => FALSE, + 'weight' => 20, ], self::BATCH_UPDATE => [ 'title' => ts('Update multiple contributions'), @@ -71,6 +74,7 @@ class CRM_Contribute_Task extends CRM_Core_Task { 'CRM_Contribute_Form_Task_Batch', ], 'result' => TRUE, + 'weight' => 30, ], self::TASK_EMAIL => [ 'title' => ts('Email - send now (to %1 or less)', [ @@ -79,11 +83,13 @@ class CRM_Contribute_Task extends CRM_Core_Task { ]), 'class' => 'CRM_Contribute_Form_Task_Email', 'result' => TRUE, + 'weight' => 40, ], self::UPDATE_STATUS => [ 'title' => ts('Record payments for contributions'), 'class' => 'CRM_Contribute_Form_Task_Status', 'result' => TRUE, + 'weight' => 50, ], self::PDF_RECEIPT => [ 'title' => ts('Receipts - print or email'), @@ -96,6 +102,7 @@ class CRM_Contribute_Task extends CRM_Core_Task { 'icon' => 'fa-envelope-o', 'filters' => ['contribution_status_id' => [CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed')]], 'is_single_mode' => TRUE, + 'weight' => 60, ], self::PDF_THANKYOU => [ 'title' => ts('Thank-you letters - print or email'), @@ -106,11 +113,13 @@ class CRM_Contribute_Task extends CRM_Core_Task { 'name' => ts('Send Letter'), 'is_single_mode' => TRUE, 'title_single_mode' => ts('Thank-you letter - print or email'), + 'weight' => 70, ], self::PDF_INVOICE => [ 'title' => ts('Invoices - print or email'), 'class' => 'CRM_Contribute_Form_Task_Invoice', 'result' => FALSE, + 'weight' => 80, ], ]; -- 2.25.1