Skip to content

Commit 0d8b87b

Browse files
Merge branch 'feature/POSTNL-58' into release/4.1.0
2 parents 201bea0 + b5b149c commit 0d8b87b

File tree

6 files changed

+267
-1
lines changed

6 files changed

+267
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PostNL\Shopware6\MailTemplate\ReturnMailBe;
6+
7+
use PostNL\Shopware6\MailTemplate\MailTemplateInterface;
8+
9+
class deDE implements MailTemplateInterface
10+
{
11+
public static function getLocale(): string
12+
{
13+
return 'de-DE';
14+
}
15+
16+
public static function getDescription(): string
17+
{
18+
return 'PostNL-Rücksendevorlage';
19+
}
20+
21+
public static function getSubject(): string
22+
{
23+
return 'Ihre Rücksendung von {{ salesChannel.name }}';
24+
}
25+
26+
public static function getContentPlain(): string
27+
{
28+
return <<<MAIL
29+
Hallo {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
30+
31+
Ihr Rücksendeantrag wurde bearbeitet. In dieser E-Mail finden Sie den Versandaufkleber für die Rücksendung Ihrer Bestellung.
32+
Bringen Sie den Aufkleber am Paket an und bringen Sie Ihre Sendung zu einer PostNL-Stelle.
33+
34+
Einen schönen Tag,
35+
36+
{{ salesChannel.name }}
37+
MAIL;
38+
}
39+
40+
public static function getContentHtml(): string
41+
{
42+
43+
return <<<MAIL
44+
<div style="font-family:arial; font-size:12px;">
45+
<p>
46+
Hallo {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
47+
</p>
48+
<p>
49+
Ihr Rücksendeantrag wurde bearbeitet. In dieser E-Mail finden Sie den Versandaufkleber für die Rücksendung Ihrer Bestellung.
50+
Bringen Sie den Aufkleber am Paket an und bringen Sie Ihre Sendung zu einer PostNL-Stelle.
51+
</p>
52+
<p>
53+
Einen schönen Tag,
54+
</p>
55+
<p>
56+
{{ salesChannel.name }}
57+
</p>
58+
</div>
59+
MAIL;
60+
}
61+
62+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PostNL\Shopware6\MailTemplate\ReturnMailBe;
6+
7+
use PostNL\Shopware6\MailTemplate\MailTemplateInterface;
8+
9+
class enGB implements MailTemplateInterface
10+
{
11+
public static function getLocale(): string
12+
{
13+
return 'en-GB';
14+
}
15+
16+
public static function getDescription(): string
17+
{
18+
return 'PostNL return mail template';
19+
}
20+
21+
public static function getSubject(): string
22+
{
23+
return 'Your return shipment from {{ salesChannel.name }}';
24+
}
25+
26+
public static function getContentPlain(): string
27+
{
28+
return <<<MAIL
29+
Hi {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
30+
31+
Your return request has been processed. In this email you will find the shipping label to return your order.
32+
Attach the label to the parcel and bring your shipment to a PostNL point.
33+
34+
Have a good day,
35+
36+
{{ salesChannel.name }}
37+
MAIL;
38+
}
39+
40+
public static function getContentHtml(): string
41+
{
42+
43+
return <<<MAIL
44+
<div style="font-family:arial; font-size:12px;">
45+
<p>
46+
Hi {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
47+
</p>
48+
<p>
49+
Your return request has been processed. In this email you will find the shipping label to return your order.
50+
Attach the label to the parcel and bring your shipment to a PostNL point.
51+
</p>
52+
<p>
53+
Have a good day,
54+
</p>
55+
<p>
56+
{{ salesChannel.name }}
57+
</p>
58+
</div>
59+
MAIL;
60+
}
61+
62+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PostNL\Shopware6\MailTemplate\ReturnMailBe;
6+
7+
use PostNL\Shopware6\MailTemplate\MailTemplateInterface;
8+
9+
class nlNL implements MailTemplateInterface
10+
{
11+
public static function getLocale(): string
12+
{
13+
return 'nl-NL';
14+
}
15+
16+
public static function getDescription(): string
17+
{
18+
return 'PostNL retour mail template';
19+
}
20+
21+
public static function getSubject(): string
22+
{
23+
return 'Uw retourzending van {{ salesChannel.name }}';
24+
}
25+
26+
public static function getContentPlain(): string
27+
{
28+
return <<<MAIL
29+
Hi {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
30+
31+
Jouw retouraanvraag is verwerkt. In deze e-mail vind je het verzendlabel om het pakket te retourneren.
32+
Plak het label op het pakket en breng het naar een PostNL punt in de buurt.
33+
34+
Een fijne dag,
35+
36+
{{ salesChannel.name }}
37+
MAIL;
38+
}
39+
40+
public static function getContentHtml(): string
41+
{
42+
43+
return <<<MAIL
44+
<div style="font-family:arial; font-size:12px;">
45+
<p>
46+
Hi {{ order.orderCustomer.firstName }} {{ order.orderCustomer.lastName }},
47+
</p>
48+
<p>
49+
Jouw retouraanvraag is verwerkt. In deze e-mail vind je het verzendlabel om het pakket te retourneren.
50+
Plak het label op het pakket en breng het naar een PostNL punt in de buurt.
51+
</p>
52+
<p>
53+
Een fijne dag,
54+
</p>
55+
<p>
56+
{{ salesChannel.name }}
57+
</p>
58+
</div>
59+
MAIL;
60+
}
61+
62+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace PostNL\Shopware6\Migration;
4+
5+
use Doctrine\DBAL\Connection;
6+
use PostNL\Shopware6\Component\Migration\MailMigration;
7+
use Shopware\Core\Framework\Log\Package;
8+
use PostNL\Shopware6\MailTemplate\ReturnMailBe;
9+
10+
/**
11+
* @internal
12+
*/
13+
#[Package('core')]
14+
class Migration1738685102AddReturnMailTemplateForBelgium extends MailMigration
15+
{
16+
public function getCreationTimestamp(): int
17+
{
18+
return 1738685102;
19+
}
20+
21+
public function update(Connection $connection): void
22+
{
23+
$emails = [
24+
'return-mail' => [
25+
new ReturnMailBe\enGB(),
26+
new ReturnMailBe\deDE(),
27+
new ReturnMailBE\nlNL(),
28+
]
29+
];
30+
31+
$mailTemplateId = $this->createMailTemplateType(
32+
$connection,
33+
'postnl_return_mail_be',
34+
[
35+
'en-GB' => 'PostNL Return Mail (BE)',
36+
'de-DE' => 'PostNL Rücksendung (BE)',
37+
'nl-NL' => 'PostNL Retour Mail (BE)',
38+
],
39+
[
40+
'order' => 'order',
41+
'salesChannel' => 'sales_channel'
42+
]
43+
);
44+
45+
foreach ($emails as $mailTemplates) {
46+
$this->createMailTemplate($connection, $mailTemplateId, $mailTemplates);
47+
}
48+
}
49+
}

src/Resources/app/administration/src/module/postnl/component/shipment-modal/postnl-create-return-modal/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ const { Criteria } = Shopware.Data
66
Shopware.Component.extend('postnl-create-return-modal', 'postnl-shipment-modal-base', {
77
template,
88

9+
inject: [
10+
'systemConfigApiService'
11+
],
12+
913
mixins: [
1014
'placeholder'
1115
],
1216

1317
data() {
1418
return {
19+
returnAddress: null,
1520
returnType: null,
1621
variant: 'large',
1722
smartReturnMailTemplate: null,
@@ -49,6 +54,14 @@ Shopware.Component.extend('postnl-create-return-modal', 'postnl-shipment-modal-b
4954
return criteria
5055
},
5156

57+
smartReturnBeMailTemplateCriteria() {
58+
const criteria = new Criteria()
59+
criteria.addAssociation('mailTemplateType')
60+
criteria.addFilter(Criteria.equals('mailTemplateType.technicalName', 'postnl_return_mail_be'))
61+
62+
return criteria
63+
},
64+
5265
shipmentAndReturnMailTemplateCriteria() {
5366
const criteria = new Criteria()
5467
criteria.addAssociation('mailTemplateType')
@@ -114,6 +127,15 @@ Shopware.Component.extend('postnl-create-return-modal', 'postnl-shipment-modal-b
114127

115128
methods: {
116129
createdComponent() {
130+
this.getReturnAddress()
131+
},
132+
133+
getReturnAddress() {
134+
this.systemConfigApiService
135+
.getValues('PostNLShopware')
136+
.then(config => config['PostNLShopware.config.returnAddress'])
137+
.then(string => JSON.parse(string))
138+
.then(address => this.returnAddress = address)
117139
},
118140

119141
mailTemplateLabel(item) {

src/Resources/app/administration/src/module/postnl/component/shipment-modal/postnl-create-return-modal/postnl-create-return-modal.html.twig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,23 @@
2828
</sw-alert>
2929

3030
<sw-entity-single-select
31-
v-if="returnType === 'smartReturn'"
31+
v-if="returnType === 'smartReturn' && returnAddress.countrycode === 'NL'"
3232
v-model:value="smartReturnMailTemplate"
3333
:label="$tc('postnl.order.modal.createReturn.selectMailTemplate')"
3434
:labelCallback="mailTemplateLabel"
3535
:criteria="smartReturnMailTemplateCriteria"
3636
entity="mail_template"
3737
/>
3838

39+
<sw-entity-single-select
40+
v-if="returnType === 'smartReturn' && returnAddress.countrycode === 'BE'"
41+
v-model:value="smartReturnMailTemplate"
42+
:label="$tc('postnl.order.modal.createReturn.selectMailTemplate')"
43+
:labelCallback="mailTemplateLabel"
44+
:criteria="smartReturnBeMailTemplateCriteria"
45+
entity="mail_template"
46+
/>
47+
3948
<sw-entity-single-select
4049
v-if="returnType === 'shipmentAndReturn'"
4150
v-model:value="shipmentAndReturnMailTemplate"

0 commit comments

Comments
 (0)