mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7134 - Can't retrieve the list of changes when editing URP_UserProfile
This commit is contained in:
@@ -6846,18 +6846,6 @@ abstract class MetaModel
|
||||
$sClass = $aRow[$sClassAlias."finalclass"];
|
||||
}
|
||||
|
||||
// if an object is already being updated, then this method will return this object instead of recreating a new one.
|
||||
// At this point the method DBUpdate of a new object with the same class and id won't do anything due to reentrance protection,
|
||||
// so to ensure that the potential modifications are correctly saved, the object currently being updated is returned.
|
||||
// DBUpdate() method then will take care that all the modifications will be saved.
|
||||
if (array_key_exists($sClassAlias.'id', $aRow)) {
|
||||
$iKey = $aRow[$sClassAlias."id"];
|
||||
$oObject = self::GetReentranceObject($sClass, $iKey);
|
||||
if ($oObject !== false) {
|
||||
return $oObject;
|
||||
}
|
||||
}
|
||||
|
||||
return new $sClass($aRow, $sClassAlias, $aAttToLoad, $aExtendedDataSpec);
|
||||
}
|
||||
|
||||
|
||||
@@ -931,32 +931,6 @@ class DBObjectTest extends ItopDataTestCase
|
||||
$this->assertEquals($sPerson2, $sPerson3);
|
||||
}
|
||||
|
||||
public function testGetObjectUpdateUnderReentryProtection()
|
||||
{
|
||||
$oPerson = $this->CreatePersonInstance();
|
||||
$oPerson->DBInsert();
|
||||
|
||||
$oPerson->Set('email', 'test@combodo.com');
|
||||
$oPerson->DBUpdate();
|
||||
|
||||
$this->assertFalse($oPerson->IsModified());
|
||||
|
||||
$oNewPerson = MetaModel::GetObject('Person', $oPerson->GetKey());
|
||||
$this->assertNotEquals($oPerson->GetObjectUniqId(), $oNewPerson->GetObjectUniqId());
|
||||
|
||||
MetaModel::StartReentranceProtection($oPerson);
|
||||
|
||||
$oPerson->Set('email', 'test1@combodo.com');
|
||||
$oPerson->DBUpdate();
|
||||
|
||||
$this->assertTrue($oPerson->IsModified());
|
||||
|
||||
$oNewPerson = MetaModel::GetObject('Person', $oPerson->GetKey());
|
||||
$this->assertEquals($oPerson->GetObjectUniqId(), $oNewPerson->GetObjectUniqId());
|
||||
|
||||
MetaModel::StopReentranceProtection($oPerson);
|
||||
}
|
||||
|
||||
public function testObjectIsReadOnly()
|
||||
{
|
||||
$oPerson = $this->CreatePersonInstance();
|
||||
|
||||
@@ -156,7 +156,7 @@ class DBObjectTest extends ItopDataTestCase
|
||||
$this->assertTrue($oPerson->IsModified());
|
||||
|
||||
$oNewPerson = MetaModel::GetObject('Person', $oPerson->GetKey());
|
||||
$this->assertEquals($oPerson->GetObjectUniqId(), $oNewPerson->GetObjectUniqId());
|
||||
$this->assertNotEquals($oPerson->GetObjectUniqId(), $oNewPerson->GetObjectUniqId());
|
||||
|
||||
MetaModel::StopReentranceProtection($oPerson);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user