예제 #1
0
파일: Case.php 프로젝트: ksecor/civicrm
 function setDefaultValues()
 {
     $defaults = array();
     $contactNames = array();
     require_once 'CRM/Case/BAO/Case.php';
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Case_BAO_Case::retrieve($params, $defaults, $ids);
         $defaults['case_contact'] = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($this->_id, $this->_contactID);
         $contactNames = CRM_Case_BAO_Case::getcontactNames($this->_id);
         foreach ($contactNames as $key => $name) {
             $defaults['contact_names'] .= $defaults['contact_names'] ? ",\"{$name}\"" : "\"{$name}\"";
         }
     }
     $this->assign('contactNames', CRM_Utils_Array::value('contact_names', $defaults));
     $defaults['case_type_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('case_type_id', $defaults));
     $config =& CRM_Core_Config::singleton();
     if ($config->civiHRD) {
         $defaults['casetag2_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('casetag2_id', $defaults));
         $defaults['casetag3_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('casetag3_id', $defaults));
     }
     if ($this->_action & CRM_Core_Action::ADD || $this->_context == 'search') {
         $defaults['start_date'] = array();
         CRM_Utils_Date::getAllDefaultValues($defaults['start_date']);
     }
     //set the assigneed contact count to template
     if (!empty($defaults['case_contact'])) {
         $this->assign('caseContactCount', count($defaults['case_contact']));
     }
     return $defaults;
 }