From a1ad7a5def79f621176b8210807a5a55114e4522 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 20 Sep 2018 15:57:37 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B0931:=20Fix=20Search=20when=20screen=20is?= =?UTF-8?q?=20refreshed=20(number=20of=20selected=20criteria=20for=20tags)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/attributedef.class.inc.php | 16 ++++++++++++---- core/oql/expression.class.inc.php | 2 +- core/ormtagset.class.inc.php | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 8af29086b4..08ee16d9d9 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -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; } } } diff --git a/core/oql/expression.class.inc.php b/core/oql/expression.class.inc.php index 169ed1e43f..5c8d343350 100644 --- a/core/oql/expression.class.inc.php +++ b/core/oql/expression.class.inc.php @@ -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(); diff --git a/core/ormtagset.class.inc.php b/core/ormtagset.class.inc.php index 8f9c5e6674..f06ce9efba 100644 --- a/core/ormtagset.class.inc.php +++ b/core/ormtagset.class.inc.php @@ -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;