Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Nov 23, 2023
1 parent 7c1a56c commit 36a447b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
105 changes: 52 additions & 53 deletions ZUGFeRD/InvoiceDescriptor21Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,37 +1178,37 @@ private void _writeOptionalLegalOrganization(ProfileAwareXmlTextWriter writer, s
// all profiles
break;
case PartyTypes.ShipToTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.UltimateShipToTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.ShipFromTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.InvoiceeTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.PayeeTradeParty:
// all profiles
break;
case PartyTypes.SalesAgentTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.BuyerTaxRepresentativeTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.ProductEndUserTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.BuyerAgentTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.InvoicerTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.PayerTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; } // extended profile only
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
default:
return;
Expand Down Expand Up @@ -1258,37 +1258,37 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa
case PartyTypes.BuyerTradeParty:
break;
case PartyTypes.ShipToTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.UltimateShipToTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.ShipFromTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.InvoiceeTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.PayeeTradeParty:
if (this.Descriptor.Profile == Profile.Minimum) { return; } // party is written for all profiles but minimum
break;
case PartyTypes.SalesAgentTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.BuyerTaxRepresentativeTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.ProductEndUserTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.BuyerAgentTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.InvoicerTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
case PartyTypes.PayerTradeParty:
if (this.Descriptor.Profile != Profile.Extended) { return; }
if ((this.Descriptor.Profile != Profile.Extended) && (this.Descriptor.Profile != Profile.XRechnung1) && (this.Descriptor.Profile != Profile.XRechnung)) { return; } // extended, XRechnung1, XRechnung profile only
break;
default:
return;
Expand Down Expand Up @@ -1368,11 +1368,7 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa
}

_writeOptionalLegalOrganization(writer, "ram:SpecifiedLegalOrganization", party.SpecifiedLegalOrganization, partyType);

if (contact != null)
{
_writeOptionalContact(writer, "ram:DefinedTradeContact", contact, Profile.Extended | Profile.XRechnung1 | Profile.XRechnung);
}
_writeOptionalContact(writer, "ram:DefinedTradeContact", contact, Profile.Extended | Profile.XRechnung1 | Profile.XRechnung);

writer.WriteStartElement("ram:PostalTradeAddress");
writer.WriteElementString("ram:PostcodeCode", party.Postcode); // BT-53
Expand Down Expand Up @@ -1424,43 +1420,46 @@ private void _writeOptionalParty(ProfileAwareXmlTextWriter writer, PartyTypes pa

private void _writeOptionalContact(ProfileAwareXmlTextWriter writer, string contactTag, Contact contact, Profile profile = Profile.Unknown)
{
if (contact != null)
if (contact == null)
{
writer.WriteStartElement(contactTag, profile);
return;
}

if (!String.IsNullOrEmpty(contact.Name))
{
writer.WriteElementString("ram:PersonName", contact.Name);
}

if (!String.IsNullOrEmpty(contact.OrgUnit))
{
writer.WriteElementString("ram:DepartmentName", contact.OrgUnit);
}
writer.WriteStartElement(contactTag, profile);

if (!String.IsNullOrEmpty(contact.PhoneNo))
{
writer.WriteStartElement("ram:TelephoneUniversalCommunication");
writer.WriteElementString("ram:CompleteNumber", contact.PhoneNo);
writer.WriteEndElement();
}
if (!String.IsNullOrEmpty(contact.Name))
{
writer.WriteElementString("ram:PersonName", contact.Name);
}

if (!String.IsNullOrEmpty(contact.FaxNo))
{
writer.WriteStartElement("ram:FaxUniversalCommunication", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung));
writer.WriteElementString("ram:CompleteNumber", contact.FaxNo);
writer.WriteEndElement();
}
if (!String.IsNullOrEmpty(contact.OrgUnit))
{
writer.WriteElementString("ram:DepartmentName", contact.OrgUnit);
}

if (!String.IsNullOrEmpty(contact.EmailAddress))
{
writer.WriteStartElement("ram:EmailURIUniversalCommunication");
writer.WriteElementString("ram:URIID", contact.EmailAddress);
writer.WriteEndElement();
}
if (!String.IsNullOrEmpty(contact.PhoneNo))
{
writer.WriteStartElement("ram:TelephoneUniversalCommunication");
writer.WriteElementString("ram:CompleteNumber", contact.PhoneNo);
writer.WriteEndElement();
}

if (!String.IsNullOrEmpty(contact.FaxNo))
{
writer.WriteStartElement("ram:FaxUniversalCommunication", ALL_PROFILES ^ (Profile.XRechnung1 | Profile.XRechnung));
writer.WriteElementString("ram:CompleteNumber", contact.FaxNo);
writer.WriteEndElement();
}

if (!String.IsNullOrEmpty(contact.EmailAddress))
{
writer.WriteStartElement("ram:EmailURIUniversalCommunication");
writer.WriteElementString("ram:URIID", contact.EmailAddress);
writer.WriteEndElement();
}

writer.WriteEndElement();
} // !_writeOptionalContact()


Expand Down
9 changes: 5 additions & 4 deletions ZUGFeRD/ZUGFeRD.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461;net480</TargetFrameworks>
<Version>12.3.0</Version>
<Version>12.3.1</Version>
<Authors>Stephan Stapel</Authors>
<Company>s2 industries</Company>
<Description>ZUGFeRD and it's successor Factur-X/ XRechnung are initiatives from German (respectively European) government to foster electronic invoices.
Expand All @@ -22,15 +22,16 @@ https://github.com/stephanstapel/ZUGFeRD-csharp</Description>
<PackageProjectUrl>https://github.com/stephanstapel/ZUGFeRD-csharp/</PackageProjectUrl>
<PackageTags>zugferd xml</PackageTags>
<Copyright>Stephan Stapel, s2 industries, 2023</Copyright>
<AssemblyVersion>12.3.0</AssemblyVersion>
<AssemblyVersion>12.3.1</AssemblyVersion>
<AssemblyTrademark>http://www.s2-industries.com</AssemblyTrademark>
<FileVersion>12.3.0.0</FileVersion>
<FileVersion>12.3.1.0</FileVersion>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<AssemblyName>s2industries.ZUGFeRD</AssemblyName>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ZUGFeRD.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageReleaseNotes>12.3.0: enhanced standard conformance for all party types</PackageReleaseNotes>
<PackageReleaseNotes>12.3.1: bug fix for all party types
12.3.0: enhanced standard conformance for all party types</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>ZUGFeRD-csharp</PackageId>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down

0 comments on commit 36a447b

Please sign in to comment.