diff --git a/core/dbobject.class.php b/core/dbobject.class.php index d4ac3e97d..25fe57f3a 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -1653,10 +1653,11 @@ abstract class DBObject protected function DBDeleteSingleObject() { - $this->OnDelete(); - if (!MetaModel::DBIsReadOnly()) { + $this->OnDelete(); + $this->RecordObjDeletion($this->m_iKey); // May cause a reload for storing history information + foreach(MetaModel::ListAttributeDefs(get_class($this)) as $sAttCode => $oAttDef) { if ($oAttDef->IsHierarchicalKey()) @@ -1689,14 +1690,12 @@ abstract class DBObject { $this->DBDeleteSingleTable($sParentClass); } + + $this->AfterDelete(); + + $this->m_bIsInDB = false; + $this->m_iKey = null; } - - $this->AfterDelete(); - - $this->RecordObjDeletion($this->m_iKey); - - $this->m_bIsInDB = false; - $this->m_iKey = null; } // Delete an object... and guarantee data integrity