Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

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

5 changes: 5 additions & 0 deletions docker-compose.pretix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ',
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ function hoeringsportal_public_meeting_update_dependencies() {
10002 => [
'itk_pretix' => 10101,
],
10003 => [
'itk_pretix' => 10102,
],
],
];
}
Expand Down Expand Up @@ -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();
}
}
}
}
Loading