N°6237 Set external value reloaded instance in the m_aOrigValues too

This commit is contained in:
Pierre Goiffon
2023-04-27 11:44:11 +02:00
parent edaa4fca31
commit 9112a06458

View File

@@ -3397,15 +3397,15 @@ abstract class DBObject implements iDisplay
// Reset original values although the object has not been reloaded
foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) {
if ($bLoaded) {
$value = $this->m_aCurrValues[$sAttCode];
$this->m_aOrigValues[$sAttCode] = is_object($value) ? clone $value : $value;
// N°6237 reloading external values, as the object instance isn't reloaded anymore
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
$value = $oAttDef->ReadExternalValues($this);
if (false === is_null($value)) {
$this->m_aCurrValues[$sAttCode] = $value;
$externalValue = $oAttDef->ReadExternalValues($this);
if (false === is_null($externalValue)) {
$this->m_aCurrValues[$sAttCode] = $externalValue;
}
$value = $this->m_aCurrValues[$sAttCode];
$this->m_aOrigValues[$sAttCode] = is_object($value) ? clone $value : $value;
}
}