Skip to content

Commit

Permalink
[Smarty variables] remove isset from case dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Dec 1, 2021
1 parent a71221d commit 50db63c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,9 @@ public static function getCasesSummary($allCases = TRUE) {

$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;
}
Expand Down
2 changes: 0 additions & 2 deletions CRM/Case/Page/DashBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ public function preProcess() {

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;
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Case/Page/DashBoard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/phpunit/CRM/Core/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -47,6 +47,9 @@ public function testOpeningForms(string $url): void {
public function formList(): array {
return [
// Array key is descriptive term to make it clearer which form it is when it fails.
'Case Dashboard' => [
'civicrm/case?reset=1',
],
'Add New Tag' => [
'civicrm/tag/edit?action=add&parent_id=',
],
Expand Down

0 comments on commit 50db63c

Please sign in to comment.