X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FCase.php;h=6cde101596e743010ebb58562a2b6e3b8ba9bdb3;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=92012d48e2f624b67f3fde39c5c8825328d4fcb6;hpb=eea8ff3839906553e09ee346c7c87395d3125afd;p=civicrm-core.git diff --git a/api/v3/Case.php b/api/v3/Case.php index 92012d48e2..6cde101596 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -189,6 +189,7 @@ function _civicrm_api3_case_delete_spec(&$params) { * * {@getfields case_get} * + * @throws API_Exception * @return array (get mode, case_id provided): Array with case details, case roles, case activity ids, (search mode, case_id not provided): Array of cases found@access public * @todo Erik Hommel 16 dec 2010 check if all DB fields are returned */ @@ -339,13 +340,14 @@ function civicrm_api3_case_update($params) { /** * Delete a specified case. * - * @param array( - //REQUIRED: + * @param array ( + * //REQUIRED: * 'id' => int * * //OPTIONAL * 'move_to_trash' => bool (defaults to false) * + * @throws API_Exception * @return boolean: true if success, else false * {@getfields case_delete} * @access public @@ -391,10 +393,6 @@ function _civicrm_api3_case_read($caseId, $options) { // Legacy support for client_id - TODO: in apiv4 remove 'client_id' $case['client_id'] = $case['contact_id'] = $dao->retrieveContactIdsByCaseId($caseId); - //handle multi-value case type - $sep = CRM_Core_DAO::VALUE_SEPARATOR; - $case['case_type_id'] = trim(str_replace($sep, ',', $case['case_type_id']), ','); - if (!empty($return['contacts'])) { //get case contacts $contacts = CRM_Case_BAO_Case::getcontactNames($caseId); @@ -419,14 +417,18 @@ function _civicrm_api3_case_read($caseId, $options) { */ function _civicrm_api3_case_format_params(&$params) { // figure out case type id from case type and vice-versa - $caseTypes = CRM_Case_PseudoConstant::caseType('label', FALSE); + $caseTypes = CRM_Case_PseudoConstant::caseType('name', FALSE); if (empty($params['case_type_id'])) { $params['case_type_id'] = array_search($params['case_type'], $caseTypes); + + // DEPRECATED: lookup by label for backward compatibility + if (!$params['case_type_id']) { + $caseTypeLabels = CRM_Case_PseudoConstant::caseType('title', FALSE); + $params['case_type_id'] = array_search($params['case_type'], $caseTypeLabels); + $params['case_type'] = $caseTypes[$params['case_type_id']]; // label => name + } } elseif (empty($params['case_type'])) { $params['case_type'] = $caseTypes[$params['case_type_id']]; } - // format input with value separators - $sep = CRM_Core_DAO::VALUE_SEPARATOR; - $params['case_type_id'] = $sep . implode($sep, (array) $params['case_type_id']) . $sep; }