mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°931: Fix Search when screen is refreshed (number of selected criteria for tags)
This commit is contained in:
@@ -6729,17 +6729,25 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
* Extract all existing tags from a string and ignore bad tags
|
||||
*
|
||||
* @param $sValue
|
||||
* @param bool $bNoLimit : don't apply the maximum tag limit
|
||||
*
|
||||
* @return \ormTagSet
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
*/
|
||||
public function GetExistingTagsFromString($sValue)
|
||||
public function GetExistingTagsFromString($sValue, $bNoLimit = false)
|
||||
{
|
||||
$aTagCodes = explode(' ', "$sValue");
|
||||
$sAttCode = $this->GetCode();
|
||||
$sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $sAttCode);
|
||||
$oTagSet = new ormTagSet($sClass, $sAttCode, $this->GetTagMaxNb());
|
||||
if ($bNoLimit)
|
||||
{
|
||||
$oTagSet = new ormTagSet($sClass, $sAttCode, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$oTagSet = new ormTagSet($sClass, $sAttCode, $this->GetTagMaxNb());
|
||||
}
|
||||
$aGoodTags = array();
|
||||
foreach($aTagCodes as $sTagCode)
|
||||
{
|
||||
@@ -6750,10 +6758,10 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
if ($oTagSet->IsValidTag($sTagCode))
|
||||
{
|
||||
$aGoodTags[] = $sTagCode;
|
||||
if (count($aGoodTags) === $this->GetTagMaxNb())
|
||||
if (!$bNoLimit && (count($aGoodTags) === $this->GetTagMaxNb()))
|
||||
{
|
||||
// extra and bad tags are ignored
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ class ScalarExpression extends UnaryExpression
|
||||
$oValue = $this->GetValue();
|
||||
if (is_string($oValue))
|
||||
{
|
||||
$oValue = $oAttDef->GetExistingTagsFromString($oValue);
|
||||
$oValue = $oAttDef->GetExistingTagsFromString($oValue, true);
|
||||
}
|
||||
/** @var \ormTagSet $oValue */
|
||||
$aTags = $oValue->GetTags();
|
||||
|
||||
@@ -131,7 +131,7 @@ final class ormTagSet
|
||||
foreach($aTagCodes as $sTagCode)
|
||||
{
|
||||
$iCount++;
|
||||
if ($iCount > $this->iLimit)
|
||||
if (($this->iLimit != 0) && ($iCount > $this->iLimit))
|
||||
{
|
||||
$bError = true;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user