Merge branch 'ZUGFeRD:master' into fix-hyphenation
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
- #678
|
||||
- #679
|
||||
|
||||
2.16.0
|
||||
=======
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
@@ -12,7 +12,7 @@
|
||||
should also work for XRechnung/CII.
|
||||
</name>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>validator</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
|
||||
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
|
||||
-->
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name>
|
||||
<description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT
|
||||
|
||||
@@ -309,7 +309,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
List<IncludedNote> includedNotes = new ArrayList<>();
|
||||
|
||||
//UBL...
|
||||
XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\"]/*[local-name()=\"Note\"]");
|
||||
XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"Note\"]");
|
||||
NodeList UBLNotesNd = (NodeList) UBLNotesEx.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
if ((UBLNotesNd != null) && (UBLNotesNd.getLength() > 0)) {
|
||||
for (int nodeIndex = 0; nodeIndex < UBLNotesNd.getLength(); nodeIndex++) {
|
||||
@@ -556,15 +556,16 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
zpp.addNotes(includedNotes);
|
||||
String rootNode = extractString("local-name(/*)");
|
||||
if (rootNode.equals("Invoice")) {
|
||||
if (rootNode.equals("Invoice")||rootNode.equals("CreditNote")) {
|
||||
// UBL...
|
||||
number = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"ID\"]").trim();
|
||||
typeCode = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
||||
String issueDateStr = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"IssueDate\"]").trim();
|
||||
// //*[local-name()="Invoice" or local-name()="CreditNote"]
|
||||
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
|
||||
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
|
||||
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
|
||||
if (issueDateStr.length()>0) {
|
||||
issueDate = new SimpleDateFormat("yyyy-MM-dd").parse(issueDateStr);
|
||||
}
|
||||
String dueDt = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"DueDate\"]").trim();
|
||||
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
|
||||
if (dueDt.length() > 0) {
|
||||
dueDate = new SimpleDateFormat("yyyy-MM-dd").parse(dueDt);
|
||||
}
|
||||
|
||||
@@ -394,6 +394,28 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void testImportUBLCreditnote() { // Confirm some basics also work with UBL credit notes
|
||||
File CIIinputFile = getResourceAsFile("ubl/UBL-CreditNote-2.1-Example.ubl.xml");
|
||||
try {
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
|
||||
|
||||
|
||||
CalculatedInvoice i = new CalculatedInvoice();
|
||||
zii.extractInto(i);
|
||||
assertEquals("TOSL108", i.getNumber());
|
||||
assertEquals("729", i.getGrandTotal().toString());
|
||||
|
||||
} catch (IOException e) {
|
||||
fail("IOException not expected");
|
||||
} catch (XPathExpressionException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version> <packaging>pom</packaging>
|
||||
<version>2.16.1-SNAPSHOT</version> <packaging>pom</packaging>
|
||||
<name>Mustang</name>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
@@ -11,7 +11,7 @@
|
||||
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<!-- for jargs -->
|
||||
@@ -38,7 +38,7 @@
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>2.15.3-SNAPSHOT</version>
|
||||
<version>2.16.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.dom4j</groupId>
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ValidationContext {
|
||||
}
|
||||
|
||||
public ValidationContext setProfile(String profile) {
|
||||
this.profile = profile;
|
||||
this.profile = profile.trim();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user