mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +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
|
* Extract all existing tags from a string and ignore bad tags
|
||||||
*
|
*
|
||||||
* @param $sValue
|
* @param $sValue
|
||||||
|
* @param bool $bNoLimit : don't apply the maximum tag limit
|
||||||
*
|
*
|
||||||
* @return \ormTagSet
|
* @return \ormTagSet
|
||||||
* @throws \CoreException
|
* @throws \CoreException
|
||||||
* @throws \CoreUnexpectedValue
|
* @throws \CoreUnexpectedValue
|
||||||
*/
|
*/
|
||||||
public function GetExistingTagsFromString($sValue)
|
public function GetExistingTagsFromString($sValue, $bNoLimit = false)
|
||||||
{
|
{
|
||||||
$aTagCodes = explode(' ', "$sValue");
|
$aTagCodes = explode(' ', "$sValue");
|
||||||
$sAttCode = $this->GetCode();
|
$sAttCode = $this->GetCode();
|
||||||
$sClass = MetaModel::GetAttributeOrigin($this->GetHostClass(), $sAttCode);
|
$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();
|
$aGoodTags = array();
|
||||||
foreach($aTagCodes as $sTagCode)
|
foreach($aTagCodes as $sTagCode)
|
||||||
{
|
{
|
||||||
@@ -6750,10 +6758,10 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
|||||||
if ($oTagSet->IsValidTag($sTagCode))
|
if ($oTagSet->IsValidTag($sTagCode))
|
||||||
{
|
{
|
||||||
$aGoodTags[] = $sTagCode;
|
$aGoodTags[] = $sTagCode;
|
||||||
if (count($aGoodTags) === $this->GetTagMaxNb())
|
if (!$bNoLimit && (count($aGoodTags) === $this->GetTagMaxNb()))
|
||||||
{
|
{
|
||||||
// extra and bad tags are ignored
|
// extra and bad tags are ignored
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -948,7 +948,7 @@ class ScalarExpression extends UnaryExpression
|
|||||||
$oValue = $this->GetValue();
|
$oValue = $this->GetValue();
|
||||||
if (is_string($oValue))
|
if (is_string($oValue))
|
||||||
{
|
{
|
||||||
$oValue = $oAttDef->GetExistingTagsFromString($oValue);
|
$oValue = $oAttDef->GetExistingTagsFromString($oValue, true);
|
||||||
}
|
}
|
||||||
/** @var \ormTagSet $oValue */
|
/** @var \ormTagSet $oValue */
|
||||||
$aTags = $oValue->GetTags();
|
$aTags = $oValue->GetTags();
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ final class ormTagSet
|
|||||||
foreach($aTagCodes as $sTagCode)
|
foreach($aTagCodes as $sTagCode)
|
||||||
{
|
{
|
||||||
$iCount++;
|
$iCount++;
|
||||||
if ($iCount > $this->iLimit)
|
if (($this->iLimit != 0) && ($iCount > $this->iLimit))
|
||||||
{
|
{
|
||||||
$bError = true;
|
$bError = true;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user