Skip to content

Commit

Permalink
Merge branch 'develop' into feature/lookup-commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuaitk committed Nov 30, 2023
2 parents 109fd3e + 36f9283 commit 37a1cd8
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 46 deletions.
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Nedenfor ses dato for release og beskrivelse af opgaver som er implementeret.

## In develop

* Removed itk-dev/itkdev-booking from composer [#246](https://github.com/itk-dev/os2forms_selvbetjening/pull/246)
* Changed permissions to webform submisison log.
* Opdaterede [OS2Forms failed jobs
* Deaktiverede Attachment PDF-elementet.
* Opdaterede til [OS2Forms REST API
2.0.1](https://github.com/OS2Forms/os2forms_rest_api/releases/tag/2.0.1)
Expand All @@ -17,6 +18,19 @@ Nedenfor ses dato for release og beskrivelse af opgaver som er implementeret.
* Tilføjede beskrivelsestekst til email-handler.
* Tilføjede praktiske CPR- og CVR-opslagskommandoer.

## [2.6.8] 2023-11-16

* itk-dev/itkdev-booking: Fixed issue with location name, edit/delete bookings.

## [2.6.7] 2023-11-08

* Allowed composite elements in Maestro notification recipient.

## [2.6.6] 2023-11-02

* Fixed issue with pending bookings in itkdev-booking.
* Removed itk-dev/itkdev-booking from composer.

## [2.6.5] 2023-10-30

* Handled nested elements in webform inherit in patch
Expand Down Expand Up @@ -343,7 +357,10 @@ og [OS2Forms 3.7.0](https://github.com/OS2Forms/os2forms/releases/tag/3.7.0)

* GO borgersager

[Under udvikling]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.5...HEAD
[Under udvikling]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.8...HEAD
[2.6.8]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.7...2.6.8
[2.6.7]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.6...2.6.7
[2.6.6]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.5...2.6.6
[2.6.5]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.4...2.6.5
[2.6.4]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.3...2.6.4
[2.6.3]: https://github.com/itk-dev/os2forms_selvbetjening/compare/2.6.2...2.6.3
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"itk-dev/getorganized-api-client-php": "^1.2",
"itk-dev/os2forms_cpr_lookup": "^1.8",
"itk-dev/os2forms_cvr_lookup": "^1.4",
"itk-dev/os2forms_failed_jobs": "^1.2",
"itk-dev/os2forms_failed_jobs": "^1.3",
"itk-dev/os2forms_nemlogin_openid_connect": "^2.0",
"itk-dev/os2forms_user_field_lookup": "^1.0",
"itk-dev/serviceplatformen": "dev-feature/guzzle6-adapter as 1.5",
Expand Down Expand Up @@ -148,7 +148,8 @@
"Disallow empty queueToken": "patches/drupal/maestro/maestro_token.patch"
},
"os2forms/os2forms": {
"Handle nested elements in webform inherit": "patches/drupal/os2forms/handle_nested_elements_in_webform_inherit.patch"
"Handle nested elements in webform inherit": "patches/drupal/os2forms/handle_nested_elements_in_webform_inherit.patch",
"Allow composite elements in Maestro notification recipient": "patches/drupal/os2forms/allow_composite_elements_in_maestro_notification_recipient.patch"
}
},
"patches-ignore": {
Expand Down
26 changes: 15 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/sync/user.role.flow_designer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ status: true
dependencies:
config:
- filter.format.full_html
- filter.format.restricted_html
- node.type.webform
- workflows.workflow.udgivelse_af_forlob_og_webformularer
module:
Expand Down Expand Up @@ -79,6 +80,7 @@ permissions:
- 'start template tildeling_og_notifikationer'
- 'use advanced search'
- 'use text format full_html'
- 'use text format restricted_html'
- 'use udgivelse_af_forlob_og_webformularer transition create_new_draft'
- 'use udgivelse_af_forlob_og_webformularer transition publish'
- 'use udgivelse_af_forlob_og_webformularer transition republish'
Expand Down
1 change: 1 addition & 0 deletions config/sync/user.role.forloeb_designer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ permissions:
- 'access toolbar'
- 'access webform advanced queue overview'
- 'access webform overview'
- 'access webform submission log'
- 'access webform submission user'
- 'administer webform element access'
- 'administer webform revisions'
Expand Down
3 changes: 3 additions & 0 deletions config/sync/user.role.sagsbehandler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ status: true
dependencies:
config:
- filter.format.full_html
- filter.format.restricted_html
module:
- block_content
- content_moderation
Expand Down Expand Up @@ -36,6 +37,7 @@ permissions:
- 'access user profiles'
- 'access webform advanced queue overview'
- 'access webform overview'
- 'access webform submission log'
- 'access webform submission user'
- 'administer block_content display'
- 'administer block_content display'
Expand Down Expand Up @@ -63,6 +65,7 @@ permissions:
- 'use advanced search'
- 'use advanced search'
- 'use text format full_html'
- 'use text format restricted_html'
- 'view any unpublished content'
- 'view any webform submission'
- 'view forloebsside revisions'
Expand Down
1 change: 1 addition & 0 deletions config/sync/user.role.site_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ permissions:
- 'access user profiles'
- 'access webform advanced queue overview'
- 'access webform overview'
- 'access webform submission log'
- 'access webform submission user'
- 'administer block_content display'
- 'administer block_content form display'
Expand Down
39 changes: 39 additions & 0 deletions config/sync/views.view.os2forms_failed_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,45 @@ display:
default_group: All
default_group_multiple: { }
group_items: { }
webform_submission_serial_exists:
id: webform_submission_serial_exists
table: advancedqueue
field: webform_submission_serial_exists
relationship: none
group_type: group
admin_label: ''
plugin_id: advancedqueue_job_submission_exists
operator: '!='
value: '0'
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
operator_limit_selection: false
operator_list: { }
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
style:
type: table
row:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
diff --git a/modules/os2forms_forloeb/src/MaestroHelper.php b/modules/os2forms_forloeb/src/MaestroHelper.php
index ce0b5fb..dfa65ca 100644
--- a/modules/os2forms_forloeb/src/MaestroHelper.php
+++ b/modules/os2forms_forloeb/src/MaestroHelper.php
@@ -8,6 +8,7 @@ use Drupal\advancedqueue\Entity\QueueInterface;
use Drupal\advancedqueue\Job;
use Drupal\advancedqueue\JobResult;
use Drupal\Component\Render\MarkupInterface;
+use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\Entity\EntityStorageInterface;
@@ -466,6 +467,17 @@ class MaestroHelper implements LoggerInterface {
?? $data[$recipientElement]
?? NULL;

+ // Handle composite elements.
+ if ($recipient === NULL) {
+ // Composite subelement keys consist of
+ // the composite element key and the subelement key separated by '__',
+ // e.g. 'contact__name'.
+ if (str_contains($recipientElement, '__')) {
+ $keys = explode('__', $recipientElement);
+ $recipient = NestedArray::getValue($data, $keys);
+ }
+ }
+
if ($notificationType === self::NOTIFICATION_ESCALATION) {
$recipient = $settings[MaestroNotificationHandler::NOTIFICATION][$notificationType][MaestroNotificationHandler::NOTIFICATION_RECIPIENT] ?? NULL;
}
diff --git a/modules/os2forms_forloeb/src/Plugin/WebformHandler/MaestroNotificationHandler.php b/modules/os2forms_forloeb/src/Plugin/WebformHandler/MaestroNotificationHandler.php
index d0afc20..35c32d8 100644
--- a/modules/os2forms_forloeb/src/Plugin/WebformHandler/MaestroNotificationHandler.php
+++ b/modules/os2forms_forloeb/src/Plugin/WebformHandler/MaestroNotificationHandler.php
@@ -99,7 +99,7 @@ final class MaestroNotificationHandler extends WebformHandlerBase {
'#title' => $this->t('Notification'),
];

- $availableElements = $this->getRecipientElements();
+ $availableElements = $this->getRecipientElementOptions();
$form[self::NOTIFICATION][static::RECIPIENT_ELEMENT] = [
'#type' => 'select',
'#title' => $this->t('Element that contains the recipient identifier (email, CPR or CVR) of the notification'),
@@ -228,7 +228,7 @@ final class MaestroNotificationHandler extends WebformHandlerBase {
/**
* Get recipient elements.
*/
- private function getRecipientElements(): array {
+ private function getRecipientElementOptions(): array {
$elements = $this->getWebform()->getElementsDecodedAndFlattened();

$elementTypes = [
@@ -240,16 +240,60 @@ final class MaestroNotificationHandler extends WebformHandlerBase {
'cvr_value_element',
'os2forms_person_lookup',
];
+
+ $isAllowedElement = static fn ($e) => in_array($e['#type'], $elementTypes, TRUE);
+
+ // Expand composite elements, NOT custom composite elements.
+ foreach ($elements as $key => $element) {
+ $formElement = $this->getWebform()->getElement($key);
+
+ if ('webform_custom_composite' === $formElement['#type']) {
+ continue;
+ }
+
+ if (isset($formElement['#webform_composite_elements'])) {
+ foreach ($formElement['#webform_composite_elements'] as $compositeElement) {
+ // If composite element is not accessible ignore it.
+ if (!($compositeElement['#access'] ?? TRUE)) {
+ continue;
+ }
+
+ if ($isAllowedElement($compositeElement)) {
+ // Group composite subelements.
+ $elements[$element['#title']][$compositeElement['#webform_composite_key']] = [
+ '#title' => $compositeElement['#title'],
+ ];
+
+ $elements[$element['#title']]['#is_composite'] = TRUE;
+ }
+ }
+ }
+ }
+
$elements = array_filter(
$elements,
- static function (array $element) use ($elementTypes) {
- return in_array($element['#type'], $elementTypes, TRUE);
- }
+ static fn (array $element) => $isAllowedElement($element)
+ // Composite elements are already filtered,
+ // i.e. they do not need to be filtered here.
+ || ($element['#is_composite'] ?? FALSE)
);

- return array_map(static function (array $element) {
- return $element['#title'];
- }, $elements);
+ // Get titles of remaining elements.
+ return array_map(
+ static function (array $element) {
+ if ($element['#is_composite'] ?? FALSE) {
+
+ return array_map(
+ static fn (array $compositeElement) => $compositeElement['#title'],
+ // Consider only elements with a title,
+ // i.e. the subelements we added earlier.
+ array_filter($element, static fn ($e) => isset($e['#title'])));
+ }
+
+ return $element['#title'];
+ },
+ $elements
+ );
}

/**
3 changes: 3 additions & 0 deletions web/modules/custom/itkdev_booking/assets/create-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npm run build
cp -v build/static/js/main.*.js dist/main.js
cp -v build/static/css/main.*.css dist/main.css
6 changes: 3 additions & 3 deletions web/modules/custom/itkdev_booking/assets/dist/main.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function UserBookingDelete({ config, booking, onBookingDeleted, close }) {
* @param {object} bookingToDelete Booking to request deletion of.
*/
const requestDeletion = (bookingToDelete) => {
const bookingId = bookingToDelete.id;
const bookingId = bookingToDelete.exchangeId;

if (bookingId) {
setLoading(true);
Expand Down Expand Up @@ -67,7 +67,7 @@ function UserBookingDelete({ config, booking, onBookingDeleted, close }) {
</div>
<div>
<strong>Titel på booking: </strong>
{booking.subject}
{booking.title}
</div>
<div>
<strong>Tidspunkt: </strong>
Expand Down Expand Up @@ -100,7 +100,7 @@ UserBookingDelete.propTypes = {
booking: PropTypes.shape({
id: PropTypes.string.isRequired,
resourceDisplayName: PropTypes.string.isRequired,
subject: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
start: PropTypes.string.isRequired,
end: PropTypes.string.isRequired,
}).isRequired,
Expand Down
Loading

0 comments on commit 37a1cd8

Please sign in to comment.