From 97ec6341e858d7b3b5d3938aa59ac9dfdd558ab3 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Fri, 13 Sep 2013 15:39:30 +0200 Subject: [PATCH 01/36] [-] BO ; Fix bug #PSCFV-10393 manufacturer filter --- controllers/admin/AdminManufacturersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index ebdb2ad1d..4d26c7627 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -140,7 +140,7 @@ class AdminManufacturersControllerCore extends AdminController 'lastname' => array( 'title' => $this->l('Last name'), 'width' => 100, - 'filter_key' => 'a!name' + 'filter_key' => 'a!lastname' ), 'postcode' => array( 'title' => $this->l('Zip Code/Postal Code'), From d0ef8cca8f66a8a1e57a5eda89ce146c6b75ce52 Mon Sep 17 00:00:00 2001 From: makk1ntosh Date: Fri, 13 Sep 2013 08:02:47 -0700 Subject: [PATCH 02/36] Added ui.button as dependency of ui.dialog While developing my own module, i've upgraded installation to latest version of PS and impacted a bug: $('#something').dialog({...}); caused an error: t().button is not a function. In my php code i had this: $this->context->controller->addJqueryUI('ui.dialog'); i found that it doesn't load ui.button dependency. Added 'ui.button' to classes/Media.php at the end of ui.dialog dependencies and all worked fine. --- classes/Media.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Media.php b/classes/Media.php index 86b51e5ff..7ce172f56 100755 --- a/classes/Media.php +++ b/classes/Media.php @@ -39,7 +39,7 @@ class MediaCore 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), 'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), - 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position'), 'theme' => true), + 'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true), 'ui.slider' => array('fileName' => 'jquery.ui.slider.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true), 'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true), 'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true), From 6da1228359a52291bdc31ce428566c7380ff0310 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 13 Sep 2013 17:56:45 +0200 Subject: [PATCH 03/36] [-] BO : Fix bug #PSCFV-8407 can not customize feature column name if needed --- js/admin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/admin.js b/js/admin.js index e4bee41e9..f3d81d410 100644 --- a/js/admin.js +++ b/js/admin.js @@ -481,7 +481,7 @@ function askFeatureName(selected, selector) { var elem; - if (selected.value == 'feature') + if (selected.value == 'features') { $('#features_' + selector).show(); $('#feature_name_' + selector).attr('name', selected.name); From 73dd524de8e0f7a78ae2690f2ada894809404c70 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Sat, 14 Sep 2013 00:05:45 +0200 Subject: [PATCH 04/36] [-] BO : Could not order in AdminStatuses by ID or template --- controllers/admin/AdminStatusesController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/admin/AdminStatusesController.php b/controllers/admin/AdminStatusesController.php index b046fe3ea..fe4e129e0 100644 --- a/controllers/admin/AdminStatusesController.php +++ b/controllers/admin/AdminStatusesController.php @@ -136,6 +136,7 @@ class AdminStatusesControllerCore extends AdminController { $this->table = 'order_return_state'; $this->_defaultOrderBy = $this->identifier = 'id_order_return_state'; + $this->list_id = 'order_return_state'; $this->deleted = false; $this->_orderBy = null; From 08373c05419a1c2cbd35421223266be4fc4a38e8 Mon Sep 17 00:00:00 2001 From: Julien Date: Sat, 14 Sep 2013 14:57:00 +0200 Subject: [PATCH 05/36] [+] Modules : add hookHome --- modules/blocknewproducts/blocknewproducts.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index ae04a77ee..f6b23a22d 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -134,6 +134,11 @@ class BlockNewProducts extends Module { return $this->hookRightColumn($params); } + + public function hookHome($params) + { + return $this->hookRightColumn($params); + } public function hookHeader($params) { From c0afb55d11d2f47d50bb9fc409c354be501923dd Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Mon, 16 Sep 2013 09:25:10 +0200 Subject: [PATCH 06/36] [-] BO : FixBug #PSCFV-9900 Double quote escape problem in delete button link --- classes/helper/HelperList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 69a6127c2..0e979f28c 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -456,7 +456,7 @@ class HelperListCore extends Helper ); if ($this->specificConfirmDelete !== false) - $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\''); + $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\'')); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); From 0e3d53321aff6cc16ea9c49e541a31c9fde6713f Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 16 Sep 2013 09:37:39 +0200 Subject: [PATCH 07/36] [-] BO : limited the number of customers displayed in the group view to 100 in order to avoid memory usage error --- .../default/template/controllers/groups/helpers/view/view.tpl | 1 + controllers/admin/AdminGroupsController.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl index eceafdb0c..e2503c9a6 100755 --- a/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/groups/helpers/view/view.tpl @@ -58,6 +58,7 @@

{l s='Members of this customer group'}

+

{l s='Limited to the 100th first customers.'} {l s='Please use filters to narrow your search.'}

{$customerList} {/block} \ No newline at end of file diff --git a/controllers/admin/AdminGroupsController.php b/controllers/admin/AdminGroupsController.php index 3c8f26a79..007bd38b0 100644 --- a/controllers/admin/AdminGroupsController.php +++ b/controllers/admin/AdminGroupsController.php @@ -193,7 +193,7 @@ class AdminGroupsControllerCore extends AdminController 'active' => array('title' => $this->l('Enabled'),'align' => 'center','width' => 20, 'active' => 'status','type' => 'bool') )); - $customer_list = $group->getCustomers(false, 0, 0, true); + $customer_list = $group->getCustomers(false, 0, 100, true); $helper = new HelperList(); $helper->currentIndex = Context::getContext()->link->getAdminLink('AdminCustomers', false); From 08efa4e3139aa8afa6a854dcfba1d8def2fdc534 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 16 Sep 2013 11:12:55 +0200 Subject: [PATCH 08/36] [-] IN : Fix bug #PSCFV-10382 add_module_to_hook retunrning false when hook not exists --- install-dev/upgrade/php/add_module_to_hook.php | 15 +++++++++------ install-dev/upgrade/sql/1.5.6.0.sql | 14 +++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/install-dev/upgrade/php/add_module_to_hook.php b/install-dev/upgrade/php/add_module_to_hook.php index c44e4eabd..fabd39cfa 100644 --- a/install-dev/upgrade/php/add_module_to_hook.php +++ b/install-dev/upgrade/php/add_module_to_hook.php @@ -35,9 +35,14 @@ function add_module_to_hook($module_name, $hook_name) if ((int)$id_module > 0) { - $id_hook = Db::getInstance()->getValue(' - SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'" - '); + $id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = "'.$hook_name.'"'); + if(!$id_hook) + { + $res &= Db::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'hook` (`name`, `title`) + VALUES ("'.pSQL($hook_name).'", "'.pSQL($hook_name).'")'); + $id_hook = Db::getInstance()->Insert_ID(); + } if ((int)$id_hook > 0) { @@ -51,7 +56,5 @@ function add_module_to_hook($module_name, $hook_name) )'); } } - return $res; -} - +} \ No newline at end of file diff --git a/install-dev/upgrade/sql/1.5.6.0.sql b/install-dev/upgrade/sql/1.5.6.0.sql index 5f5521cff..08f15d8c4 100644 --- a/install-dev/upgrade/sql/1.5.6.0.sql +++ b/install-dev/upgrade/sql/1.5.6.0.sql @@ -1 +1,13 @@ -ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; \ No newline at end of file +ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL; + +/* PHP:add_module_to_hook(blockcart, actionCartListOverride); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerDeleteAfter); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerAddAfter); */; +/* PHP:add_module_to_hook(blockmanufacturer, actionObjectManufacturerUpdateAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierDeleteAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierAddAfter); */; +/* PHP:add_module_to_hook(blocksupplier, actionObjectSupplierUpdateAfter); */; +/* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */; +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; \ No newline at end of file From e68c124218863034db1dbdb93d58ffbf5de46a17 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 16 Sep 2013 11:40:29 +0200 Subject: [PATCH 09/36] [-] FO : replace ucfirst by ucwords for the customer firstname #PSCFV-10396 --- classes/Tools.php | 7 +++++++ controllers/front/AuthController.php | 1 + controllers/front/IdentityController.php | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/Tools.php b/classes/Tools.php index 31adb3bbf..bc0721a84 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1260,6 +1260,13 @@ class ToolsCore return Tools::strtoupper(Tools::substr($str, 0, 1)).Tools::substr($str, 1); } + public static function ucwords($str) + { + if (function_exists('mb_convert_case')) + return mb_convert_case($str, MB_CASE_TITLE); + return ucwords(strtolower($str)); + } + public static function orderbyPrice(&$array, $order_way) { foreach ($array as &$row) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 79b09cce6..505630aaa 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -425,6 +425,7 @@ class AuthControllerCore extends FrontController if (Tools::isSubmit('newsletter')) $this->processCustomerNewsletter($customer); + $customer->firstname = Tools::ucwords($customer->firstname); $customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']); if (!Validate::isBirthDate($customer->birthday)) $this->errors[] = Tools::displayError('Invalid date of birth.'); diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 7f0eb50b4..109cf3bc8 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -79,7 +79,7 @@ class IdentityControllerCore extends FrontController if (!count($this->errors)) { $this->customer->id_default_group = (int)$prev_id_default_group; - $this->customer->firstname = Tools::ucfirst(Tools::strtolower($this->customer->firstname)); + $this->customer->firstname = Tools::ucwords($this->customer->firstname); if (!isset($_POST['newsletter'])) $this->customer->newsletter = 0; From 8504574ae12b5ac75e79a662173a5297e81faa85 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 16 Sep 2013 15:02:12 +0200 Subject: [PATCH 10/36] [-] IN : Could not remove some tabs --- install-dev/upgrade/php/remove_tab.php | 2 +- install-dev/upgrade/sql/1.5.6.0.sql | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/install-dev/upgrade/php/remove_tab.php b/install-dev/upgrade/php/remove_tab.php index 2a0c53902..9ade12ee5 100644 --- a/install-dev/upgrade/php/remove_tab.php +++ b/install-dev/upgrade/php/remove_tab.php @@ -29,6 +29,6 @@ function remove_tab($tabname) Db::getInstance()->execute(' DELETE t, l FROM `'._DB_PREFIX_.'tab` t LEFT JOIN `'._DB_PREFIX_.'tab_lang` l ON (t.id_tab = l.id_tab) - WHERE t.`class_name` = '.pSQL($tabname)); + WHERE t.`class_name` = "'.pSQL($tabname).'"'); } diff --git a/install-dev/upgrade/sql/1.5.6.0.sql b/install-dev/upgrade/sql/1.5.6.0.sql index 08f15d8c4..3b03e96ed 100644 --- a/install-dev/upgrade/sql/1.5.6.0.sql +++ b/install-dev/upgrade/sql/1.5.6.0.sql @@ -10,4 +10,6 @@ ALTER TABLE `PREFIX_manufacturer_lang` CHANGE `short_description` `short_descrip /* PHP:add_module_to_hook(blockmyaccount, actionModuleRegisterHookAfter); */; /* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleRegisterHookAfter); */; /* PHP:add_module_to_hook(blockmyaccount, actionModuleUnRegisterHookAfter); */; -/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; \ No newline at end of file +/* PHP:add_module_to_hook(blockmyaccountfooter, actionModuleUnRegisterHookAfter); */; +/* PHP:remove_tab(AdminRangePrice); */; +/* PHP:remove_tab(AdminRangeWeight); */; \ No newline at end of file From 852faeab7a5b60369dbddf3038d93cb43172dc25 Mon Sep 17 00:00:00 2001 From: CINS Date: Mon, 16 Sep 2013 15:57:44 +0200 Subject: [PATCH 11/36] Update admin.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lorsqu'un produit possède trop d'images, il est impossible de réordonner celle-ci car la valeur JSON fourni en URL (GET) est beaucoup trop longue. Il faut envoyer les données JSON en POST pour solutionner le problème de longueur. --------- When a product has many pictures, we can't reorder them. The JSON value is too long in URL (GET). We need to send data with POST to avoid problem. --- js/admin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/admin.js b/js/admin.js index f3d81d410..f0d210359 100644 --- a/js/admin.js +++ b/js/admin.js @@ -751,6 +751,7 @@ function doAdminAjax(data, success_func, error_func) { url : 'index.php', data : data, + type : 'POST', success : function(data){ if (success_func) return success_func(data); From 15dd1cf96f0874a28347175e3d3a23fc0f284435 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 16 Sep 2013 17:16:11 +0200 Subject: [PATCH 12/36] [-] BO : Fix bugPSCFV-10249 images copy when unix path --- classes/Tools.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/classes/Tools.php b/classes/Tools.php index bc0721a84..6e2a4030a 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1412,7 +1412,12 @@ class ToolsCore $stream_context = @stream_context_create(array('http' => array('timeout' => 10))); if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source)) - return @copy($source, $destination, $stream_context); + { + if (!is_null($stream_context)) + return @copy($source, $destination, $stream_context); + else + return @copy($source, $destination); + } elseif (function_exists('curl_init')) { $curl = curl_init(); From 2d5bd901f4ef47b34795dce6fafb08a7c821bd27 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 16 Sep 2013 18:51:06 +0200 Subject: [PATCH 13/36] [*] CORE : Refactoring Tools::copy() as copy with context > PHP 5.3 --- classes/Tools.php | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 6e2a4030a..38aee11b6 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1408,31 +1408,9 @@ class ToolsCore public static function copy($source, $destination, $stream_context = null) { - if ($stream_context == null && preg_match('/^https?:\/\//', $source)) - $stream_context = @stream_context_create(array('http' => array('timeout' => 10))); - - if (in_array(@ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $source)) - { - if (!is_null($stream_context)) - return @copy($source, $destination, $stream_context); - else - return @copy($source, $destination); - } - elseif (function_exists('curl_init')) - { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($curl, CURLOPT_URL, $source); - curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($curl, CURLOPT_TIMEOUT, 10); - curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - $opts = stream_context_get_options($stream_context); - $content = curl_exec($curl); - curl_close($curl); - return file_put_contents($destination, $content); - } - else - return false; + if (is_null($stream_context) && !preg_match('/^https?:\/\//', $source)) + return @copy($source, $destination); + return @file_put_contents($destination, Tools::file_get_contents($source, false, $stream_context)); } /** From 6ee6317feef9cf8f2c7689149b8d9666e823b126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 17 Sep 2013 11:07:29 +0200 Subject: [PATCH 14/36] // orderby position --- classes/helper/HelperList.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 0e979f28c..eeb161535 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -136,6 +136,9 @@ class HelperListCore extends Helper $this->_list = $list; $this->fields_list = $fields_display; + $this->orderBy = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderBy); + $this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay); + // Display list header (filtering, pagination and column names) $tpl_vars['header'] = $this->displayListHeader(); @@ -522,9 +525,6 @@ class HelperListCore extends Helper isset($this->context->cookie->{$this->list_id.'_pagination'}) ? $this->context->cookie->{$this->list_id.'_pagination'} : null ); - // Cleaning links - if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway')) - $this->currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $this->currentIndex); if ($this->position_identifier && (int)Tools::getValue($this->position_identifier, 1)) $table_id = substr($this->identifier, 3, strlen($this->identifier)); From e6e8efc19ab354147c7bf33db25a23a53e4ddacd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 17 Sep 2013 11:58:12 +0200 Subject: [PATCH 15/36] [-] FO: Fix Product::getAttributesGroups() minimal_quantity/weight/available_date should be multishop --- classes/Product.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/classes/Product.php b/classes/Product.php index 188ce4a05..19e5917af 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3055,18 +3055,18 @@ class ProductCore extends ObjectModel if (!Combination::isFeatureActive()) return array(); $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, - a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, - IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, pa.`weight`, + a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`, + IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`, product_attribute_shop.`default_on`, pa.`reference`, product_attribute_shop.`unit_price_impact`, - pa.`minimal_quantity`, pa.`available_date`, ag.`group_type` + product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type` FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.Product::sqlStock('pa', 'pa').' - LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` - LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` - LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` + LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`) + LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`) + LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`) '.Shop::addSqlAssociation('attribute', 'a').' WHERE pa.`id_product` = '.(int)$this->id.' AND al.`id_lang` = '.(int)$id_lang.' From 3151064daf2980bb70cf6d3c934ff2f3bc73b18f Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Tue, 17 Sep 2013 12:18:37 +0200 Subject: [PATCH 16/36] //small fix on helper form && option --- admin-dev/themes/default/template/helpers/form/form.tpl | 2 +- admin-dev/themes/default/template/helpers/options/options.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index ee9ee638a..ed77b5c40 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -30,7 +30,7 @@ {if isset($fields.title)}

{$fields.title}

{/if} {block name="defaultForm"} -
+ {if $form_id} {/if} diff --git a/admin-dev/themes/default/template/helpers/options/options.tpl b/admin-dev/themes/default/template/helpers/options/options.tpl index ea9bb26c2..3c1309690 100644 --- a/admin-dev/themes/default/template/helpers/options/options.tpl +++ b/admin-dev/themes/default/template/helpers/options/options.tpl @@ -34,7 +34,7 @@ {block name="defaultOptions"} Date: Tue, 17 Sep 2013 14:54:38 +0200 Subject: [PATCH 17/36] //small fix with mode catalog and cart button --- themes/default/product.tpl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/themes/default/product.tpl b/themes/default/product.tpl index 97f5bbb08..dfd32a4ae 100644 --- a/themes/default/product.tpl +++ b/themes/default/product.tpl @@ -433,17 +433,10 @@ var fieldRequired = '{l s='Please fill in all the required fields before saving {/if} {*close if for show price*} {/if} - {if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} - - - {l s='Add to cart'} - - {else} -

- - -

- {/if} +

quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}style="display:none"{/if} class="buttons_bottom_block"> + + +

{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}
From 47c5f400eecb12c9828a4ae619ec246c5e9dcedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 17 Sep 2013 16:30:47 +0200 Subject: [PATCH 18/36] // Add gender on order view --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- controllers/admin/AdminOrdersController.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl index ef8cc81c5..af01d0657 100755 --- a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -153,7 +153,7 @@
{l s='Customer information'} - {$customer->firstname} {$customer->lastname} ({l s='#'}{$customer->id})
+ {$gender->name|escape:'htmlall':'UTF-8'} {$customer->firstname} {$customer->lastname} ({l s='#'}{$customer->id})
({$customer->email})

{if ($customer->isGuest())} {l s='This order has been placed by a guest.'} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 23bd95520..66f3ad249 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1342,11 +1342,14 @@ class AdminOrdersControllerCore extends AdminController $product['warehouse_name'] = '--'; } + $gender = new Gender((int)$customer->id_gender, $this->context->language->id); + // Smarty assign $this->tpl_view_vars = array( 'order' => $order, 'cart' => new Cart($order->id_cart), 'customer' => $customer, + 'gender' => $gender, 'customer_addresses' => $customer->getAddresses($this->context->language->id), 'addresses' => array( 'delivery' => $addressDelivery, From 965b8a1bf3eaff0146e00c013542aa1edbaeb9aa Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Wed, 18 Sep 2013 11:18:26 +0200 Subject: [PATCH 19/36] [-] BO - fixed bug #PSCFV-10286 - End range in summary of shipping wizard not correct when range number is a float --- js/admin_carrier_wizard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index 1bb403720..d62dc9e82 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -153,12 +153,13 @@ function displaySummary() $('tr.range_inf td input').each( function() { - if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf > $(this).val())) + if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || parseFloat(range_inf) > parseFloat($(this).val()))) range_inf = $(this).val(); }); $('tr.range_sup td input').each( function(){ - if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup < $(this).val())) + + if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || parseFloat(range_sup) < parseFloat($(this).val()))) range_sup = $(this).val(); }); From 672da852c55c5f4bf4982b8cef03bc3ef67e4239 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Wed, 18 Sep 2013 11:40:58 +0200 Subject: [PATCH 20/36] [-] BO - fixed bug #PSCFV-10178 --- js/admin_carrier_wizard.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index d62dc9e82..d2bb9f401 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -273,7 +273,6 @@ function bind_inputs() }); $('tr.fees td input:checkbox').off('change').on('change', function () { - if($(this).is(':checked')) { $(this).closest('tr').children('td').each( function () { @@ -390,7 +389,7 @@ function hideFees() function showFees() { $('tr.range_inf td, tr.range_sup td, tr.fees_all td, tr.fees td').each( function () { - if ($(this).index() >= 2) + if ($(this).index() > 2) { //enable only if zone is active tr = $(this).parent('tr'); From 66f46eee032247274297ee5c57df1e55ffd450e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 18 Sep 2013 14:29:01 +0200 Subject: [PATCH 21/36] // Avoid exception if amount is null on addind an orderpayment --- controllers/admin/AdminOrdersController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 66f3ad249..d15fd1323 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -805,7 +805,7 @@ class AdminOrdersControllerCore extends AdminController if (!Validate::isLoadedObject($order)) $this->errors[] = Tools::displayError('The order cannot be found'); - elseif (!Validate::isNegativePrice($amount)) + elseif (!Validate::isNegativePrice($amount) || !(float)$amount) $this->errors[] = Tools::displayError('The amount is invalid.'); elseif (!Validate::isString(Tools::getValue('payment_method'))) $this->errors[] = Tools::displayError('The selected payment method is invalid.'); From f293562ea4c878edec40d66786e79fc9e8b36aeb Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 18 Sep 2013 15:03:16 +0200 Subject: [PATCH 22/36] [-] BO : Fix bug #PSCFV-8214 import entity pre selected --- .../controllers/import/helpers/form/form.tpl | 3 +-- admin-dev/themes/default/template/toolbar.tpl | 2 +- controllers/admin/AdminAddressesController.php | 2 +- .../admin/AdminCategoriesController.php | 2 +- controllers/admin/AdminCustomersController.php | 2 +- controllers/admin/AdminImportController.php | 7 +++++-- .../admin/AdminManufacturersController.php | 2 +- controllers/admin/AdminProductsController.php | 2 +- controllers/admin/AdminSuppliersController.php | 18 ++++++++++++++++++ 9 files changed, 30 insertions(+), 10 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl index 059ccfdd2..c1949da21 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl @@ -112,7 +112,6 @@
{l s='Import '} -
{if count($files_to_import)} @@ -146,7 +145,7 @@
{foreach $files_to_import AS $filename} - + {/foreach} {/if} @@ -151,7 +94,6 @@ {/foreach}
-
- +
- +
{l s='If you don\'t use this option, all ID\'s will be auto-incremented.'}
+ +
+ +
{if empty($files_to_import)}{l s='You must upload a file in order to proceed to the next step'}{/if} @@ -209,13 +155,10 @@ {/if}
-
- {l s='Available fields'} -
{$available_fields}
@@ -223,74 +166,88 @@


{l s='* Required field'}
-
-
 
- + \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl index 618d1a819..b35bd5e1f 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl @@ -22,20 +22,14 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - {extends file="helpers/view/view.tpl"} - {block name="override_tpl"} -

{l s='View your data'}

- {l s='Save and load your configuration for importing files'} :

- - {l s='Save'}

+ {l s='Save and load your configuration for importing files'} :

+ + {l s='Save'}

{l s='lines'} + {if $fields_value.truncate} @@ -72,49 +63,8 @@ {if $fields_value.match_ref} {/if} - - - - + +
@@ -136,8 +86,45 @@
-
-{/block} + +{/block} \ No newline at end of file diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 5a1136499..7f28c0a6d 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -471,14 +471,19 @@ class AdminImportControllerCore extends AdminController $entity_selected = $this->entities[$this->l(Tools::ucfirst(Tools::getValue('import_type')))]; $this->context->cookie->entity_selected = $entity_selected; } - elseif(isset($this->context->cookie->entity_selected)) + elseif (isset($this->context->cookie->entity_selected)) $entity_selected = (int)$this->context->cookie->entity_selected; + + $csv_selected = ''; + if (isset($this->context->cookie->csv_selected)) + $csv_selected = pSQL($this->context->cookie->csv_selected); $this->tpl_form_vars = array( 'module_confirmation' => (Tools::getValue('import')) && (isset($this->warnings) && !count($this->warnings)), 'path_import' => _PS_ADMIN_DIR_.'/import/', 'entities' => $this->entities, 'entity_selected' => $entity_selected, + 'csv_selected' => $csv_selected, 'files_to_import' => $files_to_import, 'languages' => Language::getLanguages(false), 'id_language' => $this->context->language->id, @@ -508,6 +513,8 @@ class AdminImportControllerCore extends AdminController if ($entity_selected = (int)Tools::getValue('entity')) $this->context->cookie->entity_selected = $entity_selected; + if ($csv_selected = Tools::getValue('csv')) + $this->context->cookie->csv_selected = $csv_selected; $this->tpl_view_vars = array( 'import_matchs' => Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'import_match'), @@ -518,6 +525,7 @@ class AdminImportControllerCore extends AdminController 'iso_lang' => Tools::getValue('iso_lang'), 'truncate' => Tools::getValue('truncate'), 'forceIDs' => Tools::getValue('forceIDs'), + 'regenerate' => Tools::getValue('regenerate'), 'match_ref' => Tools::getValue('match_ref'), 'separator' => $this->separator, 'multiple_value_separator' => $this->multiple_value_separator @@ -807,7 +815,7 @@ class AdminImportControllerCore extends AdminController * @param string entity 'products' or 'categories' * @return void */ - protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products') + protected static function copyImg($id_entity, $id_image = null, $url, $entity = 'products', $regenerate = true) { $tmpfile = tempnam(_PS_TMP_IMG_DIR_, 'ps_import'); $watermark_types = explode(',', Configuration::get('WATERMARK_TYPES')); @@ -835,11 +843,14 @@ class AdminImportControllerCore extends AdminController { ImageManager::resize($tmpfile, $path.'.jpg'); $images_types = ImageType::getImagesTypes($entity); - foreach ($images_types as $image_type) - ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); - if (in_array($image_type['id_image_type'], $watermark_types)) - Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); + if ($regenerate) + foreach ($images_types as $image_type) + { + ImageManager::resize($tmpfile, $path.'-'.stripslashes($image_type['name']).'.jpg', $image_type['width'], $image_type['height']); + if (in_array($image_type['id_image_type'], $watermark_types)) + Hook::exec('actionWatermark', array('id_image' => $id_image, 'id_product' => $id_entity)); + } } else { @@ -988,7 +999,7 @@ class AdminImportControllerCore extends AdminController } //copying images of categories if (isset($category->image) && !empty($category->image)) - if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories'))) + if (!(AdminImportController::copyImg($category->id, null, $category->image, 'categories', !Tools::getValue('regenerate')))) $this->warnings[] = $category->image.' '.Tools::displayError('cannot be copied.'); // If both failed, mysql error if (!$res) @@ -1450,7 +1461,7 @@ class AdminImportControllerCore extends AdminController { // associate image to selected shops $image->associateTo($shops); - if (!AdminImportController::copyImg($product->id, $image->id, $url)) + if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) { $image->delete(); $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); @@ -1576,7 +1587,7 @@ class AdminImportControllerCore extends AdminController if ($field_error === true && $lang_field_error === true && $image->add()) { $image->associateTo($id_shop_list); - if (!AdminImportController::copyImg($product->id, $image->id, $url)) + if (!AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate'))) { $this->warnings[] = sprintf(Tools::displayError('Error copying image: %s'), $url); $image->delete(); From ea6ea955bbd62b8dccb886b567dd3ef27a0b6b98 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 19 Sep 2013 16:39:21 +0200 Subject: [PATCH 34/36] // licence --- .../template/controllers/import/helpers/form/form.tpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl index 58a183cb8..c867b6c6d 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl @@ -3,10 +3,10 @@ ** * NOTICE OF LICENSE ** -* This source file is subject to the Open Software License (OSL 3.0) +* This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/osl-3.0.php +* http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. @@ -19,9 +19,8 @@ ** * @author PrestaShop SA * @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA -** *} {include file="toolbar.tpl" toolbar_btn=$toolbar_btn toolbar_scroll=$toolbar_scroll title=$title}
{block name="leadin"}{/block}
From 0361d5db8d00b7e7239ae032ac4bf429a9bed573 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 19 Sep 2013 16:59:04 +0200 Subject: [PATCH 35/36] [-] BO : do not reaffect import_type for categories --- controllers/admin/AdminImportController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index e5c634a51..0a69a5bb4 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -2743,7 +2743,6 @@ class AdminImportControllerCore extends AdminController $this->clearSmartyCache(); break; case $this->entities[$import_type = $this->l('Products')]: - $import_type = $this->l('Categories'); $this->productImport(); $this->clearSmartyCache(); break; From e0b59082f9c5ef734002331ba0ef2fdcea17cfc6 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 19 Sep 2013 17:19:51 +0200 Subject: [PATCH 36/36] [-] BO : Issue with domready on adminImport --- .../controllers/import/helpers/view/view.tpl | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl index b35bd5e1f..a7c20b5d8 100644 --- a/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/import/helpers/view/view.tpl @@ -24,6 +24,44 @@ *} {extends file="helpers/view/view.tpl"} {block name="override_tpl"} +

{l s='View your data'}

@@ -73,7 +111,7 @@ - + {section name=nb_i start=0 loop=$nb_table step=1} @@ -82,49 +120,10 @@ {/section} - +
- {/block} \ No newline at end of file