diff --git a/docs/configuration/registration/zgw.rst b/docs/configuration/registration/zgw.rst index ab8a34cfc6..5e01e771cb 100644 --- a/docs/configuration/registration/zgw.rst +++ b/docs/configuration/registration/zgw.rst @@ -7,7 +7,7 @@ ZGW API's The `ZGW (Zaakgericht Werken) API's`_ are a suite of REST based Zaak services. Open Forms can be configured to access these API's to register form submissions. -.. _`ZGW (Zaakgericht Werken) API's`: https://vng.nl/projecten/zaakgericht-werken-api +.. _`ZGW (Zaakgericht Werken) API's`: https://vng-realisatie.github.io/gemma-zaken/standaard/ .. note:: diff --git a/src/openforms/formio/utils.py b/src/openforms/formio/utils.py index 0776e4cc38..72ec227e21 100644 --- a/src/openforms/formio/utils.py +++ b/src/openforms/formio/utils.py @@ -1,3 +1,4 @@ +import json import logging from dataclasses import dataclass from typing import Any, Dict, Iterator, List, Optional, Tuple, TypeAlias, TypeGuard @@ -343,6 +344,12 @@ def is_visible_in_frontend(component: Component, data: DataMapping) -> bool: if isinstance(trigger_component_value, bool): compare_value = {"true": True, "false": False}.get(compare_value, False) + # Issue #3964 - The values of number/currency components are numbers, but in Formio frontend logic they are strings. + if isinstance(trigger_component_value, (int, float)) and isinstance( + compare_value, str + ): + compare_value = json.loads(compare_value) + return ( conditional_show if trigger_component_value == compare_value diff --git a/src/openforms/logging/logevent.py b/src/openforms/logging/logevent.py index 8d63d46c52..670f49fb3a 100644 --- a/src/openforms/logging/logevent.py +++ b/src/openforms/logging/logevent.py @@ -266,7 +266,7 @@ def registration_skipped_not_yet_paid(submission: "Submission"): def confirmation_email_scheduled( - submission: Submission, scheduling_options: dict + submission: "Submission", scheduling_options: dict ) -> None: _create_log( submission, "confirmation_email_scheduled", extra_data=scheduling_options diff --git a/src/openforms/submissions/tests/factories.py b/src/openforms/submissions/tests/factories.py index a18d3e6796..de7d216682 100644 --- a/src/openforms/submissions/tests/factories.py +++ b/src/openforms/submissions/tests/factories.py @@ -32,6 +32,7 @@ SubmissionValueVariable, TemporaryFileUpload, ) +from ..public_references import get_random_reference class SubmissionFactory(factory.django.DjangoModelFactory): @@ -127,6 +128,10 @@ class Params: status=PaymentStatus.registered, ), ) + with_public_registration_reference = factory.Trait( + completed=True, + public_registration_reference=factory.LazyFunction(get_random_reference), + ) @factory.post_generation def prefill_data(obj, create, extracted, **kwargs): diff --git a/src/openforms/submissions/tests/form_logic/test_modify_components.py b/src/openforms/submissions/tests/form_logic/test_modify_components.py index e32dc62309..91e6b64b6c 100644 --- a/src/openforms/submissions/tests/form_logic/test_modify_components.py +++ b/src/openforms/submissions/tests/form_logic/test_modify_components.py @@ -1046,6 +1046,75 @@ def test_checkbox_frontend_logic(self): self.assertEqual(submission_step.data["textField"], "Test value") + @tag("gh-3964") + def test_number_frontend_logic(self): + form = FormFactory.create() + step = FormStepFactory.create( + form=form, + form_definition__configuration={ + "components": [ + { + "key": "number", + "type": "number", + }, + { + "key": "currency", + "type": "currency", + }, + { + "key": "anotherNumber", + "type": "number", + }, + { + "key": "textField1", + "type": "textfield", + "clearOnHide": True, + "conditional": {"eq": "1", "show": True, "when": "number"}, + }, + { + "key": "textField2", + "type": "textfield", + "clearOnHide": True, + "conditional": {"eq": "1", "show": True, "when": "currency"}, + }, + { + "key": "textField3", + "type": "textfield", + "clearOnHide": True, + "conditional": { + "eq": "1.5", + "show": True, + "when": "anotherNumber", + }, + }, + ] + }, + ) + + submission = SubmissionFactory.create(form=form) + submission_step = SubmissionStepFactory.create( + submission=submission, + form_step=step, + data={ + "number": 1, + "currency": 1, + "anotherNumber": 1.5, + "textField1": "Test value", + "textField2": "Test value", + "textField3": "Test value", + }, + ) + + self.assertEqual(submission_step.data["textField1"], "Test value") + self.assertEqual(submission_step.data["textField2"], "Test value") + self.assertEqual(submission_step.data["textField3"], "Test value") + + evaluate_form_logic(submission, submission_step, submission.data, dirty=True) + + self.assertEqual(submission_step.data["textField1"], "Test value") + self.assertEqual(submission_step.data["textField2"], "Test value") + self.assertEqual(submission_step.data["textField3"], "Test value") + @tag("gh-3744") def test_postcode_component_made_optional(self): form = FormFactory.create()