Skip to content

Commit

Permalink
🐛 [#3605] Disable template localization when rendering StUF XML
Browse files Browse the repository at this point in the history
Backport-of: #3632
  • Loading branch information
vaszig authored and sergei-maertens committed Nov 28, 2023
1 parent 443d84e commit aaa3fad
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 4 deletions.
69 changes: 69 additions & 0 deletions src/openforms/registrations/contrib/stuf_zds/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2806,3 +2806,72 @@ def test_user_defined_variables(self, m, mock_task):
"//stuf:extraElementen/stuf:extraElement[@naam='userDefinedVarJson.key2.0']",
"value2",
)

@patch("celery.app.task.Task.request")
def test_plugin_with_extra_unmapped_number_data(self, m, mock_task):
submission = SubmissionFactory.from_components(
[
{
"key": "extra_number",
},
],
form__name="my-form",
bsn="111222333",
public_registration_reference="foo-zaak",
registration_result={"intermediate": {"zaaknummer": "foo-zaak"}},
submitted_data={"extra_number": 2023},
language_code="en",
)

m.post(
self.service.soap_service.url,
content=load_mock("creeerZaak.xml"),
additional_matcher=match_text("zakLk01"),
)

m.post(
self.service.soap_service.url,
content=load_mock(
"genereerDocumentIdentificatie.xml",
{"document_identificatie": "bar-document"},
),
additional_matcher=match_text("genereerDocumentIdentificatie_Di02"),
)

m.post(
self.service.soap_service.url,
content=load_mock("voegZaakdocumentToe.xml"),
additional_matcher=match_text("edcLk01"),
)
mock_task.id = 1

form_options = {
"zds_zaaktype_code": "zt-code",
"zds_zaaktype_omschrijving": "zt-omschrijving",
"zds_zaaktype_status_code": "123",
"zds_zaaktype_status_omschrijving": "aaabbc",
"zds_documenttype_omschrijving_inzending": "aaabbc",
}

plugin = StufZDSRegistration("stuf")
serializer = plugin.configuration_options(data=form_options)
self.assertTrue(serializer.is_valid())

result = plugin.register_submission(submission, serializer.validated_data)
self.assertEqual(
result,
{
"zaak": "foo-zaak",
"document": "bar-document",
},
)

xml_doc = xml_from_request_history(m, 0)
self.assertSoapXMLCommon(xml_doc)

# extraElementen
self.assertXPathEquals(
xml_doc,
"//stuf:extraElementen/stuf:extraElement[@naam='extra_number']",
"2023",
)
4 changes: 2 additions & 2 deletions src/stuf/stuf_zds/templates/stuf_zds/soap/creeerZaak.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "stuf/soap_envelope.xml" %}{% load stuf l10n %}
{% extends "stuf/soap_envelope.xml" %}{% load stuf %}
{% block body %}
{# Parent template already defines some common namespaces #}
<ZKN:zakLk01
Expand Down Expand Up @@ -31,7 +31,7 @@
<ZKN:omschrijving>{{ locatie.key }}</ZKN:omschrijving>
<ZKN:lokatie>
<GML:Point srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<GML:pos>{{ locatie.lat|unlocalize }} {{ locatie.lng|unlocalize }}</GML:pos>
<GML:pos>{{ locatie.lat }} {{ locatie.lng }}</GML:pos>
</GML:Point>
</ZKN:lokatie>
</ZKN:anderZaakObject>
Expand Down
4 changes: 2 additions & 2 deletions src/stuf/templates/stuf/soap_envelope.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load stuf %}<?xml version="1.0" encoding="UTF-8"?>
{% load stuf l10n %}<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="{% if soap_version == '1.1' %}http://schemas.xmlsoap.org/soap/envelope/{% else %}http://www.w3.org/2003/05/soap-envelope{% endif %}"
xmlns:StUF="http://www.egem.nl/StUF/StUF0301"
Expand All @@ -8,6 +8,6 @@
{% render_security service security_expires_minutes %}
</soapenv:Header>
<soapenv:Body>
{% block body %}{% endblock %}
{% localize off %}{% block body %}{% endblock %}{% endlocalize %}
</soapenv:Body>
</soapenv:Envelope>

0 comments on commit aaa3fad

Please sign in to comment.