From 2b664dba4a938f98d16926688a24325051555e9b Mon Sep 17 00:00:00 2001 From: David M Date: Thu, 15 Aug 2024 22:28:33 +0200 Subject: [PATCH 1/6] Re-Formatted and re-organized POMs --- Mustang-CLI/pom.xml | 172 +++--------------- library/pom.xml | 229 ++++++------------------ pom.xml | 421 ++++++++++++++++++++++++++++++-------------- validator/pom.xml | 193 +++----------------- 4 files changed, 392 insertions(+), 623 deletions(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 17132792..aaf4986f 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -1,215 +1,87 @@ + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - 4.0.0 + 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 + E-Invoice commandline tool + + + E-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation + should also work for XRechnung/CII. + + - UTF-8 - 11 - 11 + org.mustangproject validator - 2.13.0-SNAPSHOT - + ${project.version} + - + + commons-cli commons-cli - 1.8.0 + ${dep.commons-cli.version} org.junit.jupiter junit-jupiter-api - 5.10.2 - test + - org.junit.vintage - junit-vintage-engine - 5.10.2 - test - - - - org.xmlunit + org.xmlunit xmlunit-core - 2.10.0 + compile + org.xmlunit xmlunit-assertj - 2.10.0 + compile - - - jakarta.xml.bind - jakarta.xml.bind-api - 4.0.2 + org.junit.vintage + junit-vintage-engine - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins maven-surefire-plugin - - alphabetical - - org.apache.maven.plugins maven-jar-plugin - 3.4.2 - - - - true - true - - - - org.apache.maven.plugins maven-compiler-plugin - 2.3.2 - - 11 - 11 - org.apache.maven.plugins maven-shade-plugin - 3.5.3 org.mustangproject.commandline.Main - false - - - *:* - - LICENSE - NOTICE - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - commons-logging:commons-logging - - ** - - - - - - package - - shade - - - - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - diff --git a/library/pom.xml b/library/pom.xml index f4e24d68..66684cac 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -1,178 +1,143 @@ + + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - - 4.0.0 library jar - Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII) - FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT + + Mustang Library to r/w e-invoices + + + FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT Cross Industry Invoice based formats Factur-X/ZUGFeRD, XRechnung and Order-X in your invoice PDFs. - http://www.mustangproject.org/ - - scm:git:https://github.com/ZUGFeRD/mustangproject.git - scm:git:https://github.com/ZUGFeRD/mustangproject.git - https://github.com/ZUGFeRD/mustangproject - core-2.3.2 - - - - sonatype-oss-public - https://oss.sonatype.org/content/groups/public/ - - true - - - true - - - - - - internal.repo - Temporary Staging Repository - file://${project.build.directory}/mvn-repo - - + - UTF-8 - github - -Xdoclint:none - - 11 - 11 - true - + org.slf4j slf4j-api - 2.0.9 + net.sf.saxon Saxon-HE - 12.4 - + ${dep.saxon-he.version} + + + com.fasterxml.jackson.core jackson-databind - 2.17.1 + ${dep.jackson.version} + org.apache.xmlgraphics fop - 2.9 + ${dep.apache.fop.version} - - xml-apis - xml-apis - + + xml-apis + xml-apis + jakarta.xml.bind jakarta.xml.bind-api - 4.0.2 + ${dep.jakarta.xml-bind.version} + org.eclipse.angus angus-activation - 2.0.2 + ${dep.angus.version} org.apache.pdfbox preflight - 3.0.2 + ${dep.pdfbox.version} + org.apache.pdfbox pdfbox - 3.0.2 + ${dep.pdfbox.version} + org.dom4j dom4j - 2.1.4 + ${dep.dom4j.version} - - org.junit.jupiter - junit-jupiter-api - 5.10.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.10.2 - test - - + com.helger en16931-cii2ubl - 2.2.4 + ${dep.en16931-cii2ubl.version} + org.glassfish.jaxb jaxb-runtime - 4.0.5 + ${dep.jaxb-runtime.version} + + + + org.junit.jupiter + junit-jupiter-api + + + + org.junit.vintage + junit-vintage-engine org.xmlunit xmlunit-core - 2.10.0 - test org.xmlunit xmlunit-assertj - 2.10.0 - test + org.slf4j slf4j-simple - 2.0.9 - test + org.apache.maven.plugins maven-surefire-plugin - - alphabetical - + org.apache.maven.plugins maven-compiler-plugin - 3.13.0 - - 11 - 11 - + org.apache.maven.plugins maven-jar-plugin - 3.2.0 **/logback.xml @@ -204,26 +169,19 @@ + org.apache.maven.plugins maven-source-plugin - 3.3.1 - - - attach-sources - - jar-no-fork - - - + org.apache.maven.plugins maven-shade-plugin - 3.5.3 true - false + false + *:* @@ -243,100 +201,19 @@ - package shade + package - - + - - org.codehaus.mojo - templating-maven-plugin - 1.0.0 - - - filtering-java-templates - - filter-sources - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - - - - User List - https://groups.google.com/forum/?hl=de#!forum/mustangproject - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - - Alexander Schmidt - schmidt.alexander@mail.de - - developer - - - diff --git a/pom.xml b/pom.xml index b020447b..9355edf7 100644 --- a/pom.xml +++ b/pom.xml @@ -7,126 +7,44 @@ pom Mustang + + The Mustang project is a java library to read and write ZUGFeRD + meta data inside your invoice PDFs + + + http://www.mustangproject.org/ + library validator Mustang-CLI - - The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs - - http://www.mustangproject.org/ - - 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.3.2 - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - false - forked-path - -Dgpg.passphrase=${gpg.passphrase} - - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.5 - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.1 - - - org.mustangproject.ZUGFeRD.model.* - - - - - maven-deploy-plugin - 3.0.0-M1 - - internal.repo::default::file://${project.build.directory}/mvn-repo - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.3.1 - - alphabetical - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-javadoc - - - - - - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - + UTF-8 github -Xdoclint:none - 11 11 - true + + 2.0.13 + 12.4 + 2.17.1 + 2.9 + 4.0.2 + 2.0.2 + 3.0.2 + 2.1.4 + 2.2.4 + 4.0.5 + 5.10.2 + 2.10.0 + + 1.9.0 + 1.26.1 + 8.0.0 - - - - User List - https://groups.google.com/forum/?hl=de#!forum/mustangproject - - + Apache-2.0 @@ -135,6 +53,7 @@ A business-friendly OSS license + Jochen Stärk @@ -152,11 +71,267 @@ + + + + User List + https://groups.google.com/forum/?hl=de#!forum/mustangproject + + + + + scm:git:https://github.com/ZUGFeRD/mustangproject.git + scm:git:https://github.com/ZUGFeRD/mustangproject.git + https://github.com/ZUGFeRD/mustangproject + + + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + compile + + compile + + + ${maven.compiler.source} + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + + org.apache.maven.plugins + maven-release-plugin + 3.1.1 + + true + false + forked-path + -Dgpg.passphrase=${gpg.passphrase} + + + + org.apache.maven.scm + maven-scm-provider-gitexe + 2.1.0 + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.8.0 + + org.mustangproject.ZUGFeRD.model.* + + + + + maven-deploy-plugin + 3.1.2 + + internal.repo::default::file://${project.build.directory}/mvn-repo + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.7.0 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.3.1 + + alphabetical + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.2 + + + + true + true + + + + + + + test-jar + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + + false + + + *:* + + LICENSE + NOTICE + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + commons-logging:commons-logging + + ** + + + + + + + + shade + + package + + + + + + + + + + + org.codehaus.mojo + templating-maven-plugin + 3.0.0 + + + filtering-java-templates + + filter-sources + + + + + + + + + + org.codehaus.mojo + templating-maven-plugin + + + + + + + + org.slf4j + slf4j-api + ${dep.slf4j.version} + + + + jakarta.xml.bind + jakarta.xml.bind-api + ${dep.jakarta.xml-bind.version} + + + + org.junit.jupiter + junit-jupiter-api + ${dep.junit5.version} + test + + + + org.junit.vintage + junit-vintage-engine + ${dep.junit5.version} + test + + + + org.xmlunit + xmlunit-core + ${dep.xmlunit.version} + test + + + + org.xmlunit + xmlunit-assertj + ${dep.xmlunit.version} + test + + + + org.slf4j + slf4j-simple + ${dep.slf4j.version} + test + + + + + - - - - + release-sign-artifacts @@ -170,7 +345,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.4 sign-artifacts @@ -181,26 +356,6 @@ - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - diff --git a/validator/pom.xml b/validator/pom.xml index 0e934d03..f3f3a95a 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -1,33 +1,22 @@ + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - 4.0.0 + validator - Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung) - jar - - - - sonatype-oss-public - https://oss.sonatype.org/content/groups/public/ - - true - - - true - - - + + E-Invoices Validator + + + Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung + + - UTF-8 - false - 11 - 11 @@ -35,155 +24,82 @@ library ${project.version} + jakarta.xml.bind jakarta.xml.bind-api - 4.0.2 - - org.verapdf validation-model-jakarta - 1.26.1 + ${dep.verapdf.validation-model-jakarta.version} + com.helger.schematron ph-schematron-xslt - 8.0.0 + ${dep.ph-schematron-xslt.version} + org.xmlunit xmlunit-core - 2.10.0 - test + org.xmlunit xmlunit-assertj - 2.10.0 - test + org.junit.jupiter junit-jupiter-api - 5.10.2 - test + org.junit.vintage junit-vintage-engine - 5.10.2 - test + org.slf4j slf4j-simple - 2.0.9 - test + - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins maven-surefire-plugin - - alphabetical - - + org.apache.maven.plugins maven-jar-plugin - 3.2.0 - - - **/logback.xml - - - - true - true - - - + org.apache.maven.plugins maven-compiler-plugin - 2.3.2 - - 11 - 11 - - + org.apache.maven.plugins maven-shade-plugin - 2.4.3 - - true - false - - - *:* - - LICENSE - NOTICE - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - commons-logging:commons-logging - - ** - - - - - - - package - - shade - - - - - - - - + maven-resources-plugin - 3.1.0 copy-zf-schematron-xml-dependencies - compile copy-resources + compile ${basedir}/src/main/resources/xslt/ZF_221/ @@ -201,62 +117,11 @@ - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - + + generateXSLTFromSchematron false @@ -266,7 +131,7 @@ com.helger.maven ph-schematron-maven-plugin - 8.0.0 + ${dep.ph-schematron-xslt.version} ${basedir}/src/main/resources/schematron ${basedir}/src/main/resources/xslt From 3466f6e3db8caaba5626857c269ce50b03489f95 Mon Sep 17 00:00:00 2001 From: gundermann Date: Thu, 22 Aug 2024 10:38:03 +0200 Subject: [PATCH 2/6] changed additional references by line from String to List and implemented it on Item --- .../main/java/org/mustangproject/Item.java | 23 +++++++++++++++++++ .../ZUGFeRD/IZUGFeRDExportableItem.java | 6 ++--- .../ZUGFeRD/ZUGFeRD1PullProvider.java | 4 ++-- .../ZUGFeRD/ZUGFeRD2PullProvider.java | 11 ++++++--- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 321b4723..0dc76b83 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -465,6 +465,29 @@ public class Item implements IZUGFeRDExportableItem { return referencedDocuments.toArray(new IReferencedDocument[0]); } + + /*** + * adds item level references along with their typecodes and issuerassignedIDs (contract ID, cost centre, ...) + * @param doc the ReferencedDocument to add + * @return fluent setter + */ + public Item addAdditionalReference(ReferencedDocument doc) { + if (referencedDocuments == null) { + referencedDocuments = new ArrayList<>(); + } + referencedDocuments.add(doc); + return this; + } + + @Override + public IReferencedDocument[] getAdditionalReferences() { + if (referencedDocuments == null) { + return null; + } + return referencedDocuments.toArray(new IReferencedDocument[0]); + } + + /*** * specify a item level delivery period * (apart from the document level delivery period, and the document level diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java index f6e03242..3c20e519 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java @@ -91,10 +91,10 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{ } /*** - * the ID of an additionally referenced document for this item - * @return the id as string + * allows to specify multiple references (billing information) + * @return the referenced documents */ - default String getAdditionalReferencedDocumentID() { + default IReferencedDocument[] getAdditionalReferences() { return null; } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java index ba43dd94..0b028806 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java @@ -387,8 +387,8 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider { + "" + currencyFormat(lc.getItemTotalNetAmount()) + "" + ""; - if (currentItem.getAdditionalReferencedDocumentID() != null) { - xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; + if (currentItem.getAdditionalReferences() != null) { + xml += "" + currentItem.getAdditionalReferences()[0].getIssuerAssignedID() + "130"; } xml += "" diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index 64bfb738..bbadfdae 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -503,9 +503,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider { + "" + currencyFormat(lc.getItemTotalNetAmount()) + "" // currencyID=\"EUR\" + ""; - if (currentItem.getAdditionalReferencedDocumentID() != null) { - xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; - + if (currentItem.getAdditionalReferences() != null) { + for (final IReferencedDocument currentReference : currentItem.getAdditionalReferences()) { + xml += "" + + "" + XMLTools.encodeXML(currentReference.getIssuerAssignedID()) + "" + + "130" + + "" + XMLTools.encodeXML(currentReference.getReferenceTypeCode()) + "" + + ""; + } } xml += "" + ""; From 44d63a075ee00b46ee7fb44c500cf605fe978fe2 Mon Sep 17 00:00:00 2001 From: MellowGiant Date: Thu, 22 Aug 2024 11:27:42 +0200 Subject: [PATCH 3/6] changed additional references by line from String to List and implemented it on Item --- .../main/java/org/mustangproject/Item.java | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 0dc76b83..cb1c83fa 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -26,6 +26,7 @@ public class Item implements IZUGFeRDExportableItem { protected Product product; protected ArrayList notes = null; protected ArrayList referencedDocuments = null; + protected ArrayList additionalReference = null; protected ArrayList Allowances = new ArrayList<>(), Charges = new ArrayList<>(); @@ -248,6 +249,35 @@ public class Item implements IZUGFeRDExportableItem { } } } + + if (tradeSettlementName.equals("AdditionalReferencedDocument")) { + String IssuerAssignedID = ""; + String TypeCode = ""; + String ReferenceTypeCode = ""; + + NodeList refDocChilds = tradeSettlementChilds.item(tradeSettlementChildIndex).getChildNodes(); + for (int refDocIndex = 0; refDocIndex < refDocChilds.getLength(); refDocIndex++) { + String localName = refDocChilds.item(refDocIndex).getLocalName(); + if ((localName != null) && (localName.equals("IssuerAssignedID"))) { + IssuerAssignedID = refDocChilds.item(refDocIndex).getTextContent(); + } + if ((localName != null) && (localName.equals("TypeCode"))) { + TypeCode = refDocChilds.item(refDocIndex).getTextContent(); + } + if ((localName != null) && (localName.equals("ReferenceTypeCode"))) { + ReferenceTypeCode = refDocChilds.item(refDocIndex).getTextContent(); + } + } + + ReferencedDocument rd = new ReferencedDocument(IssuerAssignedID, TypeCode, + ReferenceTypeCode); + if (rdocs == null) { + rdocs = new ArrayList<>(); + } + rdocs.add(rd); + + } + } } } @@ -472,19 +502,19 @@ public class Item implements IZUGFeRDExportableItem { * @return fluent setter */ public Item addAdditionalReference(ReferencedDocument doc) { - if (referencedDocuments == null) { - referencedDocuments = new ArrayList<>(); + if (additionalReference == null) { + additionalReference = new ArrayList<>(); } - referencedDocuments.add(doc); + additionalReference.add(doc); return this; } @Override public IReferencedDocument[] getAdditionalReferences() { - if (referencedDocuments == null) { + if (additionalReference == null) { return null; } - return referencedDocuments.toArray(new IReferencedDocument[0]); + return additionalReference.toArray(new IReferencedDocument[0]); } From 40f35d8764e3286060fb142e1f2ae59ffc9ff806 Mon Sep 17 00:00:00 2001 From: MellowGiant Date: Thu, 22 Aug 2024 11:40:22 +0200 Subject: [PATCH 4/6] changed additional references by line from String to List and implemented it on Item --- library/src/main/java/org/mustangproject/Item.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index cb1c83fa..11d78f2f 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -64,6 +64,7 @@ public class Item implements IZUGFeRDExportableItem { String referencedLineID = null; ArrayList rdocs = null; + ArrayList additionalReferences = null; // nodes.item(i).getTextContent())) { @@ -271,10 +272,10 @@ public class Item implements IZUGFeRDExportableItem { ReferencedDocument rd = new ReferencedDocument(IssuerAssignedID, TypeCode, ReferenceTypeCode); - if (rdocs == null) { - rdocs = new ArrayList<>(); + if (additionalReferences == null) { + additionalReferences = new ArrayList<>(); } - rdocs.add(rd); + additionalReferences.add(rd); } @@ -304,6 +305,11 @@ public class Item implements IZUGFeRDExportableItem { addReferencedDocument(rdoc); } } + if (additionalReferences != null) { + for (ReferencedDocument rdoc : additionalReferences) { + addAdditionalReference(rdoc); + } + } addReferencedLineID( referencedLineID ); } From a69b1ea60d8e405681a9a242d61660c5061288a6 Mon Sep 17 00:00:00 2001 From: MellowGiant Date: Tue, 27 Aug 2024 15:28:18 +0200 Subject: [PATCH 5/6] getAdditionalReferencedDocumentID() reinserted and marked as deprecated --- .../mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java | 10 ++++++++++ .../mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java | 3 ++- .../mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java index 3c20e519..e5e25cae 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java @@ -90,6 +90,16 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{ return BigDecimal.ONE.setScale(4); } + /*** + * the ID of an additionally referenced document for this item + * @deprecated use {@link #getAdditionalReferences()} instead. + * @return the id as string + */ + @Deprecated + default String getAdditionalReferencedDocumentID() { + return null; + } + /*** * allows to specify multiple references (billing information) * @return the referenced documents diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java index 0b028806..b98abebc 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java @@ -389,7 +389,8 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider { + ""; if (currentItem.getAdditionalReferences() != null) { xml += "" + currentItem.getAdditionalReferences()[0].getIssuerAssignedID() + "130"; - + } else if (currentItem.getAdditionalReferencedDocumentID() != null) { + xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; } xml += "" + ""; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index bbadfdae..eaefecaa 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -511,6 +511,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider { "" + XMLTools.encodeXML(currentReference.getReferenceTypeCode()) + "" + ""; } + } else if (currentItem.getAdditionalReferencedDocumentID() != null) { + xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; } xml += "" + ""; From 136c8a8865795adf47195cff8b5de539f3a8b1ea Mon Sep 17 00:00:00 2001 From: MellowGiant Date: Tue, 27 Aug 2024 15:33:19 +0200 Subject: [PATCH 6/6] variable name changed from "additionalReferences" to "addRefs" to avoid confusion with "additionalReference" --- library/src/main/java/org/mustangproject/Item.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 11d78f2f..d4d417c6 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -64,7 +64,7 @@ public class Item implements IZUGFeRDExportableItem { String referencedLineID = null; ArrayList rdocs = null; - ArrayList additionalReferences = null; + ArrayList addRefs = null; // nodes.item(i).getTextContent())) { @@ -272,10 +272,10 @@ public class Item implements IZUGFeRDExportableItem { ReferencedDocument rd = new ReferencedDocument(IssuerAssignedID, TypeCode, ReferenceTypeCode); - if (additionalReferences == null) { - additionalReferences = new ArrayList<>(); + if (addRefs == null) { + addRefs = new ArrayList<>(); } - additionalReferences.add(rd); + addRefs.add(rd); } @@ -305,8 +305,8 @@ public class Item implements IZUGFeRDExportableItem { addReferencedDocument(rdoc); } } - if (additionalReferences != null) { - for (ReferencedDocument rdoc : additionalReferences) { + if (addRefs != null) { + for (ReferencedDocument rdoc : addRefs) { addAdditionalReference(rdoc); } }