Skip to content
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

Conversation

alexsilva-CGI
Copy link
Contributor

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:

@alexsilva-CGI alexsilva-CGI marked this pull request as ready for review December 6, 2023 14:10
@alexsilva-CGI
Copy link
Contributor Author

@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

@nicoprow
Copy link
Contributor

nicoprow commented Dec 7, 2023

@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
Copy link
Contributor

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

Copy link
Contributor

@nicoprow nicoprow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment

@alexsilva-CGI alexsilva-CGI force-pushed the fix/legal_address_as_site_main_address branch from 27c9846 to 69adb21 Compare December 7, 2023 09:11
@nicoprow nicoprow merged commit 8bd8b0d into eclipse-tractusx:main Dec 7, 2023
9 checks passed
@nicoprow nicoprow deleted the fix/legal_address_as_site_main_address branch December 7, 2023 09:32
@dilipdhankecha2530
Copy link
Contributor

@nicoprow @alexsilva-CGI
We also need to think for the new endpoints which will do the same. In the current development there is no endpoint which we can use to create LegalEntity address as a SiteAddress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants