mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-04 00:24:14 +01:00
N°931: Start bulk modify implementation
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -5917,8 +5917,8 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
public function GetDefaultValue(DBObject $oHostObject = null) {return null;}
|
||||
public function IsNullAllowed() {return $this->Get("is_null_allowed");}
|
||||
|
||||
public function GetEditClass() {
|
||||
return "String";
|
||||
public function GetEditClass() {
|
||||
return "TagSet";
|
||||
}
|
||||
|
||||
public function GetEditValue($value, $oHostObj = null)
|
||||
@@ -6021,7 +6021,6 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
*/
|
||||
public function GetValueLabel($sValue)
|
||||
{
|
||||
// TODO
|
||||
return $sValue;
|
||||
}
|
||||
|
||||
@@ -6042,7 +6041,7 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
$aValues = $value->GetValue();
|
||||
return implode(' ', $aValues);
|
||||
}
|
||||
throw new CoreWarning('Expected the attribute value to be a string', array('found_type' => gettype($value), 'value' => $value, 'class' => $this->GetHostClass(), 'attribute' => $this->GetCode()));
|
||||
throw new CoreWarning('Expected the attribute value to be a TagSet', array('found_type' => gettype($value), 'value' => $value, 'class' => $this->GetHostClass(), 'attribute' => $this->GetCode()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -394,15 +394,7 @@ final class ormTagSet
|
||||
*/
|
||||
private function GetAllowedTags()
|
||||
{
|
||||
if (!$this->aAllowedTags)
|
||||
{
|
||||
$oSearch = new DBObjectSearch($this->GetTagDataClass());
|
||||
$oSearch->AddCondition('tag_class', $this->sClass);
|
||||
$oSearch->AddCondition('tag_attcode', $this->sAttCode);
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
$this->aAllowedTags = $oSet->ToArray();
|
||||
}
|
||||
return $this->aAllowedTags;
|
||||
return TagSetFieldData::GetAllowedValues($this->sClass, $this->sAttCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
*/
|
||||
abstract class TagSetFieldData extends cmdbAbstractObject
|
||||
{
|
||||
private static $m_aAllowedValues = array();
|
||||
|
||||
public static function Init()
|
||||
{
|
||||
$aParams = array
|
||||
@@ -96,4 +98,18 @@ abstract class TagSetFieldData extends cmdbAbstractObject
|
||||
$this->_Set('tag_attcode', $aMatches['attcode']);
|
||||
}
|
||||
}
|
||||
|
||||
public static function GetAllowedValues($sClass, $sAttCode)
|
||||
{
|
||||
$sTagDataClass = MetaModel::GetTagDataClass($sClass, $sAttCode);
|
||||
if (!isset(self::$m_aAllowedValues[$sTagDataClass]))
|
||||
{
|
||||
$oSearch = new DBObjectSearch($sTagDataClass);
|
||||
$oSearch->AddCondition('tag_class', $sClass);
|
||||
$oSearch->AddCondition('tag_attcode', $sAttCode);
|
||||
$oSet = new DBObjectSet($oSearch);
|
||||
self::$m_aAllowedValues[$sTagDataClass] = $oSet->ToArray();
|
||||
}
|
||||
return self::$m_aAllowedValues[$sTagDataClass];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user