From ce0941848d600aeca3f53933d557b7517ca6688b Mon Sep 17 00:00:00 2001 From: langfr Date: Tue, 24 Jun 2025 15:22:45 +0100 Subject: [PATCH] =?UTF-8?q?Return=20Account=20Holder=C2=B4s=20name=20in=20?= =?UTF-8?q?prefrence=20over=20Seller=C2=B4s=20Name.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java | 10 ++++++++++ .../java/org/mustangproject/ZUGFeRD/ZF2PushTest.java | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java index cbf08b7b..5afa5a18 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java @@ -351,6 +351,16 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter { public String getHolder() { + if (importedInvoice!=null && importedInvoice.getTradeSettlement()!=null) { + for (IZUGFeRDTradeSettlement settlement : importedInvoice.getTradeSettlement()) { + if (settlement instanceof IZUGFeRDTradeSettlementPayment) { + String s = ((IZUGFeRDTradeSettlementPayment) settlement).getAccountName(); + if ( s != null ) { + return s; + } + } + } + } return extractString("//*[local-name() = 'SellerTradeParty']/*[local-name() = 'Name']"); } diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java index 9c60b75b..75f516f6 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java @@ -114,8 +114,8 @@ public class ZF2PushTest extends TestCase { ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF); assertTrue(zi.getUTF8().contains("DE88200800000970375700")); //the iban assertTrue(zi.getUTF8().contains("Max Mustermann")); //account holder - assertTrue(zi.getUTF8().contains("DueDateDateTime")); //account holder - assertTrue(zi.getUTF8().contains("20201212")); //account holder + assertTrue(zi.getUTF8().contains("DueDateDateTime")); + assertTrue(zi.getUTF8().contains("20201212")); assertTrue(zi.getUTF8().contains("