diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php
index 3ca36db19..bc3455d5c 100644
--- a/core/attributedef.class.inc.php
+++ b/core/attributedef.class.inc.php
@@ -6696,7 +6696,6 @@ class AttributeExternalField extends AttributeDefinition
{
return false;
}
-
}
@@ -7021,7 +7020,7 @@ class AttributeTagSet extends AttributeDBFieldVoid
{
$aValues = $sValue->GetLabels();
- return implode(' ', $aValues);
+ return implode(', ', $aValues);
}
throw new CoreWarning('Expected the attribute value to be a TagSet', array(
'found_type' => gettype($sValue),
@@ -7328,7 +7327,7 @@ class AttributeTagSet extends AttributeDBFieldVoid
public function EnumTemplateVerbs()
{
return array(
- '' => 'Plain text (unlocalized) representation',
+ '' => 'Plain text representation',
'html' => 'HTML representation (unordered list)',
);
}
@@ -7351,16 +7350,18 @@ class AttributeTagSet extends AttributeDBFieldVoid
if ($bLocalize)
{
$aValues = $value->GetLabels();
+ $sSep = ', ';
}
else
{
$aValues = $value->GetValue();
+ $sSep = ' ';
}
switch ($sVerb)
{
case '':
- return implode(' ', $aValues);
+ return implode($sSep, $aValues);
case 'html':
return '
- '.implode("
- ", $aValues).'
';
diff --git a/core/tagsetfield.class.inc.php b/core/tagsetfield.class.inc.php
index 11f5e5791..13e1519c6 100644
--- a/core/tagsetfield.class.inc.php
+++ b/core/tagsetfield.class.inc.php
@@ -56,7 +56,8 @@ abstract class TagSetFieldData extends cmdbAbstractObject
"sql" => 'code',
"default_value" => '',
"is_null_allowed" => false,
- "depends_on" => array()
+ "depends_on" => array(),
+ "validation_pattern" => '^[a-zA-Z0-9]{3,}$',
)));
MetaModel::Init_AddAttribute(new AttributeString("label", array(
"allowed_values" => null,
@@ -180,6 +181,26 @@ abstract class TagSetFieldData extends cmdbAbstractObject
$this->m_aCheckIssues[] = Dict::Format('Core:TagSetFieldData:ErrorTagCodeSyntax', $iMaxLen);
}
+ // Check that the code is not a MySQL stop word
+ $sSQL = "SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD";
+ try
+ {
+ $aResults = CMDBSource::QueryToArray($sSQL);
+ } catch (MySQLException $e)
+ {
+ IssueLog::Warning($e->getMessage());
+ $aResults = array();
+ }
+
+ foreach($aResults as $aResult)
+ {
+ if ($aResult['value'] == $sTagCode)
+ {
+ $this->m_aCheckIssues[] = Dict::S('Core:TagSetFieldData:ErrorTagCodeReservedWord');
+ break;
+ }
+ }
+
$sTagLabel = $this->Get('label');
$sSepItem = MetaModel::GetConfig()->Get('tag_set_item_separator');
if (empty($sTagLabel) || (strpos($sTagLabel, $sSepItem) !== false))
diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php
index de6c7ed83..f94562d55 100644
--- a/dictionaries/en.dictionary.itop.core.php
+++ b/dictionaries/en.dictionary.itop.core.php
@@ -917,11 +917,20 @@ Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', array(
'Class:TagSetFieldData' => '%2$s for class %1$s',
'Class:TagSetFieldData+' => '',
+
+ 'Class:TagSetFieldData/Attribute:code' => 'Code',
+ 'Class:TagSetFieldData/Attribute:code+' => 'Internal code. Must contain at least 3 alphanumeric characters',
+ 'Class:TagSetFieldData/Attribute:label' => 'Label',
+ 'Class:TagSetFieldData/Attribute:label+' => 'Displayed label',
+ 'Class:TagSetFieldData/Attribute:description' => 'Description',
+ 'Class:TagSetFieldData/Attribute:description+' => 'Description',
+
'Core:TagSetFieldData:ErrorDeleteUsedTag' => 'Used tags cannot be deleted',
'Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel' => 'Tags codes or labels must be unique',
- 'Core:TagSetFieldData:ErrorTagCodeSyntax' => 'Tags code should contain between 3 and %1$d alphanumeric characters',
- 'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Tags label should not contain \'%1$s\' nor be empty',
- 'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Tags "Code" cannot be changed',
+ 'Core:TagSetFieldData:ErrorTagCodeSyntax' => 'Tags code must contain between 3 and %1$d alphanumeric characters',
+ 'Core:TagSetFieldData:ErrorTagCodeReservedWord' => 'The chosen tag code is a reserved word',
+ 'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Tags label must not contain \'%1$s\' nor be empty',
+ 'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Tags Code cannot be changed when used',
'Core:TagSetFieldData:ErrorClassUpdateNotAllowed' => 'Tags "Object Class" cannot be changed',
'Core:TagSetFieldData:ErrorAttCodeUpdateNotAllowed' => 'Tags "Attribute Code" cannot be changed',
'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)',
diff --git a/dictionaries/fr.dictionary.itop.core.php b/dictionaries/fr.dictionary.itop.core.php
index b622efafd..c2fc4af01 100644
--- a/dictionaries/fr.dictionary.itop.core.php
+++ b/dictionaries/fr.dictionary.itop.core.php
@@ -768,9 +768,18 @@ Opérateurs :
'Class:TagSetFieldData' => '%2$s pour la classe %1$s',
'Class:TagSetFieldData+' => '',
+
+ 'Class:TagSetFieldData/Attribute:code' => 'Code',
+ 'Class:TagSetFieldData/Attribute:code+' => 'Code interne. Doit contenir au moins 3 caractères alphanumériques',
+ 'Class:TagSetFieldData/Attribute:label' => 'Label',
+ 'Class:TagSetFieldData/Attribute:label+' => 'Label',
+ 'Class:TagSetFieldData/Attribute:description' => 'Description',
+ 'Class:TagSetFieldData/Attribute:description+' => 'Description',
+
'Core:TagSetFieldData:ErrorDeleteUsedTag' => 'Impossible de supprimer une étiquette utilisée',
'Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel' => 'Les codes et noms des étiquettes doivent être unique',
'Core:TagSetFieldData:ErrorTagCodeSyntax' => 'Le code de l\'étiquette doit contenir entre 3 et %1$d caractères alphanumériques.',
+ 'Core:TagSetFieldData:ErrorTagCodeReservedWord' => 'Le code de l\'étiquette un mot réservé.',
'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Le nom de l\'étiquette ne doit pas être vide ni contenir le caractère \'%1$s\'',
'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Le code de l\'étiquette ne peut pas être changé',
'Core:TagSetFieldData:ErrorClassUpdateNotAllowed' => 'La classe de l\'étiquette ne peut pas être changée',