var $_contactType = NULL;
+ /**
+ * Query limit to be retained in the urls.
+ *
+ * @var int
+ */
+ var $limit;
+
// FIXME: QuickForm can't create advcheckboxes with value set to 0 or '0' :(
// see HTML_QuickForm_advcheckbox::setValues() - but patching that doesn't
// help, as QF doesn't put the 0-value elements in exportValues() anyway...
CRM_Core_Error::fatal(ts('You do not have access to this page'));
}
- $rows = array();
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$oid = CRM_Utils_Request::retrieve('oid', 'Positive', $this, TRUE);
$flip = CRM_Utils_Request::retrieve('flip', 'Positive', $this, FALSE);
$this->_rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE);
$this->_gid = $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE);
$this->_mergeId = CRM_Utils_Request::retrieve('mergeId', 'Positive', $this, FALSE);
+ $this->limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this, FALSE);
+ $urlParams = "reset=1&rgid={$this->_rgid}&gid={$this->_gid}&limit=" . $this->limit;
// Sanity check
if ($cid == $oid) {
CRM_Core_Error::statusBounce(ts('The selected pair of contacts are marked as non duplicates. If these records should be merged, you can remove this exception on the <a href="%1">Dedupe Exceptions</a> page.', array(1 => CRM_Utils_System::url('civicrm/dedupe/exception', 'reset=1'))));
}
$this->_contactType = civicrm_api3('Contact', 'getvalue', array('id' => $cid, 'return' => 'contact_type'));
+ $isFromDedupeScreen = TRUE;
if (!$this->_rgid) {
+ $isFromDedupeScreen = FALSE;
$this->_rgid = civicrm_api3('RuleGroup', 'getvalue', array(
'contact_type' => $this->_contactType,
'used' => 'Supervised',
) as $position) {
if (!empty($pos[$position])) {
if ($pos[$position]['id1'] && $pos[$position]['id2']) {
- $urlParam = "reset=1&cid={$pos[$position]['id1']}&oid={$pos[$position]['id2']}&mergeId={$pos[$position]['mergeId']}&action=update";
-
- if ($this->_rgid) {
- $urlParam .= "&rgid={$this->_rgid}";
- }
- if ($gid) {
- $urlParam .= "&gid={$gid}";
- }
-
- $this->$position = CRM_Utils_System::url('civicrm/contact/merge', $urlParam);
+ $urlParams .= "&cid={$pos[$position]['id1']}&oid={$pos[$position]['id2']}&mergeId={$pos[$position]['mergeId']}&action=update";
+ $this->$position = CRM_Utils_System::url('civicrm/contact/merge', $urlParams);
$this->assign($position, $this->$position);
}
}
$session = CRM_Core_Session::singleton();
// context fixed.
- if ($this->_rgid) {
- $urlParam = "reset=1&action=browse&rgid={$this->_rgid}";
- if ($gid) {
- $urlParam .= "&gid={$gid}";
- }
- $session->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlParam));
+ if ($isFromDedupeScreen) {
+ $browseUrl = CRM_Utils_System::url('civicrm/contact/dedupefind', $urlParams . '&action=browse');
+ $session->pushUserContext($browseUrl);
}
+ $this->assign('browseUrl', empty($browseUrl) ? '' : $browseUrl);
// ensure that oid is not the current user, if so refuse to do the merge
if ($session->get('userID') == $oid) {
$formValues['main_details'] = $this->_mainDetails;
$formValues['other_details'] = $this->_otherDetails;
-
- CRM_Dedupe_Merger::moveAllBelongings($this->_cid, $this->_oid, $formValues);
+ $migrationData = array('migration_info' => $formValues);
+ CRM_Utils_Hook::merge('form', $migrationData, $this->_cid, $this->_oid);
+ CRM_Dedupe_Merger::moveAllBelongings($this->_cid, $this->_oid, $migrationData['migration_info']);
$name = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_cid, 'display_name');
$message = '<ul><li>' . ts('%1 has been updated.', array(1 => $name)) . '</li><li>' . ts('Contact ID %1 has been deleted.', array(1 => $this->_oid)) . '</li></ul>';
CRM_Core_Session::setStatus($message, ts('Contacts Merged'), 'success');
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}");
+ $urlParams = "reset=1&gid={$this->_gid}&rgid={$this->_rgid}&limit={$this->limit}";
+
if (!empty($formValues['_qf_Merge_submit'])) {
- $listParamsURL = "reset=1&action=update&rgid={$this->_rgid}";
- if ($this->_gid) {
- $listParamsURL .= "&gid={$this->_gid}";
- }
+ $urlParams .= "&action=update";
$lisitingURL = CRM_Utils_System::url('civicrm/contact/dedupefind',
- $listParamsURL
+ $urlParams
);
CRM_Utils_System::redirect($lisitingURL);
}
$pos['next']['id2']
) {
- $urlParam = "reset=1&cid={$pos['next']['id1']}&oid={$pos['next']['id2']}&mergeId={$pos['next']['mergeId']}&action=update";
- if ($this->_rgid) {
- $urlParam .= "&rgid={$this->_rgid}";
- }
- if ($this->_gid) {
- $urlParam .= "&gid={$this->_gid}";
- }
-
- $url = CRM_Utils_System::url('civicrm/contact/merge', $urlParam);
+ $urlParams .= "&cid={$pos['next']['id1']}&oid={$pos['next']['id2']}&mergeId={$pos['next']['mergeId']}&action=update";
+ $url = CRM_Utils_System::url('civicrm/contact/merge', $urlParams);
}
}