From d6ab0696e6c2f43244d7353224409486d2a8380c Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 8 Aug 2013 10:16:41 +0200 Subject: [PATCH 1/8] [-] BO : OrderSlip now correctly displays the order slip date, thanks @Jacky75 --- classes/pdf/HTMLTemplateOrderSlip.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php index 95d9b9f1f..e84725f57 100644 --- a/classes/pdf/HTMLTemplateOrderSlip.php +++ b/classes/pdf/HTMLTemplateOrderSlip.php @@ -45,7 +45,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice $this->smarty = $smarty; // header informations - $this->date = Tools::displayDate($this->order->invoice_date, (int)$this->order->id_lang); + $this->date = Tools::displayDate($this->order_slip->date_add, (int)$this->order->id_lang); $this->title = HTMLTemplateOrderSlip::l('Slip #').Configuration::get('PS_CREDIT_SLIP_PREFIX', Context::getContext()->language->id).sprintf('%06d', (int)$this->order_slip->id); // footer informations From 0f4562eb44f25c1eec17b81834ed4595297d3c82 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 8 Aug 2013 10:24:05 +0200 Subject: [PATCH 2/8] [*] MO : added manufactureres order by name, thanks@Jacky75 --- modules/blocklayered/blocklayered.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index b2a18e831..db7890cba 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -2651,7 +2651,7 @@ class BlockLayered extends Module AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND c.active = 1 AND '.$alias.'.active = 1'; - $sql_query['group'] = ' GROUP BY p.id_manufacturer '; + $sql_query['group'] = ' GROUP BY p.id_manufacturer ORDER BY m.name'; if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES')) { @@ -2668,7 +2668,7 @@ class BlockLayered extends Module AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND c.active = 1 AND '.$alias.'.active = 1 - GROUP BY p.id_manufacturer'; + GROUP BY p.id_manufacturer ORDER BY m.name'; } break; From 1bfa43fa8b2471a54690cb8763922cc1425b3fae Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 8 Aug 2013 10:38:39 +0200 Subject: [PATCH 3/8] [-] MO : My account column block should not display module icon in list --- modules/blockmyaccountfooter/blockmyaccount.css | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/blockmyaccountfooter/blockmyaccount.css b/modules/blockmyaccountfooter/blockmyaccount.css index 0d416fbcf..38720d562 100644 --- a/modules/blockmyaccountfooter/blockmyaccount.css +++ b/modules/blockmyaccountfooter/blockmyaccount.css @@ -1,6 +1,7 @@ /* block myaccount */ -.myaccount ul {margin-bottom:10px} -.myaccount li {border-bottom: 1px solid #eee} +.myaccount ul {margin-bottom:10px;} +.myaccount .bullet .icon {display: none;} +.myaccount li {border-bottom: 1px solid #eee;} .myaccount li a { display: block; padding: 7px 11px 5px 22px; @@ -10,16 +11,14 @@ .myaccount p.logout { padding-bottom:0; font-weight:bold; - text-align:right + text-align:right; } - - /* block myaccount in footer */ #footer .myaccount .title_block, #footer .myaccount h4 {background: none;} #footer .myaccount .logout {display:none;} #footer .myaccount .title_block, #footer .myaccount h4 { padding:0 0 10px 0; - background:none + background:none; } #footer .myaccount ul {margin-bottom:0} #footer .myaccount li {border-bottom:none} @@ -27,7 +26,6 @@ display: block; padding:0; color: #fff; - background: none -} -#footer .myaccount li.lnk_wishlist img {display:none + background: none; } +#footer .myaccount li.lnk_wishlist img {display:none;} \ No newline at end of file From c31c2ca0e971c0878135e3a67eff28953839862b Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 8 Aug 2013 10:46:22 +0200 Subject: [PATCH 4/8] [-] MO: cover image issue with layered block on multishop, thanks @theginie --- modules/blocklayered/blocklayered.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index db7890cba..86d732a64 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -2518,7 +2518,7 @@ class BlockLayered extends Module '.($alias_where == 'p' ? '' : 'product_shop.*,' ).' '.$alias_where.'.id_category_default, pl.*, - i.id_image, + image_shop.`id_image`, il.legend, m.name manufacturer_name, DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB(NOW(), INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new @@ -2527,10 +2527,11 @@ class BlockLayered extends Module LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product` '.$join.' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.') - LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) - LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)($cookie->id_lang).') + LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' + LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) - WHERE '.$alias_where.'.`active` = 1 AND + WHERE (i.id_image IS NULL OR image_shop.id_shop='.(int)Context::getContext()->shop->id.') + AND '.$alias_where.'.`active` = 1 AND '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).' AND c.active = 1 From a9b44884f107d1e7f6ba5e1c12991e65fce1b9b5 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 8 Aug 2013 10:46:43 +0200 Subject: [PATCH 5/8] // Fixed upgrade of homeslider module --- modules/homeslider/upgrade/install-1.2.1.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/homeslider/upgrade/install-1.2.1.php b/modules/homeslider/upgrade/install-1.2.1.php index 7817ecaf7..2d3d12abd 100644 --- a/modules/homeslider/upgrade/install-1.2.1.php +++ b/modules/homeslider/upgrade/install-1.2.1.php @@ -16,9 +16,9 @@ function upgrade_module_1_2_1($object) function homeslider_stripslashes_field($field) { - $quotes = array('\'\\\\\'\'', '\'\\\'\''); - $dquotes = array('\'\\"\'', '\'"\''); - $backslashes = array('\'\\\\\'', '\'\\\''); + $quotes = array('"\\\'"', '"\'"'); + $dquotes = array('\'\\\\"\'', '\'"\''); + $backslashes = array('"\\\\\\\\"', '"\\\\"'); return '`'.bqSQL($field).'` = replace(replace(replace(`'.bqSQL($field).'`, '.$quotes[0].', '.$quotes[1].'), '.$dquotes[0].', '.$dquotes[1].'), '.$backslashes[0].', '.$backslashes[1].')'; } \ No newline at end of file From 4709f4a3c0ea3703b6b280c17cc9e1599b6c47d2 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 8 Aug 2013 11:03:22 +0200 Subject: [PATCH 6/8] [-] MO : fixed module upgrade with common version number --- classes/module/Module.php | 33 +++++++++++--------- controllers/admin/AdminModulesController.php | 16 ++++------ modules/blocklayered/config.xml | 4 +-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/classes/module/Module.php b/classes/module/Module.php index b323204b6..8fcbddd8c 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -292,15 +292,17 @@ abstract class ModuleCore else { if (!$upgrade_detail['number_upgraded']) - $this->_errors[] = $this->l('None upgrades have been applied'); + $this->_errors[] = $this->l('No upgrade has been applied'); else { - $this->_errors[] = $this->l('Upgraded from: ').$upgrade_detail['upgraded_from'].$this->l(' to '). - $upgrade_detail['upgraded_to']; + $this->_errors[] = sprintf($this->l('Upgraded from: %S to %s'), $upgrade_detail['upgraded_from'], $upgrade_detail['upgraded_to']); $this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left'); } - $this->_errors[] = $this->l('To prevent any problem, this module has been turned off'); + if ($upgrade_detail['duplicate']) + $this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name); + else + $this->_errors[] = $this->l('To prevent any problem, this module has been turned off'); } } } @@ -348,19 +350,21 @@ abstract class ModuleCore $upgrade = &self::$modules_cache[$this->name]['upgrade']; foreach ($upgrade['upgrade_file_left'] as $num => $file_detail) { - // Default variable required in the included upgrade file need to be set by default there: - // upgrade_version, success_upgrade - $upgrade_result = false; + if (function_exists($file_detail['upgrade_function'])) + { + $upgrade['success'] = false; + $upgrade['duplicate'] = true; + break; + } include($file_detail['file']); // Call the upgrade function if defined + $upgrade['success'] = false; if (function_exists($file_detail['upgrade_function'])) - $upgrade_result = $file_detail['upgrade_function']($this); - - $upgrade['success'] = $upgrade_result; + $upgrade['success'] = $file_detail['upgrade_function']($this); // Set detail when an upgrade succeed or failed - if ($upgrade_result) + if ($upgrade['success']) { $upgrade['number_upgraded'] += 1; $upgrade['upgraded_to'] = $file_detail['version']; @@ -378,6 +382,7 @@ abstract class ModuleCore } $upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']); + // Update module version in DB with the last succeed upgrade if ($upgrade['upgraded_to']) Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']); @@ -396,9 +401,9 @@ abstract class ModuleCore public static function upgradeModuleVersion($name, $version) { return Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'module` m - SET m.version = \''.bqSQL($version).'\' - WHERE m.name = \''.bqSQL($name).'\''); + UPDATE `'._DB_PREFIX_.'module` m + SET m.version = \''.bqSQL($version).'\' + WHERE m.name = \''.bqSQL($name).'\''); } /** diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index f76c9133b..dc2b3cdd9 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -630,9 +630,8 @@ class AdminModulesControllerCore extends AdminController if (!$download_ok) $this->errors[] = $this->l('Error on downloading the lastest version'); - else - if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false)) - $this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name)); + elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false)) + $this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name)); } } } @@ -674,18 +673,18 @@ class AdminModulesControllerCore extends AdminController // Get the return value of current method $echo = $module->{$method}(); - + // After a successful install of a single module that has a configuration method, to the configuration page if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent')) Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&configure='.$module->name.'&conf=12'); } - + // If the method called is "configure" (getContent method), we show the html code of configure page if ($key == 'configure' && Module::isInstalled($module->name)) { if (isset($module->multishop_context)) $this->multishop_context = $module->multishop_context; - + $backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name; $hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id; $tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang='; @@ -768,10 +767,8 @@ class AdminModulesControllerCore extends AdminController Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); } - if(isset($_GET['update'])) - { + if (isset($_GET['update'])) Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); - } } public function postProcess() @@ -779,7 +776,6 @@ class AdminModulesControllerCore extends AdminController // Parent Post Process parent::postProcess(); - // Get the list of installed module ans prepare it for ajax call. if (($list = Tools::getValue('installed_modules'))) Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list))); diff --git a/modules/blocklayered/config.xml b/modules/blocklayered/config.xml index da98eb84b..e6b78b59b 100644 --- a/modules/blocklayered/config.xml +++ b/modules/blocklayered/config.xml @@ -1,9 +1,9 @@ blocklayered - + - + 1 From 1c80b5fdfe8bf6c2f0b75689b15445cf44a4d1b0 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 8 Aug 2013 11:05:09 +0200 Subject: [PATCH 7/8] [-] BO : list of carriers should only contain the active one in AdminProducts --- controllers/admin/AdminProductsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 541b89f26..0ea255a48 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -3579,7 +3579,7 @@ class AdminProductsControllerCore extends AdminController protected function getCarrierList() { - $carrier_list = Carrier::getCarriers($this->context->language->id, false, false, false, null, Carrier::ALL_CARRIERS); + $carrier_list = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::ALL_CARRIERS); if ($product = $this->loadObject(true)) { $carrier_selected_list = $product->getCarriers(); From 169c3fbc6b38986c58451312980c109d8fd05c16 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 8 Aug 2013 11:24:03 +0200 Subject: [PATCH 8/8] // Removed useless line --- classes/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Product.php b/classes/Product.php index d2d49913e..404dfc4ab 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -4493,7 +4493,7 @@ class ProductCore extends ObjectModel return true; } - /* + /** * Webservice getter : get virtual field default combination *