Skip to content

Commit

Permalink
Merge pull request #10992 from seamuslee001/CRM-20907
Browse files Browse the repository at this point in the history
CRM-20907 Ensure that contact_type is valid in deduperules
  • Loading branch information
eileenmcnaughton authored Sep 19, 2017
2 parents ccd417f + 85abc69 commit 7424a81
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CRM/Contact/Form/DedupeRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ public function preProcess() {
}
$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];
}
elseif (!empty($contactType)) {
throw new CRM_Core_Exception('Contact Type is Not valid');
}
if ($this->_rgid) {
$rgDao = new CRM_Dedupe_DAO_RuleGroup();
$rgDao->id = $this->_rgid;
Expand Down

0 comments on commit 7424a81

Please sign in to comment.