<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
protected $_cid = NULL;
protected $_gid;
/**
- * Get BAO Name
+ * Get BAO Name.
*
* @return string
* Classname of BAO.
}
/**
- * Get action Links
- *
- * @return array
- * (reference) of action links
+ * Get action Links.
*/
public function &links() {
}
/**
- * Browse all rule groups
- *
- * @return void
+ * Browse all rule groups.
*/
public function run() {
$gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
elseif ($action & CRM_Core_Action::MAP) {
// do a batch merge if requested
$rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
- $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', TRUE, TRUE);
+ $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', TRUE, 75);
$skippedCount = CRM_Utils_Request::retrieve('skipped', 'Positive', $this, FALSE, 0);
$skippedCount = $skippedCount + count($result['skipped']);
if ($rgid) {
$sourceParams .= "&rgid={$rgid}";
}
+ if ($context == 'conflicts') {
+ $sourceParams .= "&selected=1";
+ }
$this->assign('sourceUrl', CRM_Utils_System::url('civicrm/ajax/dedupefind', $sourceParams, FALSE, NULL, FALSE));
$cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
$cacheKeyString .= $gid ? "_{$gid}" : '_0';
+ $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 = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
pn.entity_id2 = de.contact_id2 )";
$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
+ $sourceParams = 'reset=1&action=update';
+ if ($gid) {
+ $sourceParams .= "&gid={$gid}";
+ }
+ if ($rgid) {
+ $sourceParams .= "&rgid={$rgid}";
+ }
+ CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $sourceParams));
+ }
if ($gid) {
$foundDupes = $this->get("dedupe_dupes_$gid");
if (!$foundDupes) {
}
/**
- * Browse all rule groups
- *
- * @return void
+ * Browse all rule groups.
*/
public function browse() {
$this->assign('main_contacts', $this->_mainContacts);
}
/**
- * Get name of edit form
+ * Get name of edit form.
*
* @return string
* classname of edit form
}
/**
- * Get edit form name
+ * Get edit form name.
*
* @return string
* name of this page
}
/**
- * Get user context
+ * Get user context.
*
* @param null $mode
*
public function userContext($mode = NULL) {
return 'civicrm/contact/dedupefind';
}
+
}