From 901e9a48687b3b8c008ede70527a14710558962d Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 30 Jan 2024 17:52:35 +0100 Subject: [PATCH] fix billable and general boolean recognition in ImportOfficeData --- .../hs/office/migration/ImportOfficeData.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java index 377a415f..8b200f59 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeData.java @@ -50,6 +50,7 @@ import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; +import static java.lang.Boolean.parseBoolean; import static java.util.Arrays.stream; import static java.util.Objects.requireNonNull; import static net.hostsharing.hsadminng.mapper.PostgresDateRange.toPostgresDateRange; @@ -681,7 +682,7 @@ public class ImportOfficeData extends ContextBasedTest { .debitorNumberSuffix((byte) 0) .defaultPrefix(rec.getString("member_code").replace("hsh00-", "")) .partner(partner) - .billable(rec.isEmpty("free")) + .billable(rec.isEmpty("free") || rec.getString("free").equals("f")) .vatReverseCharge(rec.getBoolean("exempt_vat")) .vatBusiness("GROSS".equals(rec.getString("indicator_vat"))) // TODO: remove .vatId(rec.getString("uid_vat")) @@ -888,7 +889,9 @@ public class ImportOfficeData extends ContextBasedTest { final var contractualMissing = new HashSet(); partners.forEach( (id, partner) -> { final var partnerPerson = partner.getPerson(); - if (relationships.values().stream().filter(rel -> rel.getRelHolder() == partnerPerson && rel.getRelType() == HsOfficeRelationshipType.REPRESENTATIVE).findFirst().isEmpty()) { + if (relationships.values().stream() + .filter(rel -> rel.getRelHolder() == partnerPerson && rel.getRelType() == HsOfficeRelationshipType.REPRESENTATIVE) + .findFirst().isEmpty()) { addRelationship(partnerPerson, partnerPerson, partner.getContact(), HsOfficeRelationshipType.REPRESENTATIVE); contractualMissing.add(partner.getPartnerNumber()); } @@ -1145,7 +1148,8 @@ class Record { boolean getBoolean(final String columnName) { final String value = getString(columnName); - return isNotBlank(value) && Boolean.parseBoolean(value.trim()); + return isNotBlank(value) && + ( parseBoolean(value.trim()) || value.trim().startsWith("t")); } Integer getInteger(final String columnName) {