From fc7d8951d0befe1d98924acc5596303fafe3aed4 Mon Sep 17 00:00:00 2001 From: Divya Jose Date: Mon, 24 Mar 2014 15:30:33 +0530 Subject: [PATCH] --HR-313 Split case activity datatable tpl into separate file --- CRM/Case/Form/ActivityForm.php | 72 +++++++++++ CRM/Case/Form/CaseView.php | 30 +---- templates/CRM/Case/Form/ActivityTab.tpl | 165 ++++++++++++++++++++++++ templates/CRM/Case/Form/CaseView.tpl | 143 +------------------- 4 files changed, 240 insertions(+), 170 deletions(-) create mode 100644 CRM/Case/Form/ActivityForm.php create mode 100644 templates/CRM/Case/Form/ActivityTab.tpl diff --git a/CRM/Case/Form/ActivityForm.php b/CRM/Case/Form/ActivityForm.php new file mode 100644 index 0000000000..3ac4dd9ca1 --- /dev/null +++ b/CRM/Case/Form/ActivityForm.php @@ -0,0 +1,72 @@ +_contactID, $form->_caseID); + //build reporter select + $reporters = array("" => ts(' - any reporter - ')); + foreach ($caseRelationships as $key => & $value) { + $reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )"; + } + $form->add('select', 'reporter_id', ts('Reporter/Role'), $reporters); + + // take all case activity types for search filter, CRM-7187 + $aTypesFilter = array(); + $allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType(); + foreach ($allCaseActTypes as $typeDetails) { + if (!in_array($typeDetails['name'], array('Open Case'))) { + $aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails); + } + } + asort($aTypesFilter); + $form->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $aTypesFilter); + + $activityStatus = CRM_Core_PseudoConstant::activityStatus(); + $form->add('select', 'status_id', ts('Status'), array("" => ts(' - any status - ')) + $activityStatus); + + // activity dates + $form->addDate('activity_date_low', ts('Activity Dates - From'), FALSE, array('formatType' => 'searchDate')); + $form->addDate('activity_date_high', ts('To'), FALSE, array('formatType' => 'searchDate')); + + if (CRM_Core_Permission::check('administer CiviCRM')) { + $form->add('checkbox', 'activity_deleted', ts('Deleted Activities')); + } + } +} \ No newline at end of file diff --git a/CRM/Case/Form/CaseView.php b/CRM/Case/Form/CaseView.php index 0865c54e4e..1bd185b5d2 100644 --- a/CRM/Case/Form/CaseView.php +++ b/CRM/Case/Form/CaseView.php @@ -328,16 +328,8 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { } } - $activityStatus = CRM_Core_PseudoConstant::activityStatus(); - $this->add('select', 'status_id', ts('Status'), array("" => ts(' - any status - ')) + $activityStatus); - - // activity dates - $this->addDate('activity_date_low', ts('Activity Dates - From'), FALSE, array('formatType' => 'searchDate')); - $this->addDate('activity_date_high', ts('To'), FALSE, array('formatType' => 'searchDate')); - - if (CRM_Core_Permission::check('administer CiviCRM')) { - $this->add('checkbox', 'activity_deleted', ts('Deleted Activities')); - } + //call activity form + CRM_Case_Form_ActivityForm::activityform($this); //get case related relationships (Case Role) $caseRelationships = CRM_Case_BAO_Case::getCaseRoles($this->_contactID, $this->_caseID); @@ -345,11 +337,7 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { //save special label because we unset it in the loop $managerLabel = empty($managerRoleId) ? '' : $caseRoles[$managerRoleId]; - //build reporter select - $reporters = array("" => ts(' - any reporter - ')); foreach ($caseRelationships as $key => & $value) { - $reporters[$value['cid']] = $value['name'] . " ( {$value['relation']} )"; - if (!empty($managerRoleId)) { if ($managerRoleId == $value['relation_type']) { $value['relation'] = $managerLabel; @@ -362,18 +350,6 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { } } - // take all case activity types for search filter, CRM-7187 - $aTypesFilter = array(); - $allCaseActTypes = CRM_Case_PseudoConstant::caseActivityType(); - foreach ($allCaseActTypes as $typeDetails) { - if (!in_array($typeDetails['name'], array( - 'Open Case'))) { - $aTypesFilter[$typeDetails['id']] = CRM_Utils_Array::value('label', $typeDetails); - } - } - asort($aTypesFilter); - $this->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- select activity type -')) + $aTypesFilter); - $this->assign('caseRelationships', $caseRelationships); //also add client as role. CRM-4438 @@ -381,8 +357,6 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form { $this->assign('caseRoles', $caseRoles); - $this->add('select', 'reporter_id', ts('Reporter/Role'), $reporters); - // Retrieve ALL client relationships $relClient = CRM_Contact_BAO_Relationship::getRelationship($this->_contactID, CRM_Contact_BAO_Relationship::CURRENT, diff --git a/templates/CRM/Case/Form/ActivityTab.tpl b/templates/CRM/Case/Form/ActivityTab.tpl new file mode 100644 index 0000000000..20a12d798c --- /dev/null +++ b/templates/CRM/Case/Form/ActivityTab.tpl @@ -0,0 +1,165 @@ +{* + +--------------------------------------------------------------------+ + | CiviCRM version 4.4 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2013 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License and the CiviCRM Licensing Exception along | + | with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{*this template is used for activity accordion*} +
+
+ {ts}Activities{/ts} +
+
+ + + + + + + + + + + + + +
{ts}Date{/ts}{ts}Subject{/ts}{ts}Type{/ts}{ts}With{/ts}{ts}Reporter / Assignee{/ts}{ts}Status{/ts}  
+ +
+
+ +{literal} + +{/literal} \ No newline at end of file diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl index 50991b2a4c..557146eaa1 100644 --- a/templates/CRM/Case/Form/CaseView.tpl +++ b/templates/CRM/Case/Form/CaseView.tpl @@ -477,148 +477,7 @@ {/if} {* end of tag block*} -
-
- {ts}Activities{/ts} -
-
- - - - - - - - - - - - - -
{ts}Date{/ts}{ts}Subject{/ts}{ts}Type{/ts}{ts}With{/ts}{ts}Reporter / Assignee{/ts}{ts}Status{/ts}  
- -
-
- -{literal} - -{/literal} +{include file="CRM/Case/Form/ActivityTab.tpl"}
{include file="CRM/common/formButtons.tpl" location="bottom"}
-- 2.25.1