import-debitor-relationship (into intermediate data structure) #22
@ -116,7 +116,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
JOIN hs_office_relationship partnerRel
|
||||
ON partnerRel.uuid = partner.partnerRoleUUid AND partnerRel.relType = 'PARTNER'
|
||||
JOIN hs_office_relationship debitorRel
|
||||
ON debitorRel.relAnchorUuid = partnerRel.relHolderUuid AND partnerRel.relType = 'ACCOUNTING'
|
||||
ON debitorRel.relAnchorUuid = partnerRel.relHolderUuid AND partnerRel.relType = 'DEBITOR'
|
||||
WHERE debitorRel.uuid = debitor.debitorRelUuid)
|
||||
|| to_char(debitorNumberSuffix, 'fm00')
|
||||
from hs_office_debitor as debitor
|
||||
@ -137,7 +137,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
fetchedBySql("""
|
||||
SELECT *
|
||||
FROM hs_office_relationship AS r
|
||||
WHERE r.relType = 'ACCOUNTING' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
WHERE r.relType = 'DEBITOR' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
"""),
|
||||
dependsOnColumn("debitorRelUuid"))
|
||||
.createPermission(DELETE).grantedTo("debitorRel", OWNER)
|
||||
@ -148,7 +148,7 @@ public class HsOfficeDebitorEntity implements HasUuid, Stringifyable {
|
||||
dependsOnColumn("refundBankAccountUuid"), fetchedBySql("""
|
||||
SELECT *
|
||||
FROM hs_office_relationship AS r
|
||||
WHERE r.relType = 'ACCOUNTING' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
WHERE r.relType = 'DEBITOR' AND r.relHolderUuid = ${REF}.debitorRelUuid
|
||||
""")
|
||||
)
|
||||
.toRole("refundBankAccount", ADMIN).grantRole("debitorRel", AGENT)
|
||||
|
@ -6,7 +6,7 @@ public enum HsOfficeRelationshipType {
|
||||
EX_PARTNER,
|
||||
REPRESENTATIVE,
|
||||
VIP_CONTACT,
|
||||
ACCOUNTING,
|
||||
DEBITOR,
|
||||
OPERATIONS,
|
||||
SUBSCRIBER
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ CREATE TYPE HsOfficeRelationshipType AS ENUM (
|
||||
'PARTNER',
|
||||
'EX_PARTNER',
|
||||
'REPRESENTATIVE',
|
||||
'DEBITOR',
|
||||
'VIP_CONTACT',
|
||||
'ACCOUNTING',
|
||||
'OPERATIONS',
|
||||
'SUBSCRIBER');
|
||||
|
||||
|
@ -220,6 +220,23 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
|
||||
@Test
|
||||
@Order(1021)
|
||||
void buildDebitorRelationships() {
|
||||
debitors.forEach( (id, debitor) -> {
|
||||
final var debitorRel = HsOfficeRelationshipEntity.builder()
|
||||
.relType(HsOfficeRelationshipType.DEBITOR)
|
||||
.relAnchor(debitor.getPartner().getPerson())
|
||||
.relHolder(debitor.getPartner().getPerson()) // just 1 debitor/partner in legacy hsadmin
|
||||
.contact(debitor.getBillingContact())
|
||||
.build();
|
||||
if (debitorRel.getRelAnchor() != null && debitorRel.getRelHolder() != null &&
|
||||
debitorRel.getContact() != null ) {
|
||||
relationships.put(relationshipId++, debitorRel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1029)
|
||||
void verifyContacts() {
|
||||
assumeThatWeAreImportingControlledTestData();
|
||||
|
||||
@ -289,8 +306,11 @@ public class ImportOfficeData extends ContextBasedTest {
|
||||
2000013=rel(relAnchor='LP JM GmbH', relType='VIP_CONTACT', relHolder='LP JM GmbH', contact='Frau Tammy Meyer-VIP , JM GmbH'),
|
||||
2000014=rel(relAnchor='?? Test PS', relType='OPERATIONS', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000015=rel(relAnchor='?? Test PS', relType='REPRESENTATIVE', relHolder='?? Test PS', contact='Petra Schmidt , Test PS'),
|
||||
2000016=rel(relAnchor='NP Mellies, Michael', relType='SUBSCRIBER', relMark='operations-announce', relHolder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga ')
|
||||
}
|
||||
2000016=rel(relAnchor='NP Mellies, Michael', relType='SUBSCRIBER', relMark='operations-announce', relHolder='NP Fanninga, Frauke', contact='Frau Frauke Fanninga '),
|
||||
2000017=rel(relAnchor='NP Mellies, Michael', relType='DEBITOR', relHolder='NP Mellies, Michael', contact='Herr Michael Mellies '),
|
||||
2000018=rel(relAnchor='LP JM GmbH', relType='DEBITOR', relHolder='LP JM GmbH', contact='Frau Dr. Jenny Meyer-Billing , JM GmbH'),
|
||||
2000019=rel(relAnchor='?? Test PS', relType='DEBITOR', relHolder='?? Test PS', contact='Petra Schmidt , Test PS')
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user