diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 9f48ccf35..ed636380b 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -2012,7 +2012,11 @@ EOF // Note: We can't use ModelFactory::GetField() as the current clas doesn't seem to be loaded yet. $oField = $this->oFactory->GetNodes('field[@id="'.$sStateAttCode.'"]', $oFields)->item(0); if ($oField == null) { - throw new DOMFormatException("Non existing attribute '$sStateAttCode'", null, null, $oStateAttribute); + // Search field in parent class + $oField = $this->GetFieldInParentClasses($oClass, $sStateAttCode); + if ($oField == null) { + throw new DOMFormatException("Non existing attribute '$sStateAttCode'", null, null, $oStateAttribute); + } } $oValues = $oField->GetUniqueElement('values'); $oValueNodes = $oValues->getElementsByTagName('value'); @@ -3736,4 +3740,19 @@ EOF; return $sValue; } + + private function GetFieldInParentClasses($oClass, $sAttCode) + { + $sParentClass = $oClass->GetChildText('parent', 'DBObject'); + if ($sParentClass != 'DBObject') { + $oParent = $this->oFactory->GetClass($sParentClass); + $oParentFields = $oParent->GetOptionalElement('fields'); + $oField = $this->oFactory->GetNodes('field[@id="'.$sAttCode.'"]', $oParentFields)->item(0); + if ($oField != null) { + return $oField; + } + return $this->GetFieldInParentClasses($oParent, $sAttCode); + } + return null; + } }