CRM-17599 fix - CiviCase case details table is broken
authormonishdeb <monish.deb@webaccessglobal.com>
Fri, 20 Nov 2015 14:51:32 +0000 (20:21 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Fri, 20 Nov 2015 14:52:07 +0000 (20:22 +0530)
https://issues.civicrm.org/jira/browse/CRM-17599

CRM/Case/Page/CaseDetails.php
templates/CRM/Case/Form/ActivityTab.tpl
templates/CRM/Case/Page/CaseDetails.tpl

index df9471e764aa2705c1f8317a130fad6661671693..51bf4a1da8f60d0d25be3f567c95eaf43e801a7a 100644 (file)
@@ -42,7 +42,6 @@ class CRM_Case_Page_CaseDetails extends CRM_Core_Page {
   public function run() {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
-    $type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
 
     $this->assign('action', $this->_action);
     $this->assign('context', $this->_context);
@@ -53,27 +52,9 @@ class CRM_Case_Page_CaseDetails extends CRM_Core_Page {
 
     CRM_Case_Page_Tab::setContext();
 
-    $params = array('date_range' => 0);
-
-    $caseDetails = array();
-    if (CRM_Case_BAO_Case::accessCiviCase()) {
-      $caseDetails = CRM_Case_BAO_Case::getCaseActivity($caseId, $params, $this->_contactId, NULL, NULL, $type);
-    }
-
-    $this->assign('rows', $caseDetails);
-    $this->assign('caseId', $caseId);
-    $this->assign('contactId', $this->_contactId);
-
-    // Make it easy to refresh this table
-    $params = array(
-      'caseId' => $caseId,
-      'type' => $type,
-      'context' => $this->_context,
-      'cid' => $this->_contactId,
-      'action' => $this->_action,
-      'snippet' => 4,
-    );
-    $this->assign('data_params', json_encode($params));
+    $this->assign('caseID', $caseId);
+    $this->assign('contactID', $this->_contactId);
+    $this->assign('userID', CRM_Core_Session::singleton()->get('userID'));
 
     return parent::run();
   }
index 68c31105372a9959f859cd89d0a6e737dcc88f0e..a0459e7c10edf9c994c11c2ac207f88d937fc760 100644 (file)
 *}
 {*this template is used for activity accordion*}
 {assign var=caseid value=$caseID}
-<div class="crm-accordion-wrapper crm-case_activities-accordion  crm-case-activities-block">
-  <div class="crm-accordion-header">
-    {ts}Activities{/ts}
-  </div>
-  <div id="activities" class="crm-accordion-body">
+{if isset($isForm) and $isForm}
+  <div class="crm-accordion-wrapper crm-case_activities-accordion  crm-case-activities-block">
+    <div class="crm-accordion-header">
+      {ts}Activities{/ts}
+    </div>
+
+    <div id="activities" class="crm-accordion-body">
     <div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
       <div class="crm-accordion-header">
         {ts}Search Filters{/ts}
@@ -70,6 +72,7 @@
         </table>
       </div><!-- /.crm-accordion-body -->
     </div><!-- /.crm-accordion-wrapper -->
+{/if}
 
     <table id="case_id_{$caseid}"  class="nestedActivitySelector crm-ajax-table" data-order='[[0,"desc"]]' data-page-length="10">
       <thead><tr>
@@ -89,7 +92,7 @@
         var caseId = {/literal}{$caseID}{literal};
         CRM.$('table#case_id_' + caseId).data({
           "ajax": {
-            "url": {/literal}'{crmURL p="civicrm/ajax/activity" h=0 q="snippet=4&caseID=$caseId&cid=$contactID&userID=$userID"}'{literal},
+            "url": {/literal}'{crmURL p="civicrm/ajax/activity" h=0 q="snippet=4&caseID=$caseID&cid=$contactID&userID=$userID"}'{literal},
             "data": function (d) {
               d.status_id = $("select#status_id_" + caseId).val(),
               d.reporter_id = $("select#reporter_id_" + caseId).val(),
     </script>
   {/literal}
 
-  </div><!-- /.crm-accordion-body -->
-</div><!-- /.crm-accordion-wrapper -->
+{if isset($isForm) and $isForm}
+    </div><!-- /.crm-accordion-body -->
+  </div><!-- /.crm-accordion-wrapper -->
+{/if}
index a04e66f1b3f468d95a12784b1414c76c321e8696..39c08913eaeff65e47e2ecc5ded090343eb49885 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{strip}
-{if $rows}
-  <table class="nestedActivitySelector" data-params='{$data_params}'>
-    <tr class="columnheader">
-      <th>{ts}Date{/ts}</th>
-      <th>{ts}Subject{/ts}</th>
-      <th>{ts}Type{/ts}</th>
-      <th>{ts}With{/ts}</th>
-      <th>{ts}Reporter / Assignee{/ts}</th>
-      <th>{ts}Status{/ts}</th>
-      <th></th>
-    </tr>
 
-    {counter start=0 skip=1 print=false}
-    {foreach from=$rows item=row}
-    <tr class="crm-entity {$row.class}" data-entity="activity" data-id="{$row.id}">
-      <td class="crm-case-display_date">{$row.display_date}</td>
-      <td class="crm-case-subject">{$row.subject}</td>
-      <td class="crm-case-type">{$row.type}</td>
-      <td class="crm-case-with_contacts">{$row.with_contacts}</td>
-      <td class="crm-case-reporter">{$row.reporter}</td>
-      <td class="crm-case-status">{$row.status}</td>
-      <td style="white-space: nowrap;">{$row.links}</td>
-    </tr>
-    {/foreach}
 
-  </table>
-{else}
-    <strong>{ts}There are no activities defined for this case.{/ts}</strong>
-{/if}
-{/strip}
+{include file="CRM/Case/Form/ActivityTab.tpl"}
 
 {include file="CRM/Case/Form/ActivityToCase.tpl"}