Merge branch 'master' of github.com:ZUGFeRD/mustangproject

This commit is contained in:
Jochen Stärk
2020-10-06 12:23:59 +02:00
3 changed files with 25 additions and 12 deletions

View File

@@ -55,17 +55,17 @@ public class Main {
+ " [-i, --ignorefileextension] Check for all files (*.*) instead of PDF files only (*.pdf) in metrics, ignore PDF/A input file errors in combine\n"
+ "\n" + "* Merge actions\n" + " extract extract ZUGFeRD PDF to XML file\n"
+ " Additional parameters (optional - user will be prompted if not defined)\n"
+ " [--source <filename>]: set input PDF file\n"
+ " [--out <filename>]: set output XML file\n"
+ " [--source=<filename>]: set input PDF file\n"
+ " [--out=<filename>]: set output XML file\n"
+ " a3only upgrade from PDF/A1 to A3 only (no ZUGFeRD data attached)\n"
+ " Additional parameters (optional - user will be prompted if not defined)\n"
+ " [--source <filename>]: set input PDF file\n"
+ " [--out <filename>]: set output PDF file\n"
+ " [--source=<filename>]: set input PDF file\n"
+ " [--out=<filename>]: set output PDF file\n"
+ " combine combine XML and PDF file to ZUGFeRD PDF file\n"
+ " Additional parameters (optional - user will be prompted if not defined)\n"
+ " [--source <filename>]: set input PDF file\n"
+ " [--source-xml <filename>]: set input XML file\n"
+ " [--out <filename>]: set output PDF file\n"
+ " [--source=<filename>]: set input PDF file\n"
+ " [--source-xml=<filename>]: set input XML file\n"
+ " [--out=<filename>]: set output PDF file\n"
+ " [--format <fx|zf>]: set ZUGFeRD or FacturX\n"
+ " [--version <1|2>]: set ZUGFeRD version\n"
+ " [--profile <...>]: set ZUGFeRD profile\n"
@@ -73,8 +73,9 @@ public class Main {
+ " For ZUGFeRD v2: <M>INIMUM, BASIC <W>L, <B>ASIC, <C>IUS, <E>N16931, <X>Rechnung, EX<T>ENDED "
+ " validate validate XML or PDF file \n"
+ " [--no-notices]: refrain from reporting notices\n"
+ " [--logAppend=<text>]: text to be added to log line\n"
+ " Additional parameters (optional - user will be prompted if not defined)\n"
+ " [--source <filename>]: input PDF or XML file\n"
+ " [--source=<filename>]: input PDF or XML file\n"
+ " validateExpectValid validate directory expecting positive results \n"
+ " [--no-notices]: refrain from reporting notices\n"
+ " Additional parameters (optional - user will be prompted if not defined)\n"
@@ -238,7 +239,7 @@ public class Main {
// --out: output file
Option<String> outOption = parser.addStringOption("out");
Option<Boolean> noNoticesOption = parser.addBooleanOption("no-notices");
Option<String> logAppendOption = parser.addStringOption("logAppend");
// Command: Combining PDF and XML
// --combine
@@ -303,7 +304,7 @@ public class Main {
performVisualization(sourceName, outName);
optionsRecognized=true;
} else if ((action!=null)&&(action.equals("validate"))) {
optionsRecognized=performValidate(sourceName, noNotices!=null&&noNotices);
optionsRecognized=performValidate(sourceName, noNotices!=null&&noNotices, parser.getOptionValue(logAppendOption));
} else if ((action!=null)&&(action.equals("validateExpectValid"))) {
optionsRecognized=performValidateExpect(true, directoryName);
} else if ((action!=null)&&(action.equals("validateExpectInvalid"))) {
@@ -320,12 +321,15 @@ public class Main {
}
private static boolean performValidate(String sourceName, boolean noNotices) {
private static boolean performValidate(String sourceName, boolean noNotices, String logAppend) {
boolean optionsRecognized;
if (sourceName == null) {
sourceName = getFilenameFromUser("Source PDF or XML", "invoice.pdf", "pdf|xml", true, false);
}
ZUGFeRDValidator zfv=new ZUGFeRDValidator();
if ((logAppend!=null)&&(logAppend.length()>0)) {
zfv.setLogAppend(logAppend);
}
if (noNotices) {
zfv.disableNotices();
}

View File

@@ -263,6 +263,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ "</ram:ID>\n"
+ " </ram:SpecifiedTaxRegistration>\n";
}
if (party.getTaxID() != null) {
xml += " <ram:SpecifiedTaxRegistration>\n"
+ " <ram:ID schemeID=\"FC\">" + XMLTools.encodeXML(party.getTaxID())
+ "</ram:ID>\n"
+ " </ram:SpecifiedTaxRegistration>\n";
}
return xml;
}

View File

@@ -93,6 +93,7 @@ public class ZF2PushTest extends TestCase {
String orgname = "Test company";
String number = "123";
String amountStr = "1.00";
String taxID="9990815";
BigDecimal amount = new BigDecimal(amountStr);
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
@@ -104,7 +105,7 @@ public class ZF2PushTest extends TestCase {
byte[] b={12,13};
ze.attachFile("one.pdf", b, "Application/PDF", "Alternative");
ze.attachFile("two.pdf", b, "Application/PDF", "Alternative");
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE").addTaxID("0815")).setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711").setContact(new Contact("Franz Müller","01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE").addTaxID(taxID)).setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711").setContact(new Contact("Franz Müller","01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
);
String theXML = new String(ze.getProvider().getXML());
@@ -118,6 +119,7 @@ public class ZF2PushTest extends TestCase {
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_ATTACHMENTSPDF);
assertTrue(zi.getUTF8().contains("EUR"));
assertTrue(zi.getUTF8().contains(taxID));
// Reading ZUGFeRD
assertEquals("1.19", zi.getAmount());