Ver Fonte

Fixed regression due to the changes with 'finalclass', the value stored in the DB was the base class.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@382 a333f486-631f-4898-b8df-5754b55c2be0
romainq há 15 anos atrás
pai
commit
044ce2297a
2 ficheiros alterados com 14 adições e 1 exclusões
  1. 11 0
      core/attributedef.class.inc.php
  2. 3 1
      core/metamodel.class.php

+ 11 - 0
core/attributedef.class.inc.php

@@ -685,6 +685,8 @@ class AttributeFinalClass extends AttributeString
 		$this->m_sCode = $sCode;
 		$aParams["allowed_values"] = null;
 		parent::__construct($sCode, $aParams);
+
+		$this->m_sValue = $this->Get("default_value");
 	}
 
 	public function IsWritable()
@@ -692,6 +694,15 @@ class AttributeFinalClass extends AttributeString
 		return false;
 	}
 
+	public function SetFixedValue($sValue)
+	{
+		$this->m_sValue = $sValue;
+	}
+	public function GetDefaultValue()
+	{
+		return $this->m_sValue;
+	}
+
 	public function GetAsHTML($sValue)
 	{
 		return MetaModel::GetName($sValue);

+ 3 - 1
core/metamodel.class.php

@@ -926,7 +926,9 @@ abstract class MetaModel
 				{
 					throw new CoreException("Class $sChildClass, 'finalclass' is a reserved keyword, it cannot be used as a filter code");
 				}
-				self::$m_aAttribDefs[$sChildClass]['finalclass'] = clone $oClassAtt;
+				$oCloned = clone $oClassAtt;
+				$oCloned->SetFixedValue($sChildClass);
+				self::$m_aAttribDefs[$sChildClass]['finalclass'] = $oCloned;
 				self::$m_aAttribOrigins[$sChildClass]['finalclass'] = $sRootClass;
 
 				$oClassFlt = new FilterFromAttribute($oClassAtt);