diff --git a/CHANGELOG.md b/CHANGELOG.md index cba03b8c..af69740a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ Nedenfor ses dato for release og beskrivelse af opgaver som er implementeret. ## [Under udvikling] +* Opdaterede OS2Forms Attachment-skabelon + * Justerede marginer + * Stylede adresse-element ved Digital Post forsendelse. * Gav godkendte brugere adgang til toolbaren, deriblandt logud. ## [5.0.4] 2026-02-10 diff --git a/composer.json b/composer.json index 8b9f5b5a..856bde8c 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "itk-dev/os2forms_nemlogin_openid_connect": "^2.2", "itk-dev/os2forms_user_field_lookup": "^1.1", "itk-dev/web_accessibility_statement": "^1.1", - "os2forms/os2forms": "^5.0", + "os2forms/os2forms": "dev-release/5.1.0 as 5.1", "os2forms/os2forms_forloeb_profile": "^1.15", "os2forms/os2forms_get_organized": "^2.0", "os2forms/os2forms_organisation": "^2.1", @@ -53,6 +53,10 @@ "drupal/drupal": "*" }, "repositories": [ + { + "type": "vcs", + "url": "https://github.com/itk-dev/os2forms" + }, { "type": "composer", "url": "https://packages.drupal.org/8" diff --git a/composer.lock b/composer.lock index abe578c6..f35a75a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f590c9e06feee04d506d0682ee4b5fd1", + "content-hash": "5b5aaba9bf6c37c63ed0d86dc8b0b2a4", "packages": [ { "name": "asm89/stack-cors", @@ -9168,16 +9168,16 @@ }, { "name": "os2forms/os2forms", - "version": "5.0.0", + "version": "dev-release/5.1.0", "source": { "type": "git", - "url": "https://github.com/OS2Forms/os2forms.git", - "reference": "e6a339e5f5a450005d603da9ad6fac0190dc67bc" + "url": "https://github.com/itk-dev/os2forms.git", + "reference": "7c057aab145f7843a5435012b668eb16ee7b0b06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OS2Forms/os2forms/zipball/e6a339e5f5a450005d603da9ad6fac0190dc67bc", - "reference": "e6a339e5f5a450005d603da9ad6fac0190dc67bc", + "url": "https://api.github.com/repos/itk-dev/os2forms/zipball/7c057aab145f7843a5435012b668eb16ee7b0b06", + "reference": "7c057aab145f7843a5435012b668eb16ee7b0b06", "shasum": "" }, "require": { @@ -9255,49 +9255,67 @@ }, "type": "drupal-module", "extra": { + "composer-exit-on-patch-failure": false, + "drupal-lenient": { + "allowed-list": [ + "drupal/coc_forms_auto_export", + "drupal/webform_node_element" + ] + }, + "enable-patching": true, "patches": { + "drupal/coc_forms_auto_export": { + "3256951: - Unable to receive attachments in emails sent": "https://git.drupalcode.org/project/coc_forms_auto_export/-/merge_requests/11.diff", + "3531004: Unable to save initial settings due to unfocusable form control": "https://www.drupal.org/files/issues/2025-06-19/text_area_with_text_edit_always_fails_reqired_set_via_states.patch" + }, "drupal/core": { "Allow conditionals based on computed twig (https://www.drupal.org/project/webform/issues/3481569)": "https://www.drupal.org/files/issues/2024-11-05/revert-core-states.patch" }, + "drupal/entity_print": { + "2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch" + }, "drupal/webform": { - "Webform computed element post save alter": "https://www.drupal.org/files/issues/2024-06-25/webform_computed_post_save_field_alter.patch", "Unlock possibility of using Entity print module export to Word": "https://www.drupal.org/files/issues/2020-02-29/3096552-6.patch", + "Webform computed element post save alter": "https://www.drupal.org/files/issues/2024-06-25/webform_computed_post_save_field_alter.patch", "Add custom hook (hook_webform_post_load_data) for audit logging": "https://gist.githubusercontent.com/cableman/d26898fc8f65ee0a31001bf391583b59/raw/6189dc4c2ceaabb19d25cc4b98b0b3028a6b0e1e/gistfile1.txt" }, - "drupal/entity_print": { - "2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch" - }, "drupal/webform_encrypt": { "Ensure data is base64 encoded (https://www.drupal.org/project/webform_encrypt/issues/3399414)": "https://git.drupalcode.org/project/webform_encrypt/-/merge_requests/4.patch", "PHP Warning if unserialize fails (https://www.drupal.org/project/webform_encrypt/issues/3292305)": "https://www.drupal.org/files/issues/2022-06-23/unserialize-php-notice.patch" }, "drupal/webform_node_element": { "3290637 - Automated Drupal 10 compatibility fixes": "https://www.drupal.org/files/issues/2023-05-12/webform_node_element_d10-3290637-11.patch" - }, - "drupal/coc_forms_auto_export": { - "3256951: - Unable to receive attachments in emails sent": "https://git.drupalcode.org/project/coc_forms_auto_export/-/merge_requests/11.diff", - "3531004: Unable to save initial settings due to unfocusable form control": "https://www.drupal.org/files/issues/2025-06-19/text_area_with_text_edit_always_fails_reqired_set_via_states.patch" } - }, - "drupal-lenient": { - "allowed-list": [ - "drupal/coc_forms_auto_export", - "drupal/webform_node_element" - ] - }, - "enable-patching": true, - "composer-exit-on-patch-failure": false + } + }, + "scripts": { + "code-analysis": [ + "@code-analysis/phpstan" + ], + "code-analysis/phpstan": [ + "phpstan analyse" + ], + "coding-standards-apply": [ + "@coding-standards-apply/phpcs" + ], + "coding-standards-apply/phpcs": [ + "phpcbf --standard=phpcs.xml.dist" + ], + "coding-standards-check": [ + "@coding-standards-check/phpcs" + ], + "coding-standards-check/phpcs": [ + "phpcs --standard=phpcs.xml.dist" + ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "EUPL-1.2" ], "description": "Drupal 8 OS2Form module provides advanced webform functionality for Danish Municipalities", "support": { - "issues": "https://github.com/OS2Forms/os2forms/issues", - "source": "https://github.com/OS2Forms/os2forms/tree/5.0.0" + "source": "https://github.com/itk-dev/os2forms/tree/feature/address-in-digital-post-pdfs" }, - "time": "2025-11-18T14:53:37+00:00" + "time": "2026-02-19T14:23:04+00:00" }, { "name": "os2forms/os2forms_forloeb_profile", @@ -22933,10 +22951,18 @@ "time": "2024-03-03T12:36:25+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "os2forms/os2forms", + "version": "dev-release/5.1.0", + "alias": "5.1", + "alias_normalized": "5.1.0.0" + } + ], "minimum-stability": "dev", "stability-flags": { - "drupal/site_status_message": 15 + "drupal/site_status_message": 15, + "os2forms/os2forms": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.css b/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.css deleted file mode 100644 index ec6b2878..00000000 --- a/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.css +++ /dev/null @@ -1,182 +0,0 @@ -@page { - size: A4; - margin: 180px 35px 150px 35px; -} - -body { - font-family:"DejaVu Sans",Helvetica,Arial,sans-serif; - margin: 0; -} - -header { - position: fixed; - top: -150px; - left: 25px; - right: 0px; - height: 50px; - font-size: 12px; -} - -footer { - position: fixed; - bottom: -50px; - left: 25px; - right: 0px; - height: 50px; - font-size: 12px; -} - -.footer-content { - width: 70%; - display: inline-block; -} - -details { - border:1px solid #ccc; - margin-top:1em; - margin-bottom:1em; -} - -summary { - font-size: 20px !important; - font-weight:bold; - padding:.5em .5em 0 .5em; -} - -summary::marker { - display:none; -} - -legend, summary, .details-wrapper, fieldset { - padding: 0; -} - -fieldset { - margin: 0; - border: 0; -} - -.page { - padding:20px; -} - -.page img { - max-width:100%;height:auto; -} - -.page td img { - max-width:none; -} - -.details-wrapper { - padding:0 1em; -} - -.form-item { - margin-top:1em; - margin-bottom:1em; -} - -label { - display:block; - font-weight:bold; -} - -thead { - border-bottom: 1px solid black; -} - -th { - text-align: left; -} - -.strong-text { - font-weight: bold; -} - -details, .claro-details { - border: none !important; -} - -.webform-submission-table { - width:100%; - border-collapse:collapse; - border-spacing:0; -} - -.webform-submission-table th { - width:33%; - min-width:100px; -} - -.webform-submission-table th, -.webform-submission-table td { - vertical-align: top; - font-size: 12px; - text-align:left; - padding:10px 12px; - word-break: break-word; -} - -.webform-submission-table tr { - border-top:1px solid #ccc; - border-bottom:1px solid #ccc; - padding:0.1em 0.6em; -} - -.webform-entity-print-body { - font-size: 14px; - width: 65% !important; -} - -.webform-element { - padding: 5px 0; - margin: 5px 0; - font-size: 12px; - page-break-inside: avoid; - break-inside: avoid; -} - -/* Hide more link from more element. */ -.webform-element-more--link { - display: none; -} - -.webform-element-type-webform-table table { - border-collapse: collapse; - width: 100%; - border: 1px solid lightgrey; -} - -.webform-element-type-webform-table table th, -.webform-element-type-webform-table table td { - padding: .25em; - border: 1px solid lightgrey; - overflow-wrap: anywhere; -} - -.webform-entity-print-colophon { - font-size: 12px; - margin-top: -11px; -} - -.webform-section-title { - font-size: 14px !important; -} - -.table { - width: 100%; -} - -.page-numbers { - position: absolute; - display: inline-block; - text-align: right; - width: 27%; - right: 0; - bottom: 0; -} - -.page-numbers .page-number:after { - content: counter(page); -} \ No newline at end of file diff --git a/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.js b/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.js new file mode 100644 index 00000000..21bcf2f4 --- /dev/null +++ b/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.js @@ -0,0 +1 @@ +import './pdf.scss' diff --git a/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.scss b/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.scss new file mode 100644 index 00000000..176d7182 --- /dev/null +++ b/web/themes/custom/os2forms_selvbetjening_theme/assets/pdf.scss @@ -0,0 +1,223 @@ +$margin-top: 25mm; +// There is no exact measurement for margin right in the specifications +$margin-right: 10mm; +$margin-bottom: 20mm; +$margin-left: 17mm; +$page-width: 210mm; +$page-height: 297mm; +$envelope-window-height: 89mm; +$envelope-window-width: 115mm; +$recipient-window-height: 21mm; +$recipient-window-width: 59mm; + +// We reset margin from the default and set them in body +// @see https://github.com/dompdf/dompdf/blob/v2.0.8/lib/res/html.css#L18 +@page { + size: A4; + margin: 0; +} + +html, body { + font-family:"DejaVu Sans",Helvetica,Arial,sans-serif; +} + +body { + margin-top: $margin-top; + margin-right: $margin-right; + margin-bottom: $margin-bottom; + margin-left: $margin-left; +} + +header { + position: fixed; + top: 0; + height: $margin-top; + width: calc($page-width - $margin-left - $margin-right); + font-size: 12px; +} + +footer { + position: fixed; + bottom: 0; + height: $margin-bottom; + width: calc($page-width - $margin-left - $margin-right); + font-size: 12px; +} + +// Style the envelope window that may be injected by Digital Post. +// Note that top/left is made from the assumption that @page has margin 0. +// @see \Drupal\os2forms_digital_post\EventSubscriber\Os2formsDigitalPostSubscriber:onPrintRender +#envelope-window-digital-post { + position: absolute; + top: $margin-top; + left: $margin-left; + height: $envelope-window-height; + width: $envelope-window-width; + background: white +} + +// If envelope window is present, move webform content down +// @see os2forms_digital_post +#envelope-window-digital-post ~ * .webform-entity-print-body { + margin-top: $envelope-window-height; +} + +#envelope-window-digital-post > div { + position: absolute; + top: 16mm; + left: 4mm; + font-size: 10px; + height: $recipient-window-height; + width: $recipient-window-width; +} + +.footer-content { + width: 70%; + display: inline-block; +} + +details { + border: 1px solid #ccc; + margin-top: 1em; + margin-bottom: 1em; +} + +summary { + font-size: 20px !important; + font-weight: bold; + padding: .5em .5em 0 .5em; +} + +summary::marker { + display: none; +} + +legend, summary, .details-wrapper, fieldset { + padding: 0; +} + +fieldset { + margin: 0; + border: 0; +} + +.page img { + max-width: 100%; + height: auto; +} + +.page td img { + max-width: none; +} + +.details-wrapper { + padding: 0 1em; +} + +.form-item { + margin-top: 1em; + margin-bottom: 1em; +} + +label { + display: block; + font-weight: bold; +} + +thead { + border-bottom: 1px solid black; +} + +th { + text-align: left; +} + +.strong-text { + font-weight: bold; +} + +details, .claro-details { + border: none !important; +} + +.webform-submission-table { + width: 100%; + border-collapse: collapse; + border-spacing: 0; +} + +.webform-submission-table th { + width: 33%; + min-width: 100px; +} + +.webform-submission-table th, +.webform-submission-table td { + vertical-align: top; + font-size: 12px; + text-align: left; + padding: 10px 12px; + word-break: break-word; +} + +.webform-submission-table tr { + border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; + padding: 0.1em 0.6em; +} + +.webform-entity-print-body { + font-size: 14px; + width: 65% !important; +} + +.webform-element { + padding: 5px 0; + margin: 5px 0; + font-size: 12px; + page-break-inside: avoid; + break-inside: avoid; +} + +/* Hide more link from more element. */ +.webform-element-more--link { + display: none; +} + +.webform-element-type-webform-table table { + border-collapse: collapse; + width: 100%; + border: 1px solid lightgrey; +} + +.webform-element-type-webform-table table th, +.webform-element-type-webform-table table td { + padding: .25em; + border: 1px solid lightgrey; + overflow-wrap: anywhere; +} + +.webform-entity-print-colophon { + font-size: 12px; +} + +.webform-section-title { + font-size: 14px !important; +} + +.table { + width: 100%; +} + +.page-numbers { + position: absolute; + display: inline-block; + text-align: right; + width: 27%; + right: 0; + bottom: 0; +} + +.page-numbers .page-number:after { + content: counter(page); +} diff --git a/web/themes/custom/os2forms_selvbetjening_theme/build/pdf.css b/web/themes/custom/os2forms_selvbetjening_theme/build/pdf.css new file mode 100644 index 00000000..4cd861e6 --- /dev/null +++ b/web/themes/custom/os2forms_selvbetjening_theme/build/pdf.css @@ -0,0 +1 @@ +@page{size:A4;margin:0}body,html{font-family:DejaVu Sans,Helvetica,Arial,sans-serif}body{margin:25mm 10mm 20mm 17mm}header{height:25mm;top:0}footer,header{font-size:12px;position:fixed;width:183mm}footer{bottom:0;height:20mm}#envelope-window-digital-post{background:#fff;height:89mm;left:17mm;position:absolute;top:25mm;width:115mm}#envelope-window-digital-post~* .webform-entity-print-body{margin-top:89mm}#envelope-window-digital-post>div{font-size:10px;height:21mm;left:4mm;position:absolute;top:16mm;width:59mm}.footer-content{display:inline-block;width:70%}details{border:1px solid #ccc;margin-bottom:1em;margin-top:1em}summary{font-size:20px!important;font-weight:700;padding:.5em .5em 0}summary::marker{display:none}.details-wrapper,fieldset,legend,summary{padding:0}fieldset{border:0;margin:0}.page img{height:auto;max-width:100%}.page td img{max-width:none}.details-wrapper{padding:0 1em}.form-item{margin-bottom:1em;margin-top:1em}label{display:block;font-weight:700}thead{border-bottom:1px solid #000}th{text-align:left}.strong-text{font-weight:700}.claro-details,details{border:none!important}.webform-submission-table{border-collapse:collapse;border-spacing:0;width:100%}.webform-submission-table th{min-width:100px;width:33%}.webform-submission-table td,.webform-submission-table th{font-size:12px;padding:10px 12px;text-align:left;vertical-align:top;word-break:break-word}.webform-submission-table tr{border-bottom:1px solid #ccc;border-top:1px solid #ccc;padding:.1em .6em}.webform-entity-print-body{font-size:14px;width:65%!important}.webform-element{break-inside:avoid;font-size:12px;margin:5px 0;padding:5px 0;page-break-inside:avoid}.webform-element-more--link{display:none}.webform-element-type-webform-table table{border:1px solid #d3d3d3;border-collapse:collapse;width:100%}.webform-element-type-webform-table table td,.webform-element-type-webform-table table th{border:1px solid #d3d3d3;overflow-wrap:anywhere;padding:.25em}.webform-entity-print-colophon{font-size:12px}.webform-section-title{font-size:14px!important}.table{width:100%}.page-numbers{bottom:0;display:inline-block;position:absolute;right:0;text-align:right;width:27%}.page-numbers .page-number:after{content:counter(page)} \ No newline at end of file diff --git a/web/themes/custom/os2forms_selvbetjening_theme/build/pdf.js b/web/themes/custom/os2forms_selvbetjening_theme/build/pdf.js new file mode 100644 index 00000000..e69de29b diff --git a/web/themes/custom/os2forms_selvbetjening_theme/templates/pdf/os2forms-attachment--webform-submission.html.twig b/web/themes/custom/os2forms_selvbetjening_theme/templates/pdf/os2forms-attachment--webform-submission.html.twig index 5c9a7641..77c65862 100644 --- a/web/themes/custom/os2forms_selvbetjening_theme/templates/pdf/os2forms-attachment--webform-submission.html.twig +++ b/web/themes/custom/os2forms_selvbetjening_theme/templates/pdf/os2forms-attachment--webform-submission.html.twig @@ -5,7 +5,7 @@ {{ title }} - + {% if header %} diff --git a/web/themes/custom/os2forms_selvbetjening_theme/webpack.config.js b/web/themes/custom/os2forms_selvbetjening_theme/webpack.config.js index c6ccd515..ed3b6798 100644 --- a/web/themes/custom/os2forms_selvbetjening_theme/webpack.config.js +++ b/web/themes/custom/os2forms_selvbetjening_theme/webpack.config.js @@ -21,6 +21,7 @@ Encore * and one CSS file (e.g. app.css) if your JavaScript imports CSS. */ .addEntry('app', './assets/app.js') + .addEntry('pdf', './assets/pdf.js') // // will require an extra script tag for runtime.js // // but, you probably want this, unless you're building a single-page app