本文整理汇总了PHP中CRM_Core_BAO_Location::cleanupContactLocations方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Location::cleanupContactLocations方法的具体用法?PHP CRM_Core_BAO_Location::cleanupContactLocations怎么用?PHP CRM_Core_BAO_Location::cleanupContactLocations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Location
的用法示例。
在下文中一共展示了CRM_Core_BAO_Location::cleanupContactLocations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Form submission of new/edit contact is processed.
*
* @access public
* @return None
*/
public function postProcess()
{
// check if dedupe button, if so return.
$buttonName = $this->controller->getButtonName();
if ($buttonName == $this->_dedupeButtonName) {
return;
}
//get the submitted values in an array
$params = $this->controller->exportValues($this->_name);
//get the related id for shared / current employer
if (CRM_Utils_Array::value('shared_household_id', $params)) {
$params['shared_household'] = $params['shared_household_id'];
}
if (is_numeric(CRM_Utils_Array::value('current_employer_id', $params)) && CRM_Utils_Array::value('current_employer', $params)) {
$params['current_employer'] = $params['current_employer_id'];
}
// don't carry current_employer_id field,
// since we don't want to directly update DAO object without
// handling related business logic ( eg related membership )
if (isset($params['current_employer_id'])) {
unset($params['current_employer_id']);
}
$params['contact_type'] = $this->_contactType;
if ($this->_contactId) {
$params['contact_id'] = $this->_contactId;
}
//make deceased date null when is_deceased = false
if ($this->_contactType == 'Individual' && CRM_Utils_Array::value('Demographics', $this->_editOptions) && !CRM_Utils_Array::value('is_deceased', $params)) {
$params['is_deceased'] = false;
$params['deceased_date'] = null;
}
if ($this->_contactSubType && $this->_action & CRM_Core_Action::ADD) {
$params['contact_sub_type'] = $this->_contactSubType;
}
// action is taken depending upon the mode
require_once 'CRM/Utils/Hook.php';
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Utils_Hook::pre('edit', $params['contact_type'], $params['contact_id'], $params);
} else {
CRM_Utils_Hook::pre('create', $params['contact_type'], null, $params);
}
require_once 'CRM/Core/BAO/CustomField.php';
$customFields = CRM_Core_BAO_CustomField::getFields($params['contact_type'], false, true);
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_contactId, $params['contact_type'], true);
if (array_key_exists('CommunicationPreferences', $this->_editOptions)) {
// this is a chekbox, so mark false if we dont get a POST value
$params['is_opt_out'] = CRM_Utils_Array::value('is_opt_out', $params, false);
}
// copy household address, if use_household_address option (for individual form) is checked
if ($this->_contactType == 'Individual') {
if (CRM_Utils_Array::value('use_household_address', $params) && CRM_Utils_Array::value('shared_household', $params)) {
if (is_numeric($params['shared_household'])) {
CRM_Contact_Form_Edit_Individual::copyHouseholdAddress($params);
}
CRM_Contact_Form_Edit_Individual::createSharedHousehold($params);
} else {
$params['mail_to_household_id'] = 'null';
}
} else {
$params['mail_to_household_id'] = 'null';
}
if (!array_key_exists('TagsAndGroups', $this->_editOptions)) {
unset($params['group']);
}
if (CRM_Utils_Array::value('contact_id', $params) && $this->_action & CRM_Core_Action::UPDATE) {
// cleanup unwanted location blocks
require_once 'CRM/Core/BAO/Location.php';
CRM_Core_BAO_Location::cleanupContactLocations($params);
// figure out which all groups are intended to be removed
if (!empty($params['group'])) {
$contactGroupList =& CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], 'Added');
if (is_array($contactGroupList)) {
foreach ($contactGroupList as $key) {
if ($params['group'][$key['group_id']] != 1) {
$params['group'][$key['group_id']] = -1;
}
}
}
}
}
require_once 'CRM/Contact/BAO/Contact.php';
$contact =& CRM_Contact_BAO_Contact::create($params, true, false);
if ($this->_contactType == 'Individual' && CRM_Utils_Array::value('use_household_address', $params) && CRM_Utils_Array::value('mail_to_household_id', $params)) {
// add/edit/delete the relation of individual with household, if use-household-address option is checked/unchecked.
CRM_Contact_Form_Edit_Individual::handleSharedRelation($contact->id, $params);
}
if ($this->_contactType == 'Household' && $this->_action & CRM_Core_Action::UPDATE) {
//TO DO: commented because of schema changes
require_once 'CRM/Contact/Form/Edit/Household.php';
CRM_Contact_Form_Edit_Household::synchronizeIndividualAddresses($contact->id);
}
if (array_key_exists('TagsAndGroups', $this->_editOptions)) {
//add contact to tags
require_once 'CRM/Core/BAO/EntityTag.php';
//.........这里部分代码省略.........