N°1910 - iTop - Search on Text contains "_" not working

_ is a special caracter in mysql -> replace with \_
This commit is contained in:
acognet
2020-03-30 16:11:57 +02:00
parent 011d742ae3
commit fc7b772ba3
2 changed files with 3 additions and 2 deletions

View File

@@ -564,7 +564,7 @@ try
$sFullText = trim($aMatches[2]);
}
}
$sFullText = str_replace('_', '\_', $sFullText);
if (preg_match('/^"(.*)"$/', $sFullText, $aMatches))
{
// The text is surrounded by double-quotes, remove the quotes and treat it as one single expression
@@ -596,7 +596,7 @@ try
break;
}
$sFullText = implode(' ', $aFullTextNeedles);
$sFullText = str_replace('\_', '_', $sFullText);
// Sanity check of the accelerators
/** @var array $aAccelerators */
$aAccelerators = MetaModel::GetConfig()->Get('full_text_accelerators');

View File

@@ -123,6 +123,7 @@ class CriterionToOQL extends CriterionConversionAbstract
{
return "1";
}
$sValue = str_replace('_', '\_', $sValue);
return "({$sRef} LIKE '%{$sValue}%')";
}