Skip to content

Commit 125d4a1

Browse files
committed
Updated itk_pretix module and migrated contact mail
1 parent e0bd72b commit 125d4a1

6 files changed

Lines changed: 72 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
88

9+
* [PR-635](https://github.com/itk-dev/deltag.aarhus.dk/pull/635)
10+
Updated itk_pretix module and migrated contact mail
911
* [PR-634](https://github.com/itk-dev/deltag.aarhus.dk/pull/634)
1012
Added “Hide hearing replies” option
1113
* [633](https://github.com/itk-dev/deltag.aarhus.dk/pull/633)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"itk-dev/azure-ad-delta-sync-drupal": "^2.0",
8181
"itk-dev/composer-virtualenv": "^1.0",
8282
"itk-dev/itk_azure_video": "^2.0",
83-
"itk-dev/itk_pretix": "^1.3",
83+
"itk-dev/itk_pretix": "^1.5",
8484
"itk-dev/itk_siteimprove": "^1.2",
8585
"itk-dev/itk_video": "^1.0",
8686
"itk-dev/serviceplatformen": "^1.5",

composer.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.pretix.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ services:
4444
- POSTGRES_USER=pretix
4545
- POSTGRES_PASSWORD=pretix
4646
- POSTGRES_DATABASE=pretix
47+
healthcheck:
48+
test: ["CMD-SHELL", "pg_isready", "--dbname", "pretix"]
49+
interval: 10s
50+
timeout: 3s
51+
retries: 3
4752

4853
pretix_redis:
4954
image: redis:latest

web/modules/custom/hoeringsportal_base_fixtures/src/Fixture/PublicMeetingFixture.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function load() {
6161
],
6262
'field_pretix_event_settings' => [
6363
'template_event' => 'template-series',
64+
'contact_mail' => 'info@example.com',
6465
'synchronize_event' => TRUE,
6566
],
6667
'field_email' => 'parent@test.dk ',
@@ -124,6 +125,7 @@ public function load() {
124125
$node->set('field_pretix_event_settings', [
125126
// Cf. PretixConfigFixture.
126127
'template_event' => 'template-series',
128+
'contact_mail' => 'info87@example.com',
127129
'synchronize_event' => TRUE,
128130
]);
129131
$this->addReference('public_meeting:fixture-2', $node);
@@ -169,6 +171,7 @@ public function load() {
169171
$node->set('field_pretix_event_settings', [
170172
// Cf. PretixConfigFixture.
171173
'template_event' => 'template-series',
174+
'contact_mail' => 'info42@example.com',
172175
'synchronize_event' => TRUE,
173176
]);
174177
$this->addReference('public_meeting:fixture-3', $node);

web/modules/custom/hoeringsportal_public_meeting/hoeringsportal_public_meeting.install

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ function hoeringsportal_public_meeting_update_dependencies() {
1818
10002 => [
1919
'itk_pretix' => 10101,
2020
],
21+
10003 => [
22+
'itk_pretix' => 10102,
23+
],
2124
],
2225
];
2326
}
@@ -79,3 +82,53 @@ function hoeringsportal_public_meeting_update_10002() {
7982
}
8083
}
8184
}
85+
86+
/**
87+
* Copy contact mail to pretix event settings.
88+
*
89+
* Note: For performance reasons (mainly due to request to pretix), rather than
90+
* saving nodes we update values directly in the database.
91+
*/
92+
function hoeringsportal_public_meeting_update_10003() {
93+
/** @var \Drupal\hoeringsportal_public_meeting\Helper\PublicMeetingHelper $helper */
94+
$helper = \Drupal::service('hoeringsportal_public_meeting.public_meeting_helper');
95+
$publicMeetings = $helper->loadPublicMeetings();
96+
97+
$values = [];
98+
foreach ($publicMeetings as $publicMeeting) {
99+
if ($helper->hasPretixSignUp($publicMeeting)) {
100+
$contactMail = $publicMeeting->field_email_address->getString() ?: NULL;
101+
foreach ($publicMeeting->field_pretix_event_settings as $delta => $_) {
102+
$values[] = [
103+
'conditions' => [
104+
'bundle' => $publicMeeting->bundle(),
105+
'entity_id' => $publicMeeting->id(),
106+
'delta' => $delta,
107+
],
108+
'fields' => [
109+
'field_pretix_event_settings_contact_mail' => $contactMail,
110+
],
111+
];
112+
}
113+
}
114+
}
115+
116+
if (!empty($values)) {
117+
$tableNames = \Drupal::entityTypeManager()
118+
->getStorage('node')
119+
->getTableMapping()
120+
->getAllFieldTableNames('field_pretix_event_settings');
121+
$database = \Drupal::database();
122+
123+
foreach ($tableNames as $tableName) {
124+
foreach ($values as $value) {
125+
$query = $database->update($tableName)
126+
->fields($value['fields']);
127+
foreach ($value['conditions'] as $field => $val) {
128+
$query->condition($field, $val);
129+
}
130+
$query->execute();
131+
}
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)