N°7134 - Can't retrieve the list of changes when editing URP_UserProfile

This commit is contained in:
jf-cbd
2024-01-17 15:12:55 +01:00
parent aecc34a78b
commit 436b6808b5
3 changed files with 1 additions and 39 deletions

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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);
}