Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIPRES-479: subscription attribute bug fix #984

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
![Mollie](https://www.mollie.nl/files/Mollie-Logo-Style-Small.png)

# Changelog #
## Changes in release 6.2.4 ##
+ Subscription attribute editing fix

## Changes in release 6.2.3 ##
+ Multi shop improvements with order states
+ Logging improvements
Expand Down
20 changes: 19 additions & 1 deletion mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Mollie\Repository\PaymentMethodRepositoryInterface;
use Mollie\Service\ExceptionService;
use Mollie\ServiceProvider\LeagueServiceContainerProvider;
use Mollie\Subscription\Config\Config as SubscriptionConfig;
use Mollie\Subscription\Handler\CustomerAddressUpdateHandler;
use Mollie\Subscription\Handler\UpdateSubscriptionCarrierHandler;
use Mollie\Subscription\Install\AttributeInstaller;
Expand Down Expand Up @@ -89,7 +90,7 @@
{
$this->name = 'mollie';
$this->tab = 'payments_gateways';
$this->version = '6.2.3';
$this->version = '6.2.4';
$this->author = 'Mollie B.V.';
$this->need_instance = 1;
$this->bootstrap = true;
Expand Down Expand Up @@ -1404,4 +1405,21 @@
$this->context->controller->errors[] = $this->l('You can\'t remove address associated with subscription');
}
}

public function hookActionAttributeSave($params): void
{
if (isset($params['id_attribute']) && (int) $params['id_attribute'] > 0) {
$attribute = new ProductAttribute((int) $params['id_attribute']);

Check failure on line 1412 in mollie.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

Instantiated class ProductAttribute not found.

Check failure on line 1412 in mollie.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.7.0)

Instantiated class ProductAttribute not found.

if (Validate::isLoadedObject($attribute)) {
/** @var ConfigurationAdapter $configuration */
$configuration = $this->getService(ConfigurationAdapter::class);

if ((int) $attribute->id_attribute_group === (int) $configuration->get(SubscriptionConfig::SUBSCRIPTION_ATTRIBUTE_GROUP)) {

Check failure on line 1418 in mollie.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

Access to property $id_attribute_group on an unknown class ProductAttribute.

Check failure on line 1418 in mollie.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.7.0)

Access to property $id_attribute_group on an unknown class ProductAttribute.
// Add an error message if it's the Mollie group
$this->context->controller->errors[] = $this->l('New attributes are not compatible with Mollie subscription.');
}
}
}
}
}
19 changes: 19 additions & 0 deletions upgrade/Upgrade-6.2.4.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Mollie https://www.mollie.nl
*
* @author Mollie B.V. <info@mollie.nl>
* @copyright Mollie B.V.
* @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md
*
* @see https://github.com/mollie/PrestaShop
*/

if (!defined('_PS_VERSION_')) {
exit;
}

function upgrade_module_6_2_4(Mollie $module): bool
{
return $module->registerHook('actionAttributeSave');
}
Loading