diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java index 803daae3..7be9d809 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/migration/ImportOfficeTables.java @@ -170,7 +170,7 @@ public class ImportOfficeTables extends ContextBasedTest { throw new RuntimeException(e); } - if ( !"admin".equals(System.getenv("ADMIN_USER") )) { + if ( !"admin".equals(System.getenv("HSADMINNG_POSTGRES_ADMIN_USERNAME") )) { return; } @@ -183,11 +183,12 @@ public class ImportOfficeTables extends ContextBasedTest { """); assertThat(contacts.toString()).isEqualToIgnoringWhitespace(""" { - 71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'), - 101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm@example.org'), - 102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am@example.org'), - 121=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com') - } + 71=contact(label='Herr Michael Mellies ', emailAddresses='mih@example.org'), + 101=contact(label='Frau Dr. Jenny Meyer , JM e.K.', emailAddresses='jm-billing@example.org'), + 102=contact(label='Herr Andrew Meyer , JM e.K.', emailAddresses='am-operation@example.org'), + 103=contact(label='Herr Philip Meyer , JM e.K.', emailAddresses='pm-contractual@example.org'), + 121=contact(label='Petra Schmidt , Test PS', emailAddresses='ps@example.com') + } """); assertThat(persons.toString()).isEqualToIgnoringWhitespace(""" { @@ -223,7 +224,7 @@ public class ImportOfficeTables extends ContextBasedTest { throw new RuntimeException(e); } - if ( !"admin".equals(System.getenv("ADMIN_USER") )) { + if ( !"admin".equals(System.getenv("HSADMINNG_POSTGRES_ADMIN_USERNAME") )) { return; } @@ -252,7 +253,7 @@ public class ImportOfficeTables extends ContextBasedTest { throw new RuntimeException(e); } - if ( !"admin".equals(System.getenv("ADMIN_USER") )) { + if ( !"admin".equals(System.getenv("HSADMINNG_POSTGRES_ADMIN_USERNAME") )) { return; } @@ -619,6 +620,7 @@ public class ImportOfficeTables extends ContextBasedTest { if (isNotBlank(rec.getString("roles")) && rec.getString("roles").contains("billing")) { final var partner = partners.get(rec.getInteger("bp_id")); + final var debitor = debitors.get(rec.getInteger("bp_id")); final var person = partner.getPerson(); person.setTradeName(rec.getString("firma")); @@ -626,7 +628,13 @@ public class ImportOfficeTables extends ContextBasedTest { person.setGivenName(rec.getString("first_name")); person.setFamilyName(rec.getString("last_name")); - initContact(partner.getContact(), rec); + if (rec.getString("roles").contains("contractual")) { + initContact(partner.getContact(), rec); + } else if (rec.getString("roles").contains("billing")) { + initContact(debitor.getBillingContact(), rec); + } else if (rec.getString("roles").contains("operation")) { + // TODO: technical contact initContact(debitor.getBillingContact(), rec); + } } else { initContact(new HsOfficeContactEntity(), rec); diff --git a/src/test/resources/migration/contacts.csv b/src/test/resources/migration/contacts.csv index 1d8cc3e8..040a7c75 100644 --- a/src/test/resources/migration/contacts.csv +++ b/src/test/resources/migration/contacts.csv @@ -1,6 +1,6 @@ contact_id; bp_id; salut; first_name; last_name; title; firma; co; street; zipcode;city; country; phone_private; phone_office; phone_mobile; fax; email; roles 71; 7; Herr; Michael; Mellies; ; ; ; Kleine Freiheit 50; 26524; Hage; DE; ; +49 4931 123456; +49 1522 123456;; mih@example.org; contractual,billing,operation -101; 10; Frau; Jenny; Meyer; Dr.; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 1111111; ; +49 30 2222222; jm@example.org; billing -102; 10; Herr; Andrew; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 3333333; ; +49 30 4444444; am@example.org; operation -102; 10; Herr; Philip; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm@example.org; contractual +101; 10; Frau; Jenny; Meyer; Dr.; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 7777777; +49 30 1111111; ; +49 30 2222222; jm-billing@example.org; billing +102; 10; Herr; Andrew; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 3333333; ; +49 30 4444444; am-operation@example.org; operation +103; 10; Herr; Philip; Meyer; ; JM e.K.;; Waldweg 5; 11001; Berlin; DE; +49 30 6666666; +49 30 5555555; ; +49 30 6666666; pm-contractual@example.org; contractual 121; 12; ; Petra; Schmidt; ; Test PS;; ; ; ; ; ; ; ; ; ps@example.com; billing,contractual,operation