From db7b58d12430c7685881f283c533939d7afddb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rottsch=C3=A4fer=2C=20Daniel?= Date: Wed, 14 Feb 2024 13:25:56 +0100 Subject: [PATCH] 1. The `SetBuyer` and `SetSeller` methods in the `InvoiceDescriptor.cs` file have been updated to include an optional parameter for `id`. This parameters has a default values of `null`. This change allows for more flexibility when setting the buyer or seller information. (Reference: `InvoiceDescriptor.cs`) 2. In the `InvoiceDescriptor21Writer.cs` file, a condition has been added to the `else` clause in the `if` statement. Now, the `ram:ID` element will only be written if `party.ID.ID` is not null or an empty string. This change prevents writing an emtpy 'ram:id'. (Reference: `InvoiceDescriptor21Writer.cs`) --- ZUGFeRD/InvoiceDescriptor.cs | 4 ++-- ZUGFeRD/InvoiceDescriptor21Writer.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ZUGFeRD/InvoiceDescriptor.cs b/ZUGFeRD/InvoiceDescriptor.cs index 5e3094b0..acf34060 100644 --- a/ZUGFeRD/InvoiceDescriptor.cs +++ b/ZUGFeRD/InvoiceDescriptor.cs @@ -480,7 +480,7 @@ public void AddNote(string note, SubjectCodes subjectCode = SubjectCodes.Unknown } // !AddNote() - public void SetBuyer(string name, string postcode, string city, string street, CountryCodes country, string id, + public void SetBuyer(string name, string postcode, string city, string street, CountryCodes country, string id = null, GlobalID globalID = null, string receiver = "", LegalOrganization legalOrganization = null) { this.Buyer = new Party() @@ -498,7 +498,7 @@ public void SetBuyer(string name, string postcode, string city, string street, C } - public void SetSeller(string name, string postcode, string city, string street, CountryCodes country, string id, + public void SetSeller(string name, string postcode, string city, string street, CountryCodes country, string id = null, GlobalID globalID = null, LegalOrganization legalOrganization = null) { this.Seller = new Party() diff --git a/ZUGFeRD/InvoiceDescriptor21Writer.cs b/ZUGFeRD/InvoiceDescriptor21Writer.cs index 74875b02..b685d09e 100644 --- a/ZUGFeRD/InvoiceDescriptor21Writer.cs +++ b/ZUGFeRD/InvoiceDescriptor21Writer.cs @@ -1348,7 +1348,7 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa writer.WriteValue(party.ID.ID); writer.WriteEndElement(); } - else + else if (!String.IsNullOrEmpty(party.ID.ID)) { writer.WriteElementString("ram:ID", party.ID.ID); }