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

24952 - Fix not allow to update NoW draft issue #3139

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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