Skip to content

Commit 404d074

Browse files
authored
Merge pull request OS2Forms#12 from OS2Forms/fix/SUPP0RT-1361-correctly-fetch-file-content
SUPP0RT-1361: Correctly fetch file content
2 parents 8935f66 + 8285098 commit 404d074

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

.github/workflows/pr.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ jobs:
123123
composer --no-interaction --working-dir=drupal config repositories.drupal composer https://packages.drupal.org/8
124124
125125
composer --no-interaction --working-dir=drupal config --no-plugins allow-plugins.cweagans/composer-patches true
126+
composer --no-interaction --working-dir=drupal config --no-plugins allow-plugins.zaporylie/composer-drupal-optimizations true
127+
composer --no-interaction --working-dir=drupal config --no-plugins allow-plugins.simplesamlphp/composer-module-installer true
126128
# @see https://getcomposer.org/doc/03-cli.md#modifying-extra-values
127129
composer --no-interaction --working-dir=drupal config --no-plugins --json extra.enable-patching true
128130

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ about writing changes to this log.
88

99
## [Unreleased]
1010

11+
* Disallowed `webform_entity_print_attachment:pdf` attachment element.
12+
* Called correct `getFileContent` method.
13+
1114
## [1.1.4] 29.09.2023
1215

1316
* Allowed `os2forms_attachment` attachment element.

composer.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"itk-dev/getorganized-api-client-php": "^1.2",
2222
"drupal/webform": "^6.1",
2323
"drupal/advancedqueue": "^1.0",
24-
"symfony/options-resolver": "^5.4"
24+
"symfony/options-resolver": "^5.4",
25+
"os2forms/os2forms": "^3.13"
2526
},
2627
"require-dev": {
2728
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
@@ -51,7 +52,10 @@
5152
},
5253
"config": {
5354
"allow-plugins": {
54-
"dealerdirect/phpcodesniffer-composer-installer": true
55+
"dealerdirect/phpcodesniffer-composer-installer": true,
56+
"zaporylie/composer-drupal-optimizations": true,
57+
"cweagans/composer-patches": true,
58+
"simplesamlphp/composer-module-installer": true
5559
}
5660
}
5761
}

os2forms_get_organized.info.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dependencies:
77
- drupal:webform
88
- drupal:advancedqueue
99
- drupal:webform_entity_print_attachment
10+
- os2forms:os2forms_attachment
1011
configure: os2forms_get_organized.admin.settings

src/Helper/ArchiveHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
use Drupal\Core\Entity\EntityInterface;
66
use Drupal\Core\Entity\EntityTypeManagerInterface;
77
use Drupal\Core\File\Event\FileUploadSanitizeNameEvent;
8+
use Drupal\os2forms_attachment\Element\AttachmentElement;
89
use Drupal\os2forms_get_organized\Exception\ArchivingMethodException;
910
use Drupal\os2forms_get_organized\Exception\CitizenArchivingException;
1011
use Drupal\os2forms_get_organized\Exception\GetOrganizedCaseIdException;
1112
use Drupal\webform\Entity\WebformSubmission;
1213
use Drupal\webform_attachment\Element\WebformAttachmentBase;
13-
use Drupal\webform_entity_print_attachment\Element\WebformEntityPrintAttachment;
1414
use ItkDev\GetOrganized\Client;
1515
use ItkDev\GetOrganized\Service\Cases;
1616
use ItkDev\GetOrganized\Service\Documents;
@@ -334,7 +334,7 @@ private function createSubCase(string $caseId, string $caseName): string {
334334
private function uploadDocumentToCase(string $caseId, string $webformAttachmentElementId, WebformSubmission $submission, bool $shouldArchiveFiles, bool $shouldBeFinalized): void {
335335
// Handle main document (the attachment).
336336
$webformAttachmentElement = $submission->getWebform()->getElement($webformAttachmentElementId);
337-
$fileContent = WebformEntityPrintAttachment::getFileContent($webformAttachmentElement, $submission);
337+
$fileContent = AttachmentElement::getFileContent($webformAttachmentElement, $submission);
338338
$webformLabel = $submission->getWebform()->label();
339339
$webformLabel = str_replace('/', '-', $webformLabel);
340340
$pdfExtension = '.pdf';

src/Plugin/WebformHandler/GetOrganizedWebformHandler.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
107107
$form['general']['attachment_element'] = [
108108
'#type' => 'select',
109109
'#title' => $this->t('Attachment element'),
110-
'#options' => $this->getAvailableElementsByType([
111-
'webform_entity_print_attachment:pdf',
112-
'os2forms_attachment',
113-
], $elements),
110+
'#options' => $this->getAvailableElementsByType(['os2forms_attachment'], $elements),
114111
'#default_value' => $this->configuration['general']['attachment_element'] ?? '',
115112
'#description' => $this->t('Choose the element responsible for creating response attachments.'),
116113
'#required' => TRUE,

0 commit comments

Comments
 (0)