From b941416de471dc6c2b9754430498a91b4153f052 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 16 Mar 2022 15:18:55 +0100 Subject: [PATCH] fix Mandator being set after applying functions that rely on it --- MultiTool.Shared/Documents/DocumentLoader.vb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MultiTool.Shared/Documents/DocumentLoader.vb b/MultiTool.Shared/Documents/DocumentLoader.vb index c4589b2..c981faa 100644 --- a/MultiTool.Shared/Documents/DocumentLoader.vb +++ b/MultiTool.Shared/Documents/DocumentLoader.vb @@ -246,6 +246,9 @@ Namespace Documents If oMandator Is Nothing Then Logger.Warn("Mandator not found for File [{0}]", pDocument.File.Name) Else + ' Set mandator befor applying any functions that depend on a valid mandator + pDocument.Mandator = oMandator + pDocument = ApplyDefinedItemFunctionsForImport(pDocument, oMandator, pTemplate) pDocument = ApplyDynamicItemFunctionsForImport(pDocument, oMandator) @@ -253,7 +256,6 @@ Namespace Documents pDocument = Await MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate) End If - pDocument.Mandator = oMandator Return pDocument End Function @@ -312,11 +314,11 @@ Namespace Documents Dim oFunctionParams = oColumn.Config.FunctionParams Dim oParamsDict = ParseFunctionParamsAsDict(oFunctionParams) - If oFunctionName = "GLN" Then + If oFunctionName = Constants.FUNCTION_GLN Then SetAccountByGLN(oRow, pMandator, oField.Key, Nothing, oParamsDict) End If - If oFunctionName = "EAN" Then + If oFunctionName = Constants.FUNCTION_EAN Then SetArticleByEAN(oRow, pMandator, oField.Key) End If