From: Eileen McNaughton Date: Wed, 17 May 2023 19:58:43 +0000 (+1200) Subject: Add a couple more weights X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=65e4a54446c938b005e04495abbb02c21690efb3;p=civicrm-core.git Add a couple more weights --- diff --git a/CRM/Case/Selector/Search.php b/CRM/Case/Selector/Search.php index 696a8d05c0..a4b13df0d4 100644 --- a/CRM/Case/Selector/Search.php +++ b/CRM/Case/Selector/Search.php @@ -25,7 +25,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { * * @var array */ - public static $_links = NULL; + public static $_links; /** * The action links that we need to display for the browse screen. @@ -101,7 +101,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { * * @var string */ - protected $_additionalClause = NULL; + protected $_additionalClause; /** * The query object @@ -115,7 +115,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { * * @param array $queryParams * Array of parameters for query. - * @param \const|int $action - action of search basic or advanced. + * @param int $action - action of search basic or advanced. * @param string $additionalClause * If the caller wants to further restrict the search (used in participations). * @param bool $single @@ -182,6 +182,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'qs' => 'reset=1&action=renew&id=%%id%%&cid=%%cid%%&context=%%cxt%%' . $extraParams, 'ref' => 'restore-case', 'title' => ts('Restore Case'), + 'weight' => -30, ], ]; } @@ -194,6 +195,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'ref' => 'manage-case', 'class' => 'no-popup', 'title' => ts('Manage Case'), + 'weight' => -20, ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), @@ -201,6 +203,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'qs' => 'reset=1&action=delete&id=%%id%%&cid=%%cid%%&context=%%cxt%%' . $extraParams, 'ref' => 'delete-case', 'title' => ts('Delete Case'), + 'weight' => -10, ], CRM_Core_Action::UPDATE => [ 'name' => ts('Assign to Another Client'), @@ -209,13 +212,14 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'ref' => 'reassign', 'class' => 'medium-popup', 'title' => ts('Assign to Another Client'), + 'weight' => -10, ], ]; } $actionLinks = []; - foreach (self::$_links as $key => $value) { - $actionLinks['primaryActions'][$key] = $value; + foreach (self::$_links as $index => $value) { + $actionLinks['primaryActions'][$index] = $value; } return $actionLinks; @@ -654,6 +658,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'icon' => 'fa-undo', 'accessKey' => '', 'ref' => 'Restore', + 'weight' => 90, ], CRM_Core_Action::DETACH => [ 'name' => ts('Move To Case'), @@ -662,6 +667,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'extra' => 'onclick = "Javascript:fileOnCase( \'move\', %%aid%%, %%caseid%%, this ); return false;"', 'icon' => 'fa-clipboard', 'accessKey' => '', + 'weight' => 60, ], CRM_Core_Action::COPY => [ 'name' => ts('Copy To Case'), @@ -670,6 +676,7 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { 'extra' => 'onclick = "Javascript:fileOnCase( \'copy\', %%aid%%, %%caseid%%, this ); return false;"', 'icon' => 'fa-files-o', 'accessKey' => '', + 'weight' => 70, ], ]; } diff --git a/tests/phpunit/CRM/Case/BAO/CaseTest.php b/tests/phpunit/CRM/Case/BAO/CaseTest.php index 375bcc83e6..bf1adf3c65 100644 --- a/tests/phpunit/CRM/Case/BAO/CaseTest.php +++ b/tests/phpunit/CRM/Case/BAO/CaseTest.php @@ -129,7 +129,7 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase { * * @throws \CRM_Core_Exception */ - public function testSortByCaseContact() { + public function testSortByCaseContact(): void { // delete any cases if present $this->callAPISuccess('Case', 'get', ['api.Case.delete' => ['id' => '$value.id']]); @@ -536,14 +536,14 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase { /** * Test max_instances */ - public function testMaxInstances() { + public function testMaxInstances(): void { $loggedInUser = $this->createLoggedInUser(); $client_id = $this->individualCreate(); $caseObj = $this->createCase($client_id, $loggedInUser); $case_id = $caseObj->id; // Sanity check to make sure we'll be testing what we think we're testing. - $this->assertEquals($caseObj->case_type_id, 1); + $this->assertEquals(1, $caseObj->case_type_id); // Get the case type $result = $this->callAPISuccess('CaseType', 'get', [ @@ -553,7 +553,7 @@ class CRM_Case_BAO_CaseTest extends CiviUnitTestCase { $caseType = array_shift($result['values']); $activityTypeName = $caseType['definition']['activityTypes'][1]['name']; // Sanity check to make sure we'll be testing what we think we're testing. - $this->assertEquals($activityTypeName, "Medical evaluation"); + $this->assertEquals('Medical evaluation', $activityTypeName); // Look up the activity type label - we need it later $result = $this->callAPISuccess('OptionValue', 'get', [