Skip to content

Commit fae5581

Browse files
authored
Merge branch 'develop' into feature/issue-183-webform-auto-exports-initial-setting-save
2 parents 6f6d961 + 420bbcc commit fae5581

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1111

1212
## [Unreleased]
1313

14+
- [PR-228](https://github.com/OS2Forms/os2forms/pull/228)
15+
Added Drupal Core patch ensuring conditionals based upon computed twig
16+
works as intended.
17+
- [PR-215](https://github.com/OS2Forms/os2forms/pull/215)
18+
Added condition to maestro notification submission handler
1419
- [PR-101](https://github.com/OS2Forms/os2forms/pull/101)
1520
- Added support for `os2web_key` in Digital post
1621
- Switched from saving settings in key value store to config, i.e
@@ -25,6 +30,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa
2530
- [PR-184](https://github.com/OS2Forms/os2forms/pull/184)
2631
- Patches `coc_forms_auto_export` to ensure settings can be saved upon initial
2732
attempt, cf. [Unable to save initial settings due to unfocusable form control](https://www.drupal.org/project/coc_forms_auto_export/issues/3531004)
33+
- [PR-222](https://github.com/OS2Forms/os2forms/pull/222)
34+
Correctly sets sender label on Maestro digital post notifications.
2835
- [OS-199] Remove modules that are not used and not covered by central maintenance from OS2forms
2936

3037
## [4.1.0] 2025-06-03

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@
116116
"3256951: - Unable to receive attachments in emails sent": "https://git.drupalcode.org/project/coc_forms_auto_export/-/merge_requests/11.diff",
117117
"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"
118118
},
119+
"drupal/core": {
120+
"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"
121+
},
119122
"drupal/entity_print": {
120123
"2733781 - Add Export to Word Support": "https://www.drupal.org/files/issues/2019-11-22/2733781-47.patch"
121124
},

modules/os2forms_forloeb/src/MaestroHelper.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ private function sendNotification(
239239
|| $handler->isDisabled()
240240
|| $handler->isExcluded()
241241
|| !$handler->isNotificationEnabled($notificationType)
242+
|| !$handler->checkConditions($submission)
242243
) {
243244
continue;
244245
}
@@ -250,13 +251,14 @@ private function sendNotification(
250251
'subject' => $subject,
251252
'taskUrl' => $taskUrl,
252253
'actionLabel' => $actionLabel,
254+
'senderLabel' => $senderLabel,
253255
] = $this->renderNotification($submission, $handler->getHandlerId(), $notificationType, $templateTask, $maestroQueueID);
254256

255257
if ('email' === $contentType) {
256258
$this->sendNotificationEmail($recipient, $subject, $content, $submission, $notificationType);
257259
}
258260
else {
259-
$this->sendNotificationDigitalPost($recipient, $subject, $content, $taskUrl, $actionLabel, $submission, $notificationType);
261+
$this->sendNotificationDigitalPost($recipient, $subject, $content, $taskUrl, $actionLabel, $submission, $notificationType, $senderLabel);
260262
}
261263
}
262264
}
@@ -368,7 +370,9 @@ private function sendNotificationEmail(
368370
* @param \Drupal\webform\WebformSubmissionInterface $submission
369371
* The webform submission.
370372
* @param string $notificationType
371-
* The notification type (one of the NOTIFICATION_* constannts).
373+
* The notification type (one of the NOTIFICATION_* constants).
374+
* @param string $senderLabel
375+
* The sender label.
372376
*/
373377
private function sendNotificationDigitalPost(
374378
string $recipient,
@@ -378,6 +382,7 @@ private function sendNotificationDigitalPost(
378382
string $actionLabel,
379383
WebformSubmissionInterface $submission,
380384
string $notificationType,
385+
string $senderLabel,
381386
): void {
382387
try {
383388
$document = new Document(
@@ -386,7 +391,6 @@ private function sendNotificationDigitalPost(
386391
$subject . '.pdf'
387392
);
388393

389-
$senderLabel = $subject;
390394
$messageLabel = $subject;
391395

392396
$recipientLookupResult = $this->digitalPostHelper->lookupRecipient($recipient);
@@ -436,13 +440,13 @@ private function sendNotificationDigitalPost(
436440
* @param string $handlerId
437441
* The handler ID.
438442
* @param string $notificationType
439-
* The notification type (one of the NOTIFICATION_* constannts).
443+
* The notification type (one of the NOTIFICATION_* constants).
440444
* @param array $templateTask
441445
* The Maestro template task.
442446
* @param int $maestroQueueID
443447
* The Maestro queue ID.
444448
* @param string|null $contentType
445-
* Optional content type. If not set the content type will be compoted based
449+
* Optional content type. If not set the content type will be computed based
446450
* on the recipient.
447451
*
448452
* @return array
@@ -453,13 +457,20 @@ private function sendNotificationDigitalPost(
453457
* - subject
454458
* - taskUrl (for digital post)
455459
* - actionLabel (for digital post)
460+
* - senderLabel (for digital post)
456461
*
457462
* @see self::renderHtml()
458463
*/
459464
public function renderNotification(WebformSubmissionInterface $submission, string $handlerId, string $notificationType, array $templateTask, int $maestroQueueID, ?string $contentType = NULL): array {
460465
$handler = $submission->getWebform()->getHandler($handlerId);
461466
$settings = $handler->getSettings();
462467

468+
$senderLabel = $settings[MaestroNotificationHandler::NOTIFICATION][MaestroNotificationHandler::SENDER_LABEL] ?? NULL;
469+
470+
if (NULL === $senderLabel) {
471+
throw new RuntimeException(sprintf('Cannot get setting for Maestro notification: %s', MaestroNotificationHandler::SENDER_LABEL));
472+
}
473+
463474
$data = $submission->getData();
464475
$recipientElement = $settings[MaestroNotificationHandler::NOTIFICATION][MaestroNotificationHandler::RECIPIENT_ELEMENT] ?? NULL;
465476
// Handle os2forms_person_lookup element.
@@ -558,6 +569,7 @@ public function renderNotification(WebformSubmissionInterface $submission, strin
558569
'subject' => $subject,
559570
'taskUrl' => $taskUrl,
560571
'actionLabel' => $actionLabel,
572+
'senderLabel' => $senderLabel,
561573
];
562574
}
563575

0 commit comments

Comments
 (0)