Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
[SDPAP-9170] Fixes webform downloading issue (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao authored Aug 2, 2024
1 parent 2e55bcd commit fedc365
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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"
}
}
},
Expand Down
18 changes: 8 additions & 10 deletions src/TideWebformSubmissionExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Drupal\user\Entity\User;
use Drupal\webform\Entity\WebformSubmission;
use Drupal\webform\Plugin\WebformElementManagerInterface;
use Drupal\webform\Plugin\WebformExporterManagerInterface;
use Drupal\webform\WebformSubmissionExporter;
Expand Down Expand Up @@ -72,15 +71,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);
Expand Down

0 comments on commit fedc365

Please sign in to comment.