Stop allowing the service org type to be changed

The service organisation type will either be the same as the org type of
the service's organisation or will be set by a user when creating a new
service. This removes the ability to change it from the platform admin
settings table.
This commit is contained in:
Katie Smith
2019-07-08 09:44:22 +01:00
parent 3167c6dc31
commit 53214937a8
6 changed files with 56 additions and 133 deletions

View File

@@ -591,10 +591,6 @@ class CreateServiceForm(StripWhitespaceForm):
organisation_type = organisation_type()
class OrganisationTypeForm(StripWhitespaceForm):
organisation_type = organisation_type()
class NewOrganisationForm(
RenameOrganisationForm,
OrganisationOrganisationTypeForm,

View File

@@ -36,7 +36,6 @@ from app.main.forms import (
FreeSMSAllowance,
InternationalSMSForm,
LinkOrganisationsForm,
OrganisationTypeForm,
PreviewBranding,
RenameServiceForm,
SearchByNameForm,
@@ -860,29 +859,6 @@ def service_set_letter_contact_block(service_id):
)
@main.route("/services/<service_id>/service-settings/set-organisation-type", methods=['GET', 'POST'])
@user_is_platform_admin
def set_organisation_type(service_id):
form = OrganisationTypeForm(organisation_type=current_service.organisation_type)
if form.validate_on_submit():
free_sms_fragment_limit = current_app.config['DEFAULT_FREE_SMS_FRAGMENT_LIMITS'].get(
form.organisation_type.data)
current_service.update(
organisation_type=form.organisation_type.data,
)
billing_api_client.create_or_update_free_sms_fragment_limit(service_id, free_sms_fragment_limit)
return redirect(url_for('.service_settings', service_id=service_id))
return render_template(
'views/service-settings/set-organisation-type.html',
form=form,
)
@main.route("/services/<service_id>/service-settings/set-free-sms-allowance", methods=['GET', 'POST'])
@user_is_platform_admin
def set_free_sms_allowance(service_id):

View File

@@ -286,7 +286,6 @@ class HeaderNavigation(Navigation):
'service_verify_reply_to_address_updates',
'services_or_dashboard',
'set_free_sms_allowance',
'set_organisation_type',
'set_sender',
'set_template_sender',
'show_accounts_or_dashboard',
@@ -411,7 +410,6 @@ class MainNavigation(Navigation):
'service_sms_senders',
'set_free_sms_allowance',
'service_set_letter_branding',
'set_organisation_type',
'submit_request_to_go_live',
},
'api-integration': {
@@ -815,7 +813,6 @@ class CaseworkNavigation(Navigation):
'services_or_dashboard',
'set_free_sms_allowance',
'service_set_letter_branding',
'set_organisation_type',
'set_sender',
'set_template_sender',
'show_accounts_or_dashboard',
@@ -1088,7 +1085,6 @@ class OrgNavigation(Navigation):
'services_or_dashboard',
'set_free_sms_allowance',
'service_set_letter_branding',
'set_organisation_type',
'set_sender',
'set_template_sender',
'show_accounts_or_dashboard',

View File

@@ -308,16 +308,27 @@
{% call row() %}
{{ text_field('Organisation')}}
{{ optional_text_field(current_service.organisation.name) }}
{% call field() %}
{% if current_service.organisation_id %}
<a href="{{ url_for('main.organisation_dashboard', org_id=current_service.organisation_id) }}">
{{ current_service.organisation.name }}
</a>
{% else %}
<span class="table-field-status-default">Not set</span>
{% endif %}
{% if current_service.organisation_type %}
<div class="hint">
{{ {
'central': 'Central government',
'local': 'Local government',
'nhs': 'NHS',
}.get(current_service.organisation_type) }}
</div>
{% endif %}
{% endcall %}
{{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Organisation type')}}
{{ optional_text_field(
(current_service.organisation_type or '')|title
) }}
{{ edit_field('Change', url_for('.set_organisation_type', service_id=current_service.id)) }}
{% endcall %}
{% call row() %}
{{ text_field('Free text message allowance')}}
{{ text_field('{:,}'.format(current_service.free_sms_fragment_limit)) }}

View File

@@ -1,23 +0,0 @@
{% extends "withnav_template.html" %}
{% from "components/radios.html" import radios %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
Set branding and organisation
{% endblock %}
{% block maincolumn_content %}
{{ page_header(
'Set organisation type',
back_link=url_for('.service_settings', service_id=current_service.id)
) }}
{% call form_wrapper() %}
{{ radios(form.organisation_type) }}
{{ page_footer('Save') }}
{% endcall %}
{% endblock %}