This commit is contained in:
jstaerk
2024-12-07 10:35:43 +01:00
parent c9853c097d
commit 98f0f140aa
4 changed files with 63 additions and 59 deletions

View File

@@ -1,12 +1,6 @@
595
591
577
575
573
601
2.15.1
=======
- #566 Failed to parse PDF - Could not reproduce the invoice
? be able to access ID in error message
- closes #579 prepaidamount is only read in UBL
@@ -18,6 +12,13 @@
- allow jackson to run over more classes, e.g., DirectDebit, bean contructor for direct debit
- allow json includedNotes
- support importing duePayableAmount
- #595 Treat all fatal XR schematron rules as errors, not as warnings.
- #591 Import IncludedNotes on item extraction
- #577 dom4j: exclude all (optional) dependencies to avoid potential conflicts.
- #575 Fix compilation problems.
- #573 Feature/category code
- #601 exceptions in metrics
- #606 also parse BT-25
2.15.0

View File

@@ -808,6 +808,7 @@ public class ZUGFeRDInvoiceImporter {
} else {
zpp.setDespatchAdviceReferencedDocumentID(extractString("//*[local-name()=\"DespatchDocumentReference\"]/*[local-name()=\"ID\"]"));
}
zpp.setInvoiceReferencedDocumentID(extractString("//*[local-name()=\"InvoiceReferencedDocument\"]/*[local-name()=\"IssuerAssignedID\"]|//*[local-name()=\"BillingReference\"]/*[local-name()=\"InvoiceDocumentReference\"]/*[local-name()=\"ID\"]"));
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]|//*[local-name()=\"AccountingSupplierParty\"]/*[local-name()=\"Party\"]/*[local-name()=\"PartyName\"]").trim());
@@ -929,6 +930,7 @@ public class ZUGFeRDInvoiceImporter {
}
TransactionCalculator tc = new TransactionCalculator(zpp);
String expectedStringTotalGross = tc.getGrandTotal()
.subtract(Objects.requireNonNullElse(zpp.getTotalPrepaidAmount(), BigDecimal.ZERO)).toPlainString();

View File

@@ -539,6 +539,7 @@ public class ZF2PushTest extends TestCase {
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
.addCashDiscount(new CashDiscount(new BigDecimal(2), 14))
.setDeliveryDate(sdf.parse("2020-11-02")).setNumber(number).setVATDueDateTypeCode(EventTimeCodeTypeConstants.PAYMENT_DATE)
.setInvoiceReferencedDocumentID("abc123")
);
} catch (ParseException e) {
e.printStackTrace();
@@ -582,6 +583,7 @@ public class ZF2PushTest extends TestCase {
try {
Invoice i = zii.extractInvoice();
assertEquals("abc123", i.getInvoiceReferencedDocumentID());
assertEquals("4304171000002", i.getRecipient().getGlobalID());
assertEquals("2001015001325", i.getZFItems()[0].getProduct().getGlobalID());
assertEquals(orgID, i.getSender().getID());

View File

@@ -1,4 +1,5 @@
package org.mustangproject.validator;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
@@ -69,14 +70,12 @@ public class XMLValidator extends Validator {
final ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(9)
.setPart(EPart.fx);
try (final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw))
{
final PrintWriter pw = new PrintWriter(sw)) {
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
}
catch (IOException ex) {
throw new UncheckedIOException (ex);
} catch (IOException ex) {
throw new UncheckedIOException(ex);
}
}
@@ -191,7 +190,7 @@ public class XMLValidator extends Validator {
boolean isExtended = false;
boolean isXRechnung = false;
String currentZFVersionDir = "ZF_232";
int mainSchematronSectionErrorTypeCode=4;
int mainSchematronSectionErrorTypeCode = 4;
String xsltFilename = null;
// urn:ferd:CrossIndustryDocument:invoice:1p0:extended,
// urn:ferd:CrossIndustryDocument:invoice:1p0:comfort,
@@ -269,16 +268,16 @@ public class XMLValidator extends Validator {
// saxon java net.sf.saxon.Transform -o tcdl2.0.tsdtf.sch.tmp.xsl -s
// tcdl2.0.tsdtf.sch iso_svrl.xsl
} else if (root.getLocalName().equalsIgnoreCase("Invoice") || root.getLocalName().equalsIgnoreCase("CreditNote") ) {
} else if (root.getLocalName().equalsIgnoreCase("Invoice") || root.getLocalName().equalsIgnoreCase("CreditNote")) {
context.setGeneration("2");
context.setFormat("UBL");
isXRechnung = context.getProfile().contains("xrechnung");
// UBL
LOGGER.debug("UBL");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-"+root.getLocalName()+"-2.1.xsd", 18, EPart.fx);
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-" + root.getLocalName() + "-2.1.xsd", 18, EPart.fx);
xsltFilename = "/xslt/en16931schematron/EN16931-UBL-validation.xslt";
mainSchematronSectionErrorTypeCode=24;
mainSchematronSectionErrorTypeCode = 24;
if (isXRechnung) {
validateSchematron(zfXML, xsltFilename, 24, ESeverity.error);
@@ -287,14 +286,14 @@ public class XMLValidator extends Validator {
XRechnung is a EN16931 subset so the validation vis a vis FACTUR-X_EN16931.xslt=schematron also has to pass
* */
//validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
String xrVersion=context.getProfile().substring(context.getProfile().length()-3).replace(".","");
if (!xrVersion.equals("12")&&!xrVersion.equals("20")&&!xrVersion.equals("21")&&!xrVersion.equals("22")&&!xrVersion.equals("23")&&!xrVersion.equals("30")) {
String xrVersion = context.getProfile().substring(context.getProfile().length() - 3).replace(".", "");
if (!xrVersion.equals("12") && !xrVersion.equals("20") && !xrVersion.equals("21") && !xrVersion.equals("22") && !xrVersion.equals("23") && !xrVersion.equals("30")) {
throw new Exception("Unsupported XR version");
}
LOGGER.debug("is XRechnung v"+xrVersion);
xsltFilename = "/xslt/XR_"+xrVersion+"/XRechnung-UBL-validation.xslt";
LOGGER.debug("is XRechnung v" + xrVersion);
xsltFilename = "/xslt/XR_" + xrVersion + "/XRechnung-UBL-validation.xslt";
XrechnungSeverity = ESeverity.error;
mainSchematronSectionErrorTypeCode=27;
mainSchematronSectionErrorTypeCode = 27;
}
@@ -353,7 +352,7 @@ public class XMLValidator extends Validator {
}
}
if (xsltFilename!=null) {
if (xsltFilename != null) {
// main schematron validation
validateSchematron(zfXML, xsltFilename, mainSchematronSectionErrorTypeCode, ESeverity.error);