mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
N°931 Fix bug when max allowed items set to 1
This commit is contained in:
@@ -264,7 +264,7 @@ class ormSet
|
||||
*/
|
||||
public function Add($oItem)
|
||||
{
|
||||
if (($this->iLimit != 0) && ($this->Count() === $this->iLimit))
|
||||
if (($this->iLimit != 0) && ($this->Count() > $this->iLimit))
|
||||
{
|
||||
throw new CoreException("Maximum number of items ({$this->iLimit}) reached for {$this->sClass}:{$this->sAttCode}");
|
||||
}
|
||||
|
||||
@@ -278,6 +278,13 @@ $.widget('itop.set_widget',
|
||||
}
|
||||
}
|
||||
|
||||
// When only one item allowed, selectize doesn't trigger the _onTagRemove callback so we have to clean ourselves.
|
||||
if((this.maxItemsAllowed === 1) && (this.originalValue.length > 0)) {
|
||||
if(setItemCode !== this.originalValue[0]) {
|
||||
this.setItemsCodesStatus[this.originalValue[0]] = this.STATUS_REMOVED;
|
||||
}
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user