<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
- * Open a new case, add client and manager roles, and add standard timeline.
+ * Open a new case, add client and manager roles, and standard timeline.
*
* @param array $params
+ *
* @code
* //REQUIRED:
* 'case_type_id' => int OR
$values = array();
_civicrm_api3_object_to_array($caseBAO, $values[$caseBAO->id]);
- return civicrm_api3_create_success($values, $params, 'case', 'create', $caseBAO);
+ return civicrm_api3_create_success($values, $params, 'Case', 'create', $caseBAO);
}
/**
* Parameters determined by getfields.
*/
function _civicrm_api3_case_get_spec(&$params) {
- $params['contact_id']['api.aliases'] = array('client_id');
- $params['contact_id']['title'] = 'Case Client';
+ $params['contact_id'] = array(
+ 'api.aliases' => array('client_id'),
+ 'title' => 'Case Client',
+ 'type' => CRM_Utils_Type::T_INT,
+ );
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_case_create_spec(&$params) {
- $params['contact_id']['api.aliases'] = array('client_id');
- $params['contact_id']['title'] = 'Case Client';
- $params['contact_id']['api.required'] = 1;
+ $params['contact_id'] = array(
+ 'api.aliases' => array('client_id'),
+ 'title' => 'Case Client',
+ 'api.required' => 1,
+ 'type' => CRM_Utils_Type::T_INT,
+ );
$params['status_id']['api.default'] = 1;
$params['status_id']['api.aliases'] = array('case_status');
$params['creator_id']['api.default'] = 'user_contact_id';
$params['medium_id'] = array(
'name' => 'medium_id',
'title' => 'Activity Medium',
+ 'type' => CRM_Utils_Type::T_INT,
);
}
$cases[$id] = $case;
}
}
- return civicrm_api3_create_success($cases, $params, 'case', 'get');
+ return civicrm_api3_create_success($cases, $params, 'Case', 'get');
}
//search by activity
}
$caseId = CRM_Case_BAO_Case::getCaseIdByActivityId($params['activity_id']);
if (!$caseId) {
- return civicrm_api3_create_success(array(), $params, 'case', 'get');
+ return civicrm_api3_create_success(array(), $params, 'Case', 'get');
}
$case = array($caseId => _civicrm_api3_case_read($caseId, $options));
- return civicrm_api3_create_success($case, $params, 'case', 'get');
+ return civicrm_api3_create_success($case, $params, 'Case', 'get');
}
//search by contacts
while ($dao->fetch()) {
$cases[$dao->case_id] = _civicrm_api3_case_read($dao->case_id, $options);
}
- return civicrm_api3_create_success($cases, $params, 'case', 'get');
+ return civicrm_api3_create_success($cases, $params, 'Case', 'get');
}
// For historic reasons we always return these when an id is provided
}
}
- return civicrm_api3_create_success($cases, $params, 'case', 'get');
+ return civicrm_api3_create_success($cases, $params, 'Case', 'get');
}
/**
_civicrm_api3_object_to_array($dao, $case);
$values[$dao->id] = $case;
- return civicrm_api3_create_success($values, $params, 'case', 'update', $dao);
+ return civicrm_api3_create_success($values, $params, 'Case', 'update', $dao);
}
/**
* Delete a specified case.
*
* @param array $params
+ *
+ * @code
* //REQUIRED:
* 'id' => int
*
* //OPTIONAL
* 'move_to_trash' => bool (defaults to false)
+ * @endcode
*
* @throws API_Exception
* @return bool
civicrm_api3_verify_mandatory($params, NULL, array('id'));
if (CRM_Case_BAO_Case::deleteCase($params['id'], CRM_Utils_Array::value('move_to_trash', $params, FALSE))) {
- return civicrm_api3_create_success($params, $params, 'case', 'delete');
+ return civicrm_api3_create_success($params, $params, 'Case', 'delete');
}
else {
throw new API_Exception('Could not delete case.');