<?php
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* File for the CiviCRM APIv3 Case functions
* @package CiviCRM_APIv3
* @subpackage API_Case
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
- * Open a new case, add client and manager roles, and add standard timeline
+ * Open a new case, add client and manager roles, and add standard timeline.
*
- * @param array (
+ * @param array $params
* //REQUIRED:
* 'case_type_id' => int OR
* 'case_type' => str (provide one or the other)
* 'details' => str // html format
*
* @throws API_Exception
- * @return array api result array
- *
- * @access public
- * {@getfields case_create}
+ * @return array
+ * api result array
*/
function civicrm_api3_case_create($params) {
}
/**
- * Adjust Metadata for Get Action
+ * Adjust Metadata for Get Action.
*
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Parameters determined by getfields.
*/
function _civicrm_api3_case_get_spec(&$params) {
$params['contact_id']['api.aliases'] = array('client_id');
}
/**
- * Adjust Metadata for Create Action
+ * Adjust Metadata for Create Action.
*
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Array or parameters determined by getfields.
*/
function _civicrm_api3_case_create_spec(&$params) {
$params['contact_id']['api.aliases'] = array('client_id');
}
/**
- * Adjust Metadata for Update action
+ * Adjust Metadata for Update action.
*
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Array or parameters determined by getfields.
*/
function _civicrm_api3_case_update_spec(&$params) {
$params['id']['api.required'] = 1;
/**
* Adjust Metadata for Delete action
*
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ * Array or parameters determined by getfields.
*/
function _civicrm_api3_case_delete_spec(&$params) {
$params['id']['api.required'] = 1;
*
* Please provide one (and only one) of the four get/search parameters:
*
- * @param array (
- * 'id' => if set, will get all available info about a case, including contacts and activities
- *
- * // if no case_id provided, this function will use one of the following search parameters:
- * 'client_id' => finds all cases with a specific client
- * 'activity_id' => returns the case containing a specific activity
- * 'contact_id' => finds all cases associated with a contact (in any role, not just client)
+ * @param array $params
+ * 'id' => if set, will get all available info about a case, including contacts and activities
*
- * {@getfields case_get}
+ * // if no case_id provided, this function will use one of the following search parameters:
+ * 'client_id' => finds all cases with a specific client
+ * 'activity_id' => returns the case containing a specific activity
+ * 'contact_id' => finds all cases associated with a contact (in any role, not just client)
*
* @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
+ * @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
*/
function civicrm_api3_case_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
$options['return'] = array('contacts' => 1, 'activities' => 1);
}
- $foundcases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Case');
+ $foundcases = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Case');
$cases = array();
foreach ($foundcases['values'] as $foundcase) {
- if ($case = _civicrm_api3_case_read($foundcase['id'], $options)) {
- $cases[$foundcase['id']] = $case;
- }
+ if ($case = _civicrm_api3_case_read($foundcase['id'], $options)) {
+ $cases[$foundcase['id']] = $case;
}
+ }
return civicrm_api3_create_success($cases, $params, 'case', 'get');
}
/**
* @deprecated api notice
- * @return array of deprecated actions
+ * @return array
+ * Array of deprecated actions
*/
function _civicrm_api3_case_deprecation() {
return array('activity_create' => 'Case api "activity_create" action is deprecated. Use the activity api instead.');
/**
* Update a specified case.
*
- * @param array (
- * //REQUIRED:
- * 'case_id' => int
+ * @param array $params
+ * //REQUIRED:
+ * 'case_id' => int
*
- * //OPTIONAL
- * 'status_id' => int
- * 'start_date' => str datestamp
- * 'contact_id' => int // case client
+ * //OPTIONAL
+ * 'status_id' => int
+ * 'start_date' => str datestamp
+ * 'contact_id' => int // case client
*
* @throws API_Exception
- * @return array api result array
+ * @return array
+ * api result array
*
- * @access public
*/
function civicrm_api3_case_update($params) {
//check parameters
/**
* Delete a specified case.
*
- * @param array (
- * //REQUIRED:
- * 'id' => int
+ * @param array $params
+ * //REQUIRED:
+ * 'id' => int
*
- * //OPTIONAL
- * 'move_to_trash' => bool (defaults to false)
+ * //OPTIONAL
+ * 'move_to_trash' => bool (defaults to false)
*
* @throws API_Exception
- * @return boolean: true if success, else false
- * {@getfields case_delete}
- * @access public
+ * @return bool
+ * true if success, else false
*/
function civicrm_api3_case_delete($params) {
//check parameters
*
* @param $options
*
- * @return array case object
+ * @return array
+ * case object
*/
function _civicrm_api3_case_read($caseId, $options) {
$return = CRM_Utils_Array::value('return', $options, array());