From c18f7316601b95a9f100d4109cdc532d670a150a Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Sat, 1 May 2010 17:20:56 +0000 Subject: [PATCH] Fixed regression due to the changes with 'finalclass', the value stored in the DB was the base class. SVN:trunk[382] --- core/attributedef.class.inc.php | 11 +++++++++++ core/metamodel.class.php | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 0556d72e2e..275b8d25f1 100644 --- a/core/attributedef.class.inc.php +++ b/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); diff --git a/core/metamodel.class.php b/core/metamodel.class.php index c9957c1960..00b3489af6 100644 --- a/core/metamodel.class.php +++ b/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);