-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix (Pool) - Added way to LegalAddress to be Main Site Address in Pool #674
Fix (Pool) - Added way to LegalAddress to be Main Site Address in Pool #674
Conversation
@nicoprow Tested with the round trip, and it seems that its now associating both site and legalEntity to an address when the LegalAndSiteMainAddress is present on the AddressType. I do have a question. Should also this logic apply when an update is done? so for example when type changes from SiteMainAddress to LegalAndSiteMainAddress, an association from both Site and Legal Entity to a single Address is done, with the deletion of the old persisted addresses. Thanks |
For the update I would follow the same principle we have done before: The parent relationship between L/S/A business partners doesn't change |
address.site = createSite | ||
createSite | ||
|
||
if (taskEntry.generic.postalAddress.addressType == AddressType.LegalAndSiteMainAddress) { //Association of Site Main Address to Legal Address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some duplicated code here. Why not somthing like:
val siteMainAddress =
if(genericBusinessPartner.postalAddress.addressType == AddressType.LegalAndSiteMainAddress)
legalEntity.legalAddress
else
createLogisticAddress(mainAddress, taskEntryBpnMapping)
createSite.mainAddress = siteMainAddress
siteMainAddress.site = createSite
createSite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment
27c9846
to
69adb21
Compare
@nicoprow @alexsilva-CGI |
Description
Currently, it is not possible in the Pool for a legal address to be also a main site address at the same time. This PR adjust the way a Address is persisted if both Legal Entity and Site share it.
Related issues: #657
Pre-review checks
Please ensure to do as many of the following checks as possible, before asking for committer review: