Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove open licence references #2275

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion caseworker/cases/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class CaseType(Enum):
QUERY = "query"
REGISTRATION = "registration"
STANDARD = "standard"
OPEN = "open"
HMRC = "hmrc"
# The case_type_reference for HMRC
HMRC_REFERENCE = "cre"
Expand Down
16 changes: 1 addition & 15 deletions caseworker/cases/forms/advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

from django.urls import reverse

from caseworker.cases.constants import CaseType
from caseworker.cases.forms.finalise_case import approve_licence_form
from caseworker.cases.services import get_application_default_duration
from caseworker.core.constants import Permission
from caseworker.core import helpers
from lite_content.lite_internal_frontend.advice import GoodsDecisionMatrixPage, GenerateGoodsDecisionForm
from lite_content.lite_internal_frontend.advice import GenerateGoodsDecisionForm
from lite_forms.components import (
Form,
BackLink,
Expand Down Expand Up @@ -37,17 +36,6 @@ def generate_documents_form(queue_pk, case_pk):
)


def finalise_goods_countries_form(case_pk, queue_pk):
return Form(
title=GoodsDecisionMatrixPage.TITLE,
questions=[Custom("components/finalise-goods-countries-table.html")],
back_link=BackLink(
url=reverse("cases:case", kwargs={"queue_pk": queue_pk, "pk": case_pk, "tab": "final-advice"})
),
container="case",
)


def get_approve_data(request, case_id, licence=None):
if licence:
start_date = datetime.strptime(licence["start_date"], "%Y-%m-%d")
Expand All @@ -69,7 +57,6 @@ def reissue_finalise_form(request, licence, case, queue_pk):
form = approve_licence_form(
queue_pk=queue_pk,
case_id=case["id"],
is_open_licence=case.data["case_type"]["sub_type"]["key"] == CaseType.OPEN.value,
editable_duration=helpers.has_permission(request, Permission.MANAGE_LICENCE_DURATION),
goods=licence["goods_on_licence"],
goods_html="components/goods-licence-reissue-list.html",
Expand All @@ -82,7 +69,6 @@ def finalise_form(request, case, goods, queue_pk):
form = approve_licence_form(
queue_pk=queue_pk,
case_id=case["id"],
is_open_licence=case.data["case_type"]["sub_type"]["key"] == CaseType.OPEN.value,
editable_duration=helpers.has_permission(request, Permission.MANAGE_LICENCE_DURATION),
goods=goods,
goods_html="components/goods-licence-list.html",
Expand Down
2 changes: 1 addition & 1 deletion caseworker/cases/forms/finalise_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from lite_forms.helpers import conditional


def approve_licence_form(queue_pk, case_id, is_open_licence, editable_duration, goods, goods_html):
def approve_licence_form(queue_pk, case_id, editable_duration, goods, goods_html):
return Form(
title=lite_content.lite_internal_frontend.advice.FinaliseLicenceForm.APPROVE_TITLE,
questions=[
Expand Down
8 changes: 4 additions & 4 deletions caseworker/cases/helpers/advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from core.builtins.custom_tags import filter_advice_by_level, filter_advice_by_id, filter_advice_by_user

SINGULAR_ENTITIES = ["end_user", "consignee"]
PLURAL_ENTITIES = ["ultimate_end_user", "third_party", "country", "good", "goods_type"]
PLURAL_ENTITIES = ["ultimate_end_user", "third_party", "country", "good"]
ALL_ENTITIES = SINGULAR_ENTITIES + PLURAL_ENTITIES


Expand Down Expand Up @@ -37,8 +37,8 @@ def get_param_destinations(request, case: Case):


def get_param_goods(request, case: Case):
selected_goods_ids = request.GET.getlist("goods", request.GET.getlist("goods_types"))
goods = case.data.get("goods", case.data.get("goods_types"))
selected_goods_ids = request.GET.getlist("goods")
goods = case.data.get("goods")
return [good for good in goods if good["id"] in selected_goods_ids]


Expand Down Expand Up @@ -194,7 +194,7 @@ def order_grouped_advice(grouped_advice):


def filter_advice_by_target(advice_list, target):
# filters a list of advice by the type of item it is for eg good, goods_type, country etc
# filters a list of advice by the type of item it is for eg good, country etc
filtered = []

for advice in advice_list:
Expand Down
1 change: 0 additions & 1 deletion caseworker/cases/helpers/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class Slices:
HMRC_NOTE = Slice("case/slices/hmrc-note.html", "HMRC note")
END_USER_DETAILS = Slice("case/slices/end-user-details.html", "End user details")
TEMPORARY_EXPORT_DETAILS = Slice("case/slices/temporary-export-details.html", "Temporary export details")
OPEN_APP_PARTIES = Slice("case/slices/open-app-parties.html")
OPEN_GENERAL_LICENCE = Slice("case/slices/open-general-licence.html")
COMPLIANCE_LICENCES = Slice("case/slices/compliance-licences.html")
OPEN_LICENCE_RETURNS = Slice("case/slices/open-licence-returns.html", cases.OpenLicenceReturns.TITLE)
Expand Down
4 changes: 2 additions & 2 deletions caseworker/cases/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def reference(self):

@property
def goods(self):
if "goods" not in self.data and "goods_types" not in self.data:
if "goods" not in self.data:
return []

return self.data.get("goods", self.data.get("goods_types"))
return self.data.get("goods")

@property
def destinations(self):
Expand Down
22 changes: 0 additions & 22 deletions caseworker/cases/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,6 @@ def clear_final_advice(request, case_pk):
return data.json(), data.status_code


def get_good_countries_decisions(request, case_pk):
data = client.get(request, f"/cases/{case_pk}/goods-countries-decisions/")
return data.json()


def post_good_countries_decisions(request, pk, json):
response = client.post(request, f"/cases/{pk}/goods-countries-decisions/", json)
return response.json(), response.status_code


def get_open_licence_decision(request, case_pk):
data = client.get(request, f"/cases/{case_pk}/open-licence-decision/")
return data.json()["decision"]


def post_user_case_advice(request, pk, json):
response = client.post(request, f"/cases/{pk}/user-advice/", json)
return response.json(), response.status_code
Expand Down Expand Up @@ -253,13 +238,6 @@ def get_good(request, pk):
return data.json(), data.status_code


def get_goods_type(request, pk):
data = client.get(request, f"/goods-types/{pk}")
# API doesn't structure the endpoints in a way that flags (currently) works,
# so wrap data in dictionary
return {"good": data.json()}, data.status_code


# Good Flags
def get_flags_for_team_of_level(request, level, team_id, include_system_flags=False):
"""
Expand Down
1 change: 0 additions & 1 deletion caseworker/cases/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
path("coalesce-team-advice/", advice.CoalesceTeamAdvice.as_view(), name="coalesce_team_advice"),
path("team-advice-view/", advice.ClearTeamAdvice.as_view(), name="team_advice_view"),
path("final-advice-view/", advice.ClearFinalAdvice.as_view(), name="final_advice_view"),
path("finalise-goods-countries/", advice.FinaliseGoodsCountries.as_view(), name="finalise_goods_countries"),
path("finalise/", advice.Finalise.as_view(), name="finalise"),
path("finalise/generate-documents/", advice.FinaliseGenerateDocuments.as_view(), name="finalise_documents"),
path(
Expand Down
25 changes: 2 additions & 23 deletions caseworker/cases/views/advice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from caseworker.cases.constants import CaseType
from caseworker.cases.forms.advice import (
finalise_goods_countries_form,
generate_documents_form,
reissue_finalise_form,
finalise_form,
Expand All @@ -21,13 +20,10 @@
clear_final_advice,
get_case,
finalise_application,
get_good_countries_decisions,
grant_licence,
get_final_decision_documents,
get_licence,
get_finalise_application_goods,
post_good_countries_decisions,
get_open_licence_decision,
)
from core.builtins.custom_tags import filter_advice_by_level
from lite_content.lite_internal_frontend.advice import FinaliseLicenceForm, GenerateGoodsDecisionForm
Expand Down Expand Up @@ -119,19 +115,6 @@ def create_mapping(goods):
return return_dict


class FinaliseGoodsCountries(LoginRequiredMixin, SingleFormView):
def init(self, request, **kwargs):
self.object_pk = kwargs["pk"]
self.context = {
"case": get_case(request, self.object_pk),
"goods_type_country_decisions": get_good_countries_decisions(request, self.object_pk),
"decisions": {"approve": "Approve", "refuse": "Reject"},
}
self.form = finalise_goods_countries_form(kwargs["pk"], kwargs["queue_pk"])
self.action = post_good_countries_decisions
self.success_url = reverse_lazy("cases:finalise", kwargs={"queue_pk": kwargs["queue_pk"], "pk": self.object_pk})


class Finalise(LoginRequiredMixin, TemplateView):
"""
Finalise a case and change the case status to finalised
Expand Down Expand Up @@ -165,13 +148,9 @@ def get(self, request, *args, **kwargs):

approve = False
all_nlr = False
is_case_open = case_type == CaseType.OPEN.value

if is_case_open:
approve = get_open_licence_decision(request, str(kwargs["pk"])) == "approve"
else:
approve = any([item == "approve" or item == "proviso" for item in advice_items_with_goods])
all_nlr = all(item == "no_licence_required" for item in advice_items_with_goods)
approve = any([item == "approve" or item == "proviso" for item in advice_items_with_goods])
all_nlr = all(item == "no_licence_required" for item in advice_items_with_goods)

if approve:
any_nlr = any([item == "no_licence_required" for item in advice_items_with_goods])
Expand Down
22 changes: 0 additions & 22 deletions caseworker/cases/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,6 @@ def get_advice_additional_context(self):
"blocking_flags": blocking_flags,
}

def get_open_application(self):
self.tabs = self.get_tabs()
self.tabs.insert(1, Tabs.LICENCES)
self.tabs.append(Tabs.ADVICE)
self.slices = [
Slices.GOODS,
Slices.DESTINATIONS,
Slices.OPEN_APP_PARTIES,
Slices.SANCTION_MATCHES,
conditional(self.case.data["inactive_parties"], Slices.DELETED_ENTITIES),
Slices.LOCATIONS,
*conditional(
self.case.data["goodstype_category"]["key"] != "cryptographic",
[Slices.END_USE_DETAILS, Slices.ROUTE_OF_GOODS],
[],
),
Slices.SUPPORTING_DOCUMENTS,
conditional(self.case.data["export_type"]["key"] == "temporary", Slices.TEMPORARY_EXPORT_DETAILS),
]

self.additional_context = self.get_advice_additional_context()

def get_standard_application(self):
self.tabs = self.get_standard_application_tabs()
self.slices = [
Expand Down
7 changes: 3 additions & 4 deletions caseworker/flags/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def get(self, request, **kwargs):


def perform_action(case, level, request, pk, json):
selected_goods_ids = request.GET.getlist("goods", request.GET.getlist("goods_types"))
goods = case.data.get("goods", case.data.get("goods_types"))
selected_goods_ids = request.GET.getlist("goods")
goods = case.data.get("goods")
product_ids = [item["good"]["id"] for item in goods if item["id"] in selected_goods_ids]
data = {
"level": level,
Expand All @@ -76,7 +76,6 @@ def perform_action(case, level, request, pk, json):
request.GET.get("case"),
request.GET.get("organisation"),
*product_ids,
*request.GET.getlist("goods_types"),
*request.GET.getlist("countries"),
request.GET.get("end_user"),
request.GET.get("consignee"),
Expand Down Expand Up @@ -125,7 +124,7 @@ def get_level(self):
return FlagLevel.CASES
elif self.request.GET.get("organisation"):
return FlagLevel.ORGANISATIONS
elif self.request.GET.get("goods") or self.request.GET.get("goods_types"):
elif self.request.GET.get("goods"):
return FlagLevel.GOODS
else:
return FlagLevel.DESTINATIONS
Expand Down
2 changes: 1 addition & 1 deletion caseworker/templates/case/slices/goods.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2 class="govuk-heading-m">{% if case.goods|length <= 1 %}Product{% else %}{{ c
{% if not hide_checkboxes %}
<td class="govuk-table__cell govuk-table__cell--checkbox {% if show_advice %}lite-!-no-border{% endif %}">
<div>
<input class="govuk-checkboxes__input" type="checkbox" name="goods_types" value="{{ good.id }}" id="{{ good.id }}">
<input class="govuk-checkboxes__input" type="checkbox" name="goods_other" value="{{ good.id }}" id="{{ good.id }}">
<label class="govuk-label govuk-checkboxes__label" for="{{ good.id }}">{{ forloop.counter }}</label>
</div>
</td>
Expand Down
35 changes: 0 additions & 35 deletions caseworker/templates/case/slices/open-app-parties.html

This file was deleted.

10 changes: 0 additions & 10 deletions caseworker/templates/case/slices/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,6 @@
</dd>
</div>
{% endif %}
{% if case.data.goodstype_category %}
<div class="app-case__summary-list__row">
<dt class="app-case__summary-list__key">
{% lcs 'cases.CasePage.DetailsTab.GOODS_CATEGORY' %}
</dt>
<dd class="app-case__summary-list__value">
{{ case.data.goodstype_category.value }}
</dd>
</div>
{% endif %}
{% if case.data.trade_control_activity and case.case_type.reference.key == "oicl" or case.case_type.reference.key == "sicl" %}
<div class="app-case__summary-list__row">
<dt class="app-case__summary-list__key">
Expand Down
Loading
Loading