diff --git a/core/tagsetfield.class.inc.php b/core/tagsetfield.class.inc.php index 7cee91b75..48c337cff 100644 --- a/core/tagsetfield.class.inc.php +++ b/core/tagsetfield.class.inc.php @@ -234,21 +234,29 @@ abstract class TagSetFieldData extends cmdbAbstractObject $oSet = new DBObjectSet($oFilter); $iCount = $oSet->Count(); $oPage->SetCurrentTab(Dict::Format('Core:TagSetFieldData:WhereIsThisTagTab', $iCount)); - $aClassLabels = array(); - foreach(MetaModel::EnumChildClasses($sClass) as $sCurrentClass) + if ($iCount === 0) { - $aClassLabels[$sCurrentClass] = MetaModel::GetName($sCurrentClass); + $sNoEntries = Dict::S('Core:TagSetFieldData:NoEntryFound'); + $oPage->add("

$sNoEntries

"); } - - foreach($aClassLabels as $sClass => $sClassLabel) + else { - $oFilter = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'"); - $oSet = new DBObjectSet($oFilter); - if ($oSet->CountExceeds(0)) + $aClassLabels = array(); + foreach(MetaModel::EnumChildClasses($sClass) as $sCurrentClass) { - $oPage->add("

$sClassLabel

"); - $oResultBlock = new DisplayBlock($oFilter, 'list', false); - $oResultBlock->Display($oPage, 1); + $aClassLabels[$sCurrentClass] = MetaModel::GetName($sCurrentClass); + } + + foreach($aClassLabels as $sClass => $sClassLabel) + { + $oFilter = DBSearch::FromOQL("SELECT $sClass WHERE $sAttCode MATCHES '$sTagCode'"); + $oSet = new DBObjectSet($oFilter); + if ($oSet->CountExceeds(0)) + { + $oPage->add("

$sClassLabel

"); + $oResultBlock = new DisplayBlock($oFilter, 'list', false); + $oResultBlock->Display($oPage, 1); + } } } } diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php index 24de351c1..a59c8fcfd 100644 --- a/dictionaries/en.dictionary.itop.core.php +++ b/dictionaries/en.dictionary.itop.core.php @@ -923,4 +923,5 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Tags label should not contain | nor be empty', 'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Tags code cannot be changed', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)', + 'Core:TagSetFieldData:NoEntryFound' => 'No entry found for this tag', )); diff --git a/dictionaries/fr.dictionary.itop.core.php b/dictionaries/fr.dictionary.itop.core.php index 0e16d3013..599fe217a 100644 --- a/dictionaries/fr.dictionary.itop.core.php +++ b/dictionaries/fr.dictionary.itop.core.php @@ -774,4 +774,6 @@ Opérateurs :
'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Le nom de l\'étiquette ne doit pas être vide ni contenir le caractère \'|\'', 'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Le code de l\'étiquette ne peut pas être changé', 'Core:TagSetFieldData:WhereIsThisTagTab' => 'Utilisation (%1$d)', + 'Core:TagSetFieldData:NoEntryFound' => 'Pas d\'utilisation de cette étiquette', + ));