Add weights to scheduled jobs
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 31 Aug 2023 11:09:31 +0000 (23:09 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 4 Sep 2023 05:18:21 +0000 (17:18 +1200)
CRM/Admin/Page/Job.php
CRM/Event/Selector/Search.php

index 005b38f5ee177fe13e51a5469fc13ba5de90810f..f8a1a10171909dce2bcd15d490a235e136115705 100644 (file)
@@ -51,40 +51,47 @@ class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
           'url' => 'civicrm/admin/joblog',
           'qs' => 'jid=%%id%%&reset=1',
           'title' => ts('See log entries for this Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::VIEW),
         ],
         CRM_Core_Action::VIEW => [
           'name' => ts('Execute'),
           'url' => 'civicrm/admin/job/edit',
           'qs' => 'action=view&id=%%id%%&reset=1',
           'title' => ts('Execute Scheduled Job Now'),
+          'weight' => -15,
         ],
         CRM_Core_Action::UPDATE => [
           'name' => ts('Edit'),
           'url' => 'civicrm/admin/job/edit',
           'qs' => 'action=update&id=%%id%%&reset=1',
           'title' => ts('Edit Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::UPDATE),
         ],
         CRM_Core_Action::DISABLE => [
           'name' => ts('Disable'),
           'ref' => 'crm-enable-disable',
           'title' => ts('Disable Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DISABLE),
         ],
         CRM_Core_Action::ENABLE => [
           'name' => ts('Enable'),
           'ref' => 'crm-enable-disable',
           'title' => ts('Enable Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::ENABLE),
         ],
         CRM_Core_Action::DELETE => [
           'name' => ts('Delete'),
           'url' => 'civicrm/admin/job/edit',
           'qs' => 'action=delete&id=%%id%%',
           'title' => ts('Delete Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::DELETE),
         ],
         CRM_Core_Action::COPY => [
           'name' => ts('Copy'),
           'url' => 'civicrm/admin/job/edit',
           'qs' => 'action=copy&id=%%id%%',
           'title' => ts('Copy Scheduled Job'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::COPY),
         ],
       ];
     }
index b7f6967f6b4d30b68ca2c81ee85448c2c91e299d..9000dbbf90be52bd273a73d83a466c46cdee2ae2 100644 (file)
@@ -354,12 +354,13 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
       $row['checkbox'] = CRM_Core_Form::CB_PREFIX . $result->participant_id;
       $links = self::links($this->_key, $this->_context, $this->_compContext);
 
-      if ($statusTypes[$row['participant_status_id']] == 'Partially paid') {
+      if ($statusTypes[$row['participant_status_id']] === 'Partially paid') {
         $links[CRM_Core_Action::ADD] = [
           'name' => ts('Record Payment'),
           'url' => 'civicrm/payment',
           'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event',
           'title' => ts('Record Payment'),
+          'weight' => CRM_Core_Action::getWeight(CRM_Core_Action::ADD),
         ];
         if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
           $links[CRM_Core_Action::BASIC] = [
@@ -367,16 +368,18 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
             'url' => 'civicrm/payment/add',
             'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event&mode=live',
             'title' => ts('Submit Credit Card payment'),
+            'weight' => 50,
           ];
         }
       }
 
-      if ($statusTypes[$row['participant_status_id']] == 'Pending refund') {
+      if ($statusTypes[$row['participant_status_id']] === 'Pending refund') {
         $links[CRM_Core_Action::ADD] = [
           'name' => ts('Record Refund'),
           'url' => 'civicrm/payment',
           'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=add&component=event',
           'title' => ts('Record Refund'),
+          'weight' => 60,
         ];
       }
 
@@ -391,6 +394,7 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
           'url' => 'civicrm/event/selfsvcupdate',
           'qs' => 'reset=1&pid=%%id%%&is_backoffice=1&cs=' . CRM_Contact_BAO_Contact_Utils::generateChecksum($result->contact_id, NULL, 'inf'),
           'title' => ts('Transfer or Cancel'),
+          'weight' => 70,
         ];
       }