本文整理汇总了PHP中CRM_Core_BAO_UFMatch::updateUFEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFMatch::updateUFEmail方法的具体用法?PHP CRM_Core_BAO_UFMatch::updateUFEmail怎么用?PHP CRM_Core_BAO_UFMatch::updateUFEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFMatch
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFMatch::updateUFEmail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
/**
* takes an associative array and creates a contact object and all the associated
* derived objects (i.e. individual, location, email, phone etc)
*
* This function is invoked from within the web form layer and also from the api layer
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $ids the array that holds all the db ids
* @param int $maxLocationBlocks the maximum number of location blocks to process
*
* @return object CRM_Contact_BAO_Contact object
* @access public
* @static
*/
function &create(&$params, &$ids, $maxLocationBlocks)
{
require_once 'CRM/Utils/Hook.php';
if (CRM_Utils_Array::value('contact', $ids)) {
CRM_Utils_Hook::pre('edit', $params['contact_type'], $ids['contact'], $params);
} else {
CRM_Utils_Hook::pre('create', $params['contact_type'], null, $params);
}
CRM_Core_DAO::transaction('BEGIN');
$contact = CRM_Contact_BAO_Contact::add($params, $ids);
$params['contact_id'] = $contact->id;
// invoke the add operator on the contact_type class
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_BAO_" . $params['contact_type']) . ".php";
eval('$contact->contact_type_object =& CRM_Contact_BAO_' . $params['contact_type'] . '::add($params, $ids);');
$location = array();
for ($locationId = 1; $locationId <= $maxLocationBlocks; $locationId++) {
// start of for loop for location
$location[$locationId] = CRM_Core_BAO_Location::add($params, $ids, $locationId);
}
$contact->location = $location;
// add notes
if (CRM_Utils_Array::value('note', $params)) {
if (is_array($params['note'])) {
foreach ($params['note'] as $note) {
$noteParams = array('entity_id' => $contact->id, 'entity_table' => 'civicrm_contact', 'note' => $note['note']);
CRM_Core_BAO_Note::add($noteParams);
}
} else {
$noteParams = array('entity_id' => $contact->id, 'entity_table' => 'civicrm_contact', 'note' => $params['note']);
CRM_Core_BAO_Note::add($noteParams);
}
}
// update the UF email if that has changed
require_once 'CRM/Core/BAO/UFMatch.php';
CRM_Core_BAO_UFMatch::updateUFEmail($contact->id);
// add custom field values
if (CRM_Utils_Array::value('custom', $params)) {
foreach ($params['custom'] as $customValue) {
$cvParams = array('entity_table' => 'civicrm_contact', 'entity_id' => $contact->id, 'value' => $customValue['value'], 'type' => $customValue['type'], 'custom_field_id' => $customValue['custom_field_id']);
if ($customValue['id']) {
$cvParams['id'] = $customValue['id'];
}
CRM_Core_BAO_CustomValue::create($cvParams);
}
}
// make a civicrm_subscription_history entry only on contact create (CRM-777)
if (!CRM_Utils_Array::value('contact', $ids)) {
$subscriptionParams = array('contact_id' => $contact->id, 'status' => 'Added', 'method' => 'Admin');
CRM_Contact_BAO_SubscriptionHistory::create($subscriptionParams);
}
CRM_Core_DAO::transaction('COMMIT');
if (CRM_Utils_Array::value('contact', $ids)) {
CRM_Utils_Hook::post('edit', $params['contact_type'], $contact->id, $contact);
} else {
CRM_Utils_Hook::post('create', $params['contact_type'], $contact->id, $contact);
}
$contact->contact_type_display = CRM_Contact_DAO_Contact::tsEnum('contact_type', $contact->contact_type);
return $contact;
}