diff --git a/History.md b/History.md index 6ea3b5cb..f393403b 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,6 @@ 2.24.x ======= +- #1134 Fix: Trade party universal communication id not imported when scheme is not "email address" (EM) but "electronic address" (0225). - #1150 Remove [D].[M].[Y] after Rechnungsdatum in HTML visualization - #996 Omit ExemptionReason written to line item level for profile EN16931, some validators raise a warning or even an error - #1097 Invoice importer: LegalOrganization id not imported (wrong node name 'GlobalID' instead of 'ID' used) diff --git a/library/src/main/java/org/mustangproject/TradeParty.java b/library/src/main/java/org/mustangproject/TradeParty.java index ea395a92..fa9b664f 100644 --- a/library/src/main/java/org/mustangproject/TradeParty.java +++ b/library/src/main/java/org/mustangproject/TradeParty.java @@ -121,11 +121,11 @@ protected void parseFromUBL(NodeList nodes) { } if (party.item(partyIndex).getLocalName().equals("EndpointID")) { Node currentNode = party.item(partyIndex); - if ((currentNode.getAttributes() != null && - (currentNode.getAttributes().getNamedItem("schemeID") != null)) - && (party.item(partyIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("EM")) - ) { - setEmail(currentNode.getTextContent()); + List supportedSchemeIDs = Arrays.asList("EM", "0225"); + if ((currentNode.getAttributes() != null + && (currentNode.getAttributes().getNamedItem("schemeID") != null)) + && (supportedSchemeIDs.contains(currentNode.getAttributes().getNamedItem("schemeID").getNodeValue()))) { + setEmail(currentNode.getAttributes().getNamedItem("schemeID").getNodeValue(), currentNode.getTextContent()); } } @@ -425,14 +425,13 @@ public TradeParty(NodeList nodes) { } if (itemChilds.item(itemChildIndex).getLocalName().equals("URIUniversalCommunication")) { NodeList URIchilds = itemChilds.item(itemChildIndex).getChildNodes(); + List supportedSchemeIDs = Arrays.asList("EM", "0225"); for (int URIChildIndex = 0; URIChildIndex < URIchilds.getLength(); URIChildIndex++) { Node currentNode = URIchilds.item(URIChildIndex); if ((currentNode.getLocalName() != null) && (currentNode.getLocalName().equals("URIID") - && - (currentNode.getAttributes().getNamedItem("schemeID") != null)) - && (URIchilds.item(URIChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("EM")) - ) { - setEmail(currentNode.getTextContent()); + && (currentNode.getAttributes().getNamedItem("schemeID") != null)) + && (supportedSchemeIDs.contains(currentNode.getAttributes().getNamedItem("schemeID").getNodeValue()))) { + setEmail(currentNode.getAttributes().getNamedItem("schemeID").getNodeValue(), currentNode.getTextContent()); } } } @@ -520,6 +519,12 @@ public TradeParty setEmail(String eMail) { return this; } + public TradeParty setEmail(String schemeID, String eMail) { + SchemedID theSchemedID = new SchemedID(schemeID, eMail); + addUriUniversalCommunicationID(theSchemedID); + return this; + } + /** * if it's a customer, this can e.g. be the customer ID