CRM/Case add automatically generated comments
[civicrm-core.git] / CRM / Case / Form / Activity / ChangeCaseStartDate.php
index 1c080a13f4d8acfaa691e1d2e54896afd8444acd..b9a6172be2a6ccf8c8661a2815b059921ce22512 100644 (file)
  */
 class CRM_Case_Form_Activity_ChangeCaseStartDate {
 
+  /**
+   * @param $form
+   *
+   * @throws Exception
+   */
   static function preProcess(&$form) {
     if (!isset($form->_caseId)) {
       CRM_Core_Error::fatal(ts('Case Id not found.'));
@@ -51,6 +56,8 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    *
    * @access public
    *
+   * @param $form
+   *
    * @return void
    */
   static function setDefaultValues(&$form) {
@@ -77,6 +84,9 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
     return $defaults;
   }
 
+  /**
+   * @param $form
+   */
   static function buildQuickForm(&$form) {
     $form->removeElement('status_id');
     $form->removeElement('priority_id');
@@ -91,6 +101,9 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    *
    * @param array $values posted values of the form
    *
+   * @param $files
+   * @param $form
+   *
    * @return array list of errors to be posted back to the form
    * @static
    * @access public
@@ -104,6 +117,9 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    *
    * @access public
    *
+   * @param $form
+   * @param $params
+   *
    * @return void
    */
   static function beginPostProcess(&$form, &$params) {
@@ -117,6 +133,10 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    *
    * @access public
    *
+   * @param $form
+   * @param $params
+   * @param $activity
+   *
    * @return void
    */
   static function endPostProcess(&$form, &$params, $activity) {
@@ -127,16 +147,7 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
     $caseType = $form->_caseType;
 
     if (!$caseType && $form->_caseId) {
-
-      $query = "
-SELECT  cov_type.label as case_type FROM civicrm_case
-LEFT JOIN  civicrm_option_group cog_type ON cog_type.name = 'case_type'
-LEFT JOIN civicrm_option_value cov_type ON
-( civicrm_case.case_type_id = cov_type.value AND cog_type.id = cov_type.option_group_id )
-WHERE civicrm_case.id=  %1";
-
-      $queryParams = array(1 => array($form->_caseId, 'Integer'));
-      $caseType = CRM_Core_DAO::singleValueQuery($query, $queryParams);
+      $caseType = CRM_Case_BAO_Case::getCaseType($form->_caseId, 'title');
     }
 
     if (!$form->_currentlyViewedContactId ||