Explain 3 required address columns

Our rules about address columns are relaxing, so that none of them are
mandatory any more. Instead you just need any 3 of the 7 to make a valid
address.

This commit updates our error messaging to reflect that.
This commit is contained in:
Chris Hill-Scott
2020-04-19 22:46:13 +01:00
parent b2118057ef
commit f5649d72c9
8 changed files with 35 additions and 26 deletions

View File

@@ -19,13 +19,8 @@ from notifications_utils import LETTER_MAX_PAGE_COUNT, SMS_CHAR_COUNT_LIMIT
from notifications_utils.columns import Columns
from notifications_utils.pdf import is_letter_too_long
from notifications_utils.postal_address import PostalAddress
from notifications_utils.recipients import (
RecipientCSV,
first_column_headings,
optional_address_columns,
)
from notifications_utils.recipients import RecipientCSV, first_column_headings
from notifications_utils.sanitise_text import SanitiseASCII
from orderedset import OrderedSet
from xlrd.biffh import XLRDError
from xlrd.xldate import XLDateError
@@ -663,9 +658,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
)
recipients = RecipientCSV(
contents,
template_type=template.template_type,
template=template,
placeholders=template.placeholders,
max_initial_rows_shown=50,
max_errors_shown=50,
whitelist=itertools.chain.from_iterable(
@@ -711,7 +704,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
current_service.trial_mode,
template.template_type == 'letter',
)),
required_recipient_columns=OrderedSet(recipients.recipient_column_headers) - optional_address_columns,
first_recipient_column=recipients.recipient_column_headers[0],
preview_row=preview_row,
sent_previously=job_api_client.has_sent_previously(
service_id, template.id, db_template['version'], request.args.get('original_file_name', '')

View File

@@ -43,6 +43,7 @@ from app.utils import (
generate_previous_dict,
get_errors_for_csv,
get_letter_validation_error,
get_sample_template,
get_template,
unicode_truncate,
user_has_permissions,
@@ -357,7 +358,7 @@ def check_contact_list(service_id, upload_id):
recipients = RecipientCSV(
contents,
template_type=template_type or 'sms',
template=get_sample_template(template_type or 'sms'),
whitelist=itertools.chain.from_iterable(
[user.name, user.mobile_number, user.email_address]
for user in current_service.active_users