From 4279597ece7015ef58808f813b06b83c6f8aad69 Mon Sep 17 00:00:00 2001 From: Nino Date: Thu, 15 Aug 2024 09:53:01 +0200 Subject: [PATCH] implement new informatiebrief route --- app/apps/summons/fixtures/fixture.json | 27 + .../default/summon/7.2.0/summon.bpmn | 1111 +++++++++++++++++ app/apps/workflow/models.py | 20 +- app/apps/workflow/tests/tests_models.py | 48 + app/apps/workflow/user_tasks.py | 12 + app/apps/workflow/views.py | 11 +- app/config/settings.py | 1 + 7 files changed, 1215 insertions(+), 15 deletions(-) create mode 100644 app/apps/workflow/bpmn_files/default/summon/7.2.0/summon.bpmn diff --git a/app/apps/summons/fixtures/fixture.json b/app/apps/summons/fixtures/fixture.json index 3a7d44ecc..4cb91f2c5 100644 --- a/app/apps/summons/fixtures/fixture.json +++ b/app/apps/summons/fixtures/fixture.json @@ -439,5 +439,32 @@ "workflow_option": "besluit", "name": "Besluit (geen boete / LOD)" } + }, + { + "model": "summons.summontype", + "pk": 63, + "fields": { + "theme": 3, + "workflow_option": "informatiebrief", + "name": "Informatiebrief" + } + }, + { + "model": "summons.summontype", + "pk": 64, + "fields": { + "theme": 4, + "workflow_option": "informatiebrief", + "name": "Informatiebrief" + } + }, + { + "model": "summons.summontype", + "pk": 65, + "fields": { + "theme": 7, + "workflow_option": "informatiebrief", + "name": "Informatiebrief" + } } ] diff --git a/app/apps/workflow/bpmn_files/default/summon/7.2.0/summon.bpmn b/app/apps/workflow/bpmn_files/default/summon/7.2.0/summon.bpmn new file mode 100644 index 000000000..51cee2079 --- /dev/null +++ b/app/apps/workflow/bpmn_files/default/summon/7.2.0/summon.bpmn @@ -0,0 +1,1111 @@ + + + + + + + + + task_check_summons + task_nakijken_informatiebrief + + + task_monitor_incoming_point_of_view + service_status_zienswijze + task_monitor_incoming_permit_application + service_script_set_status_vergunningscheck + service_script_next_step_unoccupied + Event_1s4a0ru + Event_1mo05mc + + + task_create_summon + service_script_next_step_renounce_summon + service_script_next_step_decision_summon + service_script_next_step_summon + service_script_next_step_close_case_summon + task_monitoren_reactie_platform + Activity_1fpf4er + gateway_do_we_renounce_or_decision + gateway_has_point_of_view_received + task_judge_point_of_view + task_check_incoming_point_of_view + gateway_has_permit_been_granted + task_monitor_permit_request_procedure + Activity_1gaa36w + Gateway_0zrx2ej + gateway_has_permit_been_requested + task_check_incoming_permit_application + task_rappelleren_informeren_collegas_beleid + gateway_reactie_platform + Gateway_14b0omd + service_script_next_step_visit + service_script_next_step_closing_procedure + Event_12zzx0r + task_afzien_concept_aanschrijving + gateway_afzien_concept_aanschrijvingen_na_check + gateway_afzien_concept_aanschrijvingen_opties + Event_1rmmm5s + service_status_summon + gateway_afzien_concept_aanschrijvingen + task_create_concept_summons + Gateway_0hmo9yd + task_create_quick_decision + task_verwerken_ + Event_1514cbt + timer_monitoren_reactie_platform + gateway_which_type_of_summon + + + + + + + + + + + + + + + + + + + + Flow_0bf9aqr + Flow_1detbpm + + + Flow_1kxv6a9 + Flow_09zglj3 + summon_next_step = {"value": "renounce"} + + + Flow_0o6dkue + Flow_15k43jt + Flow_1nk79jc + summon_next_step = {"value": "decision"} + + + Flow_12sivk9 + Flow_1usf3sm + Flow_07uhdij + Flow_18vst05 + Flow_1l3103l + summon_next_step = {"value": "summon"} + + + Flow_0sy2hc3 + Flow_025eea2 + Flow_1e0tx2f + Flow_0p1mnxg + Flow_0763lk9 + Flow_0hq2av6 + Flow_02202f8 + Flow_15oojg9 + summon_next_step = {"value": "close_case"} + + + + + + + + + + Flow_079uczj + Flow_02rp65e + Flow_0763lk9 + + + Flow_08sz0p5 + Flow_079uczj + set_status("Verwijdering advertentie") + + + Flow_1bkt8kw + Flow_1kxv6a9 + Flow_0o6dkue + + + Flow_1luefv1 + Flow_141448o + Flow_15k43jt + + + + + + + + + + + Flow_0umy2og + Flow_141448o + Flow_1bkt8kw + + + + + + + + + + + Flow_05c0mfz + Flow_1luefv1 + + + + + + + + Flow_1pop5qk + Flow_0umy2og + + + Flow_0ca7pn4 + Flow_1pop5qk + set_status("Zienswijze") + + + Flow_1f8btyg + Flow_1usf3sm + Flow_1izu6zi + + + + + + + + + + + + + + Flow_18si44b + Flow_0oyiegq + Flow_0m6yape + + + + + + + + + + + + Flow_1kedpc9 + Flow_0oyiegq + + + + + + + + + + + Flow_1g3luuj + Flow_1f8btyg + + + Flow_1izu6zi + Flow_1igavhi + Flow_1e0tx2f + + + Flow_1b4iipp + Flow_1kedpc9 + set_status("Vergunningscheck") + + + Flow_1c107fw + Flow_18si44b + Flow_12sivk9 + + + + + + + + + + + Flow_1tvv61b + Flow_1c107fw + + + + + + + + + + + + Flow_1o2ylbn + Flow_0ymg74d + + + Flow_0ymg74d + Flow_02rp65e + Flow_07uhdij + Flow_0p1mnxg + + + Flow_1ejttzw + Flow_01fmf92 + summon_next_step = {"value": "unoccupied"} + + + Flow_0m6yape + Flow_1igavhi + Flow_18vst05 + + + Flow_0kqbmg9 + Flow_0fx0k7f + summon_next_step = {"value": "visit"} + + + Flow_0jcg14m + Flow_01jkj9f + summon_next_step = {"value": "closing_procedure"} + + + Flow_01jkj9f + Flow_15oojg9 + Flow_1l3103l + Flow_1nk79jc + Flow_09zglj3 + Flow_0fx0k7f + Flow_01fmf92 + + + + + + + + + + + + Flow_1ohw0bb + Flow_189gckp + Flow_041q8eg + + + Flow_0ij4o8b + Flow_0bf9aqr + Flow_189gckp + + + Flow_041q8eg + Flow_1pt6l2m + Flow_0sy2hc3 + Flow_0kqbmg9 + + + Flow_1wlsww0 + + + + + "false" + + + Flow_1wlsww0 + Flow_1atmgnk + set_status("Aanschrijving") + + + Flow_0ot0wae + Flow_02q9z4q + Flow_1ohw0bb + + + + + + + + + + + + + + + + Flow_1pt6l2m + Flow_1r5xisk + Flow_0ot0wae + + + Flow_1atmgnk + Flow_1r5xisk + Flow_1v19dma + + + + + + + + + + + Flow_02q9z4q + Flow_1v19dma + Flow_0ij4o8b + + + + + + + + + + Flow_1abp6nw + Flow_0hq2av6 + + + Flow_0s4h3uh + Flow_0qa4dxm + + + Flow_0qa4dxm + Flow_02202f8 + + + Flow_1tvv61b + + parse_duration(task_monitor_incoming_permit_application_timer_duration) + + + + Flow_1g3luuj + + parse_duration(task_monitor_permit_request_procedure_timer_duration) + + + + Flow_05c0mfz + + parse_duration(task_monitor_incoming_point_of_view_timer_duration) + + + + Flow_1o2ylbn + + parse_duration(monitoren_reactie_platform_duration) + + + + + type_aanschrijving.value == "sluiting" + + + type_aanschrijving.value == "waarschuwingsbrief" + + + type_aanschrijving.value == "aanschrijvingen" + + + type_aanschrijving.value == "legalisatie-brief" + + + type_aanschrijving.value == "verzoek_verwijdering_advertentie" + + + type_aanschrijving.value == "leegstandsbrief" + + + type_aanschrijving.value == "besluit" + + + type_aanschrijving.value == "informatiebrief" + + + + is_citizen_objection_valid.value == "yes_citizen_objection_valid" + + + + is_civilian_objection_received.value == "no_objection_not_received" + + + is_citizen_objection_valid.value == "no_citizen_objection_not_valid" + + + + action_civilian_permit_requested.value == "no_action" + + + civilian_has_gotten_permit.value == "no_permit" + + + summon_rappelleren_informeren_collegas_beleid.value == "opstellen_aanschrijving" + + + civilian_has_gotten_permit.value == 'no_permit' + + + + afzien_concept_aanschrijving.value == "geen_overtreding" + + + + + + + + + + + + summon_rappelleren_informeren_collegas_beleid.value == "opnieuw_monitoren" + + + + + is_civilian_objection_received.value == "yes_objection_received" + + + + + + + civilian_has_gotten_permit.value == "yes_permit" + + + action_civilian_permit_requested.value == "yes_permit_requested" + + + action_civilian_permit_requested.value == True + + + + + + civilian_has_gotten_permit.value == 'yes_permit' + + + + + + + + afzien_concept_aanschrijving.value == "nieuw_huisbezoek" + + + + + aanschrijving_valide.value == "nee" + + + type_concept_aanschrijving.value == "afzien_aanschrijving" + + + + + afzien_concept_aanschrijving.value == "concept_aanschrijving" + + + + + + + + direct_to_check_summons.value == "ja" + + + + Flow_1detbpm + Flow_0ca7pn4 + Flow_025eea2 + Flow_0jcg14m + Flow_1b4iipp + Flow_08sz0p5 + Flow_1ejttzw + Flow_1abp6nw + Flow_0s4h3uh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/apps/workflow/models.py b/app/apps/workflow/models.py index d81aa2610..16f68ba65 100644 --- a/app/apps/workflow/models.py +++ b/app/apps/workflow/models.py @@ -47,9 +47,6 @@ logger = logging.getLogger(__name__) -# Summon types with workflow option "besluit" are only available from version "6.3.0" -LTS_WORKFLOW_VERSION_SUMMON = "6.3.0" - class CaseWorkflow(models.Model): WORKFLOW_TYPE_MAIN = "main_workflow" @@ -153,12 +150,19 @@ class CaseWorkflow(models.Model): serializer = BpmnSerializer - def is_workflow_version_supported(self): + def get_workflow_exclude_options(self): if self.workflow_type == CaseWorkflow.WORKFLOW_TYPE_SUMMON: - return version.parse(self.workflow_version) >= version.parse( - LTS_WORKFLOW_VERSION_SUMMON - ) - return True + summon_version = version.parse(self.workflow_version) + # Version is lower than 6.3, remove these options because they are not present in that BPMN version + if summon_version < version.parse("6.3.0"): + exclude_options = ["besluit", "informatiebrief"] + # Version is 6.3.0 or 7.1.0 + elif version.parse("6.3.0") <= summon_version < version.parse("7.2.0"): + exclude_options = ["informatiebrief"] + else: + exclude_options = [] + + return exclude_options def get_lock_id(self): return f"caseworkflow-lock-{self.id}" diff --git a/app/apps/workflow/tests/tests_models.py b/app/apps/workflow/tests/tests_models.py index 759a9639b..4cce7abe3 100644 --- a/app/apps/workflow/tests/tests_models.py +++ b/app/apps/workflow/tests/tests_models.py @@ -43,3 +43,51 @@ def test_can_get_workflow_spec(self): ) self.assertEquals(workflow.get_workflow_spec().__class__, BpmnProcessSpec) + + def test_get_workflow_exclude_options(self): + """Tests can get workflow spec""" + + theme = baker.make(CaseTheme, name=settings.DEFAULT_THEME) + case = baker.make(Case, theme=theme) + workflow = baker.make( + CaseWorkflow, + case=case, + workflow_type=CaseWorkflow.WORKFLOW_TYPE_SUMMON, + id=8, + workflow_version="7.1.0", + workflow_theme_name="default", + data={}, + ) + exclude_options = workflow.get_workflow_exclude_options() + self.assertEqual( + exclude_options, + ["informatiebrief"], + "Should exclude 'informatiebrief' for version 7.1.0", + ) + + # Test case for version 6.0.0 + workflow.workflow_version = "6.0.0" + exclude_options = workflow.get_workflow_exclude_options() + self.assertEqual( + exclude_options, + ["besluit", "informatiebrief"], + "Should exclude 'besluit' and 'informatiebrief' for version below 6.3.0", + ) + + # Test case for version 6.3.0 + workflow.workflow_version = "6.3.0" + exclude_options = workflow.get_workflow_exclude_options() + self.assertEqual( + exclude_options, + ["informatiebrief"], + "Should exclude 'informatiebrief' for version 6.3.0", + ) + + # Test case for version 7.2.0 and above (e.g., 7.2.0) + workflow.workflow_version = "7.2.0" + exclude_options = workflow.get_workflow_exclude_options() + self.assertEqual( + exclude_options, + [], + "Should not exclude any options for version 7.2.0 and above", + ) diff --git a/app/apps/workflow/user_tasks.py b/app/apps/workflow/user_tasks.py index 8dc5dc3bd..8165ee70d 100644 --- a/app/apps/workflow/user_tasks.py +++ b/app/apps/workflow/user_tasks.py @@ -1016,3 +1016,15 @@ class task_doorzon_pv(user_task): class task_sub_workflow_terug_melding_bag(user_task): """Terug melding BAG""" + + +class task_nakijken_informatiebrief(user_task): + """task_nakijken_informatiebrief""" + + _task_name = "task_nakijken_informatiebrief" + + +class task_verwerken_informatiebrief(user_task): + """task_nakijken_informatiebrief""" + + _task_name = "task_verwerken_informatiebrief" diff --git a/app/apps/workflow/views.py b/app/apps/workflow/views.py index e4660080a..d7d1fc877 100644 --- a/app/apps/workflow/views.py +++ b/app/apps/workflow/views.py @@ -382,14 +382,11 @@ def summon_types(self, request, pk): paginator = LimitOffsetPagination() caseUserTask = self.get_object() theme = caseUserTask.case.theme - - # Summon types with workflow option "besluit" are only available from version "6.3.0" - if caseUserTask.workflow.is_workflow_version_supported(): - # The version is equal to or higher than 6.3.0" so return all types for theme. - query_set = theme.summon_types.all() + exclude_options = caseUserTask.workflow.get_workflow_exclude_options() + if exclude_options: + query_set = theme.summon_types.exclude(workflow_option__in=exclude_options) else: - # The version is lower than 6.3.0" so exclude "besluit". - query_set = theme.summon_types.exclude(workflow_option="besluit") + query_set = theme.summon_types.all() context = paginator.paginate_queryset(query_set, request) serializer = SummonTypeSerializer(context, many=True) diff --git a/app/config/settings.py b/app/config/settings.py index 434e33a0d..c32721989 100644 --- a/app/config/settings.py +++ b/app/config/settings.py @@ -1297,6 +1297,7 @@ def get_redis_url(): "4.1.0": {}, "6.3.0": {}, "7.1.0": {}, + "7.2.0": {}, }, }, "unoccupied": {