<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
CRM_Utils_System::permissionDenied();
CRM_Utils_System::civiExit();
}
- $this->_options = array(ts('Unsupervised'), ts('Supervised'), ts('General'));
+ $this->_options = CRM_Core_SelectValues::getDedupeRuleTypes();
$this->_rgid = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
if ($this->_rgid) {
}
$this->add('text', 'threshold', ts("Weight Threshold to Consider Contacts 'Matching':"), $attributes);
- $this->addButtons(array(
- array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE),
- array('type' => 'cancel', 'name' => ts('Cancel')),
- ));
$this->assign('contact_type', $this->_contactType);
$this->addFormRule(array('CRM_Contact_Form_DedupeRules', 'formRule'), $this);
+
+ parent::buildQuickForm();
}
/**
$values = $this->exportValues();
//FIXME: Handle logic to replace is_default column by usage
- $used = CRM_Utils_Array::value('used', $values, FALSE);
// reset used column to General (since there can only
// be one 'Supervised' or 'Unsupervised' rule)
- if ($this->_options[$used] != 'General') {
+ if ($values['used'] != 'General') {
$query = "
UPDATE civicrm_dedupe_rule_group
SET used = 'General'
WHERE contact_type = %1
AND used = %2";
- $queryParams = array(1 => array($this->_contactType, 'String'),
- 2 => array($this->_options[$used], 'String'),
+ $queryParams = array(
+ 1 => array($this->_contactType, 'String'),
+ 2 => array($values['used'], 'String'),
);
CRM_Core_DAO::executeQuery($query, $queryParams);
$rgDao->title = $values['title'];
$rgDao->is_reserved = CRM_Utils_Array::value('is_reserved', $values, FALSE);
- $rgDao->used = $this->_options[$values['used']];
+ $rgDao->used = $values['used'];
$rgDao->contact_type = $this->_contactType;
$rgDao->threshold = $values['threshold'];
$rgDao->save();
// also create an index for this dedupe rule
// CRM-3837
+ CRM_Utils_Hook::dupeQuery($ruleDao, 'dedupeIndexes', $tables);
CRM_Core_BAO_SchemaHandler::createIndexes($tables, 'dedupe_index', $substrLenghts);
//need to clear cache of deduped contacts