From: Poonam Date: Wed, 2 Apr 2014 06:16:50 +0000 (+0530) Subject: --HR-321 Simplify case-activity forms and add case_status as a url param X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4d91aee1d8cd8b033dce5ea7be9df96748658507;p=civicrm-core.git --HR-321 Simplify case-activity forms and add case_status as a url param --- diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index 8faebedf7e..fb9bad8ea6 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -152,7 +152,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ), 'details' => array( 'type' => 'wysiwyg', - 'label' => ts('Details'), + 'label' => ts('Notes'), // forces a smaller edit window 'attributes' => array('rows' => 4, 'cols' => 60), 'required' => FALSE diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index aa7467a8a8..dd324fcfac 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -74,6 +74,11 @@ class CRM_Case_Form_Activity_OpenCase { $caseTypes = CRM_Case_PseudoConstant::caseType(); $form->_caseTypeId = array_key_exists($caseTypeId, $caseTypes) ? $caseTypeId : NULL; + // check if the case status id passed in url is a valid one + $caseStatusId = CRM_Utils_Request::retrieve('cStatus', 'Positive', $form); + $caseStatus = CRM_Case_PseudoConstant::caseStatus(); + $form->_caseStatusId = array_key_exists($caseStatusId, $caseStatus) ? $caseStatusId : NULL; + // Add attachments CRM_Core_BAO_File::buildAttachment( $form, 'civicrm_activity', $form->_activityId ); } @@ -95,10 +100,16 @@ class CRM_Case_Form_Activity_OpenCase { list($defaults['start_date'], $defaults['start_date_time']) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime'); // set default case status, case type, encounter medium, location type and phone type defaults are set in DB - $caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, 'AND is_default = 1'); - if (count($caseStatus) == 1) { - $defaults['status_id'] = key($caseStatus); + if ($form->_caseStatusId) { + $caseStatus = $form->_caseStatusId; } + else { + $caseStatus = CRM_Core_OptionGroup::values('case_status', FALSE, FALSE, FALSE, 'AND is_default = 1'); + if (count($caseStatus) == 1) { + $caseStatus = key($caseStatus); //$defaults['status_id'] = key($caseStatus); + } + } + $defaults['status_id'] = $caseStatus; // set default case type passed in url if ($form->_caseTypeId) { @@ -152,7 +163,10 @@ class CRM_Case_Form_Activity_OpenCase { $element->freeze(); } - $form->addSelect('status_id', array(), TRUE); + $csElement = $form->addSelect('status_id', array(), TRUE); + if ($form->_caseStatusId) { + $csElement->freeze(); + } $form->add('text', 'duration', ts('Activity Duration'), array('size' => 4, 'maxlength' => 8)); $form->addRule('duration', ts('Please enter the duration as number of minutes (integers only).'), 'positiveInteger'); diff --git a/templates/CRM/Case/Form/Activity.tpl b/templates/CRM/Case/Form/Activity.tpl index f5c044f6c8..8e9284a5ee 100644 --- a/templates/CRM/Case/Form/Activity.tpl +++ b/templates/CRM/Case/Form/Activity.tpl @@ -55,89 +55,120 @@
{$activityTypeDescription}
{/if} - - {ts}Client{/ts} - - - {foreach from=$client_names item=client name=clients} - {$client.display_name}{if not $smarty.foreach.clients.last};   {/if} - {/foreach} - - - {if $action eq 1 or $action eq 2} -
- » {ts}With other contact(s){/ts} - {/if} - - - - {if $action eq 1 or $action eq 2} - - {ts}With Contact{/ts} + {if $activityTypeFile} + {include file="CRM/Case/Form/Activity/$activityTypeFile.tpl"} + + {$form.details.label} - {$form.target_contact_id.html} -
- - » {if not $multiClient}{ts}With client{/ts}{else}{ts}With client(s){/ts}{/if} - + {* If using plain textarea, assign class=huge to make input large enough. *} + {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if} {/if} + + + @@ -211,13 +242,6 @@ - - {$form.duration.label} - - {$form.duration.html} - {ts}minutes{/ts} - - {* Suppress activity status and priority for changes to status, case type and start date. PostProc will force status to completed. *} {if $activityTypeFile NEQ 'ChangeCaseStatus' && $activityTypeFile NEQ 'ChangeCaseType'