diff --git a/src/openforms/registrations/contrib/zgw_apis/options.py b/src/openforms/registrations/contrib/zgw_apis/options.py index b74ca05d41..ebe65e4963 100644 --- a/src/openforms/registrations/contrib/zgw_apis/options.py +++ b/src/openforms/registrations/contrib/zgw_apis/options.py @@ -123,6 +123,10 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: # We know it exists thanks to the previous check group_config = ZGWRegistration.get_zgw_config(attrs) + validate_business_logic = self.context.get("validate_business_logic", True) + if not validate_business_logic: + return attrs + # Run all validations against catalogi API in the same connection pool. with get_catalogi_client(group_config) as client: catalogi = client.get_all_catalogi() @@ -183,22 +187,19 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]: {"property_mappings": errors}, code="invalid" ) - if not ("medewerker_roltype" in attrs): - return attrs - - roltypen = client.list_roltypen( - zaaktype=attrs["zaaktype"], - matcher=omschrijving_matcher(attrs["medewerker_roltype"]), - ) - - if not roltypen: - raise serializers.ValidationError( - { - "medewerker_roltype": _( - "Could not find a roltype with this description related to the zaaktype." + if "medewerker_roltype" in attrs: + roltypen = client.list_roltypen( + zaaktype=attrs["zaaktype"], + matcher=omschrijving_matcher(attrs["medewerker_roltype"]), + ) + if not roltypen: + raise serializers.ValidationError( + { + "medewerker_roltype": _( + "Could not find a roltype with this description related to the zaaktype." + ) + }, + code="invalid", ) - }, - code="invalid", - ) return attrs diff --git a/src/openforms/registrations/tasks.py b/src/openforms/registrations/tasks.py index 35de42f689..b98da06ae9 100644 --- a/src/openforms/registrations/tasks.py +++ b/src/openforms/registrations/tasks.py @@ -52,7 +52,8 @@ def pre_registration(submission_id: int, event: PostSubmissionEvents) -> None: return options_serializer = registration_plugin.configuration_options( - data=submission.registration_backend.options + data=submission.registration_backend.options, + context={"validate_business_logic": False}, ) try: @@ -229,7 +230,10 @@ def register_submission(submission_id: int, event: PostSubmissionEvents | str) - return logger.debug("De-serializing the plugin configuration options") - options_serializer = plugin.configuration_options(data=backend_config.options) + options_serializer = plugin.configuration_options( + data=backend_config.options, + context={"validate_business_logic": False}, + ) try: options_serializer.is_valid(raise_exception=True)