Skip to content

Commit

Permalink
Merge pull request #4906 from open-formulieren/task/4319-define-filen…
Browse files Browse the repository at this point in the history
…ame-in-stufzds-and-zgw

[#4319] Make title of document configurable in StUF-ZDS
  • Loading branch information
sergei-maertens authored Dec 16, 2024
2 parents 3d6ffab + f12f23c commit 9be9f8c
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 14 deletions.
30 changes: 24 additions & 6 deletions src/openforms/js/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2939,6 +2945,12 @@
"value": "StUF-ZDS name"
}
],
"Qd9qN8": [
{
"type": 0,
"value": "Tile layer"
}
],
"Qjl92W": [
{
"type": 0,
Expand Down Expand Up @@ -4211,12 +4223,6 @@
"value": "Product request type"
}
],
"ctoEdl": [
{
"type": 0,
"value": "The name under which the INFORMATIEOBJECT is formally known."
}
],
"cuivC6": [
{
"type": 0,
Expand Down Expand Up @@ -4391,6 +4397,12 @@
"value": "Map configuration"
}
],
"eAmrdi": [
{
"type": 0,
"value": "Loading..."
}
],
"eBk+W0": [
{
"type": 0,
Expand Down Expand Up @@ -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,
Expand Down
30 changes: 24 additions & 6 deletions src/openforms/js/compiled-lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,12 @@
"value": "API-groep"
}
],
"2mgmOj": [
{
"type": 0,
"value": "De titel voor het zaakdocument."
}
],
"2nxTFx": [
{
"type": 0,
Expand Down Expand Up @@ -2956,6 +2962,12 @@
"value": "StUF-ZDS-naam"
}
],
"Qd9qN8": [
{
"type": 0,
"value": "Kaartlaag"
}
],
"Qjl92W": [
{
"type": 0,
Expand Down Expand Up @@ -4233,12 +4245,6 @@
"value": "Productaanvraagtype"
}
],
"ctoEdl": [
{
"type": 0,
"value": "Titel voor het document in de Documenten API."
}
],
"cuivC6": [
{
"type": 0,
Expand Down Expand Up @@ -4413,6 +4419,12 @@
"value": "Kaartinstellingen"
}
],
"eAmrdi": [
{
"type": 0,
"value": "Aan het laden..."
}
],
"eBk+W0": [
{
"type": 0,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/openforms/js/lang/formio/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/stuf/stuf_zds/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
58 changes: 58 additions & 0 deletions src/stuf/stuf_zds/tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9be9f8c

Please sign in to comment.