N°4756 - Ease extensibility for CRUD operations : Add unit tests

This commit is contained in:
Eric Espie
2023-01-12 17:40:17 +01:00
parent 5d1852fe45
commit 06a5d645da
3 changed files with 752 additions and 2 deletions

View File

@@ -3345,10 +3345,12 @@ abstract class DBObject implements iDisplay
$this->m_bDirty = false;
$this->m_aTouchedAtt = array();
$this->m_aModifiedAtt = array();
$bModifiedByUpdateDone = false;
try {
$this->EventUpdateDone($aChanges);
$this->AfterUpdate();
// Save the status as it is reset just after...
$bModifiedByUpdateDone = $this->IsModified();
// Reset original values although the object has not been reloaded
foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) {
@@ -3388,7 +3390,7 @@ abstract class DBObject implements iDisplay
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
}
if ($this->IsModified()) {
if ($this->IsModified() || $bModifiedByUpdateDone) {
// Controlled reentrance
$this->DBUpdate();
}