X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=api%2Fv3%2FCase.php;h=6cde101596e743010ebb58562a2b6e3b8ba9bdb3;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=a6df4a560840ccf3fdb099ce806b6bc13547c8b7;hpb=941feb146e3d9ca06423c57df026d33aa1634a89;p=civicrm-core.git diff --git a/api/v3/Case.php b/api/v3/Case.php index a6df4a5608..6cde101596 100644 --- a/api/v3/Case.php +++ b/api/v3/Case.php @@ -189,12 +189,12 @@ 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 */ function civicrm_api3_case_get($params) { $options = _civicrm_api3_get_options_from_params($params); - //search by client if (!empty($params['contact_id'])) { $ids = array(); @@ -340,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 @@ -392,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); @@ -420,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; }