From 61db8b5a0f3aec887e477c899198064ef02f005f Mon Sep 17 00:00:00 2001 From: Vincent Gao Date: Wed, 17 Jul 2024 14:38:19 +1000 Subject: [PATCH] test --- composer.json | 2 +- src/TideWebformSubmissionExporter.php | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 0f7211c..d5bce84 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "extra": { "patches": { "drupal/webform": { - "Exporting webform submission as batch does not allowed for extended field due to static method - https://www.drupal.org/project/webform/issues/3348336#comment-14969352": "https://www.drupal.org/files/issues/2023-03-16/exporting-webform-submission-static-batch-process-3348336-3.patch" + "Exporting webform submission as batch does not allowed for extended field due to static method - https://www.drupal.org/project/webform/issues/3348336#comment-15686345": "https://www.drupal.org/files/issues/2024-07-24/exporting-webform-submission-static-batch-process-3348336-8.patch" } } }, diff --git a/src/TideWebformSubmissionExporter.php b/src/TideWebformSubmissionExporter.php index 7cec924..31e58aa 100644 --- a/src/TideWebformSubmissionExporter.php +++ b/src/TideWebformSubmissionExporter.php @@ -72,15 +72,14 @@ public function generate() { parent::generate(); $export_options = $this->getExportOptions(); $entity_ids = $this->getQuery()->execute(); - if ($export_options['process_submissions']) { - $webform_submissions = WebformSubmission::loadMultiple($entity_ids); - foreach ($webform_submissions as $webform_submission) { - $processed_value = $webform_submission->processed->getValue()[0]['value']; - if ($processed_value == "0") { - $webform_submission->processed->setValue("1"); - $webform_submission->save(); - } - } + if (isset($export_options['process_submissions']) && $export_options['process_submissions'] == 1 && !empty($entity_ids)) { + \Drupal::database()->update('webform_submission') + ->fields(['processed' => 1]) + ->condition('sid', $entity_ids, 'IN') + ->execute(); + \Drupal::entityTypeManager() + ->getStorage('webform_submission') + ->resetCache($entity_ids); } $this->logExport($entity_ids, $export_options);