diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 92edb4410..a041f1476 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -3328,8 +3328,6 @@ EOF { $res = parent::DBInsertNoReload(); - InlineImage::FinalizeInlineImages($this); - // Invoke extensions after insertion (the object must exist, have an id, etc.) foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { @@ -3339,6 +3337,14 @@ EOF return $res; } + /** + * Attaches InlineImages to the current object + */ + protected function OnObjectKeyReady() + { + InlineImage::FinalizeInlineImages($this); + } + protected function DBCloneTracked_Internal($newKey = null) { $oNewObj = parent::DBCloneTracked_Internal($newKey); diff --git a/core/dbobject.class.php b/core/dbobject.class.php index 500664056..0163fb1b5 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1411,6 +1411,12 @@ abstract class DBObject implements iDisplay return true; } + // used only by insert + protected function OnObjectKeyReady() + { + // Meant to be overloaded + } + // used both by insert/update private function DBWriteLinks() { @@ -1648,7 +1654,9 @@ abstract class DBObject implements iDisplay $this->DBInsertSingleTable($sParentClass); } - $this->DBWriteLinks(); + $this->OnObjectKeyReady(); + + $this->DBWriteLinks(); $this->WriteExternalAttributes(); $this->m_bIsInDB = true;