-
Notifications
You must be signed in to change notification settings - Fork 75
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
20359 Initial business summary updates #2575
Closed
PaulGarewal
wants to merge
2
commits into
bcgov:feature-legal-name
from
PaulGarewal:20359-business-summary-update
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,11 @@ def _get_template_data(self, get_json=False): | |
# get document data | ||
business_json["reportType"] = self._document_key | ||
business_json["business"] = self._legal_entity.json() | ||
business_json["business"]["businessName"] = self._legal_entity.business_name | ||
if self._legal_entity.alternate_names: | ||
business_json["business"]["businessName"] = self._legal_entity.alternate_names[0].name | ||
else: | ||
business_json["business"]["businessName"] = self._legal_entity.business_name | ||
|
||
business_json["registrarInfo"] = {**RegistrarInfo.get_registrar_info(self._report_date_time)} | ||
self._set_description(business_json) | ||
self._set_epoch_date(business_json) | ||
|
@@ -303,6 +307,8 @@ def _set_parties(self, legal_entity: dict): | |
party["mailingAddress"] = BusinessDocument._format_address(party["mailingAddress"]) | ||
if party.get("deliveryAddress"): | ||
party["deliveryAddress"] = BusinessDocument._format_address(party["deliveryAddress"]) | ||
if not party.get("officer", {}).get("partyType") and not party.get("officer", {}).get("lastName"): | ||
party["officer"]["partyType"] = "organization" | ||
legal_entity["parties"] = party_json | ||
|
||
def _set_name_translations(self, legal_entity: dict): | ||
|
@@ -343,7 +349,7 @@ def _set_record_keepers(self, legal_entity: dict): | |
custodian_json = [ | ||
party_role.json | ||
for party_role in self._legal_entity.entity_roles.all() | ||
if party_role.role.lower() == "custodian" | ||
if party_role.role_type.lower() == "custodian" | ||
] | ||
for custodian in custodian_json: | ||
custodian["mailingAddress"] = BusinessDocument._format_address(custodian["mailingAddress"]) | ||
|
@@ -456,7 +462,7 @@ def _format_state_filing(self, filing: Filing) -> dict: | |
def _set_amalgamation_details(self, legal_entity: dict): | ||
"""Set amalgamation filing data.""" | ||
amalgamated_businesses = [] | ||
filings = Filing.get_filings_by_types(self._legal_entity.id, ["amalgamationApplication"]) | ||
filings = Filing.get_filings_by_types(self._legal_entity, ["amalgamationApplication"]) | ||
if filings: | ||
amalgamation_application = filings[0] | ||
legal_entity["business"]["amalgamatedEntity"] = True | ||
|
@@ -518,7 +524,14 @@ def _format_address(address): | |
def _set_meta_info(self, legal_entity: dict): | ||
legal_entity["environment"] = f"{self._get_environment()} BUSINESS #{self._legal_entity.identifier}".lstrip() | ||
legal_entity["meta_title"] = "Business Summary on {}".format(legal_entity["report_date_time"]) | ||
legal_entity["meta_subject"] = "{} ({})".format(self._legal_entity.legal_name, self._legal_entity.identifier) | ||
if self._legal_entity.alternate_names and self._legal_entity.legal_name is None: | ||
legal_entity["meta_subject"] = "{} ({})".format( | ||
self._legal_entity.alternate_names[0].name, self._legal_entity.identifier | ||
) | ||
else: | ||
legal_entity["meta_subject"] = "{} ({})".format( | ||
self._legal_entity.legal_name, self._legal_entity.identifier | ||
) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kept getting an error here when the conditional was met, handles that case but needs improvement. |
||
@staticmethod | ||
def _get_environment(): | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
handles an odd case when the partner of a firm is an organization, partyType will not be populated. Does not handle when there are 2 partner organizations yet.
Example in FM1000051
My initial changes were getting out of hand to handle this fully, so looking for cleaner suggestions.