corrections to comply to https://www.gs1-germany.de/gs1-standards/umsetzung/fachpublikationen/detailansicht/der-digitale-lieferschein-dls-die-digitale-abloesung-des-papier-lieferscheins/
This commit is contained in:
@@ -601,8 +601,10 @@ public class Main {
|
||||
|
||||
if (zfProfile == null) {
|
||||
try {
|
||||
if ((format.equals("zf") && (zfIntVersion == 1)) || (format.equals("ox") || (format.equals("dx")))) {
|
||||
if ((format.equals("zf") && (zfIntVersion == 1)) || (format.equals("ox") )) {
|
||||
zfProfile = getStringFromUser("Profile (b)asic, (c)omfort or ex(t)ended", "t", "B|b|C|c|T|t");
|
||||
} else if ( (format.equals("dx"))) {
|
||||
zfProfile = getStringFromUser("Profile (p)ilot", "p", "P|p");
|
||||
} else {
|
||||
zfProfile = getStringFromUser(
|
||||
"Profile [M]INIMUM, BASIC [W]L, [B]ASIC,\n" + "[C]IUS, [E]N16931, EX[T]ENDED or [X]RECHNUNG", "E",
|
||||
@@ -627,14 +629,17 @@ public class Main {
|
||||
throw new Exception("Factur-X is only available in version 1 (roughly corresponding to ZF2)");
|
||||
}
|
||||
|
||||
if (((format.equals("zf")) && (zfIntVersion == 1))||(format.equals("ox")||(format.equals("dx")))) {
|
||||
EStandard standard=EStandard.facturx;
|
||||
EStandard standard=EStandard.facturx;
|
||||
if (format.equals("dx")) {
|
||||
standard=EStandard.deliverx;
|
||||
|
||||
zfConformanceLevelProfile = Profiles.getByName(standard, "PILOT", 1);
|
||||
}
|
||||
else if (((format.equals("zf")) && (zfIntVersion == 1))||(format.equals("ox"))) {
|
||||
if (format.equals("ox")) {
|
||||
standard=EStandard.orderx;
|
||||
}
|
||||
if (format.equals("dx")) {
|
||||
standard=EStandard.deliverx;
|
||||
}
|
||||
|
||||
|
||||
if (zfProfile.equals("b")) {
|
||||
zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion);
|
||||
@@ -681,6 +686,7 @@ public class Main {
|
||||
ze = new DXExporterFromA1().setProducer("Mustang-cli")
|
||||
.setZUGFeRDVersion(zfIntVersion)
|
||||
.setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile);
|
||||
|
||||
if (ignoreInputErrors) {
|
||||
((DXExporterFromA1)ze).ignorePDFAErrors();
|
||||
}
|
||||
@@ -704,11 +710,13 @@ public class Main {
|
||||
}
|
||||
|
||||
ze.setXML(Files.readAllBytes(Paths.get(xmlName)));
|
||||
|
||||
ze.export(outName);
|
||||
System.out.println("Written to " + outName);
|
||||
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,11 @@ public class CustomXMLProvider implements IXMLProvider {
|
||||
public void setXML(byte[] newData) {
|
||||
String zf = new String(newData, StandardCharsets.UTF_8);
|
||||
/**
|
||||
* rsm:CrossIndustry is ZF/FX/XR (CII 2016b) and rsm:SCRDMCCBDACIOMessageStructure is of course Order-X (CIO 2021)
|
||||
* rsm:CrossIndustry is ZF/FX/XR (CII 2016b),rsm:SCRDMCCBDACIOMessageStructure is Order-X (CIO 2021) and
|
||||
* SCRDMCCBDACIDAMessageStructure is Despatch Advice
|
||||
*/
|
||||
if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure"))) {
|
||||
throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry or <rsm:SCRDMCCBDACIOMessageStructure and can thus not be valid");
|
||||
if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure")) && (!zf.contains("SCRDMCCBDACIDAMessageStructure"))) {
|
||||
throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry, <rsm:SCRDMCCBDACIOMessageStructure or SCRDMCCBDACIDAMessageStructure and can thus not be valid");
|
||||
}
|
||||
|
||||
zugferdData = newData;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExport
|
||||
* @return the URN of the namespace
|
||||
*/
|
||||
public String getNamespaceForVersion(int ver) {
|
||||
return "urn:factur-x:pdfa:CrossIndustryDocument:1p0#";
|
||||
return "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#";
|
||||
}
|
||||
/***
|
||||
* internal helper: returns the namespace prefix for the given order-x version number
|
||||
|
||||
@@ -105,7 +105,7 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
|
||||
* OrderX document type. As of version 1.0 it may be
|
||||
* ORDER, ORDER_RESPONSE, or ORDER_CHANGE
|
||||
*/
|
||||
protected String orderXDocumentType = "ORDER";
|
||||
protected String deliverXDocumentType = "DESPATCHADVICE";
|
||||
|
||||
|
||||
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
|
||||
@@ -396,15 +396,15 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the property orderXDocumentType.
|
||||
* Sets the property for DocumentType.
|
||||
*
|
||||
* @param orderXDocumentType new value. Expected: ORDER, ORDER_RESPONSE, or ORDER_CHANGE
|
||||
* @param
|
||||
*
|
||||
* @return this exporter
|
||||
*/
|
||||
public DXExporterFromA3 setOrderXDocumentType(String orderXDocumentType)
|
||||
public DXExporterFromA3 setDocumentType(String DocumentType)
|
||||
{
|
||||
this.orderXDocumentType = orderXDocumentType;
|
||||
this.deliverXDocumentType = DocumentType;
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -426,9 +426,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
|
||||
|
||||
if (attachZUGFeRDHeaders) {
|
||||
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, 1, true, xmlProvider.getProfile(),
|
||||
"urn:factur-x:pdfa:CrossIndustryDocument:1p0#", "fx",
|
||||
"deliver-x.xml");
|
||||
zf.setType(this.orderXDocumentType);
|
||||
"urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#", "fx",
|
||||
"cida.xml");
|
||||
zf.setType(this.deliverXDocumentType);
|
||||
|
||||
metadata.addSchema(zf);
|
||||
// also add the schema extensions...
|
||||
@@ -457,9 +457,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
|
||||
public IExporter prepare() throws IOException {
|
||||
prepareDocument();
|
||||
xmlProvider.generateXML(trans);
|
||||
String filename = "deliver-x.xml";
|
||||
String filename = "cida.xml";
|
||||
PDFAttachGenericFile(doc, filename, "Alternative",
|
||||
"Order metadata conforming to the Order-X standard (https://www.ferd-net.de/standards/order-x/index.html)",
|
||||
"Delivery metadata",
|
||||
"text/xml", xmlProvider.getXML());
|
||||
|
||||
for (FileAttachment attachment : fileAttachments) {
|
||||
|
||||
@@ -51,11 +51,7 @@ public class Profiles {
|
||||
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||
static Map<String, Profile> dx1Map = Stream.of(new Object[][]{
|
||||
{"BASIC", new Profile("BASIC", "urn:order-x.eu:1p0:basic")},
|
||||
{"COMFORT", new Profile("COMFORT", "urn:order-x.eu:1p0:comfort")},
|
||||
{"EXTENDED", new Profile("EXTENDED", "urn:order-x.eu:1p0:extended")},
|
||||
|
||||
|
||||
{"PILOT", new Profile("PILOT", "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#")}
|
||||
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class ZUGFeRDImporter {
|
||||
/**
|
||||
* filenames for invoice data (ZUGFeRD v1 and v2, Factur-X)
|
||||
*/
|
||||
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("deliver-x.xml")) {
|
||||
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("cida.xml")) {
|
||||
containsMeta = true;
|
||||
|
||||
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
|
||||
|
||||
Reference in New Issue
Block a user