3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class contains the functions for Case Contact management.
21 class CRM_Case_BAO_CaseContact
extends CRM_Case_DAO_CaseContact
{
24 * Create case contact record.
26 * @param array $params
29 * @return CRM_Case_BAO_CaseContact
31 public static function create($params) {
32 $caseContact = self
::writeRecord($params);
34 // add to recently viewed
35 $caseType = CRM_Case_BAO_Case
::getCaseType($caseContact->case_id
);
36 $url = CRM_Utils_System
::url('civicrm/contact/view/case',
37 "action=view&reset=1&id={$caseContact->case_id}&cid={$caseContact->contact_id}&context=home"
40 $title = CRM_Contact_BAO_Contact
::displayName($caseContact->contact_id
) . ' - ' . $caseType;
43 if (CRM_Core_Permission
::checkActionPermission('CiviCase', CRM_Core_Action
::DELETE
)) {
44 $recentOther['deleteUrl'] = CRM_Utils_System
::url('civicrm/contact/view/case',
45 "action=delete&reset=1&id={$caseContact->case_id}&cid={$caseContact->contact_id}&context=home"
49 // add the recently created case
50 CRM_Utils_Recent
::add($title,
52 $caseContact->case_id
,
54 $caseContact->contact_id
,
65 public function addSelectWhereClause() {
68 'case_id' => CRM_Utils_SQL
::mergeSubquery('Case'),
69 // Case acls already check for contact access so we can just mark contact_id as handled
72 // Don't call hook selectWhereClause, the case query already did