Skip to content

Commit 15e82dd

Browse files
committed
Add new organisation type for custom domain pharmacy
1 parent c120db8 commit 15e82dd

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

app/main/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ class CreateServiceForm(StripWhitespaceForm):
13051305
class CreateNhsServiceForm(CreateServiceForm):
13061306
organisation_type = OrganisationTypeField(
13071307
"Who runs this service?",
1308-
include_only={"nhs_central", "nhs_local", "nhs_gp"},
1308+
include_only={"nhs_central", "nhs_local", "nhs_gp", "pharmacy_local"},
13091309
)
13101310

13111311

app/main/views/add_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def add_service():
7070

7171
new_service = Service.from_id(service_id)
7272

73-
# GPs have a zero message limit (to prevent them sending messages while in trial mode)
74-
if form.organisation_type.data == Organisation.TYPE_NHS_GP:
73+
# GPs and private pharmacies have a zero message limit (to prevent them sending messages while in trial mode)
74+
if form.organisation_type.data in Organisation.ZERO_TEXT_LIMIT_ORGANISATION_TYPES:
7575
new_service.update(sms_message_limit=0)
7676

7777
# show the tour if the user doesn't have any other services. Never show for NHS GPs

app/main/views/agreement.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def service_agreement(service_id):
2525
if current_service.organisation.agreement_signed:
2626
return render_template("views/agreement/service-agreement-signed.html")
2727
return render_template("views/agreement/service-agreement.html")
28+
# TODO: private pharmacies agrrement not implemented yet, so we don't show the agreement page for them.
2829

2930

3031
@main.route("/services/<uuid:service_id>/agreement.pdf")

app/main/views/organisations/index.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def add_organisation():
7979
@main.route("/services/<uuid:service_id>/add-gp-organisation", methods=["GET", "POST"])
8080
@user_has_permissions("manage_service")
8181
def add_organisation_from_gp_service(service_id):
82-
if (not current_service.organisation_type == Organisation.TYPE_NHS_GP) or current_service.organisation:
82+
if (
83+
current_service.organisation_type not in Organisation.ZERO_TEXT_LIMIT_ORGANISATION_TYPES
84+
) or current_service.organisation:
8385
abort(403)
8486

8587
form = AddGPOrganisationForm(service_name=current_service.name)

app/models/organisation.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Organisation(JSONModel):
2121
TYPE_NHS_CENTRAL = "nhs_central"
2222
TYPE_NHS_LOCAL = "nhs_local"
2323
TYPE_NHS_GP = "nhs_gp"
24+
TYPE_PHRAMACY_LOCAL = "pharmacy_local"
2425
TYPE_EMERGENCY_SERVICE = "emergency_service"
2526
TYPE_SCHOOL_OR_COLLEGE = "school_or_college"
2627
TYPE_OTHER = "other"
@@ -29,6 +30,7 @@ class Organisation(JSONModel):
2930
TYPE_NHS_CENTRAL,
3031
TYPE_NHS_LOCAL,
3132
TYPE_NHS_GP,
33+
TYPE_PHRAMACY_LOCAL,
3234
)
3335

3436
TYPE_LABELS = {
@@ -39,9 +41,15 @@ class Organisation(JSONModel):
3941
TYPE_NHS_GP: "GP surgery",
4042
TYPE_EMERGENCY_SERVICE: "Emergency service",
4143
TYPE_SCHOOL_OR_COLLEGE: "School or college",
44+
TYPE_PHRAMACY_LOCAL: "Pharmacy local",
4245
TYPE_OTHER: "Other",
4346
}
4447

48+
ZERO_TEXT_LIMIT_ORGANISATION_TYPES = (
49+
TYPE_NHS_GP,
50+
TYPE_PHRAMACY_LOCAL,
51+
)
52+
4553
id: Any
4654
name: str
4755
active: bool

tests/app/main/views/organisations/test_organisations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_page_to_create_new_organisation(
8585
("radio", "organisation_type", "nhs_gp"),
8686
("radio", "organisation_type", "emergency_service"),
8787
("radio", "organisation_type", "school_or_college"),
88+
("radio", "organisation_type", "pharmacy_local"),
8889
("radio", "organisation_type", "other"),
8990
("radio", "crown_status", "crown"),
9091
("radio", "crown_status", "non-crown"),
@@ -1345,6 +1346,7 @@ def test_archive_organisation_does_not_allow_orgs_with_team_members_or_services_
13451346
{"value": "nhs_gp", "label": "GP surgery"},
13461347
{"value": "emergency_service", "label": "Emergency service"},
13471348
{"value": "school_or_college", "label": "School or college"},
1349+
{"value": "pharmacy_local", "label": "Pharmacy local"},
13481350
{"value": "other", "label": "Other"},
13491351
),
13501352
"central",

tests/app/main/views/test_add_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_get_should_render_add_service_template(
4848
"GP surgery",
4949
"Emergency service",
5050
"School or college",
51+
"Pharmacy local",
5152
"Other",
5253
]
5354
assert [radio["value"] for radio in page.select(".govuk-radios__item input")] == [
@@ -58,6 +59,7 @@ def test_get_should_render_add_service_template(
5859
"nhs_gp",
5960
"emergency_service",
6061
"school_or_college",
62+
"pharmacy_local",
6163
"other",
6264
]
6365

@@ -224,12 +226,7 @@ def test_add_service_has_to_choose_org_type(
224226

225227
@pytest.mark.parametrize(
226228
"email_address",
227-
(
228-
"test@nhs.net",
229-
"test@nhs.uk",
230-
"test@example.NhS.uK",
231-
"test@EXAMPLE.NHS.NET",
232-
),
229+
("test@nhs.net", "test@nhs.uk", "test@example.NhS.uK", "test@EXAMPLE.NHS.NET"),
233230
)
234231
def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
235232
client_request,
@@ -250,11 +247,13 @@ def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
250247
"NHS – central government agency or public body",
251248
"NHS Trust or Integrated Care Board",
252249
"GP surgery",
250+
"Pharmacy local",
253251
]
254252
assert [radio["value"] for radio in page.select(".govuk-radios__item input")] == [
255253
"nhs_central",
256254
"nhs_local",
257255
"nhs_gp",
256+
"pharmacy_local",
258257
]
259258

260259

@@ -268,6 +267,7 @@ def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
268267
"nhs_gp",
269268
"school_or_college",
270269
"emergency_service",
270+
"pharmacy_local",
271271
"other",
272272
],
273273
)

0 commit comments

Comments
 (0)