$inVal = trim($v[2]);
//checking for format to avoid db errors
if ($type == 'Int') {
- if (!preg_match('/^[(]([A-Za-z0-9\,]+)[)]$/', $inVal)) {
+ if (!preg_match('/^[A-Za-z0-9\,]+$/', $inVal)) {
$errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data (in valid format).");
}
}
else {
- if (!(substr($inVal, 0, 1) == '(' && substr($inVal, -1, 1) == ')') && !preg_match('/^[(]([A-Za-z0-9åäöÅÄÖüÜœŒæÆøØ\,\s]+)[)]$/', $inVal)) {
+ if (!preg_match('/^[A-Za-z0-9åäöÅÄÖüÜœŒæÆøØ()\,\s]+$/', $inVal)) {
$errorMsg["value[$v[3]][$v[4]]"] = ts("Please enter correct Data (in valid format).");
}
}
if ($html_type == 'CheckBox') {
$newData = array();
foreach ($checkedData as $v) {
- $newData[$v] = 1;
+ $v = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, '', $v);
+ $newData[] = $v;
}
$checkedData = $newData;
}
// CRM-14563,CRM-16575 : Special handling of multi-select custom fields
if ($isSerialized && !empty($value)) {
if (strstr($op, 'IN')) {
- $value = str_replace(array('(', ')'), '', str_replace(",", "[[:cntrl:]]|[[:cntrl:]]", $value));
+ $value = str_replace(",", "[[:cntrl:]]*|[[:cntrl:]]*", $value);
}
$op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE';
- $value = "[[:cntrl:]]" . $value . "[[:cntrl:]]";
+ $value = "[[:cntrl:]]*" . $value . "[[:cntrl:]]*";
if (!$wildcard) {
- $value = str_replace("[[:cntrl:]]|", '', $value);
+ $value = str_replace("[[:cntrl:]]*|", '', $value);
}
}
$value = $params['value'][$key][$k];
if ($fldName == 'group' || $fldName == 'tag') {
$value = trim($value);
- $value = str_replace('(', '', $value);
- $value = str_replace(')', '', $value);
$v = explode(',', $value);
$value = array();
}
// CRM-14983: verify if values are comma separated convert to array
- if (!is_array($value) && (strpos($value, ',') !== FALSE || strstr($value, '(')) && substr($fldName, 0, 7) != 'custom_' && $params['operator'][$key][$k] == 'IN') {
- $value = explode(',', trim($value, "(..)"));
+ if (!is_array($value) && strstr($params['operator'][$key][$k], 'IN')) {
+ $value = explode(',', $value);
$value = array($params['operator'][$key][$k] => $value);
}
.on('change', '.crm-search-value select', function() {
var value = $(this).val() || '';
if ($(this).attr('multiple') == 'multiple' && value.length) {
- value = '(' + value.join(',') + ')';
+ value = value.join(',');
}
$(this).siblings('input').val(value);
})