Skip to content

Commit

Permalink
24952 - Fix not allow to update NoW draft issue (bcgov#3139)
Browse files Browse the repository at this point in the history
* update logic to allow update NoW draft
  • Loading branch information
eason-pan-bc authored Dec 20, 2024
1 parent a0d7fef commit 9edd49d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions legal-api/src/legal_api/services/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def is_allowed(business: Business,
else:
is_ignore_draft_blockers = True

# Special case: handiling authorization for amalgamation application
# Special case: handling authorization for amalgamation application
# this check is to make sure that amalgamation application is not allowed/authorized with continue in corps
if filing_type == 'amalgamationApplication' and legal_type in ['C', 'CBEN', 'CUL', 'CCC']:
return False
Expand Down Expand Up @@ -746,7 +746,7 @@ def business_blocker_check(business: Business, is_ignore_draft_blockers: bool =
if business.in_dissolution:
business_blocker_checks[BusinessBlocker.IN_DISSOLUTION] = True

if has_notice_of_withdrawal_filing_blocker(business):
if has_notice_of_withdrawal_filing_blocker(business, is_ignore_draft_blockers):
business_blocker_checks[BusinessBlocker.FILING_WITHDRAWAL] = True

return business_blocker_checks
Expand Down Expand Up @@ -872,15 +872,16 @@ def has_blocker_warning_filing(warnings: List, blocker_checks: dict):
return warning_matches


def has_notice_of_withdrawal_filing_blocker(business: Business):
def has_notice_of_withdrawal_filing_blocker(business: Business, is_ignore_draft_blockers: bool = False):
"""Check if there are any blockers specific to Notice of Withdrawal."""
if business.admin_freeze:
return True

filing_statuses = [Filing.Status.DRAFT.value,
Filing.Status.PENDING.value,
filing_statuses = [Filing.Status.PENDING.value,
Filing.Status.PENDING_CORRECTION.value,
Filing.Status.ERROR.value]
if not is_ignore_draft_blockers:
filing_statuses.append(Filing.Status.DRAFT.value)
blocker_filing_matches = Filing.get_filings_by_status(business.id, filing_statuses)
if any(blocker_filing_matches):
return True
Expand Down

0 comments on commit 9edd49d

Please sign in to comment.