Skip to content
Snippets Groups Projects
Commit f873ba92 authored by lobo's avatar lobo
Browse files

Merge pull request #734 from mlutfy/crm12606

CRM-12606: do not escape() the strings twice.
parents 11ee5a30 3df236f6
No related branches found
No related tags found
No related merge requests found
......@@ -242,8 +242,8 @@ class CRM_Custom_Form_Option extends CRM_Core_Form {
* @access public
*/
static function formRule($fields, $files, $form) {
$optionLabel = CRM_Utils_Type::escape($fields['label'], 'String');
$optionValue = CRM_Utils_Type::escape($fields['value'], 'String');
$optionLabel = $fields['label'];
$optionValue = $fields['value'];
$fieldId = $form->_fid;
$optionGroupId = $form->_optionGroupID;
......@@ -254,7 +254,8 @@ SELECT count(*)
FROM civicrm_option_value
WHERE option_group_id = %1
AND label = %2";
$params = array(1 => array($optionGroupId, 'Integer'),
$params = array(
1 => array($optionGroupId, 'Integer'),
2 => array($optionLabel, 'String'),
);
if (CRM_Core_DAO::singleValueQuery($query, $params) > 0) {
......@@ -266,7 +267,8 @@ SELECT count(*)
FROM civicrm_option_value
WHERE option_group_id = %1
AND value = %2";
$params = array(1 => array($optionGroupId, 'Integer'),
$params = array(
1 => array($optionGroupId, 'Integer'),
2 => array($optionValue, 'String'),
);
if (CRM_Core_DAO::singleValueQuery($query, $params) > 0) {
......@@ -284,7 +286,8 @@ SELECT count(*)
WHERE option_group_id = %1
AND id != %2
AND label = %3";
$params = array(1 => array($optionGroupId, 'Integer'),
$params = array(
1 => array($optionGroupId, 'Integer'),
2 => array($optionId, 'Integer'),
3 => array($optionLabel, 'String'),
);
......@@ -299,7 +302,8 @@ SELECT count(*)
WHERE option_group_id = %1
AND id != %2
AND value = %3";
$params = array(1 => array($optionGroupId, 'Integer'),
$params = array(
1 => array($optionGroupId, 'Integer'),
2 => array($optionId, 'Integer'),
3 => array($optionValue, 'String'),
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment