Skip to content

Commit 93588cf

Browse files
authored
Merge pull request PrestaShop#120 from PrestaShop/dev
Release 2.8.3
2 parents ce4e159 + cacf793 commit 93588cf

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

.github/workflows/php.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v2.0.0
10+
uses: actions/checkout@v4
1111

1212
- name: PHP syntax checker 5.6
1313
uses: prestashop/github-action-php-lint/5.6@master
@@ -38,10 +38,10 @@ jobs:
3838
php-version: '7.4'
3939

4040
- name: Checkout
41-
uses: actions/checkout@v2.0.0
41+
uses: actions/checkout@v4
4242

4343
- name: Cache dependencies
44-
uses: actions/cache@v2
44+
uses: actions/cache@v4
4545
with:
4646
path: vendor
4747
key: php-${{ hashFiles('composer.lock') }}
@@ -66,18 +66,18 @@ jobs:
6666
php-version: '7.4'
6767

6868
- name: Checkout
69-
uses: actions/checkout@v2.0.0
69+
uses: actions/checkout@v4
7070

7171
# Add vendor folder in cache to make next builds faster
7272
- name: Cache vendor folder
73-
uses: actions/cache@v1
73+
uses: actions/cache@v4
7474
with:
7575
path: vendor
7676
key: php-${{ hashFiles('composer.lock') }}
7777

7878
# Add composer local folder in cache to make next builds faster
7979
- name: Cache composer folder
80-
uses: actions/cache@v1
80+
uses: actions/cache@v4
8181
with:
8282
path: ~/.composer/cache
8383
key: php-composer-cache

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>ps_emailsubscription</name>
44
<displayName><![CDATA[E-mail subscription form]]></displayName>
5-
<version><![CDATA[2.8.2]]></version>
5+
<version><![CDATA[2.8.3]]></version>
66
<description><![CDATA[Adds a block for newsletter subscription.]]></description>
77
<author><![CDATA[PrestaShop]]></author>
88
<confirmUninstall><![CDATA[Are you sure that you want to delete all of your contacts?]]></confirmUninstall>

ps_emailsubscription.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function __construct()
100100
$this->confirmUninstall = $this->trans('Are you sure that you want to delete all of your contacts?', [], 'Modules.Emailsubscription.Admin');
101101
$this->ps_versions_compliancy = ['min' => '1.7.1.0', 'max' => _PS_VERSION_];
102102

103-
$this->version = '2.8.2';
103+
$this->version = '2.8.3';
104104
$this->author = 'PrestaShop';
105105
$this->error = false;
106106
$this->valid = false;
@@ -239,7 +239,7 @@ public function getContent()
239239
$c->update();
240240
}
241241

242-
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&conf=4&token=' . Tools::getAdminTokenLite('AdminModules'));
242+
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true, [], ['configure' => $this->name, 'conf' => 4]));
243243
} elseif (Tools::isSubmit('submitExport') && $action = Tools::getValue('action')) {
244244
$this->export_csv();
245245
} elseif (Tools::isSubmit('searchEmail')) {
@@ -312,7 +312,7 @@ public function renderList()
312312
$helper_list->simple_header = false;
313313
$helper_list->identifier = 'id';
314314
$helper_list->table = 'merged';
315-
$helper_list->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name;
315+
$helper_list->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name]);
316316
$helper_list->token = Tools::getAdminTokenLite('AdminModules');
317317
$helper_list->actions = ['viewCustomer'];
318318

@@ -334,7 +334,7 @@ public function renderList()
334334
public function displayViewCustomerLink($token = null, $id = null, $name = null)
335335
{
336336
$this->smarty->assign([
337-
'href' => 'index.php?controller=AdminCustomers&id_customer=' . (int) $id . '&updatecustomer&token=' . Tools::getAdminTokenLite('AdminCustomers'),
337+
'href' => $this->context->link->getAdminLink('AdminCustomers', true, ['route' => 'admin_customers_edit', 'customerId' => (int) $id], ['id_customer' => (int) $id, 'updatecustomer' => 1]),
338338
'action' => $this->trans('View', [], 'Admin.Actions'),
339339
'disable' => !((int) $id > 0),
340340
]);
@@ -958,8 +958,9 @@ public function hookActionCustomerAccountAdd($params)
958958
if ($params['newCustomer']->newsletter && $code = Configuration::get('NW_VOUCHER_CODE')) {
959959
$this->sendVoucher($email, $code);
960960
}
961-
962-
return (bool) Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop=' . (int) $id_shop . ' AND email=\'' . pSQL($email) . "'");
961+
if ($params['newCustomer']->newsletter) {
962+
return (bool) Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop=' . (int) $id_shop . ' AND email=\'' . pSQL($email) . "'");
963+
}
963964
}
964965

965966
if ($newsletter) {
@@ -978,6 +979,8 @@ public function hookActionObjectCustomerUpdateBefore($params)
978979
{
979980
$customer = new Customer($params['object']->id);
980981
$this->_origin_newsletter = (int) $customer->newsletter;
982+
983+
Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop=' . (int) $params['object']->id_shop . ' AND email=\'' . pSQL($params['object']->email) . "'");
981984
}
982985

983986
public function hookActionCustomerAccountUpdate($params)
@@ -1106,7 +1109,7 @@ public function renderForm()
11061109
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
11071110
$helper->identifier = $this->identifier;
11081111
$helper->submit_action = 'submitUpdate';
1109-
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
1112+
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
11101113
$helper->token = Tools::getAdminTokenLite('AdminModules');
11111114
$helper->tpl_vars = [
11121115
'fields_value' => $this->getConfigFieldsValues(),
@@ -1207,7 +1210,7 @@ public function renderExportForm()
12071210
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
12081211
$helper->identifier = $this->identifier;
12091212
$helper->submit_action = 'btnSubmit';
1210-
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
1213+
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
12111214
$helper->token = Tools::getAdminTokenLite('AdminModules');
12121215
$helper->tpl_vars = [
12131216
'fields_value' => $this->getConfigFieldsValues(),
@@ -1246,7 +1249,7 @@ public function renderSearchForm()
12461249
$helper->table = $this->table;
12471250
$helper->identifier = $this->identifier;
12481251
$helper->submit_action = 'searchEmail';
1249-
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
1252+
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false, [], ['configure' => $this->name, 'tab_module' => $this->tab, 'module_name' => $this->name]);
12501253
$helper->token = Tools::getAdminTokenLite('AdminModules');
12511254
$helper->tpl_vars = [
12521255
'fields_value' => ['searched_email' => $this->_searched_email],

0 commit comments

Comments
 (0)