From f34be1d02807c9748f0b258898d823a9470cfcc3 Mon Sep 17 00:00:00 2001 From: johnyu95 Date: Fri, 29 Nov 2024 16:13:47 -0500 Subject: [PATCH 1/3] Added point of contact to acknowledgement emails --- app/response/utils.py | 12 +++++++++++- .../email_response_acknowledgment.html | 4 ++++ app/templates/response/add_acknowledgment.js.html | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/response/utils.py b/app/response/utils.py index b52c6cd88..27fc3b135 100644 --- a/app/response/utils.py +++ b/app/response/utils.py @@ -1155,6 +1155,9 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem else: description_hidden_by_default = False + # Determine if point of contact should be used + use_point_of_contact = request.agency.agency_features.get('use_point_of_contact', False) + if acknowledgment is not None: acknowledgment = json.loads(acknowledgment) default_content = True @@ -1165,11 +1168,13 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem acknowledgment['date'], data['tz_name']) info = acknowledgment['info'].strip() or None + point_of_contact = assign_point_of_contact(acknowledgment.get('point_of_contact', None)) else: default_content = False content = data['email_content'] date = None info = None + point_of_contact = None return jsonify({"template": render_template(email_template, custom_request_forms_enabled=custom_request_forms_enabled, default_content=default_content, @@ -1180,7 +1185,9 @@ def _acknowledgment_email_handler(request_id, data, page, agency_name, email_tem agency_name=agency_name, date=date, info=info, - page=page), + page=page, + use_point_of_contact=use_point_of_contact, + point_of_contact=point_of_contact), "header": header}), 200 @@ -1217,7 +1224,10 @@ def _acknowledgment_letter_handler(request_id, data): letterhead = render_template_string(agency_letter_data['letterhead']) + print("In letter handler") + print(acknowledgment) point_of_contact_user = assign_point_of_contact(acknowledgment.get('point_of_contact', None)) + print(point_of_contact_user) template = render_template_string(contents.content, days=acknowledgment['days'], diff --git a/app/templates/email_templates/email_response_acknowledgment.html b/app/templates/email_templates/email_response_acknowledgment.html index d41e826b9..58b7c2405 100644 --- a/app/templates/email_templates/email_response_acknowledgment.html +++ b/app/templates/email_templates/email_response_acknowledgment.html @@ -14,6 +14,10 @@ {{ info | safe }}

{% endif %} + {% if use_point_of_contact %} +

Your request has been assigned to {{ point_of_contact.title }} {{ point_of_contact.last_name }} + ({{ point_of_contact.formatted_point_of_contact_number }}) of this office.

+ {% endif %} Please visit {{ request_id }} to view additional information and take any necessary action. {% else %} diff --git a/app/templates/response/add_acknowledgment.js.html b/app/templates/response/add_acknowledgment.js.html index b0bc481e0..cdcebc1fa 100644 --- a/app/templates/response/add_acknowledgment.js.html +++ b/app/templates/response/add_acknowledgment.js.html @@ -219,7 +219,8 @@ acknowledgment: JSON.stringify({ days: email_days.val(), date: email_date.val(), - info: tinyMCE.get('acknowledgment-email-info-text').getContent() + info: tinyMCE.get('acknowledgment-email-info-text').getContent(), + point_of_contact: point_of_contact.val() }), tz_name: jstz.determine().name() }, From 3b4b37328814e68a14c8e04af8326ca378a61257 Mon Sep 17 00:00:00 2001 From: johnyu95 Date: Fri, 29 Nov 2024 16:16:01 -0500 Subject: [PATCH 2/3] Removed debugging code --- app/response/utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/response/utils.py b/app/response/utils.py index 27fc3b135..ff3640c9a 100644 --- a/app/response/utils.py +++ b/app/response/utils.py @@ -1224,10 +1224,7 @@ def _acknowledgment_letter_handler(request_id, data): letterhead = render_template_string(agency_letter_data['letterhead']) - print("In letter handler") - print(acknowledgment) point_of_contact_user = assign_point_of_contact(acknowledgment.get('point_of_contact', None)) - print(point_of_contact_user) template = render_template_string(contents.content, days=acknowledgment['days'], From 618aa60a109a64c33c3c4dd0b9a5c0aaa6c8bcdf Mon Sep 17 00:00:00 2001 From: johnyu95 Date: Fri, 29 Nov 2024 16:23:13 -0500 Subject: [PATCH 3/3] Added use_point_of_contact feature to agencies schema --- app/constants/schemas/agencies.schema | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/constants/schemas/agencies.schema b/app/constants/schemas/agencies.schema index 29a25617a..57a891d56 100644 --- a/app/constants/schemas/agencies.schema +++ b/app/constants/schemas/agencies.schema @@ -16,6 +16,12 @@ "description": "An array of agency EINs. Each EIN must be unique. Used to notify a \"parent\" agency of requests submitted to the \"child\"", "uniqueItems": true }, + "use_point_of_contact": { + "$id": "/properties/agencies/items/properties/agency_features/properties/use_point_of_contact", + "type": "boolean", + "title": "Use Point of Contact", + "description": "Boolean value that determines if point of contact information should be used in email templates.", + }, "letters": { "generate_letters": { "$id": "/properties/agencies/items/properties/agency_features/properties/letters/properties/generate_letters",