function _civicrm_api3_case_get_spec(&$params) {
$params['contact_id']['api.aliases'] = array('client_id');
$params['contact_id']['title'] = 'Case Client';
- $params['creator_id']['api.default'] = 'user_contact_id';
}
/**
$params['contact_id']['title'] = 'Case Client';
$params['contact_id']['api.required'] = 1;
$params['status_id']['api.default'] = 1;
+ $params['creator_id']['api.default'] = 'user_contact_id';
+ $params['creator_id']['type'] = CRM_Utils_Type::T_INT;
+ $params['start_date']['api.default'] = 'now';
$params['medium_id'] = array(
'name' => 'medium_id',
'title' => 'Activity Medium',
*
* {@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();
/**
* 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
// 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);
*/
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('title', FALSE);
if (empty($params['case_type_id'])) {
$params['case_type_id'] = array_search($params['case_type'], $caseTypes);
}
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;
}