From 9112a06458e06d27b854d2f9f21f2cfd319dfcb5 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 27 Apr 2023 11:44:11 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B06237=20Set=20external=20value=20reloaded?= =?UTF-8?q?=20instance=20in=20the=20m=5FaOrigValues=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbobject.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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; } }