3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * This api exposes CiviCRM CaseContact records.
31 * @package CiviCRM_APIv3
37 * @param array $params
41 function civicrm_api3_case_contact_create($params) {
42 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
46 * @param array $fields
48 function _civicrm_api3_case_contact_create_spec(&$fields) {
49 $fields['contact_id']['api.required'] = $fields['case_id']['api.required'] = 1;
55 * @param array $params
58 * Array of retrieved case_contact property values.
60 function civicrm_api3_case_contact_get($params) {
61 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
65 * Delete a CaseContact.
67 * @param array $params
70 * Array of deleted values.
72 function civicrm_api3_case_contact_delete($params) {
73 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
77 * Results formatting for Case entityRef lookups.
79 * @param array $result
80 * @param array $request
81 * @param string $entity
82 * @param array $fields
86 function _civicrm_api3_case_contact_getlist_output($result, $request, $entity, $fields) {
88 if (!empty($result['values'])) {
89 foreach ($result['values'] as $row) {
91 'id' => $row[$request['id_field']],
92 'label' => $row[$request['label_field']] . ' - ' . $row['case_id.case_type_id.title'],
94 $status = CRM_Core_PseudoConstant
::getLabel('CRM_Case_BAO_Case', 'status_id', $row['case_id.status_id']);
95 $date = CRM_Utils_Date
::customFormat($row['case_id.start_date']);
96 $data['description'] = array(
97 "#{$row['case_id']}: $status " . ts('(opened %1)', array(1 => $date)),
98 $row['case_id.subject'],
100 if (!empty($request['image_field'])) {
101 $data['image'] = isset($row[$request['image_field']]) ?
$row[$request['image_field']] : '';