diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 200f349c9..db1620c0f 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -9694,6 +9694,21 @@ abstract class AttributeSet extends AttributeDBFieldVoid return parent::GetAllowedValues($aArgs, $sContains); } + /** + * Allowed different values for the set values are mandatory for this attribute to be modified + * + * @param array $aArgs + * @param string $sContains + * + * @return array|null + * @throws \CoreException + * @throws \OQLException + */ + public function GetPossibleValues($aArgs = array(), $sContains = '') + { + return $this->GetAllowedValues($aArgs, $sContains); + } + /** * @param \ormSet $oValue * @@ -9708,7 +9723,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid $aJson = array(); // possible_values - $aAllowedValues = $this->GetAllowedValues($aArgs); + $aAllowedValues = $this->GetPossibleValues($aArgs); $aSetKeyValData = array(); foreach($aAllowedValues as $sCode => $sLabel) { @@ -10054,13 +10069,20 @@ class AttributeEnumSet extends AttributeSet { const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; - public function GetAllowedValues($aArgs = array(), $sContains = '') + public static function ListExpectedParams() { - $aRawValues = parent::GetAllowedValues($aArgs, $sContains); - if (is_null($aRawValues)) + return array_merge(parent::ListExpectedParams(), array('possible_values', 'is_null_allowed', 'max_items')); + } + + public function GetPossibleValues($aArgs = array(), $sContains = '') + { + $oValSetDef = $this->Get('possible_values'); + if (!$oValSetDef) { return null; } + + $aRawValues = $oValSetDef->GetValues($aArgs, $sContains); $aLocalizedValues = array(); foreach($aRawValues as $sKey => $sValue) { diff --git a/core/trigger.class.inc.php b/core/trigger.class.inc.php index 8240d57ef..9ad798699 100644 --- a/core/trigger.class.inc.php +++ b/core/trigger.class.inc.php @@ -58,7 +58,7 @@ abstract class Trigger extends cmdbAbstractObject MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list", array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array()))); $aTags = ContextTag::GetTags(); $sTags = implode(',', $aTags); - MetaModel::Init_AddAttribute( new AttributeEnumSet("context", array("allowed_values" => new ValueSetEnum($sTags), "sql" => "context", "depends_on" => array(), "is_null_allowed" => true, "max_items" => 12))); + MetaModel::Init_AddAttribute( new AttributeEnumSet("context", array("allowed_values" => null, "possible_values" => new ValueSetEnum($sTags), "sql" => "context", "depends_on" => array(), "is_null_allowed" => true, "max_items" => 12))); // Display lists MetaModel::Init_SetZListItems('details', array('finalclass', 'description', 'context', 'action_list')); // Attributes to be displayed for the complete details