Don't write "null" as paymentDescription if no Bank account is specified

This commit is contained in:
jstaerk
2020-12-01 18:32:46 +01:00
parent 744ffca12a
commit 57d53af39f
2 changed files with 13 additions and 4 deletions

View File

@@ -571,9 +571,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
if (trans.getPaymentTerms() == null) {
xml = xml + " <ram:SpecifiedTradePaymentTerms>\n"
+ " <ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
if ((trans.getPaymentTerms() == null)&&((paymentTermsDescription!=null)||(trans.getTradeSettlement()!=null)||(hasDueDate))) {
xml = xml + "<ram:SpecifiedTradePaymentTerms>\n";
if (paymentTermsDescription!=null) {
xml = xml + "<ram:Description>" + paymentTermsDescription + "</ram:Description>\n";
}
if (trans.getTradeSettlement() != null) {
for (IZUGFeRDTradeSettlement payment : trans.getTradeSettlement()) {
@@ -645,9 +648,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
private String buildPaymentTermsXml() {
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
IZUGFeRDPaymentTerms paymentTerms = trans.getPaymentTerms();
if (paymentTerms==null) {
return "";
}
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
IZUGFeRDPaymentDiscountTerms discountTerms = paymentTerms.getDiscountTerms();
Date dueDate = paymentTerms.getDueDate();
if (dueDate != null && discountTerms != null && discountTerms.getBaseDate() != null) {