@@ -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