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 $this->add('text', 'limit', ts('No of contacts to find matches for '));
46 // To improve usability for smaller sites, we don't show the limit field unless a default limit has been set.
47 $this->assign('limitShown', (bool) Civi
::settings()->get('dedupe_default_limit'));
52 'name' => ts('Continue'),
55 //hack to support cancel button functionality
60 'name' => ts('Cancel'),
66 * Set the default values for the form.
70 public function setDefaultValues() {
71 $this->_defaults
['limit'] = Civi
::settings()->get('dedupe_default_limit');
72 return $this->_defaults
;
76 * Process the form submission.
78 public function postProcess() {
79 $values = $this->exportValues();
80 if (!empty($_POST['_qf_DedupeFind_submit'])) {
81 //used for cancel button
82 CRM_Utils_System
::redirect(CRM_Utils_System
::url('civicrm/contact/deduperules', 'reset=1'));
85 $url = CRM_Utils_System
::url('civicrm/contact/dedupefind', "reset=1&action=update&rgid={$this->rgid}");
86 if ($values['group_id']) {
87 $url .= "&gid={$values['group_id']}";
90 if (!empty($values['limit'])) {
91 $url .= '&limit=' . $values['limit'];
94 CRM_Utils_System
::redirect($url);