CRM-15180, added support in case view
[civicrm-core.git] / CRM / Case / Page / AJAX.php
index 273fd975489e327b0bfd46968f619de2ad0a7eec..9479fbf5c3ca3f96bd95339d69ee40cf7b7b4881 100644 (file)
@@ -144,10 +144,15 @@ class CRM_Case_Page_AJAX {
                                     <tr><td>" . ts('Case Status') . "</td><td>{$cs}</td></tr>
                                     <tr><td>" . ts('Case Start Date') . "</td><td>" . CRM_Utils_Date::customFormat($dao->start_date) . "</td></tr>
                                     <tr><td>" . ts('Case End Date') . "</td><td></td></tr>" . CRM_Utils_Date::customFormat($dao->end_date) . "</table>";
-      echo $caseDetails;
+      if (CRM_Utils_Array::value('snippet', $_GET) == 'json') {
+        CRM_Core_Page_AJAX::returnJsonResponse($caseDetails);
+      }
+      else {
+        echo $caseDetails;
+      }
     }
     else {
-      echo ts('Could not find valid Case!');
+      CRM_Core_Error::fatal('Could not find valid Case.');
     }
     CRM_Utils_System::civiExit();
   }
@@ -193,7 +198,7 @@ class CRM_Case_Page_AJAX {
   }
 
   /**
-   * Function to delete relationships specific to case and relationship type
+   * Delete relationships specific to case and relationship type
    */
   static function deleteCaseRoles() {
     $caseId  = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');