diff --git a/core/dbobject.class.php b/core/dbobject.class.php index e5e35dcce..f701af3b7 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -2810,6 +2810,9 @@ abstract class DBObject implements iDisplay $this->DBWriteLinks(); $this->WriteExternalAttributes(); + // Write object creation history within the transaction + $this->RecordObjCreation(); + if ($bIsTransactionEnabled) { CMDBSource::Query('COMMIT'); } @@ -2870,8 +2873,6 @@ abstract class DBObject implements iDisplay } } - $this->RecordObjCreation(); - return $this->m_iKey; } diff --git a/test/core/CMDBSource/TransactionsTest.php b/test/core/CMDBSource/TransactionsTest.php index 4c07226d4..82594e578 100644 --- a/test/core/CMDBSource/TransactionsTest.php +++ b/test/core/CMDBSource/TransactionsTest.php @@ -123,30 +123,29 @@ class TransactionsTest extends ItopTestCase "History 13" => ['iFailAt' => 15, 'bIsInDB' => false], "History 14" => ['iFailAt' => 16, 'bIsInDB' => false], "History 15" => ['iFailAt' => 17, 'bIsInDB' => false], - // For 3.0 when CRUD sequence is ok -// "History 16" => ['iFailAt' => 18, 'bIsInDB' => false], -// "History 17" => ['iFailAt' => 19, 'bIsInDB' => false], -// "History 18" => ['iFailAt' => 20, 'bIsInDB' => false], -// "History 19" => ['iFailAt' => 21, 'bIsInDB' => false], -// "History 20" => ['iFailAt' => 22, 'bIsInDB' => false], -// "History 21" => ['iFailAt' => 23, 'bIsInDB' => false], -// "History 22" => ['iFailAt' => 24, 'bIsInDB' => false], -// "History 23" => ['iFailAt' => 25, 'bIsInDB' => false], -// "History 24" => ['iFailAt' => 26, 'bIsInDB' => false], -// "History 25" => ['iFailAt' => 27, 'bIsInDB' => false], -// "History 26" => ['iFailAt' => 28, 'bIsInDB' => false], -// "History 27" => ['iFailAt' => 29, 'bIsInDB' => false], -// "History 28" => ['iFailAt' => 30, 'bIsInDB' => false], -// "History 29" => ['iFailAt' => 31, 'bIsInDB' => false], -// "History 30" => ['iFailAt' => 32, 'bIsInDB' => false], -// "History 31" => ['iFailAt' => 33, 'bIsInDB' => false], -// "History 32" => ['iFailAt' => 34, 'bIsInDB' => false], -// "History 33" => ['iFailAt' => 35, 'bIsInDB' => false], -// "History 34" => ['iFailAt' => 36, 'bIsInDB' => false], -// "History 35" => ['iFailAt' => 37, 'bIsInDB' => false], -// "History 36" => ['iFailAt' => 38, 'bIsInDB' => false], -// "History 37" => ['iFailAt' => 39, 'bIsInDB' => false], -// "History 38" => ['iFailAt' => 40, 'bIsInDB' => false], + "History 16" => ['iFailAt' => 18, 'bIsInDB' => false], + "History 17" => ['iFailAt' => 19, 'bIsInDB' => false], + "History 18" => ['iFailAt' => 20, 'bIsInDB' => false], + "History 19" => ['iFailAt' => 21, 'bIsInDB' => false], + "History 20" => ['iFailAt' => 22, 'bIsInDB' => false], + "History 21" => ['iFailAt' => 23, 'bIsInDB' => false], + "History 22" => ['iFailAt' => 24, 'bIsInDB' => false], + "History 23" => ['iFailAt' => 25, 'bIsInDB' => false], + "History 24" => ['iFailAt' => 26, 'bIsInDB' => false], + "History 25" => ['iFailAt' => 27, 'bIsInDB' => false], + "History 26" => ['iFailAt' => 28, 'bIsInDB' => false], + "History 27" => ['iFailAt' => 29, 'bIsInDB' => false], + "History 28" => ['iFailAt' => 30, 'bIsInDB' => false], + "History 29" => ['iFailAt' => 31, 'bIsInDB' => false], + "History 30" => ['iFailAt' => 32, 'bIsInDB' => false], + "History 31" => ['iFailAt' => 33, 'bIsInDB' => false], + "History 32" => ['iFailAt' => 34, 'bIsInDB' => false], + "History 33" => ['iFailAt' => 35, 'bIsInDB' => false], + "History 34" => ['iFailAt' => 36, 'bIsInDB' => false], + "History 35" => ['iFailAt' => 37, 'bIsInDB' => false], + "History 36" => ['iFailAt' => 38, 'bIsInDB' => false], + "History 37" => ['iFailAt' => 39, 'bIsInDB' => false], + "History 38" => ['iFailAt' => 40, 'bIsInDB' => false], ]; }