diff --git a/core/dbobject.class.php b/core/dbobject.class.php index dbc547d5f..21741a77f 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -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; } }