From 84b27ea4b09edacb3412efe31a52154f4f675ff4 Mon Sep 17 00:00:00 2001 From: kurund Date: Sun, 1 Jun 2014 20:20:06 +0530 Subject: [PATCH] remove unwanted case type file, update navigation menu and add selector --- CRM/Admin/Form/CaseType.php | 137 -------------------------- CRM/Admin/Page/CaseType.php | 124 ----------------------- partials/crmCaseType/list.html | 31 ++++-- templates/CRM/Admin/Form/CaseType.tpl | 52 ---------- templates/CRM/Admin/Page/CaseType.tpl | 77 --------------- templates/CRM/Case/Page/Tab.tpl | 2 +- xml/templates/civicrm_navigation.tpl | 2 +- 7 files changed, 27 insertions(+), 398 deletions(-) delete mode 100644 CRM/Admin/Form/CaseType.php delete mode 100644 CRM/Admin/Page/CaseType.php delete mode 100644 templates/CRM/Admin/Form/CaseType.tpl delete mode 100644 templates/CRM/Admin/Page/CaseType.tpl diff --git a/CRM/Admin/Form/CaseType.php b/CRM/Admin/Form/CaseType.php deleted file mode 100644 index 32b4bcc28d..0000000000 --- a/CRM/Admin/Form/CaseType.php +++ /dev/null @@ -1,137 +0,0 @@ -_action & CRM_Core_Action::DELETE) { - return; - } - $this->applyFilter('__ALL__', 'trim'); - $this->add('text', 'title', ts('Name'), - CRM_Core_DAO::getAttribute('CRM_Case_DAO_CaseType', 'title'), - TRUE - ); - $enabled = $this->add('checkbox', 'is_active', ts('Enabled?')); - $this->add('text', 'description', ts('Description'), - CRM_Core_DAO::getAttribute('CRM_Case_DAO_CaseType', 'description') - ); - - $this->assign('cid', $this->_id); - $this->addFormRule(array('CRM_Admin_Form_CaseType', 'formRule'), $this); - } - - /** - * global form rule - * - * @param array $fields the input form values - * - * @param $files - * @param $self - * - * @return true if no errors, else array of errors - * @access public - * @static - */ - static function formRule($fields, $files, $self) { - - $errors = array(); - - if ($self->_id) { - $caseName = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $self->_id, 'name'); - } - else { - $caseName = ucfirst(CRM_Utils_String::munge($fields['title'])); - } - - if (!CRM_Core_DAO::objectExists($caseName, 'CRM_Case_DAO_CaseType', $self->_id)) { - $errors['title'] = ts('This case type name already exists in database. Case type names must be unique.'); - } - - $reservedKeyWords = CRM_Core_SelectValues::customGroupExtends(); - //restrict "name" from being a reserved keyword when a new contact subtype is created - if (!$self->_id && in_array($caseName, array_keys($reservedKeyWords))) { - $errors['title'] = ts('Case Type names should not use reserved keywords.'); - } - return empty($errors) ? TRUE : $errors; - } - - /** - * Function to process the form - * - * @access public - * - * @return void - */ - public function postProcess() { - CRM_Utils_System::flushCache(); - - if ($this->_action & CRM_Core_Action::DELETE) { - $isDelete = CRM_Case_BAO_CaseType::del($this->_id); - if ($isDelete) { - CRM_Core_Session::setStatus(ts('Selected case type has been deleted.'), ts('Record Deleted'), 'success'); - } - else { - CRM_Core_Session::setStatus(ts("Selected case type can not be deleted."), ts('Sorry'), 'error'); - } - return; - } - // store the submitted values in an array - $params = $this->exportValues(); - - if ($this->_action & CRM_Core_Action::ADD) { - $params['name'] = ucfirst(CRM_Utils_String::munge($params['title'])); - } else { - $params['id'] = $this->_id; - $params['name'] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $this->_id, 'name'); - } - $caseType = CRM_Case_BAO_CaseType::add($params); - CRM_Core_Session::setStatus(ts("The Case Type '%1' has been saved.", - array(1 => $caseType->title) - ), ts('Saved'), 'success'); - } -} - diff --git a/CRM/Admin/Page/CaseType.php b/CRM/Admin/Page/CaseType.php deleted file mode 100644 index d1bf11ea4a..0000000000 --- a/CRM/Admin/Page/CaseType.php +++ /dev/null @@ -1,124 +0,0 @@ - - array( - 'name' => ts('Edit'), - 'url' => 'civicrm/admin/options/case_type', - 'qs' => 'action=update&id=%%id%%&reset=1', - 'title' => ts('Edit Case Type'), - ), - CRM_Core_Action::DISABLE => - array( - 'name' => ts('Disable'), - 'ref' => 'crm-enable-disable', - 'title' => ts('Disable Case Type'), - ), - CRM_Core_Action::ENABLE => - array( - 'name' => ts('Enable'), - 'ref' => 'crm-enable-disable', - 'title' => ts('Enable Case Type'), - ), - CRM_Core_Action::DELETE => - array( - 'name' => ts('Delete'), - 'url' => 'civicrm/admin/options/case_type', - 'qs' => 'action=delete&id=%%id%%', - 'title' => ts('Delete Case Type'), - ), - ); - } - return self::$_links; - } - - /** - * Get name of edit form - * - * @return string Classname of edit form. - */ - function editForm() { - return 'CRM_Admin_Form_CaseType'; - } - - /** - * Get edit form name - * - * @return string name of this page. - */ - function editName() { - return 'Case Types'; - } - - /** - * Get user context. - * - * @param null $mode - * - * @return string user context. - */ - function userContext($mode = NULL) { - return 'civicrm/admin/options/case_type'; - } -} diff --git a/partials/crmCaseType/list.html b/partials/crmCaseType/list.html index d3e0923b2a..8964ef1233 100644 --- a/partials/crmCaseType/list.html +++ b/partials/crmCaseType/list.html @@ -2,10 +2,29 @@ Controller: CaseTypeListsCtrl Required vars: caseTypes --> - +
+ A Case Type describes a group of related tasks, interactions, or processes. +
-New Case \ No newline at end of file + + + + + + + + + + + + + + + + +
NameTitleDescriptionEnabled?
{{caseType.name}}{{caseType.title}}{{caseType.description}}{{caseType.is_active}}Edit +
+ + \ No newline at end of file diff --git a/templates/CRM/Admin/Form/CaseType.tpl b/templates/CRM/Admin/Form/CaseType.tpl deleted file mode 100644 index 4bd67dc94a..0000000000 --- a/templates/CRM/Admin/Form/CaseType.tpl +++ /dev/null @@ -1,52 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.5 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | - +--------------------------------------------------------------------+ - | 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 adding/editing a case type. *} -

{if $action eq 1}{ts}New Case Type{/ts}{elseif $action eq 2}{ts}Edit Case Type{/ts}{else}{ts}Delete Case Type{/ts}{/if}

-
-
{include file="CRM/common/formButtons.tpl" location="top"}
-{if $action eq 8} -
-
- {ts}WARNING: Deleting this option will result in loss of type information for all case records which use the option.{/ts} {ts}This may mean the loss of a substantial amount of data, and the action cannot be undone.{/ts} {ts}Do you want to continue?{/ts} -
-{else} - - - - - - - - - - - - - -
{$form.title.label}{$form.title.html}
{$form.description.label}{$form.description.html}
{$form.is_active.label}{$form.is_active.html}
-{/if} -
{include file="CRM/common/formButtons.tpl" location="bottom"}
-
diff --git a/templates/CRM/Admin/Page/CaseType.tpl b/templates/CRM/Admin/Page/CaseType.tpl deleted file mode 100644 index 965ab4c9f7..0000000000 --- a/templates/CRM/Admin/Page/CaseType.tpl +++ /dev/null @@ -1,77 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.5 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | - +--------------------------------------------------------------------+ - | 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 | - +--------------------------------------------------------------------+ -*} -{if $action eq 1 or $action eq 2 or $action eq 8} - {include file="CRM/Admin/Form/CaseType.tpl"} -{else} -
- {ts}A Case Type describes a group of related tasks, interactions, or processes.{/ts} -
- -{if $rows} -
- {strip} - {* handle enable/disable actions*} - {include file="CRM/common/enableDisableApi.tpl"} - {include file="CRM/common/crmeditable.tpl"} - {include file="CRM/common/jsortable.tpl"} - - - - - - - - - - - - {foreach from=$rows item=row} - - - - - - - - - {/foreach} -
{ts}Name{/ts}{ts}Title{/ts}{ts}Description{/ts}{ts}Enabled?{/ts}{ts}Reserved?{/ts}
{$row.name}{$row.title}{$row.description}{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}{if $row.is_reserved eq 1}{ts}Reserved{/ts}{/if} {$row.action|replace:'xx':$row.id}
- {/strip} - - {if $action ne 1 and $action ne 2} - - {/if} -
-{else} -
- {ts}status{/ts} - {capture assign=crmURL}{crmURL p='civicrm/admin/options/case_type' q="action=add&reset=1"}{/capture} - {ts 1=$crmURL}There are no Case Types yet. You can add one.{/ts} -
-{/if} -{/if} diff --git a/templates/CRM/Case/Page/Tab.tpl b/templates/CRM/Case/Page/Tab.tpl index 26c12cf9b2..089c4a9de1 100644 --- a/templates/CRM/Case/Page/Tab.tpl +++ b/templates/CRM/Case/Page/Tab.tpl @@ -31,7 +31,7 @@
  {ts}Oops, It looks like there are no active case types.{/ts} {if call_user_func(array('CRM_Core_Permission','check'), ' administer CiviCase')} - {capture assign=adminCaseTypeURL}{crmURL p='civicrm/admin/options/case_type' q='reset=1'} + {capture assign=adminCaseTypeURL}{crmURL p='civicrm/a/#/caseType'} {/capture} {ts 1=$adminCaseTypeURL 2=$adminCaseStatusURL}Enable case types.{/ts} {/if} diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 08443e3e77..ad8634752f 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -490,7 +490,7 @@ SET @adminCaselastID:=LAST_INSERT_ID(); INSERT INTO civicrm_navigation ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight ) VALUES - ( @domainID, 'civicrm/admin/options/case_type?reset=1', '{ts escape="sql" skip="true"}Case Types{/ts}', 'Case Types', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 1 ), + ( @domainID, 'civicrm/a/#/caseType', '{ts escape="sql" skip="true"}Case Types{/ts}', 'Case Types', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 1 ), ( @domainID, 'civicrm/admin/options/redaction_rule?reset=1', '{ts escape="sql" skip="true"}Redaction Rules{/ts}', 'Redaction Rules', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 2 ), ( @domainID, 'civicrm/admin/options/case_status?reset=1', '{ts escape="sql" skip="true"}Case Statuses{/ts}', 'Case Statuses', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 3 ), ( @domainID, 'civicrm/admin/options/encounter_medium?reset=1', '{ts escape="sql" skip="true"}Encounter Medium{/ts}', 'Encounter Medium', 'administer CiviCase', NULL, @adminCaselastID, '1', NULL, 4 ); -- 2.25.1