}
$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);
+ $contactTypes = civicrm_api3('Contact', 'getOptions', array('field' => "contact_type"));
+ $contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0);
+ if (in_array($contactType, $contactTypes['values'])) {
+ $this->_contactType = $contactTypes['values'][$contactType];
+ }
+ else {
+ throw new CRM_Core_Exception('Contact Type is Not valid');
+ }
if ($this->_rgid) {
$rgDao = new CRM_Dedupe_DAO_RuleGroup();
$rgDao->id = $this->_rgid;