Compare commits
1 Commits
01d4821ad3
...
01c86fa782
Author | SHA1 | Date | |
---|---|---|---|
|
01c86fa782 |
@ -196,14 +196,18 @@ public class HsOfficePartnerController implements HsOfficePartnersApi {
|
||||
private void optionallyUpdateRelatedRelations(final HsOfficePartnerRbacEntity saved, final HsOfficePersonRealEntity previousPartnerPerson) {
|
||||
final var partnerPersonHasChanged = !saved.getPartnerRel().getHolder().getUuid().equals(previousPartnerPerson.getUuid());
|
||||
if (partnerPersonHasChanged) {
|
||||
// self-debitors of the old partner-person become self-debitors of the new partner person
|
||||
em.createNativeQuery("""
|
||||
UPDATE hs_office.relation
|
||||
SET holderUuid = :newPartnerPersonUuid
|
||||
WHERE type = 'DEBITOR' AND holderUuid = :oldPartnerPersonUuid AND anchorUuid = :oldPartnerPersonUuid
|
||||
WHERE type = 'DEBITOR' AND
|
||||
holderUuid = :oldPartnerPersonUuid AND anchorUuid = :oldPartnerPersonUuid
|
||||
""")
|
||||
.setParameter("oldPartnerPersonUuid", previousPartnerPerson.getUuid())
|
||||
.setParameter("newPartnerPersonUuid", saved.getPartnerRel().getHolder().getUuid())
|
||||
.executeUpdate();
|
||||
|
||||
// re-anchor all relations from the old partner person to the new partner persion
|
||||
em.createNativeQuery("""
|
||||
UPDATE hs_office.relation
|
||||
SET anchorUuid = :newPartnerPersonUuid
|
||||
|
Loading…
x
Reference in New Issue
Block a user