From 69ce9dadbe6520ca974d9e9cfecea978ba80bf87 Mon Sep 17 00:00:00 2001 From: pitzm Date: Thu, 24 Sep 2026 11:49:06 +0200 Subject: [PATCH] =?UTF-8?q?ZUGFERD=20REST=20Service:=20Exception,=20wenn?= =?UTF-8?q?=20Knoten=20f=C3=BCr=20neue=20Tabelle=20nicht=20vorhanden=20war?= =?UTF-8?q?en.=20Korrektur=20&=20Pr=C3=BCfung=20aller=20Eingaben?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ValidationController.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/WEBSERVICES/ZUGFeRDRESTService/Controllers/ValidationController.cs b/WEBSERVICES/ZUGFeRDRESTService/Controllers/ValidationController.cs index fc98d01a..291b10e3 100644 --- a/WEBSERVICES/ZUGFeRDRESTService/Controllers/ValidationController.cs +++ b/WEBSERVICES/ZUGFeRDRESTService/Controllers/ValidationController.cs @@ -283,9 +283,9 @@ namespace ZUGFeRDRESTService.Controllers _UserLanguageCode = GERMAN; } - _ParserResult.WebFilename = file.FileName; - _ParserResult.WebMailAdress = oUserId; - _ParserResult.WebLanguage = _UserLanguageCode; + _ParserResult.WebFilename = file != null && !string.IsNullOrEmpty(file.FileName) ? file.FileName : string.Empty; + _ParserResult.WebMailAdress = !string.IsNullOrEmpty(oUserId) ? oUserId : string.Empty; + _ParserResult.WebLanguage = !string.IsNullOrEmpty(_UserLanguageCode) ? _UserLanguageCode : string.Empty; try { @@ -322,9 +322,9 @@ namespace ZUGFeRDRESTService.Controllers oZugferdResult.ReceiptFileType = "XML"; } - _ParserResult.XML_Specification = oZugferdResult.Specification; - _ParserResult.XML_Schema = oZugferdResult.UsedXMLSchema; - _ParserResult.XML_FileType = oZugferdResult.ReceiptFileType; + _ParserResult.XML_Specification = !string.IsNullOrEmpty(oZugferdResult.Specification) ? oZugferdResult.Specification : string.Empty; + _ParserResult.XML_Schema = !string.IsNullOrEmpty(oZugferdResult.UsedXMLSchema) ? oZugferdResult.UsedXMLSchema : string.Empty; + _ParserResult.XML_FileType = !string.IsNullOrEmpty(oZugferdResult.ReceiptFileType) ? oZugferdResult.ReceiptFileType : string.Empty; _logger.Info("Detected Specification was: [{0}]", oZugferdResult.Specification); @@ -645,9 +645,13 @@ namespace ZUGFeRDRESTService.Controllers return new Tuple(false, string.Empty); } - oParserResult.XML_InvoiceNumber = pProperties.Where(p => p.EN16931_ID == "BT-1").FirstOrDefault().Value; - oParserResult.XML_SellerTradePartyName = pProperties.Where(p => p.EN16931_ID == "BT-27").FirstOrDefault().Value; - oParserResult.XML_SellerEmailAdress = pProperties.Where(p => p.EN16931_ID == "BT-34").FirstOrDefault().Value; + _logger.Debug("Collecting history data"); + var bt1Item = pProperties.Where(p => p.EN16931_ID == "BT-1").FirstOrDefault(); + oParserResult.XML_InvoiceNumber = bt1Item != null ? bt1Item.Value : string.Empty; + var bt27Item = pProperties.Where(p => p.EN16931_ID == "BT-27").FirstOrDefault(); + oParserResult.XML_SellerTradePartyName = bt27Item != null ? bt27Item.Value : string.Empty; + var bt34Item = pProperties.Where(p => p.EN16931_ID == "BT-34").FirstOrDefault(); + oParserResult.XML_SellerEmailAdress = bt34Item != null ? bt34Item.Value : string.Empty; _logger.Debug("Calling validation prodecure."); try