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