From 72def39102b88a3db1ab1112f56b6155f38c360c Mon Sep 17 00:00:00 2001 From: Nicolas Sorosac Date: Mon, 10 Jun 2013 17:43:03 +0200 Subject: [PATCH 01/23] [-] CORE : CartRule::checkProductRestrictions : A gift product in the same category as its restrictions causes the gift to stay in the cart even if emptied --- classes/CartRule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/CartRule.php b/classes/CartRule.php index e32bd3451..ab5cef179 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -637,7 +637,8 @@ class CartRuleCore extends ObjectModel FROM `'._DB_PREFIX_.'cart_product` cp LEFT JOIN `'._DB_PREFIX_.'category_product` catp ON cp.id_product = catp.id_product WHERE cp.`id_cart` = '.(int)$context->cart->id.' - AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').')'); + AND cp.`id_product` IN ('.implode(array_map('intval', $eligibleProductsList), ',').') + AND cp.`id_product` <> '.(int)$this->gift_product); $countMatchingProducts = 0; $matchingProductsList = array(); foreach ($cartCategories as $cartCategory) From cafbed08ee039277400c8b85e1f53cd153beb6cb Mon Sep 17 00:00:00 2001 From: MatthieuB Date: Mon, 10 Jun 2013 21:13:23 +0200 Subject: [PATCH 02/23] NewProductController: new products page must display latest products first. Override default configuration values: cause the new products page must display latest products first. --- controllers/front/NewProductsController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/front/NewProductsController.php b/controllers/front/NewProductsController.php index 7cf283eba..a438c4826 100644 --- a/controllers/front/NewProductsController.php +++ b/controllers/front/NewProductsController.php @@ -47,6 +47,13 @@ class NewProductsControllerCore extends FrontController $this->productSort(); + // Override default configuration values: cause the new products page must display latest products first. + if (!Tools::getIsset('orderway') || !Tools::getIsset('orderby')) + { + $this->orderBy = 'date_add'; + $this->orderWay = 'DESC'; + } + $nbProducts = (int)Product::getNewProducts( $this->context->language->id, (isset($this->p) ? (int)($this->p) - 1 : null), From 80908e0a6f0c310cc9d95fbd87e3c989c3ff6620 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 13 Jun 2013 16:34:34 +0200 Subject: [PATCH 03/23] [-] MO : do not check the VAT number if the module is disabled #PSCFV-9397 --- classes/Address.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Address.php b/classes/Address.php index 01a227232..cb1fef134 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -222,7 +222,7 @@ class AddressCore extends ObjectModel public function validateController($htmlentities = true) { $errors = parent::validateController($htmlentities); - if (!Configuration::get('VATNUMBER_CHECKING')) + if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING')) return $errors; include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php'); if (class_exists('VatNumber', false)) From 6a2eddd81f505d7419ccd760102dc4f83b709014 Mon Sep 17 00:00:00 2001 From: Seb Date: Thu, 13 Jun 2013 17:59:01 +0200 Subject: [PATCH 04/23] [-] BO : fix require path to config.inc.php --- admin-dev/get-file-admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-dev/get-file-admin.php b/admin-dev/get-file-admin.php index b37f691e5..39fcd8a85 100644 --- a/admin-dev/get-file-admin.php +++ b/admin-dev/get-file-admin.php @@ -25,5 +25,5 @@ */ define('_PS_ADMIN_DIR_', getcwd()); -require(_PS_ADMIN_DIR_.'/config/config.inc.php'); +require(_PS_ADMIN_DIR_.'/../config/config.inc.php'); Controller::getController('GetFileController')->run(); \ No newline at end of file From cd6f415dc153e821f44bea1b00e5e49a04620d14 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 13 Jun 2013 18:37:41 +0200 Subject: [PATCH 05/23] [-] BO : fixed link in AdminTracking #PSCFV-7409 --- controllers/admin/AdminTrackingController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php index 2ccb0c6ab..8ba7265a4 100644 --- a/controllers/admin/AdminTrackingController.php +++ b/controllers/admin/AdminTrackingController.php @@ -52,6 +52,9 @@ class AdminTrackingControllerCore extends AdminController public function initContent() { + if ($id_category = Tools::getValue('id_category') && Tools::getIsset('viewcategory')) + Tools::redirectAdmin($this->context->link->getAdminLink('AdminProducts').'&id_category='.(int)$id_category.'&viewcategory'); + $this->_helper_list = new HelperList(); if (!Configuration::get('PS_STOCK_MANAGEMENT')) From ff876034b46b26065b06928addef6da2521dd6c7 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 09:56:41 +0200 Subject: [PATCH 06/23] // Fixed display of the image option "legacy system" --- controllers/admin/AdminImagesController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 38ecea2e4..22694773d 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -53,7 +53,7 @@ class AdminImagesControllerCore extends AdminController ); // No need to display the old image system if the install has been made later than 2013-03-26 - $this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true; + $this->display_move = (!Configuration::get('PS_LEGACY_IMAGES') && defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true; $this->fields_options = array( 'images' => array( @@ -62,7 +62,7 @@ class AdminImagesControllerCore extends AdminController 'top' => '', 'bottom' => '', 'description' => $this->l('JPEG images have a small file size and standard quality. PNG images have a larger file size, a higher quality and support transparency. Note that in all cases the image files will have the .jpg extension.').' -

'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'), +

'.$this->l('WARNING: This feature may not be compatible with your theme, or with some of your modules. In particular, PNG mode is not compatible with the Watermark module. If you encounter any issues, turn it off by selecting "Use JPEG".'), 'fields' => array( 'PS_IMAGE_QUALITY' => array( 'title' => $this->l('Image quality'), From 9260a43d7dd24a7594444ff310ab0fa24fa2bbae Mon Sep 17 00:00:00 2001 From: gRoussac Date: Fri, 14 Jun 2013 10:20:48 +0200 Subject: [PATCH 07/23] [-] INSTALLER : Shown index can return empty array --- install-dev/upgrade/php/p1540_add_missing_columns.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install-dev/upgrade/php/p1540_add_missing_columns.php b/install-dev/upgrade/php/p1540_add_missing_columns.php index a86938056..b63af1a71 100644 --- a/install-dev/upgrade/php/p1540_add_missing_columns.php +++ b/install-dev/upgrade/php/p1540_add_missing_columns.php @@ -52,9 +52,14 @@ function p1540_add_missing_columns() } $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `'._DB_PREFIX_.'stock_available` WHERE KEY_NAME = "product_sqlstock"');; - if (is_array($key_exists)) + if (is_array($key_exists) && count($key_exists)) if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'stock_available` DROP INDEX `product_sqlstock`')) $errors[] = Db::getInstance()->getMsgError(); + + $key_exists = Db::getInstance()->executeS('SHOW INDEX FROM `'._DB_PREFIX_.'stock_available` WHERE KEY_NAME = "id_product_2"');; + if (is_array($key_exists) && count($key_exists)) + if (!Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'stock_available` DROP INDEX `id_product_2`')) + $errors[] = Db::getInstance()->getMsgError(); if (count($errors)) return array('error' => 1, 'msg' => implode(',', $errors)) ; From 5493010e675f15d7d21a2a2c3216e6ee85fce83b Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 10:25:20 +0200 Subject: [PATCH 08/23] [-] BO : postcode required in manufacturer address --- controllers/admin/AdminEmployeesController.php | 2 +- controllers/admin/AdminManufacturersController.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index ebdef6a4a..3c09f4cf1 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -297,7 +297,7 @@ class AdminEmployeesControllerCore extends AdminController } $this->fields_form['input'][] = array( 'type' => 'select', - 'label' => $this->l('Profile:'), + 'label' => $this->l('Profile Permission:'), 'name' => 'id_profile', 'required' => true, 'options' => array( diff --git a/controllers/admin/AdminManufacturersController.php b/controllers/admin/AdminManufacturersController.php index 80d6fc516..550179b1d 100644 --- a/controllers/admin/AdminManufacturersController.php +++ b/controllers/admin/AdminManufacturersController.php @@ -440,6 +440,7 @@ class AdminManufacturersControllerCore extends AdminController 'type' => 'text', 'label' => $this->l('Zip Code/Postal Code'), 'name' => 'postcode', + 'required' => true, 'size' => 33, 'required' => false, ); From 331dcc4d6ef1fc25fe1d57bac08aaaf2206c2a24 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 10:48:24 +0200 Subject: [PATCH 09/23] [-] BO : Fixed permission update #PSCFV-7441 --- controllers/admin/AdminAccessController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index a3f79ab4b..9f636c25b 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -157,7 +157,7 @@ class AdminAccessControllerCore extends AdminController $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE `id_profile` = '.(int)$id_profile.' AND `id_tab` != '.(int)$this->id_tab_access; + WHERE `id_profile` = '.(int)$id_profile; else if ($id_tab == -1 && $perm == 'all') $sql = ' UPDATE `'._DB_PREFIX_.'access` a From ff63e0a28ced71bb1923fa08f902290f2def34b1 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Fri, 14 Jun 2013 11:17:07 +0200 Subject: [PATCH 10/23] [-] BO : fixed bug #PSCFV-9405 - Delete file of downloadable product when cancel --- .../controllers/products/virtualproduct.tpl | 7 +++-- js/admin-products.js | 30 +++++++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl index 6f46e7704..0a6c0d865 100644 --- a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl +++ b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl @@ -159,7 +159,10 @@ {/if} @@ -173,7 +176,7 @@ {$product->productDownload->getHtmlLink(false, true)} - + {l s='Delete this file'} diff --git a/js/admin-products.js b/js/admin-products.js index 1867893ba..0ee818a21 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -1356,23 +1356,27 @@ product_tabs['VirtualProduct'] = new function(){ // Bind file deletion $(('#product-tab-content-VirtualProduct')).delegate('a.delete_virtual_product', 'click', function(e){ e.preventDefault(); - if (!$('#virtual_product_id').val()) + if (confirm(delete_this_file)) { - $('#upload_input').show(); - $('#virtual_product_name').val(''); - $('#virtual_product_file').val(''); - $('#upload-confirmation').hide().find('span').remove(); - } - else - { - var object = this; - ajaxAction(this.href, 'deleteVirtualProduct', function(){ - $(object).closest('tr').remove(); + if (!$('#virtual_product_id').val()) + { $('#upload_input').show(); $('#virtual_product_name').val(''); $('#virtual_product_file').val(''); - $('#virtual_product_id').remove(); - }); + $('#upload-confirmation').hide().find('span').remove(); + } + else + { + var object = this; + ajaxAction(this.href, 'deleteVirtualProduct', function(){ + $(object).closest('tr').remove(); + $('#upload_input').show(); + $('#virtual_product_name').val(''); + $('#virtual_product_file').val(''); + $('#virtual_product_id').remove(); + }); + } + } }); } From 12e13e275faa01256a532c963fd37df5438edadd Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 11:20:23 +0200 Subject: [PATCH 11/23] [-] BO : fixed ajax in permissions tab #PSCFV-7442 --- .../controllers/access/helpers/form/form.tpl | 13 +++---- controllers/admin/AdminAccessController.php | 39 +++++++++---------- controllers/admin/AdminTrackingController.php | 2 - 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl index 532b87e80..72beec990 100644 --- a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl @@ -49,8 +49,10 @@ if (perm == 'all' && $(this).parent().parent().hasClass('parent')) { - checked = enabled ? 'checked': ''; - $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked); + if (enabled) + $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', 'checked'); + else + $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').removeAttr('checked'); $.ajax({ url: "{$link->getAdminLink('AdminAccess')|addslashes}", cache: false, @@ -68,15 +70,12 @@ }, success : function(res,textStatus,jqXHR) { - try - { + try { if (res == 'ok') showSuccessMessage("{l s='Update successful'}"); else showErrorMessage("{l s='Update error'}"); - } - catch(e) - { + } catch(e) { jAlert('Technical error'); } } diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 9f636c25b..543a3b5d2 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController $join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)'; } - if ($id_tab == -1 && $perm == 'all' && $enabled == 0) - $sql = ' + if ($id_tab == -1) + { + if ($perm == 'all') + $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile; - else if ($id_tab == -1 && $perm == 'all') - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE `id_profile` = '.(int)$id_profile; - else if ($id_tab == -1) - $sql = ' + else + $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `'.bqSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile; - else if ($perm == 'all') - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - '.$join.' - SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE '.$where.' = '.(int)$id_tab.' - AND `id_profile` = '.(int)$id_profile; + } else - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - '.$join.' + { + if ($perm == 'all') + $sql = ' + UPDATE `'._DB_PREFIX_.'access` a '.$join.' + SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' + WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile; + else + $sql = ' + UPDATE `'._DB_PREFIX_.'access` a '.$join.' SET `'.bqSQL($perm).'` = '.(int)$enabled.' - WHERE '.$where.' = '.(int)$id_tab.' - AND `id_profile` = '.(int)$id_profile; + WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile; + } $res = Db::getInstance()->execute($sql) ? 'ok' : 'error'; diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php index 8ba7265a4..4510d998c 100644 --- a/controllers/admin/AdminTrackingController.php +++ b/controllers/admin/AdminTrackingController.php @@ -154,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController $this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:')); - - return $this->renderList(); } From 909a459e5da0fce898d10a9854d6ebef4aca38c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Fri, 14 Jun 2013 11:49:04 +0200 Subject: [PATCH 12/23] // miss ; --- 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 70f395b75..95d9b9f1f 100644 --- a/classes/pdf/HTMLTemplateOrderSlip.php +++ b/classes/pdf/HTMLTemplateOrderSlip.php @@ -212,7 +212,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice foreach ($tmp_tax_infos as $rate => &$row) { if (!isset($ecotax[$rate])) - continue + continue; $row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl']; $row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $ecotax[$rate]['ecotax_tax_excl']); } From eae2a16442321aa7a043d5b9c704dab205df4699 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 11:56:33 +0200 Subject: [PATCH 13/23] // Removed button hide in contact form (create issues with the back button in the browser for example) --- themes/default/contact-form.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/contact-form.tpl b/themes/default/contact-form.tpl index 6e11d401e..dcd5d252f 100644 --- a/themes/default/contact-form.tpl +++ b/themes/default/contact-form.tpl @@ -125,7 +125,7 @@

- +

From 6778b17b2366a96e171cd818b9e9f283e3bdb766 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Fri, 14 Jun 2013 15:01:22 +0200 Subject: [PATCH 14/23] [-] BO - fixed bug #PSCFV-9347 - Saving the E-Mail preferences loses the smtp server password --- controllers/admin/AdminEmailsController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index a0c26e124..1e1394b9f 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -165,6 +165,15 @@ class AdminEmailsControllerCore extends AdminController ); } + public function updateOptionPsMailPasswd($value) + { + if (Tools::getValue('PS_MAIL_PASSWD') == '' && Configuration::get('PS_MAIL_PASSWD')) + return true; + else + Configuration::updateValue('PS_MAIL_PASSWD', Tools::getValue('PS_MAIL_PASSWD')); + } + + /** * AdminController::initContent() override * @see AdminController::initContent() From 319413ca2563636676526a7e030b70f9c5cb91d7 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Fri, 14 Jun 2013 15:08:16 +0200 Subject: [PATCH 15/23] // Added errors to user assistance --- install-dev/theme/views/footer.phtml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install-dev/theme/views/footer.phtml b/install-dev/theme/views/footer.phtml index 8e765ad3a..95b11994d 100644 --- a/install-dev/theme/views/footer.phtml +++ b/install-dev/theme/views/footer.phtml @@ -30,7 +30,13 @@ \ No newline at end of file From ce9f262feb65880791add472e643aa44da04b4b0 Mon Sep 17 00:00:00 2001 From: Gregory Roussac Date: Sat, 15 Jun 2013 01:55:02 +0200 Subject: [PATCH 16/23] [-] BO : Upload image name with trailing slash in name --- admin-dev/ajaxfilemanager/ajax_file_upload.php | 4 ++-- admin-dev/ajaxfilemanager/ajax_get_file_listing.php | 4 ++-- admin-dev/ajaxfilemanager/inc/class.file.php | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/admin-dev/ajaxfilemanager/ajax_file_upload.php b/admin-dev/ajaxfilemanager/ajax_file_upload.php index 309490e06..b21a39c13 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_upload.php +++ b/admin-dev/ajaxfilemanager/ajax_file_upload.php @@ -60,7 +60,7 @@ $tem[$k] = $v; } - $tem['path'] = backslashToSlash($path); + $tem['path'] = addslashes(backslashToSlash($path)); $tem['type'] = "file"; $tem['size'] = transformFileSize($tem['size']); $tem['ctime'] = date(DATE_TIME_FORMAT, $tem['ctime']); @@ -73,7 +73,7 @@ $info .= sprintf(", %s:'%s'", $k, $v); } - $info .= sprintf(", url:'%s'", getFileUrl($path)); + $info .= sprintf(", url:'%s'", addslashes(getFileUrl($path))); $info .= sprintf(", tipedit:'%s'", TIP_DOC_RENAME); diff --git a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php index 133486637..c72110344 100755 --- a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php +++ b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php @@ -99,9 +99,9 @@ { $v = transformFileSize($v); } - echo (($j++ > 1)?",":'') . "'" . $k . "':'" . $v . "'"; + echo (($j++ > 1)?",":'') . "'" . addslashes($k) . "':'" . addslashes($v) . "'"; } - echo (($j++ > 1)?",":'') . "'url':'" . getFileUrl($file['path']) . "'"; + echo (($j++ > 1)?",":'') . "'url':'" . addslashes(getFileUrl($file['path'])) . "'"; echo "}\n"; } echo "};\n"; diff --git a/admin-dev/ajaxfilemanager/inc/class.file.php b/admin-dev/ajaxfilemanager/inc/class.file.php index 85512eb02..d35ff7a33 100755 --- a/admin-dev/ajaxfilemanager/inc/class.file.php +++ b/admin-dev/ajaxfilemanager/inc/class.file.php @@ -33,15 +33,15 @@ $this->fileInfo['atime'] = $this->fileStat[8]; $this->fileInfo['ctime'] = $this->fileStat[10]; $this->fileInfo['mtime'] = $this->fileStat[9]; - $this->fileInfo['path'] = $path; - $this->fileInfo['name'] = basename($path); + $this->fileInfo['path'] = addslashes($path); + $this->fileInfo['name'] = addslashes(basename($path)); $this->fileInfo['is_writable'] = $this->isWritable(); $this->fileInfo['is_readable'] = $this->isReadable(); }elseif(is_dir($this->filePath)) { $this->fileStat = @stat($path); - $this->fileInfo['name'] = basename($path); - $this->fileInfo['path'] = $path; + $this->fileInfo['name'] = addslashes(basename($path)); + $this->fileInfo['path'] = addslashes($path); $this->fileInfo['atime'] = $this->fileStat[8]; $this->fileInfo['ctime'] = $this->fileStat[10]; $this->fileInfo['mtime'] = $this->fileStat[9]; From c53d2d04ce415ef7a50a9b73c3a9b89688b2984e Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 17 Jun 2013 11:16:16 +0200 Subject: [PATCH 17/23] [-] BO : fixed parsing of discount value in AdminOrders #PSCFV-9481 --- controllers/admin/AdminOrdersController.php | 35 +++++++++++---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index d9704a34d..8f980e828 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1048,16 +1048,17 @@ class AdminOrdersControllerCore extends AdminController } $cart_rules = array(); + $discount_value = (float)str_replace(',', '.', Tools::getValue('discount_value')); switch (Tools::getValue('discount_type')) { // Percent type case 1: - if (Tools::getValue('discount_value') < 100) + if ($discount_value < 100) { if (isset($order_invoice)) { - $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2); - $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2); + $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * $discount_value / 100, 2); + $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * $discount_value / 100, 2); // Update OrderInvoice $this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']); @@ -1067,8 +1068,8 @@ class AdminOrdersControllerCore extends AdminController $order_invoices_collection = $order->getInvoicesCollection(); foreach ($order_invoices_collection as $order_invoice) { - $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2); - $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2); + $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($order_invoice->total_paid_tax_incl * $discount_value / 100, 2); + $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($order_invoice->total_paid_tax_excl * $discount_value / 100, 2); // Update OrderInvoice $this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']); @@ -1076,8 +1077,8 @@ class AdminOrdersControllerCore extends AdminController } else { - $cart_rules[0]['value_tax_incl'] = Tools::ps_round($order->total_paid_tax_incl * Tools::getValue('discount_value') / 100, 2); - $cart_rules[0]['value_tax_excl'] = Tools::ps_round($order->total_paid_tax_excl * Tools::getValue('discount_value') / 100, 2); + $cart_rules[0]['value_tax_incl'] = Tools::ps_round($order->total_paid_tax_incl * $discount_value / 100, 2); + $cart_rules[0]['value_tax_excl'] = Tools::ps_round($order->total_paid_tax_excl * $discount_value / 100, 2); } } else @@ -1087,12 +1088,12 @@ class AdminOrdersControllerCore extends AdminController case 2: if (isset($order_invoice)) { - if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl) + if ($discount_value > $order_invoice->total_paid_tax_incl) $this->errors[] = Tools::displayError('The discount value is greater than the order invoice total.'); else { - $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2); - $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2); + $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($discount_value, 2); + $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2); // Update OrderInvoice $this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']); @@ -1103,12 +1104,12 @@ class AdminOrdersControllerCore extends AdminController $order_invoices_collection = $order->getInvoicesCollection(); foreach ($order_invoices_collection as $order_invoice) { - if (Tools::getValue('discount_value') > $order_invoice->total_paid_tax_incl) + if ($discount_value > $order_invoice->total_paid_tax_incl) $this->errors[] = Tools::displayError('The discount value is greater than the order invoice total.').$order_invoice->getInvoiceNumberFormatted(Context::getContext()->language->id, (int)$order->id_shop).')'; else { - $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2); - $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2); + $cart_rules[$order_invoice->id]['value_tax_incl'] = Tools::ps_round($discount_value, 2); + $cart_rules[$order_invoice->id]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2); // Update OrderInvoice $this->applyDiscountOnInvoice($order_invoice, $cart_rules[$order_invoice->id]['value_tax_incl'], $cart_rules[$order_invoice->id]['value_tax_excl']); @@ -1117,12 +1118,12 @@ class AdminOrdersControllerCore extends AdminController } else { - if (Tools::getValue('discount_value') > $order->total_paid_tax_incl) + if ($discount_value > $order->total_paid_tax_incl) $this->errors[] = Tools::displayError('The discount value is greater than the order total.'); else { - $cart_rules[0]['value_tax_incl'] = Tools::ps_round(Tools::getValue('discount_value'), 2); - $cart_rules[0]['value_tax_excl'] = Tools::ps_round(Tools::getValue('discount_value') / (1 + ($order->getTaxesAverageUsed() / 100)), 2); + $cart_rules[0]['value_tax_incl'] = Tools::ps_round($discount_value, 2); + $cart_rules[0]['value_tax_excl'] = Tools::ps_round($discount_value / (1 + ($order->getTaxesAverageUsed() / 100)), 2); } } break; @@ -1173,7 +1174,7 @@ class AdminOrdersControllerCore extends AdminController $cartRuleObj->quantity = 0; $cartRuleObj->quantity_per_user = 1; if (Tools::getValue('discount_type') == 1) - $cartRuleObj->reduction_percent = Tools::getValue('discount_value'); + $cartRuleObj->reduction_percent = $discount_value; elseif (Tools::getValue('discount_type') == 2) $cartRuleObj->reduction_amount = $cart_rule['value_tax_excl']; elseif (Tools::getValue('discount_type') == 3) From aefc22bb1000ec31fa4ddbbdfa2ba24a8d2dbe2a Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 17 Jun 2013 11:40:35 +0200 Subject: [PATCH 18/23] [-] BO : fixed quote issue with magic quote in customization in adminorders #PSCFV-9311 --- .../default/template/controllers/orders/form.tpl | 14 +++++++------- controllers/admin/AdminCartsController.php | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index ca178d9a5..3593e5cae 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -28,13 +28,13 @@ var changed_shipping_price = false; var shipping_price_selected_carrier = ''; var current_index = '{$current}&token={$token}'; - var admin_cart_link = '{$link->getAdminLink('AdminCarts')|escape:'html'}'; + var admin_cart_link = '{$link->getAdminLink('AdminCarts')|addslashes}'; var cart_quantity = new Array(); var currencies = new Array(); var id_currency = ''; var id_lang = ''; - var txt_show_carts = '{l s='Show carts and orders for this customer.'}'; - var txt_hide_carts = '{l s='Hide carts and orders for this customer.'}'; + var txt_show_carts = '{l s='Show carts and orders for this customer.' js='1'}'; + var txt_hide_carts = '{l s='Hide carts and orders for this customer.' js='1'}'; var defaults_order_state = new Array(); var customization_errors = false; var pic_dir = '{$pic_dir}'; @@ -661,17 +661,17 @@ { $.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() { var customized_desc = ''; - if(this.datas[1].length) + if (this.datas[1].length) { $.each(this.datas[1],function() { - customized_desc += this.name+':'+this.value+'
'; + customized_desc += this.name + ': ' + this.value + '
'; id_customization = this.id_customization; }); } - if(this.datas[0] && this.datas[0].length) + if (this.datas[0] && this.datas[0].length) { $.each(this.datas[0],function() { - customized_desc += this.name+':
'; + customized_desc += this.name + ':
'; id_customization = this.id_customization; }); } diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index e8ee17cef..b4c5bf35c 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -273,15 +273,15 @@ class AdminCartsControllerCore extends AdminController $field_id = 'customization_'.$id_product.'_'.$customization_field['id_customization_field']; if ($customization_field['type'] == Product::CUSTOMIZE_TEXTFIELD) { - if (!isset($_POST[$field_id]) || empty($_POST[$field_id])) + if (!Tools::getValue($field_id)) { if ($customization_field['required']) $errors[] = Tools::displayError('Please fill in all the required fields.'); continue; } - if (!Validate::isMessage($_POST[$field_id]) || empty($_POST[$field_id])) + if (!Validate::isMessage(Tools::getValue($field_id))) $errors[] = Tools::displayError('Invalid message'); - $this->context->cart->addTextFieldToProduct((int)$product->id, (int)$customization_field['id_customization_field'], Product::CUSTOMIZE_TEXTFIELD, $_POST[$field_id]); + $this->context->cart->addTextFieldToProduct((int)$product->id, (int)$customization_field['id_customization_field'], Product::CUSTOMIZE_TEXTFIELD, Tools::getValue($field_id)); } elseif ($customization_field['type'] == Product::CUSTOMIZE_FILE) { From 3f0fa3f925704a6d65f2131483ad4c7f862ef16a Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 17 Jun 2013 12:15:10 +0200 Subject: [PATCH 19/23] // Fixed warning --- classes/Tools.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 8e6c617b4..39027ed14 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1855,8 +1855,8 @@ exit; { $backtrace = debug_backtrace(); $callee = next($backtrace); - $error = 'Parameter '.$parameter.' in function '.(isset($callee['function']) ? $callee['function'] : '').'() is deprecated in '.$callee['file'].' on line '.(isset($callee['Line']) ? $callee['Line'] : '').'
'; - $message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.$callee['Line'].') is deprecated and will be removed in the next major version.'; + $error = 'Parameter '.$parameter.' in function '.(isset($callee['function']) ? $callee['function'] : '').'() is deprecated in '.$callee['file'].' on line '.(isset($callee['line']) ? $callee['line'] : '(undefined)').'
'; + $message = 'The parameter '.$parameter.' in function '.$callee['function'].' (Line '.(isset($callee['line']) ? $callee['line'] : 'undefined').') is deprecated and will be removed in the next major version.'; $class = isset($callee['class']) ? $callee['class'] : null; Tools::throwDeprecated($error, $message, $class); From d9245a31c8bc22ff8e3f209b36ca9ff068f2290c Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Mon, 17 Jun 2013 12:17:09 +0200 Subject: [PATCH 20/23] // Removed deprecated parameter in AdminCustomerThreads / displaydate --- controllers/admin/AdminCustomerThreadsController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index cc6ed3882..697d5dedb 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -549,7 +549,7 @@ class AdminCustomerThreadsControllerCore extends AdminController $orders_ok[] = $order; $total_ok += $order['total_paid_real']; } - $orders[$key]['date_add'] = Tools::displayDate($order['date_add'], $this->context->language->id); + $orders[$key]['date_add'] = Tools::displayDate($order['date_add']); $orders[$key]['total_paid_real'] = Tools::displayPrice($order['total_paid_real'], new Currency((int)$order['id_currency'])); } } @@ -557,7 +557,7 @@ class AdminCustomerThreadsControllerCore extends AdminController $products = $customer->getBoughtProducts(); if ($products && count($products)) foreach ($products as $key => $product) - $products[$key]['date_add'] = Tools::displayDate($product['date_add'],null , true); + $products[$key]['date_add'] = Tools::displayDate($product['date_add'], null, true); } foreach ($messages as $key => $message) @@ -595,7 +595,7 @@ class AdminCustomerThreadsControllerCore extends AdminController if (!empty($message['id_product']) && empty($message['employee_name'])) $id_order_product = Order::getIdOrderProduct((int)$message['id_customer'], (int)$message['id_product']); } - $message['date_add'] = Tools::displayDate($message['date_add'],null , true); + $message['date_add'] = Tools::displayDate($message['date_add'], null, true); $message['user_agent'] = strip_tags($message['user_agent']); $message['message'] = preg_replace( '/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', From 8fabee091b5e85314c44476fba1f46b6f8bccedb Mon Sep 17 00:00:00 2001 From: sLorenzini Date: Mon, 17 Jun 2013 16:35:16 +0200 Subject: [PATCH 21/23] [-] FO: Fixed bug PrestaShop 1.5.4.1 Catalog Mode Display Incorrect Header (mis-aligned) - #PSCFV-9327 --- modules/blockuserinfo/blockuserinfo.css | 5 +++++ modules/blockuserinfo/blockuserinfo.tpl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/blockuserinfo/blockuserinfo.css b/modules/blockuserinfo/blockuserinfo.css index f44c05094..0e8984980 100644 --- a/modules/blockuserinfo/blockuserinfo.css +++ b/modules/blockuserinfo/blockuserinfo.css @@ -6,6 +6,11 @@ margin-top:8px; } +#header_right #header_user.header_user_catalog { + margin-top: 15px; + min-height: 60px; +} + #header_user #header_nav { list-style-type:none; float:right; diff --git a/modules/blockuserinfo/blockuserinfo.tpl b/modules/blockuserinfo/blockuserinfo.tpl index aa2a6c1b7..fd1e4b46b 100644 --- a/modules/blockuserinfo/blockuserinfo.tpl +++ b/modules/blockuserinfo/blockuserinfo.tpl @@ -24,7 +24,7 @@ *} -
+
    {if !$PS_CATALOG_MODE}
  • From aea53e034aa316a21a6b755434a32e5e9783e54d Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 17 Jun 2013 18:27:07 +0200 Subject: [PATCH 22/23] [*] BO : Enable current subtab active class --- admin-dev/themes/default/template/header.tpl | 2 +- classes/controller/AdminController.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/default/template/header.tpl b/admin-dev/themes/default/template/header.tpl index dc80e8831..f262f39cc 100644 --- a/admin-dev/themes/default/template/header.tpl +++ b/admin-dev/themes/default/template/header.tpl @@ -204,7 +204,7 @@ diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index df0e25e39..98546450d 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1335,11 +1335,13 @@ class AdminControllerCore extends Controller foreach ($sub_tabs as $index2 => $sub_tab) { // class_name is the name of the class controller - if (Tab::checkTabRights($sub_tab['id_tab']) === true - && (bool)$sub_tab['active']) + if (Tab::checkTabRights($sub_tab['id_tab']) === true && (bool)$sub_tab['active']) + { $sub_tabs[$index2]['href'] = $this->context->link->getAdminLink($sub_tab['class_name']); + $sub_tabs[$index2]['current'] = ($sub_tab['class_name'].'Controller' == get_class($this)); + } else - unset($sub_tabs[$index2]); + unset($sub_tabs[$index2]); } $tabs[$index]['sub_tabs'] = $sub_tabs; From c5069aaa156797a5b5087f57c4a43be62930d880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 17 Jun 2013 18:56:09 +0200 Subject: [PATCH 23/23] [-] WS: Fix accessories duplication on product update --- classes/Product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/Product.php b/classes/Product.php index 1354df139..28189ded4 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -4565,6 +4565,7 @@ class ProductCore extends ObjectModel */ public function setWsAccessories($accessories) { + $this->deleteAccessories(); foreach ($accessories as $accessory) Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'accessory` (`id_product_1`, `id_product_2`) VALUES ('.(int)$this->id.', '.(int)$accessory['id'].')');