From: Coleman Watts Date: Wed, 30 Dec 2015 03:27:16 +0000 (-0500) Subject: Improve open case form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7ef0d72c6534df9e171f3258af460b8f441ad849;p=civicrm-core.git Improve open case form --- diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index 1960c212b9..2bb75669ed 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -114,8 +114,16 @@ class CRM_Case_Form_Activity_OpenCase { // set default case type passed in url if ($form->_caseTypeId) { - $caseType = $form->_caseTypeId; - $defaults['case_type_id'] = $caseType; + $defaults['case_type_id'] = $form->_caseTypeId; + } + else { + // TODO: Not possible yet to set a default case type in the system + // For now just add the convenience of auto-selecting if there is only one option + $caseTypes = CRM_Case_BAO_Case::buildOptions('case_type_id', 'create'); + if (count($caseTypes) == 1) { + reset($caseTypes); + $defaults['case_type_id'] = key($caseTypes); + } } $medium = CRM_Core_OptionGroup::values('encounter_medium', FALSE, FALSE, FALSE, 'AND is_default = 1');