diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 3bb74fb..b5ebde0 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -15,6 +15,16 @@ hooks: - exec: COMPOSER=composer.lenient.json composer config --no-plugins allow-plugins.mglaman/composer-drupal-lenient true - exec: COMPOSER=composer.lenient.json composer require mglaman/composer-drupal-lenient:^1.0 - exec: rm -f composer.lenient.* + + # Drupal private files needed to enable file webform element + - exec: mkdir -p web/sites/default/files/private + - exec: | + cat >> web/sites/default/settings.ddev.php <<'EOF' + + // Added by DDEV post-start hook + $settings['file_private_path'] = $app_root . '/' . $site_path . '/files/private'; + EOF + use_dns_when_possible: true composer_version: "2" web_environment: [] diff --git a/CHANGELOG.md b/CHANGELOG.md index 584f079..91449e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [1.0.0] - 2026-09-28 +## [1.0.0] - 2026-11-04 +* [PR-13](https://github.com/itk-dev/os2forms_f2/pull/13) + * Handled matter access level + * Added title length validation * [PR-11](https://github.com/itk-dev/os2forms_f2/pull/11) * Cleaned up identification of cases and matters * Set default matter type ("Internal") diff --git a/README.md b/README.md index a23dcc9..dd97bec 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,22 @@ and store cassettes in `tests/vcr-cassettes`. --- -``` shell -ddev dotenv set .env.local --os2forms-f2-test=value +## Feature flags + +Some features are not yet ready for production, but can be enabled by settings in `settings.local.php`: + +``` php +# settings.local.php +// Enable setting responsible party on matter +$settings['os2forms_f2']['archive']['matter_responsible_party_identifier']['enabled'] = TRUE; +``` + +## Global settings + +If need be, the user manual URLs can be overridden in `settings.local.php`: + +``` php +# settings.local.php +$settings['os2forms_f2']['user_manual']['url'] = 'https://os2form_f2.user-manual.example.com'; +$settings['os2forms_f2']['user_manual']['url_form_builder'] = 'https://os2form_f2.user-manual.example.com/form-builder'; ``` diff --git a/Taskfile.yml b/Taskfile.yml index 0692f1d..00bac02 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -205,7 +205,7 @@ tasks: - | ddev exec sed --in-place 's/id: node_type$/id: entity_bundle:node/' */modules/contrib/os2forms/config/optional/pathauto.pattern.os2forms_wf_webforms.yml - - ddev drush --yes pm:install os2forms_f2 os2forms_f2_examples os2forms_f2_test drupal_translation_extractor + - ddev drush --yes pm:install os2forms_f2 os2forms_f2_examples os2forms_f2_test drupal_translation_extractor itkdev_advancedqueue_addons # Some defaults - ddev drush --yes config:set os2forms_f2.settings f2_api.log_level debug diff --git a/composer.json b/composer.json index 340a19f..1c64250 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "drupal/coder": "^9.0", "ergebnis/composer-normalize": "^2.54", "itk-dev/drupal_translation_extractor": "^2.0", + "itk-dev/itkdev_advancedqueue_addons": "^1.0", "mglaman/composer-drupal-lenient": "^1.0", "mglaman/phpstan-drupal": "^2.2", "palantirnet/drupal-rector": "^1.1", diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case-filled.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case-filled.png index d9e4a36..f3425c1 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case-filled.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case-filled.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case.png index 6904da2..706a737 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-archive-on-case.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings-filled.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings-filled.png index 98de64e..78fc153 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings-filled.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings-filled.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings.png index a83e5d5..6916450 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general-archive-settings.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general.png index ea840d6..ec96032 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-add-general.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case-details.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case-details.png index 13bc0e4..bdaab6a 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case-details.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case-details.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case.png index 4ce0635..5ffec0a 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case-case.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case.png index 16ba8f3..375a80d 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-case.png differ diff --git a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-matter.png b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-matter.png index 01e97e0..d0538ec 100644 Binary files a/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-matter.png and b/docs/user-manual/da/images/generated/form-builder/webform-handler-archive-on-matter.png differ diff --git a/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_000.yml b/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_000.yml index b89ee7a..f424fc0 100644 --- a/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_000.yml +++ b/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_000.yml @@ -230,6 +230,7 @@ handlers: case_identifier: '2026 - 1234567890' matter_title: 'Matter: [webform_submission:label] ([site:url]) – [current-date:html_datetime]' matter_type: Internal + matter_access_level: All additional: states: - completed diff --git a/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_002.yml b/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_002.yml new file mode 100644 index 0000000..1fbd451 --- /dev/null +++ b/modules/os2forms_f2_examples/config/install/webform.webform.os2forms_f2_ex_002.yml @@ -0,0 +1,250 @@ +langcode: da +status: open +dependencies: + module: + - os2forms_f2 + enforced: + module: + - os2forms_f2_examples +weight: 0 +open: null +close: null +uid: 0 +template: false +archive: false +id: os2forms_f2_ex_002 +title: 'F2 (archive on case with files)' +description: null +categories: { } +elements: |- + name: + '#type': textfield + '#title': Name + '#required': true + attachment: + '#type': os2forms_attachment + '#title': attachment + '#export_type': pdf + '#digital_signature': 0 + '#excluded_elements': { } + '#exclude_empty': 0 + '#exclude_empty_checkbox': 0 + files: + '#type': managed_file + '#title': File + '#multiple': true + images: + '#type': webform_image_file + '#title': Image + documents: + '#type': webform_document_file + '#title': Documents + '#multiple': true +css: '' +javascript: '' +settings: + ajax: false + ajax_scroll_top: form + ajax_progress_type: '' + ajax_effect: '' + ajax_speed: null + page: true + page_submit_path: '' + page_confirm_path: '' + page_theme_name: '' + form_title: both + form_submit_once: false + form_open_message: '' + form_close_message: '' + form_exception_message: '' + form_previous_submissions: true + form_confidential: false + form_confidential_message: '' + form_disable_remote_addr: false + form_convert_anonymous: false + form_prepopulate: false + form_prepopulate_source_entity: false + form_prepopulate_source_entity_required: false + form_prepopulate_source_entity_type: '' + form_unsaved: false + form_disable_back: false + form_submit_back: false + form_disable_autocomplete: false + form_novalidate: false + form_disable_inline_errors: false + form_required: false + form_autofocus: false + form_details_toggle: false + form_reset: false + form_access_denied: default + form_access_denied_title: '' + form_access_denied_message: '' + form_access_denied_attributes: { } + form_file_limit: '' + form_attributes: { } + form_method: '' + form_action: '' + share: false + share_node: false + share_theme_name: '' + share_title: true + share_page_body_attributes: { } + submission_label: '' + submission_exception_message: '' + submission_locked_message: '' + submission_log: false + submission_excluded_elements: { } + submission_exclude_empty: false + submission_exclude_empty_checkbox: false + submission_views: { } + submission_views_replace: { } + submission_user_columns: { } + submission_user_duplicate: false + submission_access_denied: default + submission_access_denied_title: '' + submission_access_denied_message: '' + submission_access_denied_attributes: { } + previous_submission_message: '' + previous_submissions_message: '' + autofill: false + autofill_message: '' + autofill_excluded_elements: { } + wizard_progress_bar: true + wizard_progress_pages: false + wizard_progress_percentage: false + wizard_progress_link: false + wizard_progress_states: false + wizard_start_label: '' + wizard_preview_link: false + wizard_confirmation: true + wizard_confirmation_label: '' + wizard_auto_forward: true + wizard_auto_forward_hide_next_button: false + wizard_keyboard: true + wizard_track: '' + wizard_prev_button_label: '' + wizard_next_button_label: '' + wizard_toggle: false + wizard_toggle_show_label: '' + wizard_toggle_hide_label: '' + wizard_page_type: container + wizard_page_title_tag: h2 + preview: 0 + preview_label: '' + preview_title: '' + preview_message: '' + preview_attributes: { } + preview_excluded_elements: { } + preview_exclude_empty: true + preview_exclude_empty_checkbox: false + draft: none + draft_multiple: false + draft_auto_save: false + draft_saved_message: '' + draft_loaded_message: '' + draft_pending_single_message: '' + draft_pending_multiple_message: '' + confirmation_type: page + confirmation_url: '' + confirmation_title: '' + confirmation_message: '' + confirmation_attributes: { } + confirmation_back: true + confirmation_back_label: '' + confirmation_back_attributes: { } + confirmation_exclude_query: false + confirmation_exclude_token: false + confirmation_update: false + limit_total: null + limit_total_interval: null + limit_total_message: '' + limit_total_unique: false + limit_user: null + limit_user_interval: null + limit_user_message: '' + limit_user_unique: false + entity_limit_total: null + entity_limit_total_interval: null + entity_limit_user: null + entity_limit_user_interval: null + purge: all + purge_days: 30 + results_disabled: false + results_disabled_ignore: false + results_customize: false + token_view: false + token_update: false + token_delete: false + serial_disabled: false +access: + create: + roles: + - anonymous + - authenticated + users: { } + permissions: { } + view_any: + roles: { } + users: { } + permissions: { } + update_any: + roles: { } + users: { } + permissions: { } + delete_any: + roles: { } + users: { } + permissions: { } + purge_any: + roles: { } + users: { } + permissions: { } + view_own: + roles: { } + users: { } + permissions: { } + update_own: + roles: { } + users: { } + permissions: { } + delete_own: + roles: { } + users: { } + permissions: { } + administer: + roles: { } + users: { } + permissions: { } + test: + roles: { } + users: { } + permissions: { } + configuration: + roles: { } + users: { } + permissions: { } +handlers: + f2_archive_on_case: + id: os2forms_f2_f2 + handler_id: f2_archive_on_case + label: 'F2 (arkivér på sag)' + notes: '' + status: true + conditions: { } + weight: 1 + settings: + archive: + attachment_element: attachment + document_title: '[webform_submission:label] ([site:url]) – [current-date:html_datetime]' + archive_files: 1 + file_document_title: '[file:element:title]: [file:filename]' + archive_target: case + archive_target_case: + case_identifier: '2026 - 1234567890' + matter_title: 'Matter: [webform_submission:label] ([site:url]) – [current-date:html_datetime]' + matter_type: Internal + matter_access_level: All + additional: + states: + - completed +variants: { } diff --git a/src/Helper/WebformHelperF2.php b/src/Helper/WebformHelperF2.php index c88113e..ed3ab60 100644 --- a/src/Helper/WebformHelperF2.php +++ b/src/Helper/WebformHelperF2.php @@ -5,6 +5,7 @@ use Drupal\advancedqueue\Entity\QueueInterface; use Drupal\advancedqueue\Job; use Drupal\advancedqueue\JobResult; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Logger\LoggerChannelInterface; @@ -27,6 +28,7 @@ use Drupal\webform_attachment\Element\WebformAttachmentBase; use ItkDev\F2ApiClient\Model\Document; use ItkDev\F2ApiClient\Model\Matter; +use ItkDev\F2ApiClient\Model\Party; use Psr\Log\LoggerInterface; use Psr\Log\LoggerTrait; use Symfony\Component\DependencyInjection\Attribute\Autowire; @@ -37,6 +39,17 @@ final readonly class WebformHelperF2 implements LoggerInterface { use LoggerTrait; + /** + * File element types. + */ + private const array FILE_ELEMENT_TYPES = [ + 'webform_image_file', + 'webform_document_file', + 'webform_video_file', + 'webform_audio_file', + 'managed_file', + ]; + private const string PDF_MIME_TYPE = 'application/pdf'; /** @@ -92,10 +105,8 @@ private function loadQueue(): QueueInterface { * The level. * @param string $message * The message. - * @param array $context + * @param array $context * The context. - * - * @phpstan-param array $context */ #[\Override] public function log($level, $message, array $context = []): void { @@ -173,7 +184,6 @@ public function processJob(Job $job): JobResult { $context['webform_submission'] = $submission; $handlerSettings = new HandlerSettings($payload['handlerSettings']); - $this->replaceTokens($handlerSettings, $submission); $target = $handlerSettings->archive?->archiveTarget; return match ($target) { @@ -193,15 +203,20 @@ public function processJob(Job $job): JobResult { } /** - * Replace tokens in handler settings supporting tokens. + * Replace webform submission tokens in text. + * + * @param string $text + * The text. + * @param WebformSubmissionInterface $submission + * The webform submission. + * @param array $additionalTokens + * Additional tokens to replace in the text. */ - private function replaceTokens(HandlerSettings $handlerSettings, WebformSubmissionInterface $submission): HandlerSettings { - $handlerSettings->archive->documentTitle = $this->webformTokenManager->replace((string) $handlerSettings->archive->documentTitle, $submission); - if ($handlerSettings->archive->archiveTargetCase?->matterTitle) { - $handlerSettings->archive->archiveTargetCase->matterTitle = $this->webformTokenManager->replace($handlerSettings->archive->archiveTargetCase->matterTitle, $submission); - } - - return $handlerSettings; + private function replaceTokens(string $text, WebformSubmissionInterface $submission, array $additionalTokens = []): string { + return str_replace( + array_keys($additionalTokens), array_values($additionalTokens), + $this->webformTokenManager->replace($text, $submission), + ); } /** @@ -219,7 +234,7 @@ private function archiveOnCase(WebformSubmissionInterface $submission, HandlerSe } $case = $this->f2->fetchCaseByIdentifier($caseIdentifier); - $this->info('Achiving document for submission @submission on case @case ', $context + [ + $this->info('Archiving document for submission @submission on case @case ', $context + [ '@submission' => $submission->label(), '@case' => (string) $case, ]); @@ -239,8 +254,13 @@ private function archiveOnCase(WebformSubmissionInterface $submission, HandlerSe '@submission' => $submission->label(), ]); $matter = new Matter(); - $matter->title = $handlerSettings->archive->archiveTargetCase->matterTitle; + $title = $this->replaceTokens($handlerSettings->archive->archiveTargetCase->matterTitle, $submission); + $matter->title = $this->truncate($title, Matter::TITLE_MAX_LENGTH); $matter->type = $handlerSettings->archive->archiveTargetCase->matterType; + $matter->accessLevel = $handlerSettings->archive->archiveTargetCase->matterAccessLevel; + // Always archive ("journaliser") matter. + $matter->archived = TRUE; + $this->setMatterResponsible($matter, $handlerSettings); $matter = $this->f2->client()->matterCreate(matter: $matter, case: $case); $this->info('Matter for submission @submission created: @matter', $context + [ @@ -253,96 +273,118 @@ private function archiveOnCase(WebformSubmissionInterface $submission, HandlerSe webformHandlerId: $handlerSettings->handlerId, webformSubmissionId: $submission->id(), type: $itemType, + identifier: NULL, data: $matter->toArray(), ); } $this->itemRepository->save($item); - $message = $this->createDocument($matter, $submission, $handlerSettings); - return JobResult::success($message); + return $this->archiveOnMatter($submission, $handlerSettings, $matter); } /** * Archive on matter. */ - private function archiveOnMatter(WebformSubmissionInterface $submission, HandlerSettings $handlerSettings): JobResult { + private function archiveOnMatter(WebformSubmissionInterface $submission, HandlerSettings $handlerSettings, ?Matter $matter = NULL): JobResult { $context = [ 'handler_id' => WebformHandlerF2::ID, 'webform_submission' => $submission, 'operation' => 'archive on matter', ]; - $matterIdentifier = $handlerSettings->archive?->archiveTargetMatter?->matterIdentifier; - if (NULL === $matterIdentifier) { - throw new RuntimeException('Cannot get matter identifier'); + if (NULL === $matter) { + $matterIdentifier = $handlerSettings->archive?->archiveTargetMatter?->matterIdentifier; + if (NULL === $matterIdentifier) { + throw new RuntimeException('Cannot get matter identifier'); + } + $matter = $this->f2->fetchMatterByIdentifier($matterIdentifier); } - $matter = $this->f2->fetchMatterByIdentifier($matterIdentifier); - $this->info('Achiving document for submission @submission on matter @matter ', $context + [ + $this->info('Archiving document for submission @submission on matter @matter ', $context + [ '@submission' => $submission->label(), '@matter' => (string) $matter, ]); - $message = $this->createDocument($matter, $submission, $handlerSettings); + $messages = []; + + $attachment = $this->getAttachment($submission, $handlerSettings); + try { + // Apparently the F2 API inspects the filename extension to determine + // file type, i.e. we must keep the extension in the temporary filename. + $fileUri = $this->fileSystem->saveData($attachment->contents, 'temporary://' . uniqid('os2forms_f2') . '-' . $attachment->filename); + $title = $this->replaceTokens($handlerSettings->archive->documentTitle ?? $attachment->filename, $submission); + $messages[] = $this->createDocument($matter, $submission, $handlerSettings, $fileUri, 'attachment', $title); + } + finally { + if (isset($fileUri) && file_exists($fileUri)) { + unlink($fileUri); + } + } + + if ($handlerSettings->archive->archiveFiles) { + $fileElements = $this->getFileElements($submission); + $files = $this->entityTypeManager->getStorage('file')->loadMultiple(array_keys($fileElements)); + foreach ($fileElements as $fileId => $element) { + $file = $files[$fileId]; + $fileUri = $file->getFileUri(); + $title = $this->replaceTokens($handlerSettings->archive->fileDocumentTitle ?? $file->getFilename(), $submission, [ + '[file:name]' => pathinfo($file->getFilename(), PATHINFO_FILENAME), + '[file:filename]' => $file->getFilename(), + '[file:element:title]' => $element['#title'], + ]); + $messages[] = $this->createDocument($matter, $submission, $handlerSettings, $fileUri, $file->getFilename(), $title); + } + } - return JobResult::success($message); + return JobResult::success(implode(PHP_EOL, $messages)); } /** * Create document in F2. */ - private function createDocument(Matter $matter, WebformSubmissionInterface $submission, HandlerSettings $handlerSettings): string { + private function createDocument(Matter $matter, WebformSubmissionInterface $submission, HandlerSettings $handlerSettings, string $fileUri, string $identifier, string $title): string { $context = [ 'handler_id' => WebformHandlerF2::ID, 'webform_submission' => $submission, 'operation' => 'create document', ]; - $attachment = $this->getAttachment($submission, $handlerSettings); - try { - $itemType = Type::Document; - $item = $this->itemRepository->loadOneBySubmissionAndHandlerAndType($submission, $handlerSettings->handlerId, $itemType); - if (NULL !== $item) { - // Document already exists. What to do? - $id = $item->data['id']; - $document = $this->f2->client()->documentById($id); - $this->info('Document on matter @matter for submission @submission already exists: @document', $context + [ - '@submission' => $submission->label(), - '@matter' => (string) $matter, - '@document' => (string) $document, - ]); - $message = sprintf('Document %s already exists on matter %s', $document, $matter); - } - else { - // Apparently the F2 API inspects the filename extension to determine - // file type, i.e. we must keep the extension in the temporary filename. - $filePath = $this->fileSystem->saveData($attachment->contents, 'temporary://' . uniqid('os2forms_f2') . '-' . $attachment->filename); - $document = new Document(); - $document->title = $handlerSettings->archive->documentTitle ?? $attachment->filename; - $document = $this->f2->client()->documentCreate($document, $filePath, $matter); - $this->info('Document on matter @matter for submission @submission created: @document', $context + [ - '@submission' => $submission->label(), - '@matter' => (string) $matter, - '@document' => (string) $document, - ]); - $message = sprintf('Document %s created on matter %s', $document, $matter); - - $item = new F2Item( - webformId: $submission->getWebform()->id(), - webformHandlerId: $handlerSettings->handlerId, - webformSubmissionId: $submission->id(), - type: $itemType, - data: $document->toArray(), - ); - } - - $this->itemRepository->save($item); + $itemType = Type::Document; + $item = $this->itemRepository->loadOneBySubmissionAndHandlerAndType($submission, $handlerSettings->handlerId, $itemType, $identifier); + if (NULL !== $item) { + // Document already exists. What to do? + $id = $item->data['id']; + $document = $this->f2->client()->documentById($id); + $this->info('Document @identifier on matter @matter for submission @submission already exists: @document', $context + [ + '@identifier' => $identifier, + '@submission' => $submission->label(), + '@matter' => (string) $matter, + '@document' => (string) $document, + ]); + $message = sprintf('Document %s already exists on matter %s', $document, $matter); } - finally { - if (isset($filePath) && file_exists($filePath)) { - unlink($filePath); - } + else { + $document = new Document(); + $document->title = $this->truncate($title, Document::TITLE_MAX_LENGTH); + $document = $this->f2->client()->documentCreate($document, $fileUri, $matter); + $this->info('Document on matter @matter for submission @submission created: @document', $context + [ + '@submission' => $submission->label(), + '@matter' => (string) $matter, + '@document' => (string) $document, + ]); + $message = sprintf('Document %s created on matter %s', $document, $matter); + + $item = new F2Item( + webformId: $submission->getWebform()->id(), + webformHandlerId: $handlerSettings->handlerId, + webformSubmissionId: $submission->id(), + type: $itemType, + identifier: $identifier, + data: $document->toArray(), + ); } + $this->itemRepository->save($item); + return $message; } @@ -387,4 +429,90 @@ protected function getAttachment(WebformSubmissionInterface $submission, Handler ); } + /** + * Set responsible party on matter if requested. + */ + private function setMatterResponsible(Matter $matter, HandlerSettings $handlerSettings): void { + if (!ArchiveSettings::isMatterResponsiblePartyEnabled()) { + return; + } + + $partyIdentifier = $handlerSettings->archive->archiveTargetCase->matterResponsiblePartyIdentifier; + if (NULL != $partyIdentifier) { + $responsible = new Party(); + if ($partyNumber = filter_var($partyIdentifier, FILTER_VALIDATE_INT)) { + $responsible->partyNumber = $partyNumber; + } + elseif ($email = filter_var($partyIdentifier, FILTER_VALIDATE_EMAIL)) { + $responsible->email = $email; + } + else { + // Unhandled value. + return; + } + $matter->responsible = $responsible; + } + } + + /** + * Returns list of file elements indexed by a file entity ID. + * + * Example: + * + * @code + * [ + * 87 => [ + * '#type' => 'webform_image_file', + * '#title' => 'Images', + * '#multiple' => 1, + * ], + * 42 => [ + * '#type' => 'webform_image_file', + * '#title' => 'Images', + * '#multiple' => 1, + * ], + * ] + * @endcode + * + * Notice that each element can occurs multiple times in the data if multiple + * files are allowed in the element. + * + * @return array + * The list elements indexed by file ID. + */ + private function getFileElements(WebformSubmissionInterface $submission): array { + $elements = $submission->getWebform()->getElementsDecodedAndFlattened(); + + $fileElements = []; + + foreach (self::FILE_ELEMENT_TYPES as $type) { + $fileElements[] = array_filter($elements, fn(array $element) => $type === ($element['#type'] ?? NULL)); + } + + // https://dev.to/klnjmm/never-use-arraymerge-in-a-for-loop-in-php-5go1 + $fileElements = array_merge(...$fileElements); + + $result = []; + $data = $submission->getData(); + foreach ($fileElements as $key => $element) { + if (empty($data[$key])) { + continue; + } + + // Convert occurrences of singular file into array. + foreach ((array) $data[$key] as $fileId) { + $result[$fileId] = $element; + } + } + + return $result; + } + + /** + * Truncate string to a maximum length. + */ + private function truncate(string $text, int $maxLength): string { + return Unicode::truncate($text, $maxLength); + } + } diff --git a/src/Hook/InstallHooks.php b/src/Hook/InstallHooks.php index 60dd0f4..d45ad46 100644 --- a/src/Hook/InstallHooks.php +++ b/src/Hook/InstallHooks.php @@ -45,6 +45,11 @@ public function schema(): array { 'length' => '256', 'not null' => TRUE, ], + 'identifier' => [ + 'description' => 'Optional identifier for the item.', + 'type' => 'varchar', + 'length' => '256', + ], 'data' => [ 'description' => 'The data (JSON serialized).', 'type' => 'text', diff --git a/src/Model/F2Item.php b/src/Model/F2Item.php index b46a7bc..2bfd8a9 100644 --- a/src/Model/F2Item.php +++ b/src/Model/F2Item.php @@ -6,6 +6,10 @@ /** * F2 item. + * + * These are stored in and loaded from the database by the F2ItemRepository. + * + * @see \Drupal\os2forms_f2\Repository\F2ItemRepository */ final class F2Item { @@ -17,6 +21,7 @@ public function __construct( public readonly string $webformHandlerId, public readonly int $webformSubmissionId, public readonly Type $type, + public readonly ?string $identifier, public readonly array $data, public ?int $createdAt = NULL, public ?int $updatedAt = NULL, diff --git a/src/Plugin/AdvancedQueue/JobType/F2.php b/src/Plugin/AdvancedQueue/JobType/F2.php index a41cad7..a45d24b 100644 --- a/src/Plugin/AdvancedQueue/JobType/F2.php +++ b/src/Plugin/AdvancedQueue/JobType/F2.php @@ -23,8 +23,6 @@ final class F2 extends JobTypeBase implements ContainerFactoryPluginInterface { /** * {@inheritdoc} - * - * @phpstan-param array $configuration */ public function __construct( array $configuration, @@ -40,8 +38,6 @@ public function __construct( /** * {@inheritdoc} - * - * @phpstan-param array $configuration */ #[\Override] public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { diff --git a/src/Plugin/WebformHandler/WebformHandlerF2.php b/src/Plugin/WebformHandler/WebformHandlerF2.php index 44446b7..1df46be 100644 --- a/src/Plugin/WebformHandler/WebformHandlerF2.php +++ b/src/Plugin/WebformHandler/WebformHandlerF2.php @@ -15,9 +15,11 @@ use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTarget; use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTargetCase; use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTargetMatter; +use Drupal\os2forms_f2\Settings\GeneralSettings; use Drupal\webform\Plugin\WebformHandlerBase; use Drupal\webform\Utility\WebformDialogHelper; use Drupal\webform\WebformSubmissionInterface; +use ItkDev\F2ApiClient\Model\Document; use ItkDev\F2ApiClient\Model\Matter; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -87,7 +89,8 @@ public static function create(ContainerInterface $container, array $configuratio /** * {@inheritdoc} * - * @phpstan-return array + * @return array + * The default configuration. */ #[\Override] public function defaultConfiguration() { @@ -114,6 +117,11 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form[self::ID] = [ '#type' => 'fieldset', '#title' => $this->t('F2 archive settings', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('Configuration for archiving in F2. See the user manual for details.', [ + ':user_manual_url' => GeneralSettings::getFormBuilderUserManualUrl(), + ], options: ['context' => 'os2forms_f2']), + '#description_display' => 'before', + ArchiveSettings::NAME => [ ArchiveSettings::ATTACHMENT_ELEMENT => [ '#type' => 'select', @@ -127,10 +135,57 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta '#type' => 'textfield', '#required' => TRUE, '#title' => $this->t('Document title', options: ['context' => 'os2forms_f2']), - '#description' => $this->t('The title of the document. Tokens can be used in the title, e.g. [webform_submission:label].', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('The title of the document. Tokens can be used in the title, e.g. [webform_submission:label]. Max allowed length (after token expansion): @title_max_length.', [ + '@title_max_length' => Document::TITLE_MAX_LENGTH, + ], options: ['context' => 'os2forms_f2']), '#default_value' => $settings->documentTitle, ], + ArchiveSettings::ARCHIVE_FILES => [ + '#type' => 'checkbox', + '#title' => $this->t('Archive files', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('If checked, any files on a submission will be archived in F2.', options: ['context' => 'os2forms_f2']), + '#default_value' => $settings->archiveFiles, + ], + + ArchiveSettings::FILE_DOCUMENT_TITLE => [ + '#type' => 'textfield', + '#title' => $this->t('File document title', options: ['context' => 'os2forms_f2']), + '#description' => $this->t(<<<'DESCRIPTION' +Title used for file documents. Tokens can be used in the title, and in addition the regular webform submission token (e.g. [webform_submission:label]) these tokens can be used: +
    +
  • [file:name] the name of the file without any extension, e.g. my-document
  • +
  • [file:filename] the full filename e.g. my-document.pdf
  • +
  • [file:element:title] the title of the file element
  • +
+Max allowed length (after token expansion): @title_max_length. +DESCRIPTION, [ + '@title_max_length' => Document::TITLE_MAX_LENGTH, + ], options: ['context' => 'os2forms_f2']), + '#default_value' => $settings->fileDocumentTitle ?: '[file:element:name]: [file:filename]', + + '#states' => [ + 'visible' => [ + ':input[name="settings[' . implode('][', [ + self::ID, + ArchiveSettings::NAME, + ArchiveSettings::ARCHIVE_FILES, + ]) . ']"]' => [ + 'checked' => TRUE, + ], + ], + 'required' => [ + ':input[name="settings[' . implode('][', [ + self::ID, + ArchiveSettings::NAME, + ArchiveSettings::ARCHIVE_FILES, + ]) . ']"]' => [ + 'checked' => TRUE, + ], + ], + ], + ], + ArchiveSettings::ARCHIVE_TARGET => [ '#type' => 'select', '#required' => TRUE, @@ -179,7 +234,9 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ArchiveTargetCase::MATTER_TITLE => [ '#type' => 'textfield', '#title' => $this->t('Matter title', options: ['context' => 'os2forms_f2']), - '#description' => $this->t('The title of the matter that will be created for the document. Tokens can be used in the title, e.g. [webform_submission:label].', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('The title of the matter that will be created for the document. Tokens can be used in the title, e.g. [webform_submission:label]. Max allowed length (after token expansion): @title_max_length.', [ + '@title_max_length' => Matter::TITLE_MAX_LENGTH, + ], options: ['context' => 'os2forms_f2']), '#default_value' => $settings->archiveTargetCase?->matterTitle, '#states' => [ @@ -219,6 +276,37 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ], ], + ArchiveTargetCase::MATTER_ACCESS_LEVEL => [ + '#type' => 'select', + '#options' => [ + Matter::ACCESS_LEVEL_INVOLVED => $this->t('Involved', options: ['context' => 'os2forms_f2']), + Matter::ACCESS_LEVEL_UNIT => $this->t('Unit', options: ['context' => 'os2forms_f2']), + Matter::ACCESS_LEVEL_ALL => $this->t('All', options: ['context' => 'os2forms_f2']), + ], + '#title' => $this->t('Matter access level', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('The access level of the matter that will be created for the document.', options: ['context' => 'os2forms_f2']), + '#default_value' => $settings->archiveTargetCase->matterAccessLevel ?? Matter::ACCESS_LEVEL_ALL, + + '#states' => [ + 'required' => [ + ':input[name="settings[' . implode('][', [ + self::ID, + ArchiveSettings::NAME, + ArchiveSettings::ARCHIVE_TARGET, + ]) . ']"]' => [ + 'value' => ArchiveTarget::Case->value, + ], + ], + ], + ], + + ArchiveTargetCase::MATTER_RESPONSIBLE_PARTY_IDENTIFIER => [ + '#type' => 'textfield', + '#title' => $this->t('Responsible party identifier', options: ['context' => 'os2forms_f2']), + '#description' => $this->t('The party responsible for the matter that will be created. Can be a party number or an email address.', options: ['context' => 'os2forms_f2']), + '#default_value' => $settings->archiveTargetCase->matterResponsiblePartyIdentifier ?? NULL, + '#access' => ArchiveSettings::isMatterResponsiblePartyEnabled(), + ], ], ArchiveTargetMatter::NAME => [ @@ -354,6 +442,26 @@ public function validateConfigurationForm(array &$form, FormStateInterface $form ], options: ['context' => 'os2forms_f2'])); } } + + if (ArchiveSettings::isMatterResponsiblePartyEnabled()) { + // Validate responsible party identifier. + $key = [ + self::ID, + ArchiveSettings::NAME, + ArchiveTargetCase::NAME, + ArchiveTargetCase::MATTER_RESPONSIBLE_PARTY_IDENTIFIER, + ]; + $partyIdentifier = trim((string) $form_state->getValue($key)); + if ('' !== $partyIdentifier) { + if (FALSE === filter_var($partyIdentifier, FILTER_VALIDATE_INT) + && FALSE === filter_var($partyIdentifier, FILTER_VALIDATE_EMAIL)) { + $setError($key, t('Party identifier "@party_identifier" must be an integer or an email address.', [ + '@party_identifier' => $partyIdentifier, + ], options: ['context' => 'os2forms_f2'])); + } + } + } + break; case ArchiveTarget::Matter: @@ -465,7 +573,8 @@ public function getSummary(): array { /** * Get attachment elements. * - * @phpstan-return array + * @return array + * The attachment elements. */ private function getAttachmentElements(): array { $elements = $this->getWebform()->getElementsDecodedAndFlattened(); diff --git a/src/Repository/F2ItemRepository.php b/src/Repository/F2ItemRepository.php index 20c10ab..e1b4870 100644 --- a/src/Repository/F2ItemRepository.php +++ b/src/Repository/F2ItemRepository.php @@ -9,6 +9,8 @@ /** * Repository for F2 items. + * + * @see \Drupal\os2forms_f2\Model\F2Item */ final class F2ItemRepository extends AbstractRepository { private const string TABLE = InstallHooks::TABLE_F2_ITEM; @@ -16,8 +18,9 @@ final class F2ItemRepository extends AbstractRepository { /** * Load F2 items. * - * @param array $conditions - * The criteria. + * @param list $conditions + * The conditions ([field, value, [operator]). If the value is null and no + * operator is specified, 'IS NULL' will be used as the operator. * @param array $orderBy * The order. * @@ -30,6 +33,9 @@ private function loadBy(array $conditions = [], array $orderBy = ['created_at' = ->fields('t'); foreach ($conditions as $condition) { + if (2 === count($condition) && NULL === $condition[1]) { + $condition[] = 'IS NULL'; + } $query->condition(...$condition); } @@ -47,6 +53,7 @@ private function loadBy(array $conditions = [], array $orderBy = ['created_at' = webformHandlerId: $row->webform_handler_id, webformSubmissionId: $row->webform_submission_id, type: Type::from($row->type), + identifier: $row->identifier, data: $this->unserializeData($row->data), createdAt: $row->created_at, updatedAt: $row->updated_at, @@ -58,15 +65,18 @@ private function loadBy(array $conditions = [], array $orderBy = ['created_at' = /** * Load one item by ... */ - public function loadOneBySubmissionAndHandlerAndType(WebformSubmissionInterface $submission, string $handlerId, Type $type): ?F2Item { - $items = $this->loadBy([ + public function loadOneBySubmissionAndHandlerAndType(WebformSubmissionInterface $submission, string $handlerId, Type $type, ?string $identifier = NULL): ?F2Item { + $conditions = [ ['webform_id', $submission->getWebform()->id()], ['webform_handler_id', $handlerId], ['webform_submission_id', $submission->id()], ['type', $type->value], - ]); + ['identifier', $identifier], + ]; + + $items = $this->loadBy($conditions); - return 1 === count($items) ? reset($items) : NULL; + return count($items) > 0 ? reset($items) : NULL; } /** @@ -123,6 +133,7 @@ public function save(F2Item $item): bool { 'webform_handler_id' => $item->webformHandlerId, 'webform_submission_id' => $item->webformSubmissionId, 'type' => $item->type->value, + 'identifier' => $item->identifier, 'data' => $this->serializeData($item->data), 'created_at' => $item->createdAt, 'updated_at' => $item->updatedAt, @@ -133,6 +144,7 @@ public function save(F2Item $item): bool { ['webform_handler_id', $fields['webform_handler_id']], ['webform_submission_id', $fields['webform_submission_id']], ['type', $fields['type']], + ['identifier', $fields['identifier']], ]))) { $this->database ->insert(self::TABLE) @@ -146,6 +158,7 @@ public function save(F2Item $item): bool { ->condition('webform_handler_id', $fields['webform_handler_id']) ->condition('webform_submission_id', $fields['webform_submission_id']) ->condition('type', $fields['type']) + ->condition('identifier', $fields['identifier']) ->fields($fields) ->execute(); } diff --git a/src/Settings/ArchiveSettings.php b/src/Settings/ArchiveSettings.php index 1ce3bc0..5234e09 100644 --- a/src/Settings/ArchiveSettings.php +++ b/src/Settings/ArchiveSettings.php @@ -2,6 +2,7 @@ namespace Drupal\os2forms_f2\Settings; +use Drupal\Core\Site\Settings as DrupalSettings; use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTarget; use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTargetCase; use Drupal\os2forms_f2\Settings\ArchiveSettings\ArchiveTargetMatter; @@ -30,6 +31,12 @@ final class ArchiveSettings extends AbstractSettings { const string DOCUMENT_TITLE = 'document_title'; public ?string $documentTitle = NULL; + const string ARCHIVE_FILES = 'archive_files'; + public bool $archiveFiles = FALSE; + + const string FILE_DOCUMENT_TITLE = 'file_document_title'; + public ?string $fileDocumentTitle = NULL; + const string ARCHIVE_TARGET = 'archive_target'; public ?ArchiveTarget $archiveTarget = NULL; @@ -39,4 +46,11 @@ final class ArchiveSettings extends AbstractSettings { const string ARCHIVE_TARGET_MATTER = 'archive_target_matter'; public ?ArchiveTargetMatter $archiveTargetMatter = NULL; + /** + * Get value of "matter responsible party" feature flags. + */ + public static function isMatterResponsiblePartyEnabled(): bool { + return TRUE === (DrupalSettings::get('os2forms_f2')[ArchiveSettings::NAME][ArchiveTargetCase::MATTER_RESPONSIBLE_PARTY_IDENTIFIER]['enabled'] ?? NULL); + } + } diff --git a/src/Settings/ArchiveSettings/ArchiveTargetCase.php b/src/Settings/ArchiveSettings/ArchiveTargetCase.php index 82be5d0..dd60dea 100644 --- a/src/Settings/ArchiveSettings/ArchiveTargetCase.php +++ b/src/Settings/ArchiveSettings/ArchiveTargetCase.php @@ -21,4 +21,10 @@ final class ArchiveTargetCase extends AbstractSettings { const string MATTER_TYPE = 'matter_type'; public ?string $matterType = Matter::TYPE_INTERNAL; + const string MATTER_ACCESS_LEVEL = 'matter_access_level'; + public ?string $matterAccessLevel = Matter::ACCESS_LEVEL_ALL; + + const string MATTER_RESPONSIBLE_PARTY_IDENTIFIER = 'matter_responsible_party_identifier'; + public ?string $matterResponsiblePartyIdentifier = NULL; + } diff --git a/src/Settings/GeneralSettings.php b/src/Settings/GeneralSettings.php index 3d0fb69..fb273eb 100644 --- a/src/Settings/GeneralSettings.php +++ b/src/Settings/GeneralSettings.php @@ -2,6 +2,8 @@ namespace Drupal\os2forms_f2\Settings; +use Drupal\Core\Site\Settings as DrupalSettings; + /** * General module settings. */ @@ -11,4 +13,22 @@ final class GeneralSettings extends AbstractSettings { const string QUEUE = 'queue'; public ?string $queue = NULL; + /** + * Get user manual URL. + */ + public static function getUserManualUrl(): string { + $settings = DrupalSettings::get('os2forms_f2'); + + return $settings['user_manual']['url'] ?? 'https://itk-dev.github.io/os2forms_f2/user-manual/da/'; + } + + /** + * Get form builder user manual URL. + */ + public static function getFormBuilderUserManualUrl(): string { + $settings = DrupalSettings::get('os2forms_f2'); + + return $settings['user_manual']['url_form_builder'] ?? 'https://itk-dev.github.io/os2forms_f2/user-manual/da/'; + } + } diff --git a/tests/Playwright/tests/user-manual-images.spec.ts b/tests/Playwright/tests/user-manual-images.spec.ts index 629d224..4c8b1cd 100644 --- a/tests/Playwright/tests/user-manual-images.spec.ts +++ b/tests/Playwright/tests/user-manual-images.spec.ts @@ -218,6 +218,11 @@ screenshooting ${selector} await page .locator('[name="settings[os2forms_f2_f2][archive][document_title]"]') .fill("[webform_submission:label] ([site:url])"); + await page + .locator('[name="settings[os2forms_f2_f2][archive][archive_files]"]') + .check(); + // Wait for checkbox animation to (hopefully) complete + await page.waitForTimeout(2000); await page .locator('[name="settings[os2forms_f2_f2][archive][archive_target]"]') .focus(); diff --git a/translations/os2forms_f2.da.po b/translations/os2forms_f2.da.po index 818c062..792d004 100644 --- a/translations/os2forms_f2.da.po +++ b/translations/os2forms_f2.da.po @@ -3,8 +3,8 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2026-11-02 12:54+0100\n" -"PO-Revision-Date: 2026-11-02 12:54+0100\n" +"POT-Creation-Date: 2026-11-10 11:36+0100\n" +"PO-Revision-Date: 2026-11-10 11:36+0100\n" "Last-Translator: NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -49,6 +49,14 @@ msgctxt "os2forms_f2" msgid "Alert" msgstr "Advarsel" +msgctxt "os2forms_f2" +msgid "All" +msgstr "Alle" + +msgctxt "os2forms_f2" +msgid "Archive files" +msgstr "Arkivér filer" + msgctxt "os2forms_f2" msgid "Archive on case \"@case_identifier\"." msgstr "Arkivér på sag \"@case_identifier\"." @@ -89,6 +97,14 @@ msgctxt "os2forms_f2" msgid "Case number or search terms that uniquely identify a single case." msgstr "Sagsnummer eller søgetermer der entydigt identificerer en enkelt sag." +msgctxt "os2forms_f2" +msgid "" +"Configuration for archiving in F2. See the user manual for details." +msgstr "" +"Indstillinger for arkivering i F2. Se brugervejledningen for detaljer." + msgctxt "os2forms_f2" msgid "Configure the OS2Forms F2 module" msgstr "Konfigurer F2-modulet" @@ -137,6 +153,10 @@ msgctxt "os2forms_f2" msgid "F2 username" msgstr "F2-brugernavn" +msgctxt "os2forms_f2" +msgid "File document title" +msgstr "Fildokumenttitel" + msgctxt "os2forms_f2" msgid "General" msgstr "Generelt" @@ -149,6 +169,10 @@ msgctxt "os2forms_f2" msgid "Identifier \"@matter_identifier\" does not uniquely identify a matter." msgstr "Id'et \"@matter_identifier\" identificerer ikke entydigt en akt." +msgctxt "os2forms_f2" +msgid "If checked, any files on a submission will be archived in F2." +msgstr "Hvis sat, vil alle filer på en besvarelse blive arkiveret i F2." + msgctxt "os2forms_f2" msgid "Inbound" msgstr "Indgående" @@ -165,10 +189,18 @@ msgctxt "os2forms_f2" msgid "Invalid archive target: @target" msgstr "Ugyldig arkivering: @target" +msgctxt "os2forms_f2" +msgid "Involved" +msgstr "Involverede" + msgctxt "os2forms_f2" msgid "Matter" msgstr "Akt" +msgctxt "os2forms_f2" +msgid "Matter access level" +msgstr "Adgang" + msgctxt "os2forms_f2" msgid "Matter details" msgstr "Aktdetaljer" @@ -217,6 +249,14 @@ msgctxt "os2forms_f2" msgid "Outbound" msgstr "Udgående" +msgctxt "os2forms_f2" +msgid "" +"Party identifier \"@party_identifier\" must be an integer or an email " +"address." +msgstr "" +"Parts-id'et \"@party_identifier\" skal være et heltal eller en " +"e-mailadresse." + msgctxt "os2forms_f2" msgid "Ping API" msgstr "Tjek forbindelse til api" @@ -251,6 +291,10 @@ msgstr "" "Drupals cron eller med drush advancedqueue:queue:process " "@queue (i et cron-job)." +msgctxt "os2forms_f2" +msgid "Responsible party identifier" +msgstr "Id for ansvarlig part" + msgctxt "os2forms_f2" msgid "Run handler when …" msgstr "Kør behandler (handler) når …" @@ -279,31 +323,86 @@ msgctxt "os2forms_f2" msgid "The F2 username to act on behalf of" msgstr "F2-brugernavnet som der skal ageres på vegne af" +msgctxt "os2forms_f2" +msgid "The access level of the matter that will be created for the document." +msgstr "Adgang for akten der oprettes." + +msgctxt "os2forms_f2" +msgid "" +"The party responsible for the matter that will be created. Can be a " +"party number or an email address." +msgstr "" +"Part der er ansvarlig for akten der oprettes. Kan være en " +"e-mailadresse eller et partsnummer." + msgctxt "os2forms_f2" msgid "" "The title of the document. Tokens can be used in the title, e.g. " -"[webform_submission:label]." +"[webform_submission:label]. Max allowed length (after " +"token expansion): @title_max_length." msgstr "" "Titlen på dokumentet. Understøtter \"tokens\", fx " -"[webform_submission:label]." +"[webform_submission:label]. Maksimalt tilladt længde " +"(efter tokens er foldet ud): @title_max_length." msgctxt "os2forms_f2" msgid "" "The title of the matter that will be created for the document. Tokens " "can be used in the title, e.g. " -"[webform_submission:label]." +"[webform_submission:label]. Max allowed length (after " +"token expansion): @title_max_length." msgstr "" "Titlen på akten der bliver oprettet til dokumentet. Understøtter " -"\"tokens\", fx [webform_submission:label]." +"\"tokens\", fx [webform_submission:label]. Maksimalt " +"tilladt længde (efter tokens er foldet ud): @title_max_length." msgctxt "os2forms_f2" msgid "The type of the matter that will be created for the document." msgstr "Typen på akten der bliver oprettet for dokumentet." +msgctxt "os2forms_f2" +msgid "" +"Title used for file documents. Tokens can be used in the title, and in " +"addition the regular webform submission token (e.g. " +"[webform_submission:label]) these tokens can be " +"used:\n" +"
    \n" +"
  • [file:name] the name of the file " +"without any extension, e.g. " +"my-document
  • \n" +"
  • [file:filename] the " +"full filename e.g. " +"my-document.pdf
  • \n" +"
  • [file:element:title] " +"the title of the file element
  • \n" +"
\n" +"Max allowed length (after " +"token expansion): @title_max_length." +msgstr "" +"Titel på fildokumenter. Understøtter \"tokens\" og ud over de " +"sædvanlige tokens (fx [webform_submission:label]) kan " +"følgende tokens bruges:\n" +"
    \n" +"
  • [file:name] navn " +"på filen uden endelse, fx " +"my-document
  • \n" +"
  • [file:filename] det " +"fulde filnavn, fx " +"my-document.pdf
  • \n" +"
  • [file:element:title] " +"titlen på filelementet
  • \n" +"
\n" +"Maksimalt tilladt længde " +"(efter tokens er foldet ud): @title_max_length." + msgctxt "os2forms_f2" msgid "URI" msgstr "Url" +msgctxt "os2forms_f2" +msgid "Unit" +msgstr "Enhed" + msgctxt "os2forms_f2" msgid "Username" msgstr "Bruger"