N°931: Fix Label protection for tags

This commit is contained in:
Eric
2018-09-26 16:45:54 +02:00
parent 01551942b3
commit 4b08eea998

View File

@@ -214,13 +214,14 @@ abstract class TagSetFieldData extends cmdbAbstractObject
$sClassName = get_class($this);
if (empty($id))
{
$oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE (code = '$sTagCode' OR label = '$sTagLabel')");
$oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE (code = :tag_code OR label = :tag_label)");
}
else
{
$oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE id != $id AND (code = '$sTagCode' OR label = '$sTagLabel')");
$oSearch = DBSearch::FromOQL("SELECT $sClassName WHERE id != :id AND (code = :tag_code OR label = :tag_label)");
}
$oSet = new DBObjectSet($oSearch);
$aArgs = array('id' => $id, 'tag_code' => $sTagCode, 'tag_label' => $sTagLabel);
$oSet = new DBObjectSet($oSearch, array(), $aArgs);
if ($oSet->CountExceeds(0))
{
$this->m_aCheckIssues[] = Dict::S('Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel');