From f12f23c8a62632afd195b7a4fc40fab70457d17f Mon Sep 17 00:00:00 2001 From: vasileios Date: Mon, 16 Dec 2024 16:36:59 +0100 Subject: [PATCH] [#4319] Make title of document configurable in StUF-ZDS --- src/openforms/js/compiled-lang/en.json | 30 ++++++++++--- src/openforms/js/compiled-lang/nl.json | 30 ++++++++++--- src/openforms/js/lang/formio/nl.json | 2 +- src/stuf/stuf_zds/client.py | 3 +- src/stuf/stuf_zds/tests/test_backend.py | 58 +++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 14 deletions(-) diff --git a/src/openforms/js/compiled-lang/en.json b/src/openforms/js/compiled-lang/en.json index be2c72a3c7..8ca003173f 100644 --- a/src/openforms/js/compiled-lang/en.json +++ b/src/openforms/js/compiled-lang/en.json @@ -405,6 +405,12 @@ "value": "API group" } ], + "2mgmOj": [ + { + "type": 0, + "value": "The title for the document that is related to the case." + } + ], "2nxTFx": [ { "type": 0, @@ -2939,6 +2945,12 @@ "value": "StUF-ZDS name" } ], + "Qd9qN8": [ + { + "type": 0, + "value": "Tile layer" + } + ], "Qjl92W": [ { "type": 0, @@ -4211,12 +4223,6 @@ "value": "Product request type" } ], - "ctoEdl": [ - { - "type": 0, - "value": "The name under which the INFORMATIEOBJECT is formally known." - } - ], "cuivC6": [ { "type": 0, @@ -4391,6 +4397,12 @@ "value": "Map configuration" } ], + "eAmrdi": [ + { + "type": 0, + "value": "Loading..." + } + ], "eBk+W0": [ { "type": 0, @@ -6403,6 +6415,12 @@ "value": "Translation enabled" } ], + "xbUkMg": [ + { + "type": 0, + "value": "The tile layer is responsible for showing the map background. This effects the map style at particular coordinates and zoom levels." + } + ], "xcp+LU": [ { "type": 0, diff --git a/src/openforms/js/compiled-lang/nl.json b/src/openforms/js/compiled-lang/nl.json index f23f4d28d6..d452780cad 100644 --- a/src/openforms/js/compiled-lang/nl.json +++ b/src/openforms/js/compiled-lang/nl.json @@ -405,6 +405,12 @@ "value": "API-groep" } ], + "2mgmOj": [ + { + "type": 0, + "value": "De titel voor het zaakdocument." + } + ], "2nxTFx": [ { "type": 0, @@ -2956,6 +2962,12 @@ "value": "StUF-ZDS-naam" } ], + "Qd9qN8": [ + { + "type": 0, + "value": "Kaartlaag" + } + ], "Qjl92W": [ { "type": 0, @@ -4233,12 +4245,6 @@ "value": "Productaanvraagtype" } ], - "ctoEdl": [ - { - "type": 0, - "value": "Titel voor het document in de Documenten API." - } - ], "cuivC6": [ { "type": 0, @@ -4413,6 +4419,12 @@ "value": "Kaartinstellingen" } ], + "eAmrdi": [ + { + "type": 0, + "value": "Aan het laden..." + } + ], "eBk+W0": [ { "type": 0, @@ -6425,6 +6437,12 @@ "value": "Vertalingen ingeschakeld" } ], + "xbUkMg": [ + { + "type": 0, + "value": "De kaartlaag bepaalt de achtergrond van het kaartmateriaal voor verschillende coördinaten en zoomniveaus." + } + ], "xcp+LU": [ { "type": 0, diff --git a/src/openforms/js/lang/formio/nl.json b/src/openforms/js/lang/formio/nl.json index 0e776d8609..a4dba6f6fc 100644 --- a/src/openforms/js/lang/formio/nl.json +++ b/src/openforms/js/lang/formio/nl.json @@ -345,7 +345,7 @@ "Vertrouwelijkheidaanduiding": "Vertrouwelijkheidaanduiding", "Indication of the level to which extent the INFORMATIEOBJECT is meant to be public.": "Vertrouwelijkheidaanduiding van het document in de Documenten API. Indien leeg, dan worden algemene instellingen gebruikt.", "Title": "Titel", - "The name under which the INFORMATIEOBJECT is formally known.": "Titel voor het document in de Documenten API.", + "The title for the document that is related to the case.": "De titel voor het zaak document.", "The maximum number of decimal places.": "Het maximaal aantal decimalen.", "Column Properties": "Kolomeigenschappen", "Add Column": "Kolom toevoegen", diff --git a/src/stuf/stuf_zds/client.py b/src/stuf/stuf_zds/client.py index c69c8ff402..6833bf1ac0 100644 --- a/src/stuf/stuf_zds/client.py +++ b/src/stuf/stuf_zds/client.py @@ -374,7 +374,8 @@ def create_zaak_attachment( doc_id=doc_id, document=submission_attachment, doc_data={ - "titel": "bijlage", + "titel": submission_attachment.titel + or submission_attachment.get_display_name(), "bestandsnaam": submission_attachment.get_display_name(), "formaat": submission_attachment.content_type, "beschrijving": "Bijgevoegd document", diff --git a/src/stuf/stuf_zds/tests/test_backend.py b/src/stuf/stuf_zds/tests/test_backend.py index b2e0abd0b7..789d4d7280 100644 --- a/src/stuf/stuf_zds/tests/test_backend.py +++ b/src/stuf/stuf_zds/tests/test_backend.py @@ -8,7 +8,9 @@ from openforms.logging.models import TimelineLogProxy from openforms.registrations.exceptions import RegistrationFailed +from openforms.submissions.models import SubmissionStep from openforms.submissions.tests.factories import ( + SubmissionFactory, SubmissionFileAttachmentFactory, SubmissionReportFactory, ) @@ -453,6 +455,62 @@ def test_create_zaak_attachment(self, m): 1, ) + def test_create_zaak_attachment_with_custom_title(self, m): + client = StufZDSClient(self.service, self.options) + m.post( + self.service.soap_service.url, + content=load_mock("voegZaakdocumentToe.xml"), + additional_matcher=match_text("edcLk01"), + ) + + SubmissionFactory.from_components( + [ + { + "key": "field1", + "type": "file", + "registration": { + "titel": "a custom title", + }, + }, + ] + ) + + submission_attachment = SubmissionFileAttachmentFactory.create( + submission_step=SubmissionStep.objects.first(), + file_name="my-attachment.doc", + content_type="application/msword", + _component_configuration_path="components.0", + ) + + client.create_zaak_attachment( + zaak_id="foo", doc_id="bar", submission_attachment=submission_attachment + ) + request = m.request_history[0] + self.assertEqual( + request.headers["SOAPAction"], + "http://www.egem.nl/StUF/sector/zkn/0310/voegZaakdocumentToe_Lk01", + ) + + xml_doc = xml_from_request_history(m, 0) + self.assertSoapXMLCommon(xml_doc) + self.assertXPathExists(xml_doc, "//zkn:edcLk01") + self.assertStuurgegevens(xml_doc) + self.assertXPathEqualDict( + xml_doc, + { + "//zkn:stuurgegevens/stuf:berichtcode": "Lk01", + "//zkn:stuurgegevens/stuf:entiteittype": "EDC", + "//zkn:object/zkn:identificatie": "bar", + "//zkn:object/zkn:dct.omschrijving": "dt-omschrijving", + "//zkn:object/zkn:inhoud/@stuf:bestandsnaam": "my-attachment.doc", + "//zkn:object/zkn:inhoud/@xmime:contentType": "application/msword", + "//zkn:object/zkn:formaat": "application/msword", + "//zkn:object/zkn:isRelevantVoor/zkn:gerelateerde/zkn:identificatie": "foo", + "//zkn:object/zkn:isRelevantVoor/zkn:gerelateerde/zkn:omschrijving": "my-form", + "//zkn:titel": "a custom title", + }, + ) + def test_client_wraps_network_error(self, m): client = StufZDSClient(self.service, self.options) m.post(self.service.soap_service.url, exc=RequestException)