本文整理汇总了PHP中CRM_Case_BAO_Case::mergeCases方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Case_BAO_Case::mergeCases方法的具体用法?PHP CRM_Case_BAO_Case::mergeCases怎么用?PHP CRM_Case_BAO_Case::mergeCases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Case_BAO_Case
的用法示例。
在下文中一共展示了CRM_Case_BAO_Case::mergeCases方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_case_update
/**
* Update a specified case.
*
* @param array(
//REQUIRED:
* 'case_id' => int
*
* //OPTIONAL
* 'status_id' => int
* 'start_date' => str datestamp
* 'contact_id' => int // case client
*
* @return Updated case
*
* @access public
*
*/
function civicrm_api3_case_update($params)
{
//check parameters
civicrm_api3_verify_mandatory($params, NULL, array('id'));
// return error if modifing creator id
if (array_key_exists('creator_id', $params)) {
return civicrm_api3_create_error(ts('You cannot update creator id'));
}
$mCaseId = array();
$origContactIds = array();
// get original contact id and creator id of case
if (!empty($params['contact_id'])) {
$origContactIds = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($params['id']);
$origContactId = $origContactIds[1];
}
if (count($origContactIds) > 1) {
// check valid orig contact id
if (!empty($params['orig_contact_id']) && !in_array($params['orig_contact_id'], $origContactIds)) {
return civicrm_api3_create_error('Invalid case contact id (orig_contact_id)');
} elseif (empty($params['orig_contact_id'])) {
return civicrm_api3_create_error('Case is linked with more than one contact id. Provide the required params orig_contact_id to be replaced');
}
$origContactId = $params['orig_contact_id'];
}
// check for same contact id for edit Client
if (!empty($params['contact_id']) && !in_array($params['contact_id'], $origContactIds)) {
$mCaseId = CRM_Case_BAO_Case::mergeCases($params['contact_id'], $params['case_id'], $origContactId, NULL, TRUE);
}
if (!empty($mCaseId[0])) {
$params['id'] = $mCaseId[0];
}
$dao = new CRM_Case_BAO_Case();
$dao->id = $params['id'];
$dao->copyValues($params);
$dao->save();
$case = array();
_civicrm_api3_object_to_array($dao, $case);
return civicrm_api3_create_success($case, $params, 'case', 'update', $dao);
}
示例2: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
$buttonName = $this->controller->getButtonName();
// user context
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_contactID}&id={$this->_caseID}&show=1");
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
if (!empty($params['timeline_id']) && !empty($_POST['_qf_CaseView_next'])) {
$session = CRM_Core_Session::singleton();
$this->_uid = $session->get('userID');
$xmlProcessor = new CRM_Case_XMLProcessor_Process();
$xmlProcessorParams = array('clientID' => $this->_contactID, 'creatorID' => $this->_uid, 'standardTimeline' => 0, 'activity_date_time' => date('YmdHis'), 'caseID' => $this->_caseID, 'caseType' => $this->_caseType, 'activitySetName' => $params['timeline_id']);
$xmlProcessor->run($this->_caseType, $xmlProcessorParams);
$reports = $xmlProcessor->get($this->_caseType, 'ActivitySets');
CRM_Core_Session::setStatus(ts('Activities from the %1 activity set have been added to this case.', array(1 => $reports[$params['timeline_id']])), ts('Done'), 'success');
} elseif ($this->_mergeCases && $buttonName == '_qf_CaseView_next_merge_case') {
$mainCaseId = $params['merge_case_id'];
$otherCaseId = $this->_caseID;
//merge two cases.
CRM_Case_BAO_Case::mergeCases($this->_contactID, $mainCaseId, NULL, $otherCaseId);
//redirect user to main case view.
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$this->_contactID}&id={$mainCaseId}&show=1");
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
}
示例3: postProcess
/**
* Process the form.
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
//assign case to another client.
$mainCaseId = CRM_Case_BAO_Case::mergeCases($params['reassign_contact_id'], $this->get('id'), $this->get('cid'), NULL, TRUE);
// user context
$url = CRM_Utils_System::url('civicrm/contact/view/case', "reset=1&action=view&cid={$params['reassign_contact_id']}&id={$mainCaseId[0]}&show=1");
CRM_Core_Session::singleton()->pushUserContext($url);
}
示例4: civicrm_case_update
/**
* Update a specified case.
*
* @param array( //REQUIRED:
* 'case_id' => int
*
* //OPTIONAL
* 'status_id' => int
* 'start_date' => str datestamp
* 'contact_id' => int // case client
* 'creator_id' => int // case manager
*
* @return Updated case
*
* @access public
*
*/
function civicrm_case_update(&$params)
{
_civicrm_initialize();
$errors = array();
//check for various error and required conditions
$errors = _civicrm_case_check_params($params, 'update');
if (!empty($errors)) {
return $errors;
}
// return error if modifing creator id
if (array_key_exists('creator_id', $params)) {
return civicrm_create_error(ts('You have no provision to update creator id'));
}
$mCaseId = array();
$origContactIds = array();
// get original contact id and creator id of case
if ($params['contact_id']) {
$origContactIds = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($params['case_id']);
$origContactId = $origContactIds[1];
}
if (count($origContactIds) > 1) {
// check valid orig contact id
if ($params['orig_contact_id'] && !in_array($params['orig_contact_id'], $origContactIds)) {
return civicrm_create_error(ts('Invalid case contact id (orig_contact_id)'));
} else {
if (!$params['orig_contact_id']) {
return civicrm_create_error(ts('Case is linked with more than one contact id. Provide the required params orig_contact_id to be replaced'));
}
}
$origContactId = $params['orig_contact_id'];
}
// check for same contact id for edit Client
if ($params['contact_id'] && !in_array($params['contact_id'], $origContactIds)) {
$mCaseId = CRM_Case_BAO_Case::mergeCases($params['contact_id'], $params['case_id'], $origContactId, null, true);
}
if (CRM_Utils_Array::value('0', $mCaseId)) {
$params['case_id'] = $mCaseId[0];
}
$dao = new CRM_Case_BAO_Case();
$dao->id = $params['case_id'];
$dao->copyValues($params);
$dao->save();
$case = array();
_civicrm_object_to_array($dao, $case);
return civicrm_create_success($case);
}