Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-memo-ict committed Jul 10, 2024
2 parents 10bbfca + 3b8e16d commit 9852ddb
Show file tree
Hide file tree
Showing 60 changed files with 905 additions and 674 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 4.0.0
#### Shopware compatibility update
- This version is compatible with Shopware 6.6.0 and higher.

#### New features
- Added extra headers to the API calls. This enables us to provide better support by monitoring used Shopware and plugin versions.

# 3.1.2
- An incompatibility with the returns management section of the Shopware Commercial plugin was discovered, which caused the PostNL order overview to no longer work. A workaround has been implemented
- (Minor) Fixed missing images in the plugin configuration
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 4.0.0
#### Update der Shopware-Kompatibilität
- Diese Version ist kompatibel mit Shopware 6.6.0 und höher.

#### Neue Funktionen
- Es wurden zusätzliche Header zu den API-Aufrufen hinzugefügt. Dies ermöglicht uns eine bessere Unterstützung durch Überwachung der verwendeten Shopware- und Plugin-Versionen.

# 3.1.2
- Es wurde eine Inkompatibilität mit der Retourenverwaltung des Shopware Commercial Plugins entdeckt, die dazu führte, dass die PostNL Bestellübersicht nicht mehr funktionierte. Ein Workaround wurde implementiert
- (Minor) Fehlende Bilder in der Plugin-Konfiguration behoben
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG_nl-NL.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 4.0.0
#### Shopware compatibiliteit update
- Deze versie is compatibel met Shopware 6.5.2 en hoger.

#### Nieuwe functies
- Extra headers toegevoegd aan de API-aanroepen. Hierdoor kunnen we betere ondersteuning bieden door de gebruikte Shopware en plugin versies te monitoren.

# 3.1.2
- Er is een incompatibiliteit ontdekt met het retourmanagementgedeelte van de Shopware Commercial plugin, waardoor het PostNL besteloverzicht niet meer werkt. Er is een workaround geïmplementeerd
- (Minor) Ontbrekende afbeeldingen in de plugin configuratie opgelost
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# Shopware
Voor de handleiding ga naar https://postnl.github.io/shopware
# PostNL integratie voor Shopware 6

## Welke versie moet ik gebruiken?
Vanwege breaking changes in Shopware zijn we genoodzaakt om voor bepaalde Shopware versies een nieuwe major versie van de plugin uit te brengen. Zie onderstaande tabel welke versie van de plugin geschikt is voor jouw Shopware installatie.

| Shopware | Plugin |
|-------------------|------------|
| 6.6 vanaf 6.6.0.0 | Versie 4.x |
| 6.5 vanaf 6.5.2.0 | Versie 3.x |
| 6.4 vanaf 6.4.1.0 | Versie 2.x |

#### Laatste versies
![Shopware 6.6](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.6&color=ed7000)
![Shopware 6.5](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster-sw65%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.5&color=ed7000)
![Shopware 6.4](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgithub.com%2Fpostnl%2Fshopware%2Fraw%2Fmaster-sw64%2Fcomposer.json&query=version&prefix=Versie%20&style=flat-square&label=Shopware%206.4&color=ed7000)

## Installatie
De installatie handleiding is te vinden op https://postnl.github.io/shopware

Installatie via Composer of door deze repository te clonen is mogelijk, maar wordt niet officieel ondersteunt. Hiervoor zijn extra stappen nodig die niet in de handleiding worden beschreven.


8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "postnl/shopware6",
"description": "PostNL",
"type": "shopware-platform-plugin",
"version": "3.1.2",
"version": "4.0.0",
"license": "proprietary",
"authors": [
{
Expand Down Expand Up @@ -65,9 +65,9 @@
"infection/infection": "^0.26",
"nunomaduro/phpinsights": "^2.8",
"boxblinkracer/phpunuhi": "^1",
"shopware/core": ">=6.5.2 <6.6",
"shopware/administration": ">=6.5.2 <6.6",
"shopware/storefront": ">=6.5.2 <6.6"
"shopware/core": "~6.6.0",
"shopware/administration": "~6.6.0",
"shopware/storefront": "~6.6.0"
},
"scripts": {
"post-install-cmd": [
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ release: ## Create a new release
@make copy-release

zip: ## Creates a new ZIP package
@php update-composer-require.php --shopware=">=6.5.2 <6.6" --env=prod --admin --storefront
@php update-composer-require.php --shopware="~6.6.0" --env=prod --admin --storefront
@cd .. && echo "Creating Zip file $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip\n"
@cd .. && rm -rf $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip
@cd .. && zip -qq -r -0 $(PLUGIN_NAME)-$(PLUGIN_VERSION).zip $(PLUGIN_NAME)/ -x@$(PLUGIN_NAME)/zip.exclude.lst
@php update-composer-require.php --shopware=">=6.5.2 <6.6" --env=dev --admin --storefront
@php update-composer-require.php --shopware="~6.6.0" --env=dev --admin --storefront

copy-release: ## Copies it to the releases directory
@mkdir -p $(RELEASE_DIR)$(PLUGIN_NAME)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

declare(strict_types=1);

namespace PostNL\Shopware6\Migration;

use Doctrine\DBAL\Connection;
use PostNL\Shopware6\Defaults;
use Shopware\Core\Checkout\Shipping\Aggregate\ShippingMethodTranslation\ShippingMethodTranslationDefinition;
use Shopware\Core\Checkout\Shipping\ShippingMethodDefinition;
use Shopware\Core\Framework\Log\Package;
use Shopware\Core\Framework\Migration\MigrationStep;

/**
* @internal
*/
#[Package('core')]
class Migration1715095320AddTechnicalNameToShippingMethods extends MigrationStep
{
public function getCreationTimestamp(): int
{
return 1715095320;
}

public function update(Connection $connection): void
{
try {
$connection->beginTransaction();

$fetchQB = $connection->createQueryBuilder();
$updateShippingMethodQB = $connection->createQueryBuilder();
$updateTranslationQB = $connection->createQueryBuilder();

$fetchQB
->select('sm.id', 'sm.technical_name', 'smt.language_id', 'smt.custom_fields')
->from(ShippingMethodDefinition::ENTITY_NAME, 'sm')
->join(
'sm',
ShippingMethodTranslationDefinition::ENTITY_NAME,
'smt',
'sm.id = smt.shipping_method_id'
)
->where('smt.custom_fields LIKE "%postnl%"')
->andWhere('sm.technical_name IS NULL');

$updateShippingMethodQB
->update(ShippingMethodDefinition::ENTITY_NAME, 'sm')
->set('sm.technical_name', ':technical_name')
->where('sm.id = :id');

$updateTranslationQB
->update(ShippingMethodTranslationDefinition::ENTITY_NAME, 'smt')
->set('smt.custom_fields', ':custom_fields')
->where('smt.shipping_method_id = :shipping_method_id')
->andWhere('smt.language_id = :language_id');

$rows = $fetchQB->fetchAllAssociative();

foreach($rows as $row) {
$customFields = json_decode($row['custom_fields'], true);
$deliveryType = $customFields[Defaults::CUSTOM_FIELDS_KEY]['deliveryType'];
unset($customFields[Defaults::CUSTOM_FIELDS_KEY]);

$customFields = (!empty($customFields))
? json_encode($customFields)
: null;

$updateShippingMethodQB
->setParameters(
[
'id' => $row['id'],
'technical_name' => 'postnl_'.strtolower($deliveryType),
]
)
->executeStatement();

$updateTranslationQB
->setParameters(
[
'shipping_method_id' => $row['id'],
'language_id' => $row['language_id'],
'custom_fields' => $customFields,
]
)
->executeStatement();
}

$connection->commit();
}
catch (\Exception $e) {
$connection->rollBack();

throw $e;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
const { Component } = Shopware;

Component.override('sw-icon', {
methods: {
loadIconSvgData(variant, iconName, iconFullName) {
if(variant !== 'postnl') {
return this.$super('loadIconSvgData', variant, iconName, iconFullName);
}
// TODO Shopware 6.7: Create copy of mt-icon instead, as that is a basic vue component and cannot be overridden
Component.override(
Component.getComponentRegistry().has('sw-icon-deprecated') ? 'sw-icon-deprecated' : 'sw-icon',
{
methods: {
loadIconSvgData(variant, iconName, iconFullName) {
if(variant !== 'postnl') {
return this.$super('loadIconSvgData', variant, iconName, iconFullName);
}

return import(`./../../../assets/icons/${iconFullName}.svg`).then((iconSvgData) => {
this.iconSvgData = iconSvgData.default;
});
return import(`./../../../assets/icons/${iconFullName}.svg`).then((iconSvgData) => {
this.iconSvgData = iconSvgData.default;
});
},
},
},
});
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Component.register('postnl-memo-config', {
? !string.isEmptyOrSpaces(v)
: true;
}));
this.$emit('input', JSON.stringify(cleanedValue));
this.$emit('update:value', JSON.stringify(cleanedValue));
}
}
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import './product-selection';
import './postnl-required-hint';

import './postnl-config-api-credentials-link';
import './postnl-config-api-credentials-test';
import './postnl-config-customer-data';
import './postnl-config-sender-address';
import './postnl-config-return-address';
import './postnl-config-info';
import './postnl-config-description-text';

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,40 @@
</template>
</template>
<template #content="{ disabled }">
<sw-container columns="repeat(2, 1fr)" gap="0 16px">
<sw-text-field v-model="content.customerNumber"
required
:label="$tc('postnl.config.customerData.customerNumber')"
:disabled="disabled"/>
<sw-container
columns="repeat(2, 1fr)"
gap="0 16px"
>
<sw-text-field
v-model:value="content.customerNumber"
required
:label="$tc('postnl.config.customerData.customerNumber')"
:disabled="disabled"
/>

<sw-text-field v-model="content.customerCode"
required
:label="$tc('postnl.config.customerData.customerCode')"
:disabled="disabled"/>
<sw-text-field
v-model:value="content.customerCode"
required
:label="$tc('postnl.config.customerData.customerCode')"
:disabled="disabled"
/>

<sw-text-field v-model="content.globalPackBarcodeType"
required
:label="$tc('postnl.config.customerData.globalPackBarcodeType')"
:disabled="disabled"
<sw-text-field
v-model:value="content.globalPackBarcodeType"
required
:label="$tc('postnl.config.customerData.globalPackBarcodeType')"
:disabled="disabled"
/>

<sw-text-field v-model="content.globalPackCustomerCode"
required
:label="$tc('postnl.config.customerData.globalPackCustomerCode')"
:disabled="disabled"/>
<sw-text-field
v-model:value="content.globalPackCustomerCode"
required
:label="$tc('postnl.config.customerData.globalPackCustomerCode')"
:disabled="disabled"
/>
</sw-container>

<postnl-required-hint textAlign="right"/>
<postnl-required-hint textAlign="right" />
</template>
</postnl-memo-collapse>
{% endblock %}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9852ddb

Please sign in to comment.