dev/core#165 - Fix case activity breadcrumb
authorColeman Watts <coleman@civicrm.org>
Thu, 7 Jun 2018 18:39:08 +0000 (14:39 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 7 Jun 2018 18:40:08 +0000 (14:40 -0400)
When opening a case activity (without popups) this will correctly set the breadcrumb.

CRM/Case/Form/ActivityView.php

index e18b086d1909c3f95d3308e64ae819e365601045..16247cda225f1e4c7619aec3ca9268331476c530 100644 (file)
@@ -172,6 +172,38 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form {
       $recentContactDisplay,
       $recentOther
     );
+
+    // Set breadcrumb to take the user back to the case being viewed
+    $caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseID, 'case_type_id');
+    $caseType = CRM_Core_PseudoConstant::getLabel('CRM_Case_BAO_Case', 'case_type_id', $caseTypeId);
+    $caseContact = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseContact', $caseID, 'contact_id', 'case_id');
+
+    CRM_Utils_System::resetBreadCrumb();
+    $breadcrumb = [
+      [
+        'title' => ts('Home'),
+        'url' => CRM_Utils_System::url(),
+      ],
+      [
+        'title' => ts('CiviCRM'),
+        'url' => CRM_Utils_System::url('civicrm', 'reset=1'),
+      ],
+      [
+        'title' => ts('CiviCase Dashboard'),
+        'url' => CRM_Utils_System::url('civicrm/case', 'reset=1'),
+      ],
+      [
+        'title' => $caseType,
+        'url' => CRM_Utils_System::url('civicrm/contact/view/case', [
+          'reset' => 1,
+          'id' => $caseID,
+          'context' => 'case',
+          'action' => 'view',
+          'cid' => $caseContact,
+        ]),
+      ],
+    ];
+    CRM_Utils_System::appendBreadCrumb($breadcrumb);
   }
 
 }