diff --git a/library/pom.xml b/library/pom.xml
index 6e5e6daa..b9e92200 100644
--- a/library/pom.xml
+++ b/library/pom.xml
@@ -116,6 +116,12 @@
org.dom4j
dom4j
2.1.4
+
+
+ *
+ *
+
+
diff --git a/library/src/main/java/org/mustangproject/DirectDebit.java b/library/src/main/java/org/mustangproject/DirectDebit.java
index 1eee28b8..86937a0f 100644
--- a/library/src/main/java/org/mustangproject/DirectDebit.java
+++ b/library/src/main/java/org/mustangproject/DirectDebit.java
@@ -24,7 +24,8 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
* bean constructor
*/
public DirectDebit() {
-
+ this.IBAN = "";
+ this.mandate = "";
}
/***
@@ -46,8 +47,18 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
return this.IBAN;
}
+ public DirectDebit setIBAN(String iBAN) {
+ this.IBAN = iBAN;
+ return this;
+ }
+
@Override
public String getMandate() {
return this.mandate;
}
+
+ public DirectDebit setMandate(String mandate) {
+ this.mandate = mandate;
+ return this;
+ }
}
diff --git a/library/src/main/java/org/mustangproject/FileAttachment.java b/library/src/main/java/org/mustangproject/FileAttachment.java
index a7446a54..ed1fe39f 100644
--- a/library/src/main/java/org/mustangproject/FileAttachment.java
+++ b/library/src/main/java/org/mustangproject/FileAttachment.java
@@ -26,7 +26,7 @@ public class FileAttachment {
this.mimetype = mimetype;
this.relation = relation;
this.data = data;
- description = "Additional file attachment";
+ this.description = "Additional file attachment";
}
public String getDescription() {
@@ -73,8 +73,4 @@ public class FileAttachment {
this.data = data;
return this;
}
-
-
-
-
}
diff --git a/library/src/main/java/org/mustangproject/IncludedNote.java b/library/src/main/java/org/mustangproject/IncludedNote.java
index 66b23bbf..db34e793 100644
--- a/library/src/main/java/org/mustangproject/IncludedNote.java
+++ b/library/src/main/java/org/mustangproject/IncludedNote.java
@@ -9,72 +9,77 @@ import com.fasterxml.jackson.annotation.JsonInclude;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class IncludedNote {
- private String content;
+ private String content;
- private SubjectCode subjectCode;
+ private SubjectCode subjectCode;
- private static final String INCLUDE_START = "";
- private static final String INCLUDE_END = "";
- private static final String CONTENT_START = "";
- private static final String CONTENT_END = "";
- private static final String SUBJECT_CODE_START = "";
- private static final String SUBJECT_CODE_END = "";
+ private static final String INCLUDE_START = "";
+ private static final String INCLUDE_END = "";
+ private static final String CONTENT_START = "";
+ private static final String CONTENT_END = "";
+ private static final String SUBJECT_CODE_START = "";
+ private static final String SUBJECT_CODE_END = "";
- private IncludedNote(String content, SubjectCode subjectCode) {
- this.content = content;
- this.subjectCode = subjectCode;
- }
+ public IncludedNote(String content, SubjectCode subjectCode) {
+ this.content = content;
+ this.subjectCode = subjectCode;
+ }
/**
* bean constructor
*/
- public IncludedNote() {
+ public IncludedNote() {
}
- public static IncludedNote generalNote(String content) {
- return new IncludedNote(content, SubjectCode.AAI);
- }
+ public static IncludedNote generalNote(String content) {
+ return new IncludedNote(content, SubjectCode.AAI);
+ }
- public static IncludedNote regulatoryNote(String content) {
- return new IncludedNote(content, SubjectCode.REG);
- }
+ public static IncludedNote regulatoryNote(String content) {
+ return new IncludedNote(content, SubjectCode.REG);
+ }
- public static IncludedNote legalNote(String content) {
- return new IncludedNote(content, SubjectCode.ABL);
- }
+ public static IncludedNote legalNote(String content) {
+ return new IncludedNote(content, SubjectCode.ABL);
+ }
- public static IncludedNote customsNote(String content) {
- return new IncludedNote(content, SubjectCode.CUS);
- }
+ public static IncludedNote customsNote(String content) {
+ return new IncludedNote(content, SubjectCode.CUS);
+ }
- public static IncludedNote sellerNote(String content) {
- return new IncludedNote(content, SubjectCode.SUR);
- }
+ public static IncludedNote sellerNote(String content) {
+ return new IncludedNote(content, SubjectCode.SUR);
+ }
- public static IncludedNote taxNote(String content) {
- return new IncludedNote(content, SubjectCode.TXD);
- }
+ public static IncludedNote taxNote(String content) {
+ return new IncludedNote(content, SubjectCode.TXD);
+ }
- public static IncludedNote introductionNote(String content) {
- return new IncludedNote(content, SubjectCode.ACY);
- }
+ public static IncludedNote introductionNote(String content) {
+ return new IncludedNote(content, SubjectCode.ACY);
+ }
- public static IncludedNote discountBonusNote(String content) {
- return new IncludedNote(content, SubjectCode.AAK);
- }
+ public static IncludedNote discountBonusNote(String content) {
+ return new IncludedNote(content, SubjectCode.AAK);
+ }
- public static IncludedNote unspecifiedNote(String content) {
- return new IncludedNote(content, null);
- }
+ public static IncludedNote unspecifiedNote(String content) {
+ return new IncludedNote(content, null);
+ }
- public String getContent() {
- return content;
- }
+ public String getContent() {
+ return content;
+ }
- public SubjectCode getSubjectCode() {
- return subjectCode;
- }
+ public IncludedNote setContent(String content) {
+ this.content = content;
+ return this;
+}
+
+ public SubjectCode getSubjectCode() {
+ return subjectCode;
+ }
public IncludedNote setSubjectCode(SubjectCode subjectCode) {
@@ -88,13 +93,13 @@ public class IncludedNote {
}
- public String toCiiXml() {
- String result = INCLUDE_START + CONTENT_START +
- XMLTools.encodeXML(getContent()) + CONTENT_END;
- if (getSubjectCode() != null) {
- result += SUBJECT_CODE_START + getSubjectCode() + SUBJECT_CODE_END;
- }
- return result + INCLUDE_END;
- }
-
+ public String toCiiXml(){
+ String result = INCLUDE_START + CONTENT_START +
+ XMLTools.encodeXML(getContent() )+ CONTENT_END;
+ if (getSubjectCode() != null) {
+ result += SUBJECT_CODE_START + getSubjectCode() + SUBJECT_CODE_END;
+ }
+ return result + INCLUDE_END;
+ }
+
}
diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java
index f64c75fe..92aaee4e 100644
--- a/library/src/main/java/org/mustangproject/Item.java
+++ b/library/src/main/java/org/mustangproject/Item.java
@@ -12,7 +12,9 @@ import org.w3c.dom.NodeList;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
+import java.util.List;
import java.util.HashMap;
import java.util.Map;
@@ -39,6 +41,7 @@ public class Item implements IZUGFeRDExportableItem {
protected ArrayList additionalReference = null;
protected ArrayList Allowances = new ArrayList<>();
protected ArrayList Charges = new ArrayList<>();
+ protected List includedNotes = null;
//protected HashMap attributes = new HashMap<>();
/***
@@ -124,6 +127,12 @@ public class Item implements IZUGFeRDExportableItem {
.flatMap(bordNodes -> bordNodes.getAsString("LineID"))
.ifPresent(this::addReferencedLineID);
+ itemMap.getAsString("ID")
+ .ifPresent(this::setId);
+
+
+ itemMap.getAsString("Note")
+ .ifPresent(this::addNote);
@@ -172,6 +181,38 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
});
+
+ itemMap.getAsString("Note").ifPresent(this::addNote);
+ itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
+ List includedNotes = new ArrayList<>();
+ adld.getAllNodes("IncludedNote").forEach(item -> {
+ String subjectCode = "";
+ String content = null;
+ NodeList includedNodeChilds = item.getChildNodes();
+ for (int issueDateChildIndex = 0; issueDateChildIndex < includedNodeChilds.getLength(); issueDateChildIndex++) {
+ if ((includedNodeChilds.item(issueDateChildIndex).getLocalName() != null)
+ && (includedNodeChilds.item(issueDateChildIndex).getLocalName().equals("Content"))) {
+ content = XMLTools.trimOrNull(includedNodeChilds.item(issueDateChildIndex));
+ }
+ if ((includedNodeChilds.item(issueDateChildIndex).getLocalName() != null)
+ && (includedNodeChilds.item(issueDateChildIndex).getLocalName().equals("SubjectCode"))) {
+ subjectCode = XMLTools.trimOrNull(includedNodeChilds.item(issueDateChildIndex));
+ }
+ }
+ boolean foundCode = false;
+ for (SubjectCode code : SubjectCode.values()) {
+ if (code.toString().equals(subjectCode)) {
+ includedNotes.add(new IncludedNote(content, code));
+ foundCode = true;
+ break;
+ }
+ }
+ if (!foundCode) {
+ includedNotes.add(new IncludedNote(content, null));
+ }
+ });
+ addNotes(includedNotes);
+ });
}
public Item addReferencedLineID(String s) {
@@ -419,4 +460,19 @@ public class Item implements IZUGFeRDExportableItem {
return detailedDeliveryPeriodTo;
}
+ public IZUGFeRDExportableItem addNotes(Collection notes) {
+ if (notes == null) {
+ return this;
+ }
+ if (includedNotes == null) {
+ includedNotes = new ArrayList<>();
+ }
+ includedNotes.addAll(notes);
+ return this;
+ }
+
+ @Override
+ public List getNotesWithSubjectCode() {
+ return includedNotes;
+ }
}
diff --git a/library/src/main/java/org/mustangproject/SubjectCode.java b/library/src/main/java/org/mustangproject/SubjectCode.java
index c58070fd..808c09d4 100644
--- a/library/src/main/java/org/mustangproject/SubjectCode.java
+++ b/library/src/main/java/org/mustangproject/SubjectCode.java
@@ -36,5 +36,9 @@ public enum SubjectCode {
/**
* Discount and bonus agreements
*/
- AAK
+ AAK,
+ /**
+ * Vehicle licence number
+ */
+ ABZ
}
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java
index 3dcd3692..45c210ea 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java
@@ -28,7 +28,9 @@ package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal;
import java.util.Date;
+import java.util.List;
+import org.mustangproject.IncludedNote;
import org.mustangproject.Item;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -153,7 +155,6 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
return null;
}
-
/***
*
* @return the line ID
@@ -161,4 +162,14 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
default String getId() {
return null;
}
+
+ /**
+ * A grouping of business terms to indicate accounting-relevant free texts including a qualification of these.
+ *
+ * The information are written to the same xml nodes like {@link #getNotes()} but with explicit subjectCode.
+ * @return list of the notes
+ */
+ default List getNotesWithSubjectCode() {
+ return null;
+ }
}
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java b/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java
index c44f29ee..e319ec73 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/LineCalculator.java
@@ -50,10 +50,14 @@ public class LineCalculator {
quantity=currentItem.getQuantity();
}
- itemTotalNetAmount = quantity.multiply(getPrice()).divide(currentItem.getBasisQuantity(), 18, RoundingMode.HALF_UP)
+ // Division/Zero occurred here.
+ // Used the setScale only because that's also done in getBasisQuantity
+ BigDecimal basisQuantity = currentItem.getBasisQuantity().compareTo(BigDecimal.ZERO) == 0
+ ? BigDecimal.ONE.setScale(4)
+ : currentItem.getBasisQuantity();
+ itemTotalNetAmount = quantity.multiply(getPrice()).divide(basisQuantity, 18, RoundingMode.HALF_UP)
.subtract(allowanceItemTotal).setScale(2, RoundingMode.HALF_UP);
itemTotalVATAmount = itemTotalNetAmount.multiply(multiplicator);
-
}
public BigDecimal getPrice() {
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
index 91f86690..da2c8792 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
@@ -743,6 +743,15 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
node = getNodeByName(node.getChildNodes(), "CalculatedAmount");
lineItem.setTax(XMLTools.tryBigDecimal(node));
}
+
+ node = getNodeByName(nn.getChildNodes(), "ApplicableTradeTax");
+ if (node != null) {
+ node = getNodeByName(node.getChildNodes(), "CategoryCode");
+ if(node != null){
+ lineItem.getProduct().setTaxCategoryCode(XMLTools.getNodeValue(node));
+ }
+ }
+
node = getNodeByName(nn.getChildNodes(), "BillingSpecifiedPeriod");
if (node != null) {
final Node start = getNodeByName(node.getChildNodes(), "StartDateTime");
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
index 5f49b6dc..abff63bb 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
@@ -327,8 +327,10 @@ public class ZUGFeRDInvoiceImporter {
deliveryLocationNodeMap -> {
deliveryLocationNodeMap.getNode("ID").ifPresent(s -> {
- SchemedID sID = new SchemedID().setScheme(s.getAttributes().getNamedItem("schemeID").getTextContent()).setId(s.getTextContent());
- delivery.addGlobalID(sID);
+ if (s.getAttributes().getNamedItem("schemeID") != null) {
+ SchemedID sID = new SchemedID().setScheme(s.getAttributes().getNamedItem("schemeID").getTextContent()).setId(s.getTextContent());
+ delivery.addGlobalID(sID);
+ }
});
deliveryLocationNodeMap.getAsNodeMap("Address").ifPresent(s -> {
s.getAsString("StreetName").ifPresent(t -> delivery.setStreet(t));
diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
index 5b8155ea..00377327 100644
--- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
+++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
@@ -22,12 +22,15 @@ package org.mustangproject.ZUGFeRD;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.commons.codec.binary.StringUtils;
import org.junit.jupiter.api.Test;
import org.mustangproject.*;
import javax.xml.xpath.XPathExpressionException;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
@@ -308,7 +311,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
LineCalculator lc=new LineCalculator(invoice.getZFItems()[0]);
assertTrue(new BigDecimal("1").compareTo(lc.getItemTotalNetAmount()) == 0);
- assertTrue(invoice.getTradeSettlement().length==1);
+ assertTrue(invoice.getTradeSettlement().length == 1);
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
IZUGFeRDTradeSettlementPayment paym = (IZUGFeRDTradeSettlementPayment) invoice.getTradeSettlement()[0];
assertEquals("DE12500105170648489890", paym.getOwnIBAN());
@@ -439,4 +442,25 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
}
+ @Test
+ public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException {
+ File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf");
+ ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
+
+ Invoice invoice = zii.extractInvoice();
+ assertEquals(1, invoice.getZFItems().length);
+ assertEquals(8, invoice.getZFItems()[0].getNotesWithSubjectCode().size());
+ assertEquals("FB-LE 9999", invoice.getZFItems()[0].getNotesWithSubjectCode().stream().filter(note -> note.getSubjectCode().equals(SubjectCode.ABZ)).findFirst().get().getContent());
+ }
+
+ @Test
+ public void testImportXRechnungPositionNote() throws FileNotFoundException, XPathExpressionException, ParseException {
+ File inputFile = getResourceAsFile("TESTXRECHNUNG_INVDSS_012015776085.XML");
+ ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
+
+ Invoice invoice = zii.extractInvoice();
+ assertEquals(1, invoice.getZFItems().length);
+ assertFalse(invoice.getZFItems()[0].getNotes() == null);
+ assertEquals(1, invoice.getZFItems()[0].getNotes().length);
+ }
}
diff --git a/library/src/test/resources/TESTXRECHNUNG_INVDSS_012015776085.XML b/library/src/test/resources/TESTXRECHNUNG_INVDSS_012015776085.XML
new file mode 100644
index 00000000..1541326d
--- /dev/null
+++ b/library/src/test/resources/TESTXRECHNUNG_INVDSS_012015776085.XML
@@ -0,0 +1,157 @@
+
+ urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
+ urn:fdc:peppol.eu:2017:poacc:billing:01:1.0
+ 2015776085
+ 2024-11-01
+ 380
+ #AAI# Wenn bereits bezahlt, nur zu den Akten legen. Für Verzug und Verzugszinsen gelten die Bestimmungen der §§ 286 - 288 BGB. Der Schuldner einer Entgeltforderung kommt spätestens in Verzug, wenn er nicht innerhalb von 30 Tagen nach Fälligkeit und Zugang einer Rechnung oder gleichwertigen Zahlungsaufstellung leistet. Die Lieferung von Waren und Fahrzeugen erfolgt unter Eigentumsvorbehalt.
+ #PAI# Rechnungsbetrag zahlbar ohne Abzug sofort nach Erhalt der Rechnung.
+ EUR
+ 02-ZZ987654-99
+
+ 2024-11-01
+ 2024-11-30
+
+
+ N/A
+
+
+ 63435555
+
+
+
+ DE238574172
+
+ Alphabet Fuhrparkmanagement GmbH
+
+
+ Lilienthalallee 26
+ München
+ 80786
+
+ DE
+
+
+
+ DE238574172
+
+ VAT
+
+
+
+ Alphabet Fuhrparkmanagement GmbH
+ HRB 181098
+
+
+ Yildiz Tolga
+ +49899--
+ Tolga.Yildiz@alphabet.de
+
+
+
+
+
+ N/A
+
+ 00987654
+
+
+ Muster GmbH
+
+
+ Musterweg 1
+ Kiel
+ 24105
+
+ DE
+
+
+
+ Muster GmbH
+
+
+ Mustermann Max
+
+
+
+
+ 2024-11-30
+
+ 00987654
+
+ Musterweg 1
+ Kiel
+ 24105
+
+ DE
+
+
+
+
+
+ Muster GmbH
+
+
+
+
+ 30
+
+ DE34700700100156919301
+ Alphabet Fuhrparkmanagement GmbH
+
+ DEUTDEMMXXX
+
+
+
+
+ Rechnungsbetrag zahlbar ohne Abzug sofort nach Erhalt der Rechnung.
+
+
+ 161.69
+
+ 851.00
+ 161.69
+
+ S
+ 19.00
+
+ VAT
+
+
+
+
+
+ 851.00
+ 851.00
+ 1012.69
+ 1012.69
+
+
+ 1
+ #AAI# Finanzrate vom 01.11.2024 bis 30.11.2024 #ABZ/Kennzeichen#SH-9 18E #AKG/Fahrgestellnummer#WBY51EJ080CR55555 #BA/Kilometerstand#0 #AKV/LeasingNr#63435555
+ 1.00
+ 851.00
+
+ 2024-11-01
+ 2024-11-30
+
+
+ FL-Rate
+ FL-Rate
+
+ 90101
+
+
+ S
+ 19.00
+
+ VAT
+
+
+
+
+ 851.00
+ 1.00
+
+
+
diff --git a/library/src/test/resources/ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf b/library/src/test/resources/ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf
new file mode 100644
index 00000000..7b220689
Binary files /dev/null and b/library/src/test/resources/ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf differ
diff --git a/validator/pom.xml b/validator/pom.xml
index b09a497b..36ef5550 100644
--- a/validator/pom.xml
+++ b/validator/pom.xml
@@ -44,6 +44,12 @@
org.dom4j
dom4j
2.1.4
+
+
+ *
+ *
+
+
commons-io
diff --git a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
index 632b56f8..336701b3 100644
--- a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
+++ b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java
@@ -424,11 +424,6 @@ public class XMLValidator extends Validator {
*/
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity defaultSeverity) throws IrrecoverableValidationError {
ISchematronResource aResSCH = null;
- ESeverity severity=defaultSeverity;
- if (defaultSeverity!=ESeverity.notice) {
- severity=ESeverity.error;
- }
-
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
if (aResSCH != null) {
@@ -472,14 +467,15 @@ public class XMLValidator extends Validator {
thisFailLocation = currentFailNode.getAttributes().getNamedItem("location").getNodeValue();
}
- if (currentFailNode.getAttributes().getNamedItem("flag") != null) {
+ ESeverity severity;
+ if (defaultSeverity == ESeverity.notice) {
+ severity = defaultSeverity;
+ } else if (currentFailNode.getAttributes().getNamedItem("flag") != null
+ && currentFailNode.getAttributes().getNamedItem("flag").getNodeValue().equals("warning")) {
// the XR issues warnings with flag=warning
- if (currentFailNode.getAttributes().getNamedItem("flag").getNodeValue().equals("warning")) {
- if (defaultSeverity!=ESeverity.notice) {
- severity=ESeverity.warning;
- }
- }
-
+ severity = ESeverity.warning;
+ } else {
+ severity = ESeverity.error;
}
NodeList failChilds = currentFailNode.getChildNodes();
diff --git a/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java
index 2eb284f9..55affaa9 100644
--- a/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java
+++ b/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java
@@ -216,10 +216,10 @@ public class ZUGFeRDValidatorTest extends ResourceCase {
assertThat(res).valueByXPath("count(//error)")
.asInt()
- .isEqualTo(1);
+ .isEqualTo(2);
assertThat(res).valueByXPath("count(//warning)")
.asInt()
- .isEqualTo(3);
+ .isEqualTo(2);
assertThat(res).valueByXPath("count(//notice)")
.asInt()