From 56894a5cb5816722d307666893c9d466a101661a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20Sta=CC=88rk?= Date: Thu, 18 Oct 2018 12:02:56 +0200 Subject: [PATCH] closes #68 --- .../java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java index a5ad456d..c473689f 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java @@ -322,8 +322,11 @@ public class ZUGFeRDExporter implements Closeable { "Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)", "text/xml", xmlProvider.getXML()); - if (ZFVersion>1) { - // Also attach a ZF1 file for backward compatibility + if ((ZFVersion>1)&&(trans!=null)) { + /* + * Also attach a ZF1 file for backward compatibility, but only in case + * if we do not e.g. embed custom XML (in which case, if its v2, the v1 provider won't be able to deliver data) + */ setZUGFeRDVersion(1); xmlProvider.generateXML(trans); filename = getFilenameForVersion(ZFVersion); @@ -331,6 +334,7 @@ public class ZUGFeRDExporter implements Closeable { "Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)", "text/xml", xmlProvider.getXML()); + } }