N°931: Start bulk modify implementation

This commit is contained in:
Eric
2018-09-06 15:42:10 +02:00
parent f871581997
commit e2c3ea22e4
4 changed files with 1177 additions and 889 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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()));
}
/**

View File

@@ -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);
}
/**

View File

@@ -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];
}
}