From 1675728563f02ca1c15ca6eec1b78dec9a32b5df Mon Sep 17 00:00:00 2001 From: jstaerk Date: Sun, 3 Jan 2021 10:47:03 +0100 Subject: [PATCH 1/5] Enabling functionality via Command line, changing POM so no errors occur --- History.md | 3 +- .../org/mustangproject/commandline/Main.java | 41 ++++++++++++++++++- library/pom.xml | 25 +++++------ 3 files changed, 55 insertions(+), 14 deletions(-) diff --git a/History.md b/History.md index 9227afca..52ab562d 100644 --- a/History.md +++ b/History.md @@ -1,6 +1,7 @@ 2.1.0 ======= - +- make IExportableTransaction.getZFAllowances() getZFCharges() and getZFLogisticsServiceCharges() and item.getItemAllowances, item.getItemCharges optional, correct getCurrency optionality + make IZUGFeRDExportableTradeParty name id zip location street mandatory - fixed a charge/allowance rounding error #212 - Corrected intra community supply tax exemption category code diff --git a/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java b/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java index 5221d9a8..15bebf34 100755 --- a/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java +++ b/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java @@ -20,6 +20,7 @@ package org.mustangproject.commandline; import com.sanityinc.jargs.CmdLineParser; import com.sanityinc.jargs.CmdLineParser.Option; +import org.mustangproject.CII.CIIToUBL; import org.mustangproject.ZUGFeRD.*; import org.mustangproject.validator.Validator; import org.mustangproject.validator.ZUGFeRDValidator; @@ -46,7 +47,7 @@ public class Main { } private static String getUsage() { - return "Usage: --action metrics|combine|extract|a3only|validate|visualize [-d,--directory] [-l,--listfromstdin] [-i,--ignore fileextension, PDF/A errors] | [-h,--help] \r\n" + return "Usage: --action metrics|combine|extract|a3only|ubl|validate|visualize [-d,--directory] [-l,--listfromstdin] [-i,--ignore fileextension, PDF/A errors] | [-h,--help] \r\n" + " --action=metrics\n" + " -d, --directory count ZUGFeRD files in directory to be scanned\n" + " If it is a directory, it will recurse.\n" @@ -85,6 +86,9 @@ public class Main { + " [--no-notices]: refrain from reporting notices\n" + " Additional parameters (optional - user will be prompted if not defined)\n" + " -d, --directory to check recursively \n" + + " --action=ubl convert UN/CEFACT 2016b CII XML to UBL XML\n" + + " [--source ]: set input XML file\n" + + " [--out ]: set output XML file\n" + " --action=validateExpectInvalid validate directory expecting negative results \n" + " [--no-notices]: refrain from reporting notices\n" + " Additional parameters (optional - user will be prompted if not defined)\n" @@ -250,6 +254,38 @@ public class Main { Files.write(Paths.get(outName), xml.getBytes()); System.out.println("Written to " + outName); + } + + /*** + * converts from CII to UBL + * @param xmlName + * @param outName + * @throws IOException + * @throws TransformerException + */ + private static void performUBL(String xmlName, String outName) throws IOException, TransformerException { + + // Get params from user if not already defined + if (xmlName == null) { + xmlName = getFilenameFromUser("Factur-X XML source", "factur-x.xml", "xml", true, false); + } else { + System.out.println("Factur-X XML source set to " + xmlName); + } + if (outName == null) { + outName = getFilenameFromUser("UBL target", "ubl-invoice.xml", "xml", false, true); + } else { + System.out.println("UBL target to " + outName); + } + + // Verify params + ensureFileExists(xmlName); + ensureFileNotExists(outName); + + // All params are good! continue... + CIIToUBL c2u = new CIIToUBL(); + c2u.convert(new File(xmlName), new File(outName)); + System.out.println("Written to " + outName); + } /*** * the main function of the commandline tool... @@ -338,6 +374,9 @@ public class Main { } else if ((action!=null)&&(action.equals("upgrade"))) { performUpgrade(sourceName, outName); optionsRecognized=true; + } else if ((action!=null)&&(action.equals("ubl"))) { + performUBL(sourceName, outName); + optionsRecognized=true; } else if ((action!=null)&&(action.equals("validate"))) { optionsRecognized=performValidate(sourceName, noNotices!=null&&noNotices, parser.getOptionValue(logAppendOption)); } else if ((action!=null)&&(action.equals("validateExpectValid"))) { diff --git a/library/pom.xml b/library/pom.xml index 6686b648..649d4825 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -90,6 +90,12 @@ en16931-cii2ubl 1.2.5 + + + org.glassfish.jaxb + jaxb-runtime + 2.3.3 + com.helger @@ -115,6 +121,12 @@ 9.1.1 compile + + + jakarta.xml.bind + jakarta.xml.bind-api + 2.3.3 + @@ -124,12 +136,6 @@ maven-compiler-plugin 3.6.1 - - - true - org.mustangproject.toecount.Toecount - - jar-with-dependencies @@ -145,12 +151,7 @@ maven-shade-plugin 3.2.1 - true - - - org.mustangproject.toecount.Toecount - - + false false From 2defd02f1da14d8996c1f95e71058ccad9e49024 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Tue, 19 Jan 2021 08:59:26 +0100 Subject: [PATCH 2/5] switch to cii2ubl 1.3.0, update commandline help, remove getZip in favor of getZIP --- History.md | 1 + .../src/main/java/org/mustangproject/commandline/Main.java | 2 ++ library/pom.xml | 2 +- library/src/main/java/org/mustangproject/TradeParty.java | 4 ---- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/History.md b/History.md index 52ab562d..842d781e 100644 --- a/History.md +++ b/History.md @@ -4,6 +4,7 @@ make IZUGFeRDExportableTradeParty name id zip location street mandatory - fixed a charge/allowance rounding error #212 - Corrected intra community supply tax exemption category code +- removal of Tradeparty.getZip in favor of getZIP (as it's also setZIP) to avoid jackson errors 2.0.3 ======= diff --git a/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java b/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java index 15bebf34..4cf0b397 100755 --- a/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java +++ b/Mustang-CLI/src/main/java/org/mustangproject/commandline/Main.java @@ -94,6 +94,8 @@ public class Main { + " Additional parameters (optional - user will be prompted if not defined)\n" + " -d, --directory to check recursively\n" + " --action=visualize convert XML to HTML \n" + + " [--source ]: set input XML file\n" + + " [--out ]: set output HTML file\n" ; } diff --git a/library/pom.xml b/library/pom.xml index 649d4825..cf83c46b 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -88,7 +88,7 @@ com.helger en16931-cii2ubl - 1.2.5 + 1.3.0 diff --git a/library/src/main/java/org/mustangproject/TradeParty.java b/library/src/main/java/org/mustangproject/TradeParty.java index 5729fb53..0e906846 100644 --- a/library/src/main/java/org/mustangproject/TradeParty.java +++ b/library/src/main/java/org/mustangproject/TradeParty.java @@ -268,10 +268,6 @@ public class TradeParty implements IZUGFeRDExportableTradeParty { return vatID; } - public String getZip() { - return zip; - } - @Override public IZUGFeRDExportableContact getContact() { return contact; From 3d3ed12067ac913cfb557f864a129618989f2a21 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Tue, 19 Jan 2021 09:19:32 +0100 Subject: [PATCH 3/5] [maven-release-plugin] prepare release core-2.1.0 --- Mustang-CLI/pom.xml | 6 +++--- library/pom.xml | 6 +++--- pom.xml | 4 ++-- validator/pom.xml | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index c7f94c3d..95592b80 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -3,14 +3,14 @@ org.mustangproject core - 2.0.4-SNAPSHOT + 2.1.0 4.0.0 org.mustangproject Mustang-CLI e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation should also work for XRechnung/CII. jar - 2.0.4-SNAPSHOT + 2.1.0 @@ -31,7 +31,7 @@ org.mustangproject validator - 2.0.4-SNAPSHOT + 2.1.0 diff --git a/library/pom.xml b/library/pom.xml index cf83c46b..5aeedcc5 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -3,13 +3,13 @@ org.mustangproject core - 2.0.4-SNAPSHOT + 2.1.0 4.0.0 org.mustangproject library - 2.0.4-SNAPSHOT + 2.1.0 jar Library to write, read and validate e-invoices (Factur-X, ZUGFeRD and to a limited extend XRechnung/CII). The Mustang project is a java library to read, write and validate Factur-X/ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML. @@ -19,7 +19,7 @@ scm:git:https://github.com/ZUGFeRD/mustangproject.git scm:git:https://github.com/ZUGFeRD/mustangproject.git https://github.com/ZUGFeRD/mustangproject - mustang-2.0.0-SNAPSHOT + core-2.1.0 diff --git a/pom.xml b/pom.xml index 8f314cb8..13b10516 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.mustangproject core - 2.0.4-SNAPSHOT + 2.1.0 pom Mustang @@ -20,7 +20,7 @@ scm:git:git://github.com/dexecutor/dependent-tasks-executor.git scm:git:git@github.com:dexecutor/dexecutor.git https://github.com/dexecutor/dependent-tasks-executor - HEAD + core-2.1.0 diff --git a/validator/pom.xml b/validator/pom.xml index 16990f77..056e9b23 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -3,7 +3,7 @@ org.mustangproject core - 2.0.4-SNAPSHOT + 2.1.0 4.0.0 org.mustangproject @@ -11,7 +11,7 @@ Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung) jar - 2.0.4-SNAPSHOT + 2.1.0 @@ -75,7 +75,7 @@ org.mustangproject library - 2.0.4-SNAPSHOT + 2.1.0 org.xmlunit From 12ffe9716ba0863858892da5a2de7c24888ddf74 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Tue, 19 Jan 2021 09:19:32 +0100 Subject: [PATCH 4/5] [maven-release-plugin] prepare for next development iteration --- Mustang-CLI/pom.xml | 6 +++--- library/pom.xml | 6 +++--- pom.xml | 4 ++-- validator/pom.xml | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 95592b80..f6535e8e 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -3,14 +3,14 @@ org.mustangproject core - 2.1.0 + 2.1.1-SNAPSHOT 4.0.0 org.mustangproject Mustang-CLI e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation should also work for XRechnung/CII. jar - 2.1.0 + 2.1.1-SNAPSHOT @@ -31,7 +31,7 @@ org.mustangproject validator - 2.1.0 + 2.1.1-SNAPSHOT diff --git a/library/pom.xml b/library/pom.xml index 5aeedcc5..318d2223 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -3,13 +3,13 @@ org.mustangproject core - 2.1.0 + 2.1.1-SNAPSHOT 4.0.0 org.mustangproject library - 2.1.0 + 2.1.1-SNAPSHOT jar Library to write, read and validate e-invoices (Factur-X, ZUGFeRD and to a limited extend XRechnung/CII). The Mustang project is a java library to read, write and validate Factur-X/ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML. @@ -19,7 +19,7 @@ scm:git:https://github.com/ZUGFeRD/mustangproject.git scm:git:https://github.com/ZUGFeRD/mustangproject.git https://github.com/ZUGFeRD/mustangproject - core-2.1.0 + mustang-2.0.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 13b10516..f8bacf91 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.mustangproject core - 2.1.0 + 2.1.1-SNAPSHOT pom Mustang @@ -20,7 +20,7 @@ scm:git:git://github.com/dexecutor/dependent-tasks-executor.git scm:git:git@github.com:dexecutor/dexecutor.git https://github.com/dexecutor/dependent-tasks-executor - core-2.1.0 + HEAD diff --git a/validator/pom.xml b/validator/pom.xml index 056e9b23..5e8597b2 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -3,7 +3,7 @@ org.mustangproject core - 2.1.0 + 2.1.1-SNAPSHOT 4.0.0 org.mustangproject @@ -11,7 +11,7 @@ Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung) jar - 2.1.0 + 2.1.1-SNAPSHOT @@ -75,7 +75,7 @@ org.mustangproject library - 2.1.0 + 2.1.1-SNAPSHOT org.xmlunit From a360f493601812b216dc1f2f47abecab11b099c2 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Tue, 19 Jan 2021 13:52:35 +0100 Subject: [PATCH 5/5] update history --- History.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.md b/History.md index 842d781e..9b468cc0 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,7 @@ 2.1.0 ======= +2020-01-19 +- support CII to UBL conversion (thanks to https://github.com/phax/en16931-cii2ubl) - make IExportableTransaction.getZFAllowances() getZFCharges() and getZFLogisticsServiceCharges() and item.getItemAllowances, item.getItemCharges optional, correct getCurrency optionality make IZUGFeRDExportableTradeParty name id zip location street mandatory - fixed a charge/allowance rounding error #212