From 13482914158857d5977f2a1b8d42f979e2689cd1 Mon Sep 17 00:00:00 2001 From: nturato Date: Tue, 15 Jan 2013 10:17:02 +0100 Subject: [PATCH 001/195] [WS] images are only shown as jpg or gif If you enable BO to also use the PNG file you can not use these images in WS because there are no controls on the image type --- .../WebserviceSpecificManagementImages.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/classes/webservice/WebserviceSpecificManagementImages.php b/classes/webservice/WebserviceSpecificManagementImages.php index d2e20108f..c7e282bd7 100755 --- a/classes/webservice/WebserviceSpecificManagementImages.php +++ b/classes/webservice/WebserviceSpecificManagementImages.php @@ -33,7 +33,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage /** * @var string The extension of the image to display */ - protected $imgExtension = 'jpg'; + protected $imgExtension; /** * @var array The type of images (general, categories, manufacturers, suppliers, stores...) @@ -119,10 +119,18 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage // display image content if needed else if ($this->imgToDisplay) { + if(empty($this->imgExtension)){ + $imginfo = getimagesize($this->imgToDisplay); + $this->imgExtension = image_type_to_extension($imginfo[2],false); + } + $imageResource = false; - $types = array('jpg' => array('function' => 'imagecreatefromjpeg', 'Content-Type' => 'image/jpeg'), - 'gif' => array('function' => 'imagecreatefromgif', 'Content-Type' => 'image/gif') - ); + $types = array( + 'jpg' => array('function' => 'imagecreatefromjpeg', 'Content-Type' => 'image/jpeg'), + 'jpeg' => array('function' => 'imagecreatefromjpeg', 'Content-Type' => 'image/jpeg'), + 'png' => array('function' => 'imagecreatefrompng', 'Content-Type' => 'image/png'), + 'gif' => array('function' => 'imagecreatefromgif', 'Content-Type' => 'image/gif') + ); if (array_key_exists($this->imgExtension, $types)) $imageResource = @$types[$this->imgExtension]['function']($this->imgToDisplay); From 0719c26126b9bb77ea2a36fe1e52c3a2cc395e93 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 1 Mar 2013 18:21:57 +0100 Subject: [PATCH 002/195] // Fixed 2 bugs in the installer --- classes/ConfigurationTest.php | 1 + install-dev/theme/views/configure.phtml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/classes/ConfigurationTest.php b/classes/ConfigurationTest.php index fa9c6a0b8..a6d27bad4 100644 --- a/classes/ConfigurationTest.php +++ b/classes/ConfigurationTest.php @@ -76,6 +76,7 @@ class ConfigurationTestCore 'register_globals' => false, 'gz' => false, 'mcrypt' => false, + 'mbstring' => false, 'magicquotes' => false, 'dom' => false, 'pdo_mysql' => false, diff --git a/install-dev/theme/views/configure.phtml b/install-dev/theme/views/configure.phtml index 33401430e..e0e147420 100644 --- a/install-dev/theme/views/configure.phtml +++ b/install-dev/theme/views/configure.phtml @@ -50,6 +50,8 @@ var default_iso = 'session->shop_country ?>';

l('Demo products are a good way to learn how to use PrestaShop. You should install them if you are not familiar with it.') ?>

+ + From 0882c187fc03847c312970d7a23eac7da0ed5311 Mon Sep 17 00:00:00 2001 From: Samy Rabih Date: Sat, 2 Mar 2013 18:21:04 +0100 Subject: [PATCH 003/195] Import time improvment Instead of making as many queries as you ps_feature entries (for each product), it is possible to make it in one query. And we test if the user has the MySQL rights to create temporary tables. --- classes/Feature.php | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/classes/Feature.php b/classes/Feature.php index 6d9c2dc7e..c0c3c0105 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -313,19 +313,30 @@ class FeatureCore extends ObjectModel public static function cleanPositions() { $return = true; - $sql = ' - SELECT `id_feature` - FROM `'._DB_PREFIX_.'feature` - ORDER BY `position`'; - $result = Db::getInstance()->executeS($sql); + CREATE TEMPORARY TABLE `'._DB_PREFIX_.'feature_tmp` ( + `rank` INT NOT NULL AUTO_INCREMENT, + `id_feature` int not null, + `position` int not null, + primary key(rank) + ); + INSERT INTO '._DB_PREFIX_.'feature_tmp(id_feature,position) SELECT id_feature,position FROM '._DB_PREFIX_.'feature ORDER BY position ASC; + UPDATE `'._DB_PREFIX_.'feature` f LEFT JOIN '._DB_PREFIX_.'feature_tmp t USING(id_feature) SET f.position = rank-1'; + $return = Db::getInstance()->executeS($sql); + if (!$return) { + $sql = ' + SELECT `id_feature` + FROM `'._DB_PREFIX_.'feature` + ORDER BY `position`'; + $result = Db::getInstance()->executeS($sql); - $i = 0; - foreach ($result as $value) - $return = Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'feature` - SET `position` = '.(int)$i++.' - WHERE `id_feature` = '.(int)$value['id_feature']); + $i = 0; + foreach ($result as $value) + $return = Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'feature` + SET `position` = '.(int)$i++.' + WHERE `id_feature` = '.(int)$value['id_feature']); + } return $return; } From 56d4c8339a833ff96399d5050fd68b192a5fab2b Mon Sep 17 00:00:00 2001 From: Samy Rabih Date: Sat, 2 Mar 2013 18:33:59 +0100 Subject: [PATCH 004/195] cleanPositions query update We now use an unique query, with no need to use temporary table. Thanks to @sylwit for the tip ! --- classes/Feature.php | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/classes/Feature.php b/classes/Feature.php index c0c3c0105..83b49bb57 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -314,29 +314,13 @@ class FeatureCore extends ObjectModel { $return = true; $sql = ' - CREATE TEMPORARY TABLE `'._DB_PREFIX_.'feature_tmp` ( - `rank` INT NOT NULL AUTO_INCREMENT, - `id_feature` int not null, - `position` int not null, - primary key(rank) - ); - INSERT INTO '._DB_PREFIX_.'feature_tmp(id_feature,position) SELECT id_feature,position FROM '._DB_PREFIX_.'feature ORDER BY position ASC; - UPDATE `'._DB_PREFIX_.'feature` f LEFT JOIN '._DB_PREFIX_.'feature_tmp t USING(id_feature) SET f.position = rank-1'; + UPDATE `'._DB_PREFIX_.'feature` f LEFT JOIN + (SELECT @i := @i +1 AS rank, id_feature, position + FROM `'._DB_PREFIX_.'feature` JOIN (SELECT @i :=1) dummy + ORDER by position) AS f2 + USING(id_feature) + SET f.position = f2.rank-1'; $return = Db::getInstance()->executeS($sql); - if (!$return) { - $sql = ' - SELECT `id_feature` - FROM `'._DB_PREFIX_.'feature` - ORDER BY `position`'; - $result = Db::getInstance()->executeS($sql); - - $i = 0; - foreach ($result as $value) - $return = Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'feature` - SET `position` = '.(int)$i++.' - WHERE `id_feature` = '.(int)$value['id_feature']); - } return $return; } From ddcd63b9ccc5658468b2207d87ee8a68f37cb9c9 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 4 Mar 2013 10:23:03 +0100 Subject: [PATCH 005/195] [*] FO : Fix #PSCFV-7989 red quantity > 1 on orders --- .../default/template/controllers/orders/_product_line.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl index 6519dadaf..26b24fe49 100755 --- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl @@ -49,7 +49,7 @@ {/if} - {$product['product_quantity']} + {$product['product_quantity']} {if $can_edit}