allow to create fx 1 files with command line again

This commit is contained in:
jstaerk
2022-07-07 14:16:53 +02:00
parent b0bce94dbb
commit 44802f16b9
5 changed files with 44 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
- allow to create fx 1 files with command line again
- is maven build profile to gen xslt, mvn clean package -P generateXSLTFromSchematron - is maven build profile to gen xslt, mvn clean package -P generateXSLTFromSchematron
- OXPullprovider to no longer generate invsalid XML if a duedate is set - OXPullprovider to no longer generate invsalid XML if a duedate is set

View File

@@ -635,6 +635,9 @@ public class Main {
} }
EStandard standard=EStandard.facturx; EStandard standard=EStandard.facturx;
if (format.equals("zf")) {
standard=EStandard.zugferd;
}
if (format.equals("da")) { if (format.equals("da")) {
standard=EStandard.despatchadvice; standard=EStandard.despatchadvice;
@@ -644,8 +647,6 @@ public class Main {
if (format.equals("ox")) { if (format.equals("ox")) {
standard=EStandard.orderx; standard=EStandard.orderx;
} }
if (zfProfile.equals("b")) { if (zfProfile.equals("b")) {
zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion);
} else if (zfProfile.equals("c")) { } else if (zfProfile.equals("c")) {
@@ -657,19 +658,19 @@ public class Main {
} }
} else if (((format.equals("zf")) && (zfIntVersion == 2)) || (format.equals("fx"))) { } else if (((format.equals("zf")) && (zfIntVersion == 2)) || (format.equals("fx"))) {
if (zfProfile.equals("m")) { if (zfProfile.equals("m")) {
zfConformanceLevelProfile = Profiles.getByName("MINIMUM", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "MINIMUM", zfIntVersion);
} else if (zfProfile.equals("w")) { } else if (zfProfile.equals("w")) {
zfConformanceLevelProfile = Profiles.getByName("BASICWL", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "BASICWL", zfIntVersion);
} else if (zfProfile.equals("b")) { } else if (zfProfile.equals("b")) {
zfConformanceLevelProfile = Profiles.getByName("BASIC", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion);
} else if (zfProfile.equals("c")) { } else if (zfProfile.equals("c")) {
zfConformanceLevelProfile = Profiles.getByName("CIUS", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "CIUS", zfIntVersion);
} else if (zfProfile.equals("e")) { } else if (zfProfile.equals("e")) {
zfConformanceLevelProfile = Profiles.getByName("EN16931", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "EN16931", zfIntVersion);
} else if (zfProfile.equals("t")) { } else if (zfProfile.equals("t")) {
zfConformanceLevelProfile = Profiles.getByName("EXTENDED", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "EXTENDED", zfIntVersion);
} else if (zfProfile.equals("x")) { } else if (zfProfile.equals("x")) {
zfConformanceLevelProfile = Profiles.getByName("XRECHNUNG", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "XRECHNUNG", zfIntVersion);
} else { } else {
throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile)); throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile));
} }
@@ -698,7 +699,7 @@ public class Main {
} else { } else {
ze = new ZUGFeRDExporterFromA1().setProducer("Mustang-cli") ze = new ZUGFeRDExporterFromA1().setProducer("Mustang-cli")
.setZUGFeRDVersion(zfIntVersion) .setZUGFeRDVersion(standard, zfIntVersion)
.setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile); .setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile);
if (ignoreInputErrors) { if (ignoreInputErrors) {
((ZUGFeRDExporterFromA1)ze).ignorePDFAErrors(); ((ZUGFeRDExporterFromA1)ze).ignorePDFAErrors();

View File

@@ -71,7 +71,11 @@ public class Profiles {
} }
return result; return result;
} else { } else {
return getByName(name, version); int generation = version;
if ((standard==EStandard.facturx) && (version==1)) {
generation = 2;
}
return getByName(name, generation);
} }
} }

View File

@@ -22,6 +22,7 @@ package org.mustangproject.ZUGFeRD;
import org.apache.pdfbox.preflight.PreflightDocument; import org.apache.pdfbox.preflight.PreflightDocument;
import org.apache.pdfbox.preflight.exception.ValidationException; import org.apache.pdfbox.preflight.exception.ValidationException;
import org.apache.pdfbox.preflight.parser.PreflightParser; import org.apache.pdfbox.preflight.parser.PreflightParser;
import org.mustangproject.EStandard;
import javax.activation.DataSource; import javax.activation.DataSource;
import java.io.IOException; import java.io.IOException;
@@ -106,6 +107,9 @@ public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUG
public ZUGFeRDExporterFromA1 setProducer(String producer){ public ZUGFeRDExporterFromA1 setProducer(String producer){
return (ZUGFeRDExporterFromA1) super.setProducer(producer); return (ZUGFeRDExporterFromA1) super.setProducer(producer);
} }
public ZUGFeRDExporterFromA1 setZUGFeRDVersion(EStandard est, int version){
return (ZUGFeRDExporterFromA1) super.setZUGFeRDVersion(est, version);
}
public ZUGFeRDExporterFromA1 setZUGFeRDVersion(int version){ public ZUGFeRDExporterFromA1 setZUGFeRDVersion(int version){
return (ZUGFeRDExporterFromA1) super.setZUGFeRDVersion(version); return (ZUGFeRDExporterFromA1) super.setZUGFeRDVersion(version);
} }

View File

@@ -44,6 +44,7 @@ import org.apache.xmpbox.type.BadFieldValueException;
import org.apache.xmpbox.xml.DomXmpParser; import org.apache.xmpbox.xml.DomXmpParser;
import org.apache.xmpbox.xml.XmpParsingException; import org.apache.xmpbox.xml.XmpParsingException;
import org.apache.xmpbox.xml.XmpSerializer; import org.apache.xmpbox.xml.XmpSerializer;
import org.mustangproject.EStandard;
import org.mustangproject.FileAttachment; import org.mustangproject.FileAttachment;
import javax.activation.DataSource; import javax.activation.DataSource;
@@ -851,6 +852,28 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
} }
} }
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(EStandard est, int version) {
this.ZFVersion = version;
if ((version<1) || (version>2)) {
throw new IllegalArgumentException("Version not supported");
}
int generation=version;
if ((est==EStandard.facturx)&&(version==1)) {
generation=2;
}
if (generation == 1) {
ZUGFeRD1PullProvider z1p = new ZUGFeRD1PullProvider();
disableFacturX();
setXMLProvider(z1p);
} else if (generation == 2) {
ZUGFeRD2PullProvider z2p = new ZUGFeRD2PullProvider();
setXMLProvider(z2p);
}
return this;
}
@Override @Override
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(int version) { public ZUGFeRDExporterFromA3 setZUGFeRDVersion(int version) {
this.ZFVersion = version; this.ZFVersion = version;