From da1e83b3b33acd860eab62510ead0e23c70d380b Mon Sep 17 00:00:00 2001 From: Anne-Cath Date: Fri, 16 Jan 2026 10:41:25 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B09100=20-=20CSVImport:=20during=20creatio?= =?UTF-8?q?n=20test=20on=20hierarchicalKey=20don't=20work=20as=20expected?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/bulkchange.class.inc.php | 2 ++ core/valuesetdef.class.inc.php | 5 +++++ sources/Core/AttributeDefinition/AttributeExternalKey.php | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/bulkchange.class.inc.php b/core/bulkchange.class.inc.php index 8dd01b6ec3..ad35722812 100644 --- a/core/bulkchange.class.inc.php +++ b/core/bulkchange.class.inc.php @@ -550,6 +550,8 @@ protected function PrepareObject(&$oTargetObj, $aRowData, &$aErrors) // if (!array_key_exists($sAttCode, $this->m_aAttList)) continue; $oExtKey = MetaModel::GetAttributeDef(get_class($oTargetObj), $sAttCode); + //remove any loaded value to avoid problems with data already in memory due to previous operations + $oExtKey->RemoveLoaded(); if ($this->IsNullExternalKeySpec($aRowData, $sAttCode)) { foreach ($aReconKeys as $sReconKeyAttCode => $iCol) { diff --git a/core/valuesetdef.class.inc.php b/core/valuesetdef.class.inc.php index 8a9c91494c..3374b5baa3 100644 --- a/core/valuesetdef.class.inc.php +++ b/core/valuesetdef.class.inc.php @@ -179,6 +179,11 @@ public function ToObjectSet($aArgs = [], $sContains = '', $iAdditionalValue = nu return new DBObjectSet($oFilter, $this->m_aOrderBy, $aArgs); } + public function RemoveLoaded() + { + $this->m_bIsLoaded = false; + } + /** * @inheritDoc * @throws CoreException diff --git a/sources/Core/AttributeDefinition/AttributeExternalKey.php b/sources/Core/AttributeDefinition/AttributeExternalKey.php index 10783fffb5..7c9b77aa8d 100644 --- a/sources/Core/AttributeDefinition/AttributeExternalKey.php +++ b/sources/Core/AttributeDefinition/AttributeExternalKey.php @@ -153,7 +153,13 @@ public function GetValuesDef() return $oValSetDef; } - + public function RemoveLoaded() + { + $oValSetDef = $this->Get("allowed_values"); + if ($oValSetDef) { + $oValSetDef->RemoveLoaded(); + } + } public function GetAllowedValues($aArgs = [], $sContains = '') { //throw new Exception("GetAllowedValues on ext key has been deprecated");