本文整理汇总了PHP中CRM_Case_BAO_Case::endCaseRole方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::endCaseRole方法的具体用法?PHP CRM_Case_BAO_Case::endCaseRole怎么用?PHP CRM_Case_BAO_Case::endCaseRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::endCaseRole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: relationship
/**
* @throws \CiviCRM_API3_Exception
*/
public static function relationship()
{
$relType = CRM_Utils_Request::retrieve('rel_type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
$relContactID = CRM_Utils_Request::retrieve('rel_contact', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
$originalCid = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject);
$relationshipID = CRM_Utils_Request::retrieve('rel_id', 'Positive', CRM_Core_DAO::$_nullObject);
$caseID = CRM_Utils_Request::retrieve('case_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE);
if (!CRM_Case_BAO_Case::accessCase($caseID)) {
CRM_Utils_System::permissionDenied();
}
$ret = array('is_error' => 0);
list($relTypeId, $b, $a) = explode('_', $relType);
if ($relationshipID && $originalCid) {
CRM_Case_BAO_Case::endCaseRole($caseID, $a, $originalCid, $relTypeId);
}
$clientList = CRM_Case_BAO_Case::getCaseClients($caseID);
// Loop through multiple case clients
foreach ($clientList as $i => $sourceContactID) {
$result = civicrm_api3('relationship', 'create', array('case_id' => $caseID, 'relationship_type_id' => $relTypeId, "contact_id_{$a}" => $relContactID, "contact_id_{$b}" => $sourceContactID, 'start_date' => 'now'));
// Save activity only for the primary (first) client
if ($i == 0 && empty($result['is_error'])) {
CRM_Case_BAO_Case::createCaseRoleActivity($caseID, $result['id'], $relContactID);
}
}
CRM_Utils_JSON::output($ret);
}
示例2: deleteCaseRoles
/**
* Delete relationships specific to case and relationship type.
*/
public static function deleteCaseRoles()
{
$caseId = CRM_Utils_Type::escape($_POST['case_id'], 'Positive');
$cid = CRM_Utils_Type::escape($_POST['cid'], 'Positive');
$relType = CRM_Utils_Request::retrieve('rel_type', 'String', CRM_Core_DAO::$_nullObject, TRUE);
if (!$cid || !CRM_Case_BAO_Case::accessCase($caseId)) {
CRM_Utils_System::permissionDenied();
}
list($relTypeId, $a, $b) = explode('_', $relType);
CRM_Case_BAO_Case::endCaseRole($caseId, $b, $cid, $relTypeId);
CRM_Utils_System::civiExit();
}