3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components for DedupeRules.
21 class CRM_Contact_Form_DedupeFind
extends CRM_Admin_Form
{
24 * Indicate if this form should warn users of unsaved changes
27 protected $unsavedChangesWarn = FALSE;
32 public function preProcess() {
33 $this->rgid
= CRM_Utils_Request
::retrieve('rgid', 'Positive', $this, FALSE, 0);
37 * Build the form object.
39 public function buildQuickForm() {
41 $groupList = ['' => ts('- All Contacts -')] + CRM_Core_PseudoConstant
::nestedGroup();
43 $this->add('select', 'group_id', ts('Select Group'), $groupList, FALSE, ['class' => 'crm-select2 huge']);
44 if (Civi
::settings()->get('dedupe_default_limit')) {
45 $this->add('text', 'limit', ts('No of contacts to find matches for '));
50 'name' => ts('Continue'),
53 //hack to support cancel button functionality
58 'name' => ts('Cancel'),
64 * Set the default values for the form.
68 public function setDefaultValues() {
69 $this->_defaults
['limit'] = Civi
::settings()->get('dedupe_default_limit');
70 return $this->_defaults
;
74 * Process the form submission.
76 public function postProcess() {
77 $values = $this->exportValues();
78 if (!empty($_POST['_qf_DedupeFind_submit'])) {
79 //used for cancel button
80 CRM_Utils_System
::redirect(CRM_Utils_System
::url('civicrm/contact/deduperules', 'reset=1'));
83 $url = CRM_Utils_System
::url('civicrm/contact/dedupefind', "reset=1&action=update&rgid={$this->rgid}");
84 if ($values['group_id']) {
85 $url .= "&gid={$values['group_id']}";
88 if (!empty($values['limit'])) {
89 $url .= '&limit=' . $values['limit'];
92 CRM_Utils_System
::redirect($url);