diff --git a/app/main/views/templates.py b/app/main/views/templates.py index 87f32b60f..40c1d91d1 100644 --- a/app/main/views/templates.py +++ b/app/main/views/templates.py @@ -503,6 +503,8 @@ def delete_template_folder(service_id, template_folder_id): ) @user_has_permissions("manage_templates") def add_service_template(service_id, template_type, template_folder_id=None): + + print("ENTER ADD_SERVICE_TEMPLATE") if template_type not in current_service.available_template_types: return redirect( url_for( @@ -567,6 +569,7 @@ def abort_403_if_not_admin_user(): ) @user_has_permissions("manage_templates") def edit_service_template(service_id, template_id): + print("ENTER EDIT_SERVICE_TEMPLATE") template = current_service.get_template_with_user_permission_or_403( template_id, current_user ) @@ -667,6 +670,7 @@ def count_content_length(service_id, template_type): current_service, ) ) + print(f"ERROR AND MESSAGE {error} {message}") return jsonify( { @@ -681,6 +685,16 @@ def count_content_length(service_id, template_type): def _get_content_count_error_and_message_for_template(template): if template.template_type == "sms": + + islatin1 = lambda s: bool(s.encode(encoding="latin-1", errors="strict")) + warning = "" + try: + islatin1(template.content) + except UnicodeEncodeError: + warning = " Use of characters outside the iso-latin-1 character set will result in additional characters and may not display properly on older phones." + + + if template.is_message_too_long(): return True, ( f"You have " @@ -690,10 +704,10 @@ def _get_content_count_error_and_message_for_template(template): if template.placeholders: return False, ( f"Will be charged as {message_count(template.fragment_count, template.template_type)} " - f"(not including personalization)" + f"(not including personalization). {warning}" ) return False, ( - f"Will be charged as {message_count(template.fragment_count, template.template_type)} " + f"Will be charged as {message_count(template.fragment_count, template.template_type)}. {warning} " ) diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index b3f1da603..ab903ac59 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -50,7 +50,7 @@
-
+
@@ -69,7 +69,7 @@

- +

How to customize your message