[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-20907 Ensure that contact_type is valid in deduperules

2017-09-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/380677 )

Change subject: CRM-20907 Ensure that contact_type is valid in deduperules
..


CRM-20907 Ensure that contact_type is valid in deduperules

https://github.com/civicrm/civicrm-core/pull/10992

(squashed 2 into 1)

Change-Id: Ife2c109c58241ede6b17de61cf13aaf7770bfd27
---
M CRM/Contact/Form/DedupeRules.php
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php
index 82e2faf..59715a9 100644
--- a/CRM/Contact/Form/DedupeRules.php
+++ b/CRM/Contact/Form/DedupeRules.php
@@ -58,7 +58,14 @@
 }
 $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;

-- 
To view, visit https://gerrit.wikimedia.org/r/380677
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ife2c109c58241ede6b17de61cf13aaf7770bfd27
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-20907 Ensure that contact_type is valid in deduperules

2017-09-25 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380677 )

Change subject: CRM-20907 Ensure that contact_type is valid in deduperules
..

CRM-20907 Ensure that contact_type is valid in deduperules

https://github.com/civicrm/civicrm-core/pull/10992

(squashed 2 into 1)

Change-Id: Ife2c109c58241ede6b17de61cf13aaf7770bfd27
---
M CRM/Contact/Form/DedupeRules.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/77/380677/1

diff --git a/CRM/Contact/Form/DedupeRules.php b/CRM/Contact/Form/DedupeRules.php
index 82e2faf..59715a9 100644
--- a/CRM/Contact/Form/DedupeRules.php
+++ b/CRM/Contact/Form/DedupeRules.php
@@ -58,7 +58,14 @@
 }
 $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;

-- 
To view, visit https://gerrit.wikimedia.org/r/380677
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife2c109c58241ede6b17de61cf13aaf7770bfd27
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits