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");