本文整理汇总了PHP中CRM_Dedupe_BAO_Rule::dedupeRuleFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Dedupe_BAO_Rule::dedupeRuleFields方法的具体用法?PHP CRM_Dedupe_BAO_Rule::dedupeRuleFields怎么用?PHP CRM_Dedupe_BAO_Rule::dedupeRuleFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Dedupe_BAO_Rule
的用法示例。
在下文中一共展示了CRM_Dedupe_BAO_Rule::dedupeRuleFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
//.........这里部分代码省略.........
}
}
}
if ($this->_contactIdIndex < 0) {
// set the contact type if its not set
if (!isset($paramValues['contact_type'])) {
$paramValues['contact_type'] = $this->_contactType;
}
$paramValues['version'] = 3;
//retrieve contact id using contact dedupe rule
require_once 'CRM/Utils/DeprecatedUtils.php';
$error = _civicrm_api3_deprecated_check_contact_dedupe($paramValues);
if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
if (count($matchedIDs) > 1) {
array_unshift($values, 'Multiple matching contact records detected for this row. The contribution was not imported');
return CRM_Import_Parser::ERROR;
} else {
$cid = $matchedIDs[0];
$formatted['contact_id'] = $cid;
$newContribution = civicrm_api('contribution', 'create', $formatted);
if (civicrm_error($newContribution)) {
if (is_array($newContribution['error_message'])) {
array_unshift($values, $newContribution['error_message']['message']);
if ($newContribution['error_message']['params'][0]) {
return CRM_Import_Parser::DUPLICATE;
}
} else {
array_unshift($values, $newContribution['error_message']);
return CRM_Import_Parser::ERROR;
}
}
$this->_newContributions[] = $newContribution['id'];
$formatted['contribution_id'] = $newContribution['id'];
//return soft valid since we need to show how soft credits were added
if (!empty($formatted['soft_credit'])) {
return CRM_Contribute_Import_Parser::SOFT_CREDIT;
}
// process pledge payment assoc w/ the contribution
return self::processPledgePayments($formatted);
return CRM_Import_Parser::VALID;
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $this->_contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$disp = NULL;
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, 'No matching Contact found for (' . $disp . ')');
return CRM_Import_Parser::ERROR;
}
} else {
if (!empty($paramValues['external_identifier'])) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $paramValues['external_identifier'];
$checkCid->find(TRUE);
if ($checkCid->id != $formatted['contact_id']) {
array_unshift($values, 'Mismatch of External ID:' . $paramValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
return CRM_Import_Parser::ERROR;
}
}
$newContribution = civicrm_api('contribution', 'create', $formatted);
if (civicrm_error($newContribution)) {
if (is_array($newContribution['error_message'])) {
array_unshift($values, $newContribution['error_message']['message']);
if ($newContribution['error_message']['params'][0]) {
return CRM_Import_Parser::DUPLICATE;
}
} else {
array_unshift($values, $newContribution['error_message']);
return CRM_Import_Parser::ERROR;
}
}
$this->_newContributions[] = $newContribution['id'];
$formatted['contribution_id'] = $newContribution['id'];
//return soft valid since we need to show how soft credits were added
if (!empty($formatted['soft_credit'])) {
return CRM_Contribute_Import_Parser::SOFT_CREDIT;
}
// process pledge payment assoc w/ the contribution
return self::processPledgePayments($formatted);
return CRM_Import_Parser::VALID;
}
}
示例2: import
//.........这里部分代码省略.........
if ($onDuplicate != CRM_Import_Parser::DUPLICATE_UPDATE) {
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, NULL, 'Participant');
} else {
if ($formatValues['participant_id']) {
$dao = new CRM_Event_BAO_Participant();
$dao->id = $formatValues['participant_id'];
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, $formatValues['participant_id'], 'Participant');
if ($dao->find(TRUE)) {
$ids = array('participant' => $formatValues['participant_id'], 'userId' => $session->get('userID'));
$participantValues = array();
//@todo calling api functions directly is not supported
$newParticipant = _civicrm_api3_deprecated_participant_check_params($formatted, $participantValues, FALSE);
if ($newParticipant['error_message']) {
array_unshift($values, $newParticipant['error_message']);
return CRM_Import_Parser::ERROR;
}
$newParticipant = CRM_Event_BAO_Participant::create($formatted, $ids);
if (!empty($formatted['fee_level'])) {
$otherParams = array('fee_label' => $formatted['fee_level'], 'event_id' => $newParticipant->event_id);
CRM_Price_BAO_LineItem::syncLineItems($newParticipant->id, 'civicrm_participant', $newParticipant->fee_amount, $otherParams);
}
$this->_newParticipant[] = $newParticipant->id;
return CRM_Import_Parser::VALID;
} else {
array_unshift($values, 'Matching Participant record not found for Participant ID ' . $formatValues['participant_id'] . '. Row was skipped.');
return CRM_Import_Parser::ERROR;
}
}
}
if ($this->_contactIdIndex < 0) {
//retrieve contact id using contact dedupe rule
$formatValues['contact_type'] = $this->_contactType;
$formatValues['version'] = 3;
$error = _civicrm_api3_deprecated_check_contact_dedupe($formatValues);
if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
if (count($matchedIDs) >= 1) {
foreach ($matchedIDs as $contactId) {
$formatted['contact_id'] = $contactId;
$formatted['version'] = 3;
$newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate);
}
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $this->_contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$disp = '';
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (!empty($params['external_identifier'])) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, 'No matching Contact found for (' . $disp . ')');
return CRM_Import_Parser::ERROR;
}
} else {
if (!empty($formatValues['external_identifier'])) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $formatValues['external_identifier'];
$checkCid->find(TRUE);
if ($checkCid->id != $formatted['contact_id']) {
array_unshift($values, 'Mismatch of External ID:' . $formatValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
return CRM_Import_Parser::ERROR;
}
}
$newParticipant = _civicrm_api3_deprecated_create_participant_formatted($formatted, $onDuplicate);
}
if (is_array($newParticipant) && civicrm_error($newParticipant)) {
if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
$contactID = CRM_Utils_Array::value('contactID', $newParticipant);
$participantID = CRM_Utils_Array::value('participantID', $newParticipant);
$url = CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&id={$participantID}&cid={$contactID}&action=view", TRUE);
if (is_array($newParticipant['error_message']) && $participantID == $newParticipant['error_message']['params'][0]) {
array_unshift($values, $url);
return CRM_Import_Parser::DUPLICATE;
} elseif ($newParticipant['error_message']) {
array_unshift($values, $newParticipant['error_message']);
return CRM_Import_Parser::ERROR;
}
return CRM_Import_Parser::ERROR;
}
}
if (!(is_array($newParticipant) && civicrm_error($newParticipant))) {
$this->_newParticipants[] = CRM_Utils_Array::value('id', $newParticipant);
}
return CRM_Import_Parser::VALID;
}
示例3: array
/**
* combine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
* next week or so, before this can be called complete.
*
* @param NULL
*
* @return array array of importable Fields
* @access public
*/
function &importableFields()
{
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
}
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Activity Fields -')));
}
require_once 'CRM/Activity/DAO/Activity.php';
$tmpFields = CRM_Activity_DAO_Activity::import();
require_once 'CRM/Contact/BAO/Contact.php';
$contactFields = CRM_Contact_BAO_Contact::importableFields('Individual', null);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => 'Individual', 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$tmpConatctField = array();
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$tmpConatctField[trim($value)] = $contactFields[trim($value)];
$tmpConatctField[trim($value)]['title'] = $tmpConatctField[trim($value)]['title'] . " (match to contact)";
}
}
$tmpConatctField['external_identifier'] = $contactFields['external_identifier'];
$tmpConatctField['external_identifier']['title'] = $contactFields['external_identifier']['title'] . " (match to contact)";
$fields = array_merge($fields, $tmpConatctField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Activity'));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例4: import
//.........这里部分代码省略.........
//fix for CRM-3570, exclude the statuses those having is_admin = 1
//now user can import is_admin if is override is true.
$excludeIsAdmin = false;
if (!CRM_Utils_Array::value('is_override', $formatted)) {
$formatted['exclude_is_admin'] = $excludeIsAdmin = true;
}
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, $endDate, $joinDate, 'today', $excludeIsAdmin);
if (!$formatted['status_id']) {
$formatted['status_id'] = $calcStatus['id'];
} elseif (!CRM_Utils_Array::value('is_override', $formatted)) {
if (empty($calcStatus)) {
array_unshift($values, "Status in import row (" . $formatValues['status_id'] . ") does not match calculated status based on your configured Membership Status Rules. Record was not imported.");
return CRM_Member_Import_Parser::ERROR;
} else {
if ($formatted['status_id'] != $calcStatus['id']) {
//Status Hold" is either NOT mapped or is FALSE
array_unshift($values, "Status in import row (" . $formatValues['status_id'] . ") does not match calculated status based on your configured Membership Status Rules (" . $calcStatus['name'] . "). Record was not imported.");
return CRM_Member_Import_Parser::ERROR;
}
}
}
$newMembership = civicrm_contact_membership_create($formatted);
if (civicrm_error($newMembership)) {
array_unshift($values, $newMembership['error_message']);
return CRM_Member_Import_Parser::ERROR;
}
$this->_newMemberships[] = $newMembership['id'];
return CRM_Member_Import_Parser::VALID;
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $this->_contactType, 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (CRM_Utils_Array::value('external_identifier', $params)) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, "No matching Contact found for (" . $disp . ")");
return CRM_Member_Import_Parser::ERROR;
}
} else {
if ($formatValues['external_identifier']) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $formatValues['external_identifier'];
$checkCid->find(true);
if ($checkCid->id != $formatted['contact_id']) {
array_unshift($values, "Mismatch of External identifier :" . $formatValues['external_identifier'] . " and Contact Id:" . $formatted['contact_id']);
return CRM_Member_Import_Parser::ERROR;
}
}
//to calculate dates
require_once 'CRM/Member/BAO/MembershipType.php';
示例5: array
/**
* combine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
* next week or so, before this can be called complete.
*
* @return array array of importable Fields
* @access public
*/
function &importableFields($contacType = 'Individual', $status = true)
{
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
}
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Contribution Fields -')));
}
require_once 'CRM/Core/DAO/Note.php';
$note = CRM_Core_DAO_Note::import();
$tmpFields = CRM_Contribute_DAO_Contribution::import();
unset($tmpFields['option_value']);
require_once 'CRM/Core/OptionValue.php';
$optionFields = CRM_Core_OptionValue::getFields($mode = 'contribute');
require_once 'CRM/Contact/BAO/Contact.php';
$contactFields = CRM_Contact_BAO_Contact::importableFields($contacType, null);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contacType, 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$tmpConatctField = array();
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
//skip if there is no dupe rule
if ($value == 'none') {
continue;
}
$tmpConatctField[trim($value)] = $contactFields[trim($value)];
if (!$status) {
$title = $tmpConatctField[trim($value)]['title'] . " (match to contact)";
} else {
$title = $tmpConatctField[trim($value)]['title'];
}
$tmpConatctField[trim($value)]['title'] = $title;
}
}
$tmpConatctField['external_identifier'] = $contactFields['external_identifier'];
$tmpConatctField['external_identifier']['title'] = $contactFields['external_identifier']['title'] . " (match to contact)";
$tmpFields['contribution_contact_id']['title'] = $tmpFields['contribution_contact_id']['title'] . " (match to contact)";
$fields = array_merge($fields, $tmpConatctField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $note);
$fields = array_merge($fields, $optionFields);
require_once 'CRM/Contribute/DAO/ContributionType.php';
$fields = array_merge($fields, CRM_Contribute_DAO_ContributionType::export());
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Contribution'));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例6: array
/**
* Combine all the importable fields from the lower levels object.
*
* @param string $contactType
* @param bool $status
* @param bool $onlyParticipant
* @param bool $checkPermission
* Is this a permissioned retrieval?
*
* @return array
* array of importable Fields
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE, $checkPermission = TRUE)
{
if (!self::$_importableFields) {
if (!$onlyParticipant) {
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Participant Fields -')));
}
} else {
$fields = array();
}
$tmpFields = CRM_Event_DAO_Participant::import();
$note = array('participant_note' => array('title' => ts('Participant Note'), 'name' => 'participant_note', 'headerPattern' => '/(participant.)?note$/i'));
// Split status and status id into 2 fields
// Fixme: it would be better to leave as 1 field and intelligently handle both during import
$participantStatus = array('participant_status' => array('title' => ts('Participant Status'), 'name' => 'participant_status', 'data_type' => CRM_Utils_Type::T_STRING));
$tmpFields['participant_status_id']['title'] = ts('Participant Status Id');
// Split role and role id into 2 fields
// Fixme: it would be better to leave as 1 field and intelligently handle both during import
$participantRole = array('participant_role' => array('title' => ts('Participant Role'), 'name' => 'participant_role', 'data_type' => CRM_Utils_Type::T_STRING));
$tmpFields['participant_role_id']['title'] = ts('Participant Role Id');
$eventType = array('event_type' => array('title' => ts('Event Type'), 'name' => 'event_type', 'data_type' => CRM_Utils_Type::T_STRING));
$tmpContactField = $contactFields = array();
$contactFields = array();
if (!$onlyParticipant) {
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
$tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
}
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
}
$tmpFields['participant_contact_id']['title'] = $tmpFields['participant_contact_id']['title'] . ' (match to contact)';
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $note, $participantStatus, $participantRole, $eventType);
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant', FALSE, FALSE, FALSE, $checkPermission));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例7: array
/**
* combine all the importable fields from the lower levels object
*
* @return array array of importable Fields
* @access public
*/
function &importableFields($contactType = 'Individual', $status = true, $onlyParticipant = false)
{
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
}
if (!$onlyParticipant) {
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Participant Fields -')));
}
} else {
$fields = array();
}
require_once 'CRM/Core/DAO/Note.php';
$tmpFields = CRM_Event_DAO_Participant::import();
$note = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note', 'headerPattern' => '/(participant.)?note$/i'));
$participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status', 'data_type' => CRM_Utils_Type::T_STRING));
$participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role', 'data_type' => CRM_Utils_Type::T_STRING));
$eventType = array('event_type' => array('title' => 'Event Type', 'name' => 'event_type', 'data_type' => CRM_Utils_Type::T_STRING));
$tmpConatctField = array();
if (!$onlyParticipant) {
require_once 'CRM/Contact/BAO/Contact.php';
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, null);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . " (match to contact)";
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
}
$tmpContactField['external_identifier'] = CRM_Utils_Array::value('external_identifier', $contactFields);
$tmpContactField['external_identifier']['title'] = $contactFields['external_identifier']['title'] . " (match to contact)";
$tmpFields['participant_contact_id']['title'] = $tmpFields['participant_contact_id']['title'] . " (match to contact)";
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $note, $participantStatus, $participantRole, $eventType);
//$fields = array_merge($fields, $optionFields);
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant'));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例8: array
/**
* Combine all the importable fields from the lower levels object.
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
* next week or so, before this can be called complete.
*
* @param string $contactType
* @param bool $status
*
* @return array
* array of importable Fields
*/
public static function &importableFields($contactType = 'Individual', $status = TRUE)
{
if (!self::$_importableFields) {
if (!self::$_importableFields) {
self::$_importableFields = array();
}
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Contribution Fields -')));
}
$note = CRM_Core_DAO_Note::import();
$tmpFields = CRM_Contribute_DAO_Contribution::import();
unset($tmpFields['option_value']);
$optionFields = CRM_Core_OptionValue::getFields($mode = 'contribute');
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$tmpContactField = array();
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
//skip if there is no dupe rule
if ($value == 'none') {
continue;
}
$customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
$tmpContactField[trim($value)] = $contactFields[trim($value)];
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' ' . ts('(match to contact)');
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
$tmpContactField['external_identifier'] = $contactFields['external_identifier'];
$tmpContactField['external_identifier']['title'] = $contactFields['external_identifier']['title'] . ' ' . ts('(match to contact)');
$tmpFields['contribution_contact_id']['title'] = $tmpFields['contribution_contact_id']['title'] . ' ' . ts('(match to contact)');
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $note);
$fields = array_merge($fields, $optionFields);
$fields = array_merge($fields, CRM_Financial_DAO_FinancialType::export());
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Contribution'));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例9: array
/**
* combine all the importable fields from the lower levels object
*
* @return array array of importable Fields
* @access public
* @static
*/
static function &importableFields($contactType = 'Individual', $status = TRUE, $onlyParticipant = FALSE)
{
if (!self::$_importableFields) {
if (!$onlyParticipant) {
if (!$status) {
$fields = array('' => array('title' => ts('- do not import -')));
} else {
$fields = array('' => array('title' => ts('- Participant Fields -')));
}
} else {
$fields = array();
}
$tmpFields = CRM_Event_DAO_Participant::import();
$note = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note', 'headerPattern' => '/(participant.)?note$/i'));
$participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status', 'data_type' => CRM_Utils_Type::T_STRING));
$participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role', 'data_type' => CRM_Utils_Type::T_STRING));
$eventType = array('event_type' => array('title' => 'Event Type', 'name' => 'event_type', 'data_type' => CRM_Utils_Type::T_STRING));
$tmpContactField = $contactFields = array();
$contactFields = array();
if (!$onlyParticipant) {
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'level' => 'Strict');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
$tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
}
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
}
$tmpFields['participant_contact_id']['title'] = $tmpFields['participant_contact_id']['title'] . ' (match to contact)';
//campaign fields.
if (isset($tmpFields['participant_campaign_id'])) {
$tmpFields['participant_campaign'] = array('title' => ts('Campaign Title'));
}
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$fields = array_merge($fields, $note, $participantStatus, $participantRole, $eventType);
//$fields = array_merge($fields, $optionFields);
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant'));
self::$_importableFields = $fields;
}
return self::$_importableFields;
}
示例10: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$this->addElement('checkbox', 'is_online_registration', ts('Allow Online Registration?'), null, array('onclick' => "return showHideByValue('is_online_registration', \n '', \n 'registration_blocks', \n 'block', \n 'radio', \n false );"));
$this->add('text', 'registration_link_text', ts('Registration Link Text'));
if (!$this->_isTemplate) {
$this->addDateTime('registration_start_date', ts('Registration Start Date'), false, array('formatType' => 'activityDateTime'));
$this->addDateTime('registration_end_date', ts('Registration End Date'), false, array('formatType' => 'activityDateTime'));
}
$this->addElement('checkbox', 'is_multiple_registrations', ts('Register multiple participants?'), null, array('onclick' => "return showHideByValue('is_multiple_registrations', '', 'additional_profile_pre|additional_profile_post', 'table-row', 'radio', false);"));
require_once 'CRM/Dedupe/BAO/Rule.php';
$params = array('level' => 'Fuzzy', 'contact_type' => 'Individual');
$dedupeRuleFields = CRM_Dedupe_BAO_Rule::dedupeRuleFields($params);
foreach ($dedupeRuleFields as $key => $fields) {
$ruleFields[$key] = ucwords(str_replace('_', ' ', $fields));
}
$this->addElement('checkbox', 'allow_same_participant_emails', ts('Allow multiple registrations from the same email address?'), null, array('onclick' => "return showRuleFields( " . json_encode($ruleFields) . " );"));
$this->assign('ruleFields', json_encode($ruleFields));
require_once 'CRM/Event/PseudoConstant.php';
$participantStatuses =& CRM_Event_PseudoConstant::participantStatus();
if (in_array('Awaiting approval', $participantStatuses) and in_array('Pending from approval', $participantStatuses) and in_array('Rejected', $participantStatuses)) {
$this->addElement('checkbox', 'requires_approval', ts('Require participant approval?'), null, array('onclick' => "return showHideByValue('requires_approval', '', 'id-approval-text', 'table-row', 'radio', false);"));
$this->add('textarea', 'approval_req_text', ts('Approval message'), $attributes['approval_req_text']);
}
$this->add('text', 'expiration_time', ts('Pending participant expiration (hours)'));
$this->addRule('expiration_time', ts('Please enter the number of hours (as an integer).'), 'integer');
self::buildRegistrationBlock($this);
self::buildConfirmationBlock($this);
self::buildMailBlock($this);
self::buildThankYouBlock($this);
parent::buildQuickForm();
}
示例11: import
//.........这里部分代码省略.........
}
if (!CRM_Utils_Rule::integer($formatted['event_id'])) {
array_unshift($values, ts('Invalid value for Event ID'));
return CRM_Event_Import_Parser::ERROR;
}
if ($onDuplicate != CRM_Event_Import_Parser::DUPLICATE_UPDATE) {
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, CRM_Core_DAO::$_nullObject, null, 'Participant');
} else {
if ($formatValues['participant_id']) {
require_once 'CRM/Event/BAO/Participant.php';
$dao = new CRM_Event_BAO_Participant();
$dao->id = $formatValues['participant_id'];
$formatted['custom'] = CRM_Core_BAO_CustomField::postProcess($formatted, CRM_Core_DAO::$_nullObject, $formatValues['participant_id'], 'Participant');
if ($dao->find(true)) {
$ids = array('participant' => $formatValues['participant_id'], 'userId' => $session->get('userID'));
$newParticipant = civicrm_participant_check_params($formatted, false);
if ($newParticipant['error_message']) {
array_unshift($values, $newParticipant['error_message']);
return CRM_Event_Import_Parser::ERROR;
}
$newParticipant =& CRM_Event_BAO_Participant::create($formatted, $ids);
$this->_newParticipant[] = $newParticipant->id;
return CRM_Event_Import_Parser::VALID;
} else {
array_unshift($values, "Matching Participant record not found for Participant ID " . $formatValues['participant_id'] . ". Row was skipped.");
return CRM_Event_Import_Parser::ERROR;
}
}
}
if ($this->_contactIdIndex < 0) {
//retrieve contact id using contact dedupe rule
$formatValues['contact_type'] = $this->_contactType;
$error = civicrm_check_contact_dedupe($formatValues);
if (civicrm_duplicate($error)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
if (count($matchedIDs) >= 1) {
foreach ($matchedIDs as $contactId) {
$formatted['contact_id'] = $contactId;
$newParticipant = civicrm_create_participant_formatted($formatted, $onDuplicate);
}
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $this->_contactType, 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (CRM_Utils_Array::value('external_identifier', $params)) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, "No matching Contact found for (" . $disp . ")");
return CRM_Event_Import_Parser::ERROR;
}
} else {
if ($formatValues['external_identifier']) {
$checkCid = new CRM_Contact_DAO_Contact();
$checkCid->external_identifier = $formatValues['external_identifier'];
$checkCid->find(true);
if ($checkCid->id != $formatted['contact_id']) {
array_unshift($values, "Mismatch of External identifier :" . $formatValues['external_identifier'] . " and Contact Id:" . $formatted['contact_id']);
return CRM_Event_Import_Parser::ERROR;
}
}
$newParticipant = civicrm_create_participant_formatted($formatted, $onDuplicate);
}
if (is_array($newParticipant) && civicrm_error($newParticipant)) {
if ($onDuplicate == CRM_Event_Import_Parser::DUPLICATE_SKIP) {
$contactID = CRM_Utils_Array::value('contactID', $newParticipant['error_data']);
$participantID = CRM_Utils_Array::value('participantID', $newParticipant['error_data']);
$url = CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&id={$participantID}&cid={$contactID}&action=view", true);
if (is_array($newParticipant['error_message']) && $participantID == $newParticipant['error_message']['params'][0]) {
array_unshift($values, $url);
return CRM_Event_Import_Parser::DUPLICATE;
} else {
if ($newParticipant['error_message']) {
array_unshift($values, $newParticipant['error_message']);
return CRM_Event_Import_Parser::ERROR;
}
}
return CRM_Event_Import_Parser::ERROR;
}
}
if (!(is_array($newParticipant) && civicrm_error($newParticipant))) {
$this->_newParticipants[] = $newParticipant['id'];
}
return CRM_Event_Import_Parser::VALID;
}
示例12: array
/**
* combine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important
*
* @param int $contactType contact Type
* @param boolean $status status is used to manipulate first title
* @param boolean $showAll if true returns all fields (includes disabled fields)
* @param boolean $isProfile if its profile mode
* @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
*
* @return array array of importable Fields
* @access public
* @static
*/
static function &importableFields($contactType = 'Individual', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
{
$contactType = 'Individual';
$fields = CRM_Hrjobcontract_DAO_HRJobContract::import();
$tmpContactField = $contactFields = array();
$contactFields = array();
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
$tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
}
$fields = array_merge($fields, $tmpContactField);
self::$_importableFields = $fields;
return self::$_importableFields;
//$fields;
}
示例13: import
/**
* handle the values in import mode
*
* @param int $onDuplicate the code for what action to take on duplicates
* @param array $values the array of values belonging to this line
*
* @return boolean the result of this processing
* @access public
*/
function import($onDuplicate, &$values)
{
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Activity_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
$activityName = array_search('activity_name', $this->_mapperKeys);
if ($activityName) {
$params = array_merge($params, array('activity_name' => $values[$activityName]));
}
//for date-Formats
$session =& CRM_Core_Session::singleton();
$dateType = $session->get("dateTypes");
$params['source_contact_id'] = $session->get('userID');
$formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
foreach ($params as $key => $val) {
if ($key == 'activity_date_time') {
if ($val) {
if ($dateType == 1) {
$params[$key] = CRM_Utils_Date::customFormat($val, '%Y%m%d%H%i');
//hack to add seconds
$params[$key] = $params[$key] . '00';
} else {
CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key);
}
}
} elseif ($key == 'duration') {
$params['duration_minutes'] = $params['duration'];
unset($params['duration']);
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Import_Parser_Contact::formatCustomDate($params, $params, $dateType, $key);
} else {
if ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
}
}
//date-Format part ends
$formatError = _civicrm_activity_formatted_param($params, $params, true);
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, CRM_Core_DAO::$_nullObject, null, 'Activity');
if ($this->_contactIdIndex < 0) {
//retrieve contact id using contact dedupe rule.
//since we are support only individual's activity import.
$params['contact_type'] = 'Individual';
$error = civicrm_check_contact_dedupe($params);
if (civicrm_duplicate($error)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
if (count($matchedIDs) > 1) {
array_unshift($values, "Multiple matching contact records detected for this row. The activity was not imported");
return CRM_Activity_Import_Parser::ERROR;
} else {
$cid = $matchedIDs[0];
$params['target_contact_id'] = $cid;
$newActivity = civicrm_activity_create($params);
if (CRM_Utils_Array::value('is_error', $newActivity)) {
array_unshift($values, $newActivity['error_message']);
return CRM_Activity_Import_Parser::ERROR;
}
$this->_newActivity[] = $newActivity['id'];
return CRM_Activity_Import_Parser::VALID;
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => 'Individual', 'level' => 'Strict');
require_once 'CRM/Dedupe/BAO/Rule.php';
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (CRM_Utils_Array::value('external_identifier', $params)) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, "No matching Contact found for (" . $disp . ")");
return CRM_Activity_Import_Parser::ERROR;
//.........这里部分代码省略.........
示例14: preProcess
/**
* Set variables up before form is built.
*/
public function preProcess()
{
$dataSource = $this->get('dataSource');
$skipColumnHeader = $this->get('skipColumnHeader');
$this->_mapperFields = $this->get('fields');
$this->_importTableName = $this->get('importTableName');
$this->_onDuplicate = $this->get('onDuplicate');
$highlightedFields = array();
$highlightedFields[] = 'email';
$highlightedFields[] = 'external_identifier';
//format custom field names, CRM-2676
switch ($this->get('contactType')) {
case CRM_Import_Parser::CONTACT_INDIVIDUAL:
$contactType = 'Individual';
$highlightedFields[] = 'first_name';
$highlightedFields[] = 'last_name';
break;
case CRM_Import_Parser::CONTACT_HOUSEHOLD:
$contactType = 'Household';
$highlightedFields[] = 'household_name';
break;
case CRM_Import_Parser::CONTACT_ORGANIZATION:
$contactType = 'Organization';
$highlightedFields[] = 'organization_name';
break;
}
$this->_contactType = $contactType;
if ($this->_onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
unset($this->_mapperFields['id']);
} else {
$highlightedFields[] = 'id';
}
if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK) {
//Mark Dedupe Rule Fields as required, since it's used in matching contact
foreach (array('Individual', 'Household', 'Organization') as $cType) {
$ruleParams = array('contact_type' => $cType, 'used' => 'Unsupervised');
$this->_dedupeFields[$cType] = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
}
//Modify mapper fields title if fields are present in dedupe rule
if (is_array($this->_dedupeFields[$contactType])) {
foreach ($this->_dedupeFields[$contactType] as $val) {
if ($valTitle = CRM_Utils_Array::value($val, $this->_mapperFields)) {
$this->_mapperFields[$val] = $valTitle . ' (match to contact)';
}
}
}
}
// retrieve and highlight required custom fields
$formattedFieldNames = $this->formatCustomFieldName($this->_mapperFields);
self::$customFields = CRM_Core_BAO_CustomField::getFields($this->_contactType);
foreach (self::$customFields as $key => $attr) {
if (!empty($attr['is_required'])) {
$highlightedFields[] = "custom_{$key}";
}
}
$this->assign('highlightedFields', $highlightedFields);
$this->_formattedFieldNames[$contactType] = $this->_mapperFields = array_merge($this->_mapperFields, $formattedFieldNames);
$columnNames = array();
//get original col headers from csv if present.
if ($dataSource == 'CRM_Import_DataSource_CSV' && $skipColumnHeader) {
$columnNames = $this->get('originalColHeader');
} else {
// get the field names from the temp. DB table
$dao = new CRM_Core_DAO();
$db = $dao->getDatabaseConnection();
$columnsQuery = "SHOW FIELDS FROM {$this->_importTableName}\n WHERE Field NOT LIKE '\\_%'";
$columnsResult = $db->query($columnsQuery);
while ($row = $columnsResult->fetchRow(DB_FETCHMODE_ASSOC)) {
$columnNames[] = $row['Field'];
}
}
$showColNames = TRUE;
if ($dataSource == 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) {
$showColNames = FALSE;
}
$this->assign('showColNames', $showColNames);
$this->_columnCount = count($columnNames);
$this->_columnNames = $columnNames;
$this->assign('columnNames', $columnNames);
//$this->_columnCount = $this->get( 'columnCount' );
$this->assign('columnCount', $this->_columnCount);
$this->_dataValues = $this->get('dataValues');
$this->assign('dataValues', $this->_dataValues);
$this->assign('rowDisplayCount', 2);
}
示例15: import
/**
* handle the values in import mode
*
* @param int $onDuplicate the code for what action to take on duplicates
* @param array $values the array of values belonging to this line
*
* @return boolean the result of this processing
* @access public
*/
function import($onDuplicate, &$values)
{
// first make sure this is a valid line
$response = $this->summary($values);
if ($response != CRM_Import_Parser::VALID) {
return $response;
}
$params =& $this->getActiveFieldParams();
$activityLabel = array_search('activity_label', $this->_mapperKeys);
if ($activityLabel) {
$params = array_merge($params, array('activity_label' => $values[$activityLabel]));
}
//for date-Formats
$session = CRM_Core_Session::singleton();
$dateType = $session->get('dateTypes');
if (!isset($params['source_contact_id'])) {
$params['source_contact_id'] = $session->get('userID');
}
$formatted = array();
$customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('contact_type', $params));
foreach ($params as $key => $val) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
if ($key == 'activity_date_time' && $val) {
$params[$key] = CRM_Utils_Date::formatDate($val, $dateType);
} elseif ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $params, $dateType, $key);
} elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
} elseif ($key == 'activity_subject') {
$params['subject'] = $val;
}
}
//date-Format part ends
require_once 'CRM/Utils/DeprecatedUtils.php';
$formatError = _civicrm_api3_deprecated_activity_formatted_param($params, $params, TRUE);
if ($formatError) {
array_unshift($values, $formatError['error_message']);
return CRM_Import_Parser::ERROR;
}
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, CRM_Core_DAO::$_nullObject, NULL, 'Activity');
if ($this->_contactIdIndex < 0) {
//retrieve contact id using contact dedupe rule.
//since we are support only individual's activity import.
$params['contact_type'] = 'Individual';
$params['version'] = 3;
$error = _civicrm_api3_deprecated_duplicate_formatted_contact($params);
if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) {
$matchedIDs = explode(',', $error['error_message']['params'][0]);
if (count($matchedIDs) > 1) {
array_unshift($values, 'Multiple matching contact records detected for this row. The activity was not imported');
return CRM_Import_Parser::ERROR;
} else {
$cid = $matchedIDs[0];
$params['target_contact_id'] = $cid;
$params['version'] = 3;
$newActivity = civicrm_api('activity', 'create', $params);
if (CRM_Utils_Array::value('is_error', $newActivity)) {
array_unshift($values, $newActivity['error_message']);
return CRM_Import_Parser::ERROR;
}
$this->_newActivity[] = $newActivity['id'];
return CRM_Import_Parser::VALID;
}
} else {
// Using new Dedupe rule.
$ruleParams = array('contact_type' => 'Individual', 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
$disp = NULL;
foreach ($fieldsArray as $value) {
if (array_key_exists(trim($value), $params)) {
$paramValue = $params[trim($value)];
if (is_array($paramValue)) {
$disp .= $params[trim($value)][0][trim($value)] . " ";
} else {
$disp .= $params[trim($value)] . " ";
}
}
}
if (CRM_Utils_Array::value('external_identifier', $params)) {
if ($disp) {
$disp .= "AND {$params['external_identifier']}";
} else {
$disp = $params['external_identifier'];
}
}
array_unshift($values, 'No matching Contact found for (' . $disp . ')');
return CRM_Import_Parser::ERROR;
}
} else {
if (CRM_Utils_Array::value('external_identifier', $params)) {
//.........这里部分代码省略.........