本文整理汇总了PHP中CRM_Dedupe_Finder::parseAndStoreDupePairs方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Dedupe_Finder::parseAndStoreDupePairs方法的具体用法?PHP CRM_Dedupe_Finder::parseAndStoreDupePairs怎么用?PHP CRM_Dedupe_Finder::parseAndStoreDupePairs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Dedupe_Finder
的用法示例。
在下文中一共展示了CRM_Dedupe_Finder::parseAndStoreDupePairs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refillCache
/**
* Repopulate the cache of merge prospects.
*
* @param int $rgid
* @param int $gid
* @param NULL $cacheKeyString
* @param array $criteria
* Additional criteria to filter by.
*
* @param bool $checkPermissions
* Respect logged in user's permissions.
*
* @return bool
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
public static function refillCache($rgid, $gid, $cacheKeyString, $criteria, $checkPermissions)
{
if (!$cacheKeyString && $rgid) {
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions);
}
if (!$cacheKeyString) {
return FALSE;
}
// 1. Clear cache if any
$sql = "DELETE FROM civicrm_prevnext_cache WHERE cacheKey LIKE %1";
CRM_Core_DAO::executeQuery($sql, array(1 => array("{$cacheKeyString}%", 'String')));
// FIXME: we need to start using temp tables / queries here instead of arrays.
// And cleanup code in CRM/Contact/Page/DedupeFind.php
// 2. FILL cache
$foundDupes = array();
if ($rgid && $gid) {
$foundDupes = CRM_Dedupe_Finder::dupesInGroup($rgid, $gid);
} elseif ($rgid) {
$contactIDs = array();
if (!empty($criteria)) {
$contacts = civicrm_api3('Contact', 'get', array_merge(array('options' => array('limit' => 0), 'return' => 'id'), $criteria['contact']));
$contactIDs = array_keys($contacts['values']);
}
$foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIDs, $checkPermissions);
}
if (!empty($foundDupes)) {
CRM_Dedupe_Finder::parseAndStoreDupePairs($foundDupes, $cacheKeyString);
}
}
示例2: run
//.........这里部分代码省略.........
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry . "&action=update"));
} else {
$urlQry .= "&action=map&skipped={$skippedCount}&merged={$mergedCount}";
CRM_Utils_System::jsRedirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry), ts('Batch Merge Task in progress'), ts('The batch merge task is still in progress. This page will be refreshed automatically.'));
}
}
if ($action & CRM_Core_Action::UPDATE || $action & CRM_Core_Action::BROWSE) {
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
$this->action = CRM_Core_Action::UPDATE;
$urlQry .= '&snippet=4';
if ($context == 'conflicts') {
$urlQry .= "&selected=1";
}
$this->assign('sourceUrl', CRM_Utils_System::url('civicrm/ajax/dedupefind', $urlQry, FALSE, NULL, FALSE));
//reload from cache table
$cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid);
$stats = CRM_Dedupe_Merger::getMergeStatsMsg($cacheKeyString);
if ($stats) {
CRM_Core_Session::setStatus($stats);
// reset so we not displaying same message again
CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
}
$join = CRM_Dedupe_Merger::getJoinOnDedupeTable();
$where = "de.id IS NULL";
if ($context == 'conflicts') {
$where .= " AND pn.is_selected = 1";
}
$this->_mainContacts = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where);
if (empty($this->_mainContacts)) {
if ($context == 'conflicts') {
// if the current screen was intended to list only selected contacts, move back to full dupe list
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $urlQry . '&action=update'));
}
if ($gid) {
$foundDupes = $this->get("dedupe_dupes_{$gid}");
if (!$foundDupes) {
$foundDupes = CRM_Dedupe_Finder::dupesInGroup($rgid, $gid, $limit);
}
$this->set("dedupe_dupes_{$gid}", $foundDupes);
} elseif (!empty($contactIds)) {
$foundDupes = $this->get("search_dedupe_dupes_{$gid}");
if (!$foundDupes) {
$foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIds);
}
$this->set("search_dedupe_dupes_{$gid}", $foundDupes);
} else {
$foundDupes = $this->get('dedupe_dupes');
if (!$foundDupes) {
$foundDupes = CRM_Dedupe_Finder::dupes($rgid, array(), TRUE, $limit);
}
$this->set('dedupe_dupes', $foundDupes);
}
if (!$foundDupes) {
$ruleGroup = new CRM_Dedupe_BAO_RuleGroup();
$ruleGroup->id = $rgid;
$ruleGroup->find(TRUE);
$session = CRM_Core_Session::singleton();
$session->setStatus(ts('No possible duplicates were found using %1 rule.', array(1 => $ruleGroup->name)), ts('None Found'), 'info');
$url = CRM_Utils_System::url('civicrm/contact/deduperules', 'reset=1');
if ($context == 'search') {
$url = $session->readUserContext();
}
CRM_Utils_System::redirect($url);
} else {
$mainContacts = CRM_Dedupe_Finder::parseAndStoreDupePairs($foundDupes, $cacheKeyString);
if ($cid) {
$this->_cid = $cid;
}
if ($gid) {
$this->_gid = $gid;
}
$this->_rgid = $rgid;
$this->_mainContacts = $mainContacts;
$session = CRM_Core_Session::singleton();
if ($this->_cid) {
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules', $urlQry . "&action=update&cid={$this->_cid}"));
} else {
$session->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry . "&action=update"));
}
}
} else {
if ($cid) {
$this->_cid = $cid;
}
if ($gid) {
$this->_gid = $gid;
}
$this->_rgid = $rgid;
}
$this->assign('action', $this->action);
$this->browse();
} else {
$this->action = CRM_Core_Action::UPDATE;
$this->edit($this->action);
$this->assign('action', $this->action);
}
$this->assign('context', $context);
// parent run
return parent::run();
}