From 31891665478dcebde9499eb6c0f67c1f24734e4e Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Tue, 2 Jan 2024 16:54:38 -0800 Subject: [PATCH 1/2] MHR API UXA review amend permit report updates. Signed-off-by: Doug Lovett --- .../report-templates/registrationCoverV2.html | 18 +++++++++--------- .../template-parts/registration/location.html | 1 - .../report-templates/transportPermitV2.html | 7 +++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mhr_api/report-templates/registrationCoverV2.html b/mhr_api/report-templates/registrationCoverV2.html index ddcea2930..27d101014 100644 --- a/mhr_api/report-templates/registrationCoverV2.html +++ b/mhr_api/report-templates/registrationCoverV2.html @@ -100,15 +100,6 @@ {{ documentDescription }} {% endif %} -
- {% if registrationType is defined and registrationType == 'PERMIT' %}Transport Permit Number:{% else %}Document Registration Number:{% endif %} - - {% if documentRegistrationNumber is defined and documentRegistrationNumber != '' %} - {{ documentRegistrationNumber }} - {% else %} - N/A - {% endif %} -
{% if documentType is defined and documentType == 'CANCEL_PERMIT' and note is defined and note.cancelledDocumentRegistrationNumber is defined %}
Transport Permit Number: {{ note.cancelledDocumentRegistrationNumber }} @@ -118,6 +109,15 @@ {{ permitRegistrationNumber }}
{% endif %} +
+ {% if registrationType is defined and registrationType == 'PERMIT' %}Transport Permit Number:{% else %}Document Registration Number:{% endif %} + + {% if documentRegistrationNumber is defined and documentRegistrationNumber != '' %} + {{ documentRegistrationNumber }} + {% else %} + N/A + {% endif %} +
{% if registrationType is defined and registrationType == 'PERMIT' %}Date of Issue:{% else %}Document Registration Date and Time:{% endif %} {{ createDateTime }} diff --git a/mhr_api/report-templates/template-parts/registration/location.html b/mhr_api/report-templates/template-parts/registration/location.html index 69f354890..e735682fb 100644 --- a/mhr_api/report-templates/template-parts/registration/location.html +++ b/mhr_api/report-templates/template-parts/registration/location.html @@ -5,7 +5,6 @@ {% elif registrationType in ('PERMIT', 'REG_STAFF_ADMIN') and (documentType is not defined or documentType != 'CANCEL_PERMIT') %}
New Registered Location
{% elif amendment is defined and amendment %} -
New Registered Location AMENDED
{% elif registrationType not in ('EXEMPTION_RES', 'EXEMPTION_NON_RES') %} {% if documentType is not defined or documentType != 'CANCEL_PERMIT' %} diff --git a/mhr_api/report-templates/transportPermitV2.html b/mhr_api/report-templates/transportPermitV2.html index 1373d3d66..8fbf4ce3b 100644 --- a/mhr_api/report-templates/transportPermitV2.html +++ b/mhr_api/report-templates/transportPermitV2.html @@ -30,7 +30,7 @@ {{permitDateTime}} - Permit Expiry Date: + Transport Permit Expiry Date: {{permitExpiryDateTime}} {% else %} @@ -89,9 +89,8 @@
If the manufactured home is permanently placed on a location other than specifically described on the transport permit, the owner must advise the Registrar and provide full details of the location either
-
(a) within 3 days after the manufactured home was transported to the new location
-
or
-
(b) within 3 days after the expiration of the transport permit which ever occurs first.
+
(a) within 3 days after the manufactured home was transported to the new location, or
+
(b) within 3 days after the expiration of the transport permit which ever occurs first.
From cb83826238307521dfcec9900ded90497710067f Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Wed, 3 Jan 2024 10:10:20 -0800 Subject: [PATCH 2/2] Batch registration amendment/correction updates. Signed-off-by: Doug Lovett --- mhr_api/src/mhr_api/models/batch_utils.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mhr_api/src/mhr_api/models/batch_utils.py b/mhr_api/src/mhr_api/models/batch_utils.py index b30534a6a..288507e23 100644 --- a/mhr_api/src/mhr_api/models/batch_utils.py +++ b/mhr_api/src/mhr_api/models/batch_utils.py @@ -18,7 +18,7 @@ from flask import current_app from sqlalchemy.sql import text -from mhr_api.models import EventTracking, utils as model_utils, MhrRegistration +from mhr_api.models import EventTracking, utils as model_utils, MhrRegistration, registration_json_utils from mhr_api.models.db import db from mhr_api.models.type_tables import MhrDocumentTypes, MhrRegistrationStatusTypes from mhr_api.resources import registration_utils as reg_utils @@ -317,12 +317,14 @@ def get_batch_registration_json(registration: MhrRegistration, json_data: dict, if not doc_type: doc_type = registration.documents[0].document_type reg_json['documentType'] = doc_type + if not reg_json.get('declaredValue'): + reg_json = registration_json_utils.set_current_misc_json(registration, reg_json, False) reg_json = batch_json_cleanup(reg_json) if not current_json or doc_type == MhrDocumentTypes.REG_101: return reg_json reg_json = set_batch_json_description(reg_json, current_json) - reg_json = set_batch_json_location(reg_json, current_json, doc_type) - reg_json = set_batch_json_owners(reg_json, current_json, doc_type) + reg_json = set_batch_json_location(reg_json, current_json, doc_type, registration) + reg_json = set_batch_json_owners(reg_json, current_json, doc_type, registration) if reg_json.get('status') == model_utils.STATUS_FROZEN: reg_json['status'] = MhrRegistrationStatusTypes.ACTIVE.value return reg_json @@ -337,9 +339,11 @@ def set_batch_json_description(reg_json: dict, current_json: dict) -> dict: return reg_json -def set_batch_json_location(reg_json: dict, current_json: dict, doc_type: str) -> dict: +def set_batch_json_location(reg_json: dict, current_json: dict, doc_type: str, registration: MhrRegistration) -> dict: """Update the batch JSON: add the current location and conditionally the previous location.""" - if is_previous_location_doc_type(doc_type, reg_json) and current_json: + if doc_type in (MhrDocumentTypes.REGC, MhrDocumentTypes.PUBA) and not registration.locations: + current_app.logger.debug(f'No location change: skipping previous location for doc type={doc_type}.') + elif is_previous_location_doc_type(doc_type, reg_json) and current_json: current_app.logger.debug(f'Setting up previous location for doc type={doc_type}.') reg_json['previousLocation'] = current_json.get('location') if reg_json.get('newLocation'): @@ -350,9 +354,11 @@ def set_batch_json_location(reg_json: dict, current_json: dict, doc_type: str) - return reg_json -def set_batch_json_owners(reg_json: dict, current_json: dict, doc_type: str) -> dict: +def set_batch_json_owners(reg_json: dict, current_json: dict, doc_type: str, registration: MhrRegistration) -> dict: """Update the batch JSON: add the current owner groups and conditionally the previous owner groups.""" - if is_previous_owner_doc_type(doc_type, reg_json) and current_json: + if doc_type in (MhrDocumentTypes.REGC, MhrDocumentTypes.PUBA) and not registration.owner_groups: + current_app.logger.debug(f'No owner change: skipping previous owner groups for doc type={doc_type}.') + elif is_previous_owner_doc_type(doc_type, reg_json) and current_json: current_app.logger.debug(f'Setting up previous owners for doc type={doc_type}.') reg_json['previousOwnerGroups'] = current_json.get('ownerGroups') if reg_json.get('deleteOwnerGroups'):