When updating org type to NHS type also update email branding if none set

This commit is contained in:
Pea Tyczynska
2022-04-12 17:18:57 +01:00
parent b1ed722252
commit 769b71cdc0
3 changed files with 87 additions and 8 deletions

View File

@@ -105,6 +105,12 @@ def create_organisation():
def update_organisation(organisation_id):
data = request.get_json()
validate(data, post_update_organisation_schema)
organisation = dao_get_organisation_by_id(organisation_id)
if data.get('organisation_type') in NHS_ORGANISATION_TYPES and not organisation.email_branding_id:
data["email_branding_id"] = current_app.config['NHS_EMAIL_BRANDING_ID']
result = dao_update_organisation(organisation_id, **data)
if data.get('agreement_signed') is True: