Skip to content

Commit eeeeaf7

Browse files
authored
Merge pull request #3 from team23/release/2.2.1
Fix type errors
2 parents 7d805c0 + 41a15e3 commit eeeeaf7

File tree

7 files changed

+25
-13
lines changed

7 files changed

+25
-13
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [2.2.1] - 2024-07-08
9+
10+
### Fixed
11+
12+
- Fix type id error (`int` versus `string`)
13+
- Fix wrong template type check
14+
815
## [2.2.0] - 2024-06-19
916

1017
### Changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "team23/module-email-attachments",
33
"description": "Attach different files to transaction mails",
44
"type": "magento2-component",
5-
"version": "2.2.0",
5+
"version": "2.2.1",
66
"license": ["BSD-3-Clause"],
77
"authors": [
88
{

src/module-email-attachments-admin-ui/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "team23/module-email-attachments-admin-ui",
33
"description": "Attach different files to transaction mails.",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"type": "magento2-module",
66
"license": ["BSD-3-Clause"],
77
"authors": [

src/module-email-attachments-api/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "team23/module-email-attachments-api",
33
"description": "Attach different files to transaction mails",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"type": "magento2-module",
66
"license": ["BSD-3-Clause"],
77
"authors": [

src/module-email-attachments/Model/Order/Email/SenderBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function sendCopyTo()
7575
private function addAttachments(): array
7676
{
7777
$templateVars = $this->templateContainer->getTemplateVars();
78-
$storeId = $templateVars['store']->getId();
78+
$storeId = (int)$templateVars['store']->getId();
7979
$type = false;
8080
$result = [];
8181

src/module-email-attachments/Model/Template/TransportBuilder.php

+13-8
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,19 @@ protected function prepareMessage()
183183
$template = $this->getTemplate();
184184
$content = $template->processTemplate();
185185

186-
$partType = match ($template->getType()) {
187-
TemplateTypesInterface::TYPE_TEXT => MimeInterface::TYPE_TEXT,
188-
TemplateTypesInterface::TYPE_HTML => MimeInterface::TYPE_HTML,
189-
default => throw new LocalizedException(
190-
new Phrase('Unknown template type')
191-
),
192-
};
193-
$mimePart = $this->mimePartInterfaceFactory->create(['content' => $content, 'type' => $partType]);
186+
switch ($template->getType()) {
187+
case TemplateTypesInterface::TYPE_TEXT:
188+
$part['type'] = MimeInterface::TYPE_TEXT;
189+
break;
190+
case TemplateTypesInterface::TYPE_HTML:
191+
$part['type'] = MimeInterface::TYPE_HTML;
192+
break;
193+
default:
194+
throw new LocalizedException(
195+
new Phrase('Unknown template type')
196+
);
197+
}
198+
$mimePart = $this->mimePartInterfaceFactory->create(['content' => $content]);
194199
$parts = [$mimePart];
195200

196201
foreach ($this->attachments as $attachment) {

src/module-email-attachments/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "team23/module-email-attachments",
33
"description": "Attach different files to transaction mails.",
4-
"version": "2.2.0",
4+
"version": "2.2.1",
55
"type": "magento2-module",
66
"license": ["BSD-3-Clause"],
77
"authors": [

0 commit comments

Comments
 (0)