diff --git a/CHANGELOG.md b/CHANGELOG.md index 6eb93f4c1..d2e2a31bb 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +* [PR-635](https://github.com/itk-dev/deltag.aarhus.dk/pull/635) + Updated itk_pretix module and migrated contact mail * [PR-634](https://github.com/itk-dev/deltag.aarhus.dk/pull/634) Added “Hide hearing replies” option * [633](https://github.com/itk-dev/deltag.aarhus.dk/pull/633) diff --git a/composer.json b/composer.json index 324db8118..de32af58c 100755 --- a/composer.json +++ b/composer.json @@ -80,7 +80,7 @@ "itk-dev/azure-ad-delta-sync-drupal": "^2.0", "itk-dev/composer-virtualenv": "^1.0", "itk-dev/itk_azure_video": "^2.0", - "itk-dev/itk_pretix": "^1.3", + "itk-dev/itk_pretix": "^1.5", "itk-dev/itk_siteimprove": "^1.2", "itk-dev/itk_video": "^1.0", "itk-dev/serviceplatformen": "^1.5", diff --git a/composer.lock b/composer.lock index 413b0bcad..4b8868f8b 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": "253aae1327fb4c42938c4f0bd4f486a9", + "content-hash": "7104c0ac7a701982773f7df48b2cb697", "packages": [ { "name": "asm89/stack-cors", @@ -7269,16 +7269,16 @@ }, { "name": "itk-dev/itk_pretix", - "version": "1.3.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/itk-dev/itk_pretix.git", - "reference": "9e10ac6e55b01b44f0a0d1f3b6b283f11995a494" + "reference": "81acb13bd49508916091803894eed54936200bfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/itk-dev/itk_pretix/zipball/9e10ac6e55b01b44f0a0d1f3b6b283f11995a494", - "reference": "9e10ac6e55b01b44f0a0d1f3b6b283f11995a494", + "url": "https://api.github.com/repos/itk-dev/itk_pretix/zipball/81acb13bd49508916091803894eed54936200bfd", + "reference": "81acb13bd49508916091803894eed54936200bfd", "shasum": "" }, "require": { @@ -7307,9 +7307,9 @@ ], "support": { "issues": "https://github.com/itk-dev/itk_pretix/issues", - "source": "https://github.com/itk-dev/itk_pretix/tree/1.3.0" + "source": "https://github.com/itk-dev/itk_pretix/tree/1.5.0" }, - "time": "2025-07-04T12:26:59+00:00" + "time": "2026-03-09T08:54:50+00:00" }, { "name": "itk-dev/itk_siteimprove", @@ -21571,5 +21571,5 @@ "php": "^8.4.0" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/docker-compose.pretix.yml b/docker-compose.pretix.yml index 3e260570b..a76386850 100644 --- a/docker-compose.pretix.yml +++ b/docker-compose.pretix.yml @@ -44,6 +44,11 @@ services: - POSTGRES_USER=pretix - POSTGRES_PASSWORD=pretix - POSTGRES_DATABASE=pretix + healthcheck: + test: ["CMD-SHELL", "pg_isready", "--dbname", "pretix"] + interval: 10s + timeout: 3s + retries: 3 pretix_redis: image: redis:latest diff --git a/web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php b/web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php index 582572409..d65cd293e 100644 --- a/web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php +++ b/web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php @@ -61,6 +61,7 @@ public function load() { ], 'field_pretix_event_settings' => [ 'template_event' => 'template-series', + 'contact_mail' => 'info@example.com', 'synchronize_event' => TRUE, ], 'field_email' => 'parent@test.dk ', @@ -124,6 +125,7 @@ public function load() { $node->set('field_pretix_event_settings', [ // Cf. PretixConfigFixture. 'template_event' => 'template-series', + 'contact_mail' => 'info87@example.com', 'synchronize_event' => TRUE, ]); $this->addReference('public_meeting:fixture-2', $node); @@ -169,6 +171,7 @@ public function load() { $node->set('field_pretix_event_settings', [ // Cf. PretixConfigFixture. 'template_event' => 'template-series', + 'contact_mail' => 'info42@example.com', 'synchronize_event' => TRUE, ]); $this->addReference('public_meeting:fixture-3', $node); diff --git a/web/modules/custom/hoeringsportal_public_meeting/hoeringsportal_public_meeting.install b/web/modules/custom/hoeringsportal_public_meeting/hoeringsportal_public_meeting.install index f3197009e..003299c37 100644 --- a/web/modules/custom/hoeringsportal_public_meeting/hoeringsportal_public_meeting.install +++ b/web/modules/custom/hoeringsportal_public_meeting/hoeringsportal_public_meeting.install @@ -18,6 +18,9 @@ function hoeringsportal_public_meeting_update_dependencies() { 10002 => [ 'itk_pretix' => 10101, ], + 10003 => [ + 'itk_pretix' => 10102, + ], ], ]; } @@ -79,3 +82,53 @@ function hoeringsportal_public_meeting_update_10002() { } } } + +/** + * Copy contact mail to pretix event settings. + * + * Note: For performance reasons (mainly due to request to pretix), rather than + * saving nodes we update values directly in the database. + */ +function hoeringsportal_public_meeting_update_10003() { + /** @var \Drupal\hoeringsportal_public_meeting\Helper\PublicMeetingHelper $helper */ + $helper = \Drupal::service('hoeringsportal_public_meeting.public_meeting_helper'); + $publicMeetings = $helper->loadPublicMeetings(); + + $values = []; + foreach ($publicMeetings as $publicMeeting) { + if ($helper->hasPretixSignUp($publicMeeting)) { + $contactMail = $publicMeeting->field_email_address->getString() ?: NULL; + foreach ($publicMeeting->field_pretix_event_settings as $delta => $_) { + $values[] = [ + 'conditions' => [ + 'bundle' => $publicMeeting->bundle(), + 'entity_id' => $publicMeeting->id(), + 'delta' => $delta, + ], + 'fields' => [ + 'field_pretix_event_settings_contact_mail' => $contactMail, + ], + ]; + } + } + } + + if (!empty($values)) { + $tableNames = \Drupal::entityTypeManager() + ->getStorage('node') + ->getTableMapping() + ->getAllFieldTableNames('field_pretix_event_settings'); + $database = \Drupal::database(); + + foreach ($tableNames as $tableName) { + foreach ($values as $value) { + $query = $database->update($tableName) + ->fields($value['fields']); + foreach ($value['conditions'] as $field => $val) { + $query->condition($field, $val); + } + $query->execute(); + } + } + } +}