From 904b04699598462e429ba7503381d780f8b2e591 Mon Sep 17 00:00:00 2001 From: Mark Hanna Date: Sat, 21 Oct 2017 15:33:15 -0500 Subject: [PATCH] backported fix for CRM-20907 --- CRM/Contact/Form/DedupeRules.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php index bb4e553c82..ac57d1a640 100644 --- a/CRM/Contact/Form/DedupeRules.php +++ b/CRM/Contact/Form/DedupeRules.php @@ -57,7 +57,14 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { } $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; -- 2.25.1