[Smarty variables] remove isset from case dashboard
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 30 Nov 2021 20:09:49 +0000 (09:09 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 1 Dec 2021 19:34:46 +0000 (08:34 +1300)
CRM/Case/BAO/Case.php
CRM/Case/Page/DashBoard.php
templates/CRM/Case/Page/DashBoard.tpl
tests/phpunit/CRM/Core/FormTest.php

index 5014e4a0cd1e39ba46bd2ecf995df2e809615c8e..f28721991b5f1edf94d811690dd71f398db1ca5e 100644 (file)
@@ -761,6 +761,9 @@ SELECT civicrm_case.id, case_status.label AS case_status, status_id, civicrm_cas
 
     $res = CRM_Core_DAO::executeQuery($query);
     while ($res->fetch()) {
+      if (!isset($rows[$res->case_type])) {
+        $rows[$res->case_type] = array_fill_keys($caseStatuses, []);
+      }
       if (!empty($rows[$res->case_type]) && !empty($rows[$res->case_type][$res->case_status])) {
         $rows[$res->case_type][$res->case_status]['count'] = $rows[$res->case_type][$res->case_status]['count'] + 1;
       }
index 7a24af22cea6027fb74137b9b11a8d817aec003b..bfc8c1fe3aed26dfa835e3cba4a3cb7bda7e8720 100644 (file)
@@ -46,8 +46,6 @@ class CRM_Case_Page_DashBoard extends CRM_Core_Page {
 
     CRM_Utils_System::setTitle(ts('CiviCase Dashboard'));
 
-    $userID = $session->get('userID');
-
     //validate access for all cases.
     if ($allCases && !CRM_Core_Permission::check('access all cases and activities')) {
       $allCases = 0;
index 08797ceb7d574dc651cf745e0c42068ab4e09f8a..5ce2cca18e6fff09b027f63ec9864f27447a51f9 100644 (file)
@@ -56,7 +56,7 @@
           {foreach from=$casesSummary.headers item=header}
             {assign var="caseStatus" value=$header.status}
             <td class="label">
-              {if isset($row.$caseStatus)}
+              {if is_array($row.$caseStatus)}
                 <a class="crm-case-summary-drilldown" href="{$row.$caseStatus.url}">{$row.$caseStatus.count}</a>
               {else}
                 0
index d04858ec9ca0a7475412ccf7d202fabc32a3c0f0..8bd989acd707f6d4041c738d55ff598b28b2eefa 100644 (file)
@@ -17,7 +17,7 @@ class CRM_Core_FormTest extends CiviUnitTestCase {
    */
   public function testOpeningForms(string $url): void {
     $this->createLoggedInUser();
-
+    \CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
     $_SERVER['REQUEST_URI'] = $url;
     $urlParts = explode('?', $url);
     $_GET['q'] = $urlParts[0];