From 481cb5c28a2f80f8be9d1e04035cae415d7054af Mon Sep 17 00:00:00 2001 From: Zollner Robert Date: Fri, 4 Oct 2013 23:30:24 +0300 Subject: [PATCH 001/186] [-] BO : Fixed Bug what displayed Dashboard sales statistics in wrong currency --- controllers/admin/AdminHomeController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php index 45797273e..279ce6d32 100644 --- a/controllers/admin/AdminHomeController.php +++ b/controllers/admin/AdminHomeController.php @@ -303,7 +303,7 @@ class AdminHomeControllerCore extends AdminController public function getMonthlyStatistics() { - $currency = Tools::setCurrency($this->context->cookie); + $currency = Tools::setCurrency(NULL); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT IFNULL(SUM(`total_paid_real` / conversion_rate), "0") as total_sales, COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` @@ -400,7 +400,7 @@ class AdminHomeControllerCore extends AdminController $chart->getCurve(1)->setPoint(strtotime($row['invoice_date'].' 02:00:00'), $row['total_converted']); $chart->setSize(580, 170); $chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd'); - $currency = Tools::setCurrency($this->context->cookie); + $currency = Tools::setCurrency(NULL); $chart->getCurve(1)->setLabel($this->l('Sales + Tax').' ('.strtoupper($currency->iso_code).')'); $content .= $chart->fetch(); From 1787923c4c20b2d6c809ac271d65fc0a5e653b2f Mon Sep 17 00:00:00 2001 From: Zollner Robert Date: Sat, 5 Oct 2013 00:42:29 +0300 Subject: [PATCH 002/186] [-] BO : Fixed Bug what displayed Dashboard sales statistics in wrong currency (changed NULL to lowercase) --- controllers/admin/AdminHomeController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php index 279ce6d32..d923c051c 100644 --- a/controllers/admin/AdminHomeController.php +++ b/controllers/admin/AdminHomeController.php @@ -303,7 +303,7 @@ class AdminHomeControllerCore extends AdminController public function getMonthlyStatistics() { - $currency = Tools::setCurrency(NULL); + $currency = Tools::setCurrency(null); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT IFNULL(SUM(`total_paid_real` / conversion_rate), "0") as total_sales, COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` @@ -400,7 +400,7 @@ class AdminHomeControllerCore extends AdminController $chart->getCurve(1)->setPoint(strtotime($row['invoice_date'].' 02:00:00'), $row['total_converted']); $chart->setSize(580, 170); $chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd'); - $currency = Tools::setCurrency(NULL); + $currency = Tools::setCurrency(null); $chart->getCurve(1)->setLabel($this->l('Sales + Tax').' ('.strtoupper($currency->iso_code).')'); $content .= $chart->fetch(); From 30adb0932da79aae9700e280f3970292e6d2e95d Mon Sep 17 00:00:00 2001 From: Zollner Robert Date: Mon, 7 Oct 2013 23:42:26 +0300 Subject: [PATCH 003/186] [-] BO : pass correct typed parameter to setCurrency --- controllers/admin/AdminHomeController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php index d923c051c..50fa95051 100644 --- a/controllers/admin/AdminHomeController.php +++ b/controllers/admin/AdminHomeController.php @@ -303,7 +303,7 @@ class AdminHomeControllerCore extends AdminController public function getMonthlyStatistics() { - $currency = Tools::setCurrency(null); + $currency = Tools::setCurrency((object)array('id_currency' => null)); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' SELECT IFNULL(SUM(`total_paid_real` / conversion_rate), "0") as total_sales, COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` @@ -400,7 +400,7 @@ class AdminHomeControllerCore extends AdminController $chart->getCurve(1)->setPoint(strtotime($row['invoice_date'].' 02:00:00'), $row['total_converted']); $chart->setSize(580, 170); $chart->setTimeMode(strtotime('-7 DAYS', time()), time(), 'd'); - $currency = Tools::setCurrency(null); + $currency = Tools::setCurrency((object)array('id_currency' => null)); $chart->getCurve(1)->setLabel($this->l('Sales + Tax').' ('.strtoupper($currency->iso_code).')'); $content .= $chart->fetch(); From ae7d33effe1dd13b789d2b30db63991dcea65960 Mon Sep 17 00:00:00 2001 From: Krystian Podemski Date: Tue, 8 Oct 2013 11:11:24 +0200 Subject: [PATCH 004/186] [*] CORE: Add phone_mobile to address format I honestly do not know why you decided by default to show only the first field of the phone :) Users often ask me why they don't see their mobile phone on orders in BO. --- install-dev/data/xml/address_format.xml | 732 ++++++++++++++++-------- 1 file changed, 488 insertions(+), 244 deletions(-) diff --git a/install-dev/data/xml/address_format.xml b/install-dev/data/xml/address_format.xml index fd195888b..68c7ed274 100644 --- a/install-dev/data/xml/address_format.xml +++ b/install-dev/data/xml/address_format.xml @@ -13,7 +13,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -23,7 +24,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -33,7 +35,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -42,7 +45,8 @@ address1 address2 city State:name postcode Country:name -phone +phone +phone_mobile firstname lastname @@ -52,7 +56,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -62,7 +67,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -72,7 +78,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -82,7 +89,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -92,7 +100,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -103,7 +112,8 @@ address2 postcode city State:name Country:name -phone +phone +phone_mobile firstname lastname @@ -114,7 +124,8 @@ address2 postcode city State:name Country:name -phone +phone +phone_mobile firstname lastname @@ -124,7 +135,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -134,7 +146,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -144,7 +157,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -154,7 +168,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -164,7 +179,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -174,7 +190,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -184,7 +201,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -194,7 +212,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -204,7 +223,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -212,7 +232,8 @@ company address1 address2 city, State:name postcode Country:name -phone +phone +phone_mobile firstname lastname @@ -222,7 +243,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -232,7 +254,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -242,7 +265,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -252,7 +276,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -262,7 +287,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -272,7 +298,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -282,7 +309,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -292,7 +320,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -302,7 +331,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -312,7 +342,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -322,7 +353,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -332,7 +364,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -342,7 +375,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -352,7 +386,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -362,7 +397,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -372,7 +408,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -382,7 +419,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -392,7 +430,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -402,7 +441,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -412,7 +452,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -422,7 +463,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -432,7 +474,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -443,7 +486,8 @@ address2 postcode city State:name Country:name -phone +phone +phone_mobile firstname lastname @@ -453,7 +497,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -463,7 +508,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -473,7 +519,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -483,7 +530,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -493,7 +541,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -503,7 +552,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -513,7 +563,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -523,7 +574,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -533,7 +585,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -543,7 +596,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -553,7 +607,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -563,7 +618,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -573,7 +629,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -583,7 +640,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -593,7 +651,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -603,7 +662,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -613,7 +673,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -623,7 +684,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -633,7 +695,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -643,7 +706,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -653,7 +717,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -663,7 +728,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -673,7 +739,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -683,7 +750,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -693,7 +761,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -703,7 +772,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -713,7 +783,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -723,7 +794,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -733,7 +805,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -743,7 +816,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -753,7 +827,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -763,7 +838,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -773,7 +849,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -783,7 +860,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -793,7 +871,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -803,7 +882,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -813,7 +893,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -823,7 +904,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -833,7 +915,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -843,7 +926,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -853,7 +937,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -863,7 +948,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -873,7 +959,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -883,7 +970,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -893,7 +981,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -903,7 +992,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -913,7 +1003,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -923,7 +1014,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -933,7 +1025,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -943,7 +1036,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -953,7 +1047,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -963,7 +1058,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -973,7 +1069,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -983,7 +1080,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -993,7 +1091,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1003,7 +1102,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1013,7 +1113,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1023,7 +1124,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1033,7 +1135,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1043,7 +1146,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1053,7 +1157,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1063,7 +1168,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1073,7 +1179,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1083,7 +1190,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1093,7 +1201,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1103,7 +1212,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1114,7 +1224,8 @@ address2 postcode city State:name Country:name -phone +phone +phone_mobile firstname lastname @@ -1124,7 +1235,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1134,7 +1246,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1144,7 +1257,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1154,7 +1268,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1164,7 +1279,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1174,7 +1290,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1184,7 +1301,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1194,7 +1312,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1204,7 +1323,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1214,7 +1334,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1224,7 +1345,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1234,7 +1356,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1244,7 +1367,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1254,7 +1378,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1264,7 +1389,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1274,7 +1400,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1284,7 +1411,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1294,7 +1422,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1304,7 +1433,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1314,7 +1444,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1324,7 +1455,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1334,7 +1466,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1344,7 +1477,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1354,7 +1488,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1364,7 +1499,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1374,7 +1510,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1384,7 +1521,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1394,7 +1532,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1404,7 +1543,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1414,7 +1554,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1424,7 +1565,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1434,7 +1576,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1444,7 +1587,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1455,7 +1599,8 @@ address2 postcode city State:name Country:name -phone +phone +phone_mobile firstname lastname @@ -1465,7 +1610,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1475,7 +1621,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1485,7 +1632,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1495,7 +1643,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1505,7 +1654,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1515,7 +1665,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1525,7 +1676,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1535,7 +1687,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1545,7 +1698,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1555,7 +1709,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1565,7 +1720,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1575,7 +1731,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1585,7 +1742,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1595,7 +1753,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1605,7 +1764,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1615,7 +1775,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1625,7 +1786,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1635,7 +1797,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1645,7 +1808,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1655,7 +1819,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1665,7 +1830,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1675,7 +1841,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1685,7 +1852,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1695,7 +1863,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1705,7 +1874,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1715,7 +1885,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1725,7 +1896,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1735,7 +1907,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1745,7 +1918,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1755,7 +1929,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1765,7 +1940,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1775,7 +1951,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1785,7 +1962,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1795,7 +1973,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1805,7 +1984,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1815,7 +1995,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1825,7 +2006,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1835,7 +2017,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1845,7 +2028,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1855,7 +2039,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1865,7 +2050,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1875,7 +2061,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1885,7 +2072,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1895,7 +2083,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1905,7 +2094,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1915,7 +2105,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1925,7 +2116,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1935,7 +2127,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1945,7 +2138,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1955,7 +2149,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1965,7 +2160,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1975,7 +2171,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1985,7 +2182,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -1995,7 +2193,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2005,7 +2204,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2015,7 +2215,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2025,7 +2226,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2035,7 +2237,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2045,7 +2248,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2055,7 +2259,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2065,7 +2270,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2075,7 +2281,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2085,7 +2292,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2095,7 +2303,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2105,7 +2314,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2115,7 +2325,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2125,7 +2336,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2135,7 +2347,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2145,7 +2358,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2155,7 +2369,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2165,7 +2380,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2175,7 +2391,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2185,7 +2402,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2195,7 +2413,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2205,7 +2424,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2215,7 +2435,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2225,7 +2446,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2235,7 +2457,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2245,7 +2468,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2255,7 +2479,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2265,7 +2490,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2275,7 +2501,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2285,7 +2512,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2295,7 +2523,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2305,7 +2534,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2315,7 +2545,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2325,7 +2556,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2335,7 +2567,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2345,7 +2578,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2355,7 +2589,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2365,7 +2600,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2375,7 +2611,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2385,7 +2622,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2395,7 +2633,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2405,7 +2644,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2415,7 +2655,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2425,7 +2666,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2435,7 +2677,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile firstname lastname @@ -2445,7 +2688,8 @@ address1 address2 postcode city Country:name -phone +phone +phone_mobile From 9d5a9225e502884f716b48914c44d5c535c85c69 Mon Sep 17 00:00:00 2001 From: Axome Date: Fri, 11 Oct 2013 18:17:55 +0200 Subject: [PATCH 005/186] Correct some "bad query" in the admin products getList Here the wrong Sql generated : SELECT SQL_CALC_FOUND_ROWS a.`id_product`,b.name as name,`reference`,a.price as price,a.active as active , MAX(i.id_image) id_image,cl.name `name_category` , a.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, a.`active` FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1) LEFT JOIN `ps_image` i ON (i.`id_product` = a.`id_product` AND i.cover=1)LEFT JOIN `ps_category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1) LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 ) WHERE 1 AND a.`active` = 0 GROUP BY a.id_product ORDER BY quantity desc LIMIT 0,50 'quantity' is ambigus (for the ORDER BY) --- classes/controller/AdminController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 9fcc3d66e..d202ccada 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2284,7 +2284,7 @@ class AdminControllerCore extends Controller (isset($this->_filter) ? $this->_filter : '').$where_shop.' '.(isset($this->_group) ? $this->_group.' ' : '').' '.$having_clause.' - ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). + ORDER BY '.(($order_by == $this->identifier || $order_by == 'quantity') ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : ''); @@ -3042,4 +3042,4 @@ class AdminControllerCore extends Controller return $return; } -} \ No newline at end of file +} From 85c6e799c36fa5a45ccddb70b2fa55aec79bc0b0 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Sat, 12 Oct 2013 11:33:36 +0200 Subject: [PATCH 006/186] [+] BO : AdminImport add entity Alias --- controllers/admin/AdminImportController.php | 75 ++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 58fa8f527..ffbf617b1 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -88,6 +88,7 @@ class AdminImportControllerCore extends AdminController $this->l('Addresses'), $this->l('Manufacturers'), $this->l('Suppliers'), + $this->l('Alias'), ); // @since 1.5.0 @@ -360,7 +361,6 @@ class AdminImportControllerCore extends AdminController 'postcode' => 'X' ); break; - case $this->entities[$this->l('Manufacturers')]: case $this->entities[$this->l('Suppliers')]: //Overwrite validators AS name is not MultiLangField @@ -392,6 +392,23 @@ class AdminImportControllerCore extends AdminController 'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')), ); break; + case $this->entities[$this->l('Alias')]: + //Overwrite required_fields + $this->required_fields = array( + 'alias', + 'search', + ); + $this->available_fields = array( + 'no' => array('label' => $this->l('Ignore this column')), + 'id' => array('label' => $this->l('ID')), + 'alias' => array('label' => $this->l('Alias *')), + 'search' => array('label' => $this->l('Search *')), + 'active' => array('label' => $this->l('Active')), + ); + self::$default_values = array( + 'active' => '1', + ); + break; } // @since 1.5.0 @@ -2435,6 +2452,56 @@ class AdminImportControllerCore extends AdminController $this->closeCsvFile($handle); } + public function aliasImport() + { + $this->receiveTab(); + $handle = $this->openCsvFile(); + AdminImportController::setLocale(); + for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) + { + if (Tools::getValue('convert')) + $line = $this->utf8EncodeArray($line); + $info = AdminImportController::getMaskedRow($line); + + AdminImportController::setDefaultValues($info); + + if (Tools::getValue('forceIDs') && isset($info['id']) && (int)$info['id']) + $alias = new Alias((int)$info['id']); + else + { + if (array_key_exists('id', $info) && (int)$info['id'] && Alias::existsInDatabase((int)$info['id'], 'alias')) + $alias = new Alias((int)$info['id']); + else + $alias = new Alias(); + } + + AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $alias); + + $res = false; + if (($field_error = $alias->validateFields(UNFRIENDLY_ERROR, true)) === true && + ($lang_field_error = $alias->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) + { + if ($alias->id && $alias->aliasExists($alias->id)) + $res = $alias->update(); + if (!$res) + $res = $alias->add(); + + if (!$res) + $this->errors[] = Db::getInstance()->getMsgError().' '.sprintf( + Tools::displayError('%1$s (ID: %2$s) cannot be saved'), + $info['name'], + (isset($info['id']) ? $info['id'] : 'null') + ); + } + else + { + $this->errors[] = $this->l('Alias is invalid').' ('.$alias->name.')'; + $this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : ''); + } + } + $this->closeCsvFile($handle); + } + /** * @since 1.5.0 */ @@ -2782,6 +2849,9 @@ class AdminImportControllerCore extends AdminController if (preg_match('/^[0-9]+(\-(.*))?\.jpg$/', $d)) unlink(_PS_SUPP_IMG_DIR_.$d); break; + case $this->entities[$this->l('Alias')]: + Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'alias`'); + break; } Image::clearTmpDir(); return true; @@ -2880,6 +2950,9 @@ class AdminImportControllerCore extends AdminController $this->supplierImport(); $this->clearSmartyCache(); break; + case $this->entities[$import_type = $this->l('Alias')]: + $this->aliasImport(); + break; } // @since 1.5.0 From 2afbe8fd04b3c3b43d75cea97db1f51cc31d7775 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Sat, 12 Oct 2013 11:39:29 +0200 Subject: [PATCH 007/186] Create alias_import.csv --- docs/csv_import/alias_import.csv | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/csv_import/alias_import.csv diff --git a/docs/csv_import/alias_import.csv b/docs/csv_import/alias_import.csv new file mode 100644 index 000000000..b64a435be --- /dev/null +++ b/docs/csv_import/alias_import.csv @@ -0,0 +1,3 @@ +id;Alias *;Search *;Active (0/1) +3;microsft,micro;microsoft;1 +4;adbe,adaub;adobe;1 From 4f9191fe0c037efa1066325d90e512590f38ed85 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Sat, 12 Oct 2013 11:45:07 +0200 Subject: [PATCH 008/186] Update form.tpl --- .../template/controllers/import/helpers/form/form.tpl | 9 +++++---- 1 file changed, 5 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 09a50329f..181508404 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 @@ -77,6 +77,7 @@
  • {l s='Sample Addresses file'}
  • {l s='Sample Manufacturers file'}
  • {l s='Sample Suppliers file'}
  • +
  • {l s='Sample Alias file'}
  • {if $PS_ADVANCED_STOCK_MANAGEMENT}
  • {l s='Supply Orders sample file'}
  • {l s='Supply Orders Details sample file'}
  • @@ -203,12 +204,12 @@ }); $("select#entity").change(function(){ - if ($("#entity > option:selected").val() == 7 || $("#entity > option:selected").val() == 8) + if ($("#entity > option:selected").val() == 8 || $("#entity > option:selected").val() == 9) $("label[for=truncate],#truncate").hide(); else $("label[for=truncate],#truncate").show(); - if ($("#entity > option:selected").val() == 8) + if ($("#entity > option:selected").val() == 9) { $(".import_supply_orders_details").show(); $('input[name=multiple_value_separator]').val('|'); @@ -226,7 +227,7 @@ $(".import_products_categories, label[for=regenerate], #regenerate").show(); else $(".import_products_categories, label[for=regenerate], #regenerate").hide(); - if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6) + if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6 || $("#entity > option:selected").val() == 7) $("label[for=forceIDs], #forceIDs").show(); else $("label[for=forceIDs], #forceIDs").hide(); @@ -260,4 +261,4 @@ }); }; }); - \ No newline at end of file + From 0a441b9a4b79cc191f52e36bbd168e6552764cac Mon Sep 17 00:00:00 2001 From: indesign47 Date: Sat, 12 Oct 2013 11:49:27 +0200 Subject: [PATCH 009/186] Update Alias.php --- classes/Alias.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/classes/Alias.php b/classes/Alias.php index b6fda0903..932495206 100644 --- a/classes/Alias.php +++ b/classes/Alias.php @@ -124,5 +124,21 @@ class AliasCore extends ObjectModel { return Configuration::get('PS_ALIAS_FEATURE_ACTIVE'); } + + /** + * This method is allow to know if a alias exist for AdminImportController + * @since 1.5.7 + * @return bool + */ + public static function aliasExists($id_alias) + { + $row = Db::getInstance()->getRow(' + SELECT `id_alias` + FROM '._DB_PREFIX_.'alias a + WHERE a.`id_alias` = '.(int)$id_alias + ); + + return isset($row['id_alias']); + } } From a10dcab6e74d138a2f3a3f558ec7d66b1e9d9e10 Mon Sep 17 00:00:00 2001 From: kiropowered Date: Sat, 12 Oct 2013 14:28:27 +0200 Subject: [PATCH 010/186] Update StockMvt.php Fix bug if product have attribute --- classes/stock/StockMvt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/stock/StockMvt.php b/classes/stock/StockMvt.php index 83bd79e08..2245cf648 100644 --- a/classes/stock/StockMvt.php +++ b/classes/stock/StockMvt.php @@ -236,7 +236,7 @@ class StockMvtCore extends ObjectModel $query->innerJoin('stock', 's', 's.id_stock = sm.id_stock'); $query->innerJoin('warehouse', 'w', 'w.id_warehouse = s.id_warehouse'); $query->where('sm.sign = 1'); - $query->where('s.id_product = '.(int)$id_product.' OR s.id_product_attribute = '.(int)$id_product_attribute); + $query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute); $query->orderBy('date_add DESC'); $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); From 8d7e96176c5744d3acbc265583cfab0c802f84aa Mon Sep 17 00:00:00 2001 From: ldecoker Date: Mon, 14 Oct 2013 09:38:04 +0200 Subject: [PATCH 011/186] SEO - make sure module and controller name are in lowercase For module controller, make sure that the name of the controller and the module are saved in lowercase. Otherwise the route will not be found in getModuleLink. --- classes/Meta.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Meta.php b/classes/Meta.php index 76933c88b..d5bcbd414 100644 --- a/classes/Meta.php +++ b/classes/Meta.php @@ -85,11 +85,11 @@ class MetaCore extends ObjectModel // Add modules controllers to list (this function is cool !) foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file) { - $filename = basename($file, '.php'); + $filename = strtolower(basename($file, '.php')); if ($filename == 'index') continue; - $module = basename(dirname(dirname(dirname($file)))); + $module = strtolower(basename(dirname(dirname(dirname($file))))); $selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename; } From a377ecd5717d3de2d38241add4521df302d9ff5d Mon Sep 17 00:00:00 2001 From: ldecoker Date: Mon, 14 Oct 2013 09:53:50 +0200 Subject: [PATCH 012/186] Update Meta.php Use strtolower from Tools class. --- classes/Meta.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Meta.php b/classes/Meta.php index d5bcbd414..4e911fe72 100644 --- a/classes/Meta.php +++ b/classes/Meta.php @@ -85,11 +85,11 @@ class MetaCore extends ObjectModel // Add modules controllers to list (this function is cool !) foreach (glob(_PS_MODULE_DIR_.'*/controllers/front/*.php') as $file) { - $filename = strtolower(basename($file, '.php')); + $filename = Tools::strtolower(basename($file, '.php')); if ($filename == 'index') continue; - $module = strtolower(basename(dirname(dirname(dirname($file))))); + $module = Tools::strtolower(basename(dirname(dirname(dirname($file))))); $selected_pages[$module.' - '.$filename] = 'module-'.$module.'-'.$filename; } From af9182dad549bc77bd26c4ca038a27e5daa0488a Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 10:51:17 +0200 Subject: [PATCH 013/186] [-] CORE , follow up https://github.com/kiropowered/PrestaShop/commit/b87e934a66a15d4f68e573f5afa9494505a60e28 and https://github.com/kiropowered/PrestaShop/commit/a10dcab6e74d138a2f3a3f558ec7d66b1e9d9e10 --- classes/stock/StockMvt.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/stock/StockMvt.php b/classes/stock/StockMvt.php index 2245cf648..de75d91aa 100644 --- a/classes/stock/StockMvt.php +++ b/classes/stock/StockMvt.php @@ -236,7 +236,10 @@ class StockMvtCore extends ObjectModel $query->innerJoin('stock', 's', 's.id_stock = sm.id_stock'); $query->innerJoin('warehouse', 'w', 'w.id_warehouse = s.id_warehouse'); $query->where('sm.sign = 1'); - $query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute); + if ($id_product_attribute) + $query->where('s.id_product = '.(int)$id_product.' AND s.id_product_attribute = '.(int)$id_product_attribute); + else + $query->where('s.id_product = '.(int)$id_product); $query->orderBy('date_add DESC'); $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); From 3bc02bbe1004717d532b9ed0820782ce1524b856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 14 Oct 2013 10:56:38 +0200 Subject: [PATCH 014/186] // fields are already correctly formated when they are in a object coming from the database --- controllers/admin/AdminProductsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 763938627..d6b44706c 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -367,9 +367,9 @@ class AdminProductsControllerCore extends AdminController { if (is_array($default_product->$field_name)) foreach ($default_product->$field_name as $key => $value) - $this->object->{$field_name}[$key] = ObjectModel::formatValue($value, $def['fields'][$field_name]['type']); + $this->object->{$field_name}[$key] = $value; else - $this->object->$field_name = ObjectModel::formatValue($default_product->$field_name, $def['fields'][$field_name]['type']); + $this->object->$field_name = $default_product->$field_name; } } $this->object->loadStockData(); From 3282bd19e41b30bf1c338037a969b24c54a697cd Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Mon, 14 Oct 2013 10:59:20 +0200 Subject: [PATCH 015/186] // Small fix --- classes/helper/HelperList.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 6d9bd6cb8..8f2ed09f0 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -444,13 +444,13 @@ class HelperListCore extends Helper self::$cache_lang['Delete'] = $this->l('Delete', 'Helper'); if (!array_key_exists('DeleteItem', self::$cache_lang)) - self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', false, false); + self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper', true, false); if (!array_key_exists('Name', self::$cache_lang)) - self::$cache_lang['Name'] = $this->l('Name:', 'Helper', false, false); + self::$cache_lang['Name'] = $this->l('Name:', 'Helper', true, false); if (!is_null($name)) - $name = '\n\n'.self::$cache_lang['Name'].' '.$name; + $name = addcslashes('\n\n'.self::$cache_lang['Name'].' '.$name, '\''); $data = array( $this->identifier => $id, @@ -459,7 +459,7 @@ class HelperListCore extends Helper ); if ($this->specificConfirmDelete !== false) - $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(addcslashes(self::$cache_lang['DeleteItem'].$name, '\'')); + $data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : Tools::safeOutput(self::$cache_lang['DeleteItem'].$name); $tpl->assign(array_merge($this->tpl_delete_link_vars, $data)); From 5e407db21e3e30a1a5fa94b9558314ffa21af407 Mon Sep 17 00:00:00 2001 From: djfm Date: Mon, 14 Oct 2013 09:30:45 +0000 Subject: [PATCH 016/186] [*] LO : Fixed a few bugs with currency formats in Back-Office orders --- admin-dev/themes/default/template/controllers/orders/form.tpl | 4 ++-- controllers/admin/AdminCartsController.php | 2 ++ js/tools.js | 2 +- themes/default/js/tools.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 34a5d7cec..6e4597092 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -656,11 +656,11 @@ var id_product = Number(this.id_product); var id_product_attribute = Number(this.id_product_attribute); cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity; - cart_content += ''+this.name+'
    '+this.attributes_small+''+this.reference+''; + cart_content += ''+this.name+'
    '+this.attributes_small+''+this.reference+''; cart_content += (!this.id_customization ? '

    ' : ''); cart_content += (!this.id_customization ? '
    ' : ''); cart_content += (!this.id_customization ? '
    ' : ''); - cart_content += '' + formatCurrency(parseFloat(this.total.replace(',', '.')), currency_format, currency_sign, currency_blank) + ''; + cart_content += '' + formatCurrency(this.numeric_total, currency_format, currency_sign, currency_blank) + ''; if (this.id_customization && this.id_customization != 0) { diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 309c37e40..517934d9a 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -551,6 +551,8 @@ class AdminCartsControllerCore extends AdminController if (count($summary['products'])) foreach ($summary['products'] as &$product) { + $product['numeric_price'] = $product['price']; + $product['numeric_total'] = $product['total']; $product['price'] = str_replace($currency->sign, '', Tools::displayPrice($product['price'], $currency)); $product['total'] = str_replace($currency->sign, '', Tools::displayPrice($product['total'], $currency)); $product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small_default'); diff --git a/js/tools.js b/js/tools.js index 4da024b8c..276eaf27c 100644 --- a/js/tools.js +++ b/js/tools.js @@ -73,7 +73,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank) if (currencyFormat == 4) return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign); if (currencyFormat == 5) - return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign); + return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.')); return price; } diff --git a/themes/default/js/tools.js b/themes/default/js/tools.js index 4215f7a88..7b670168c 100644 --- a/themes/default/js/tools.js +++ b/themes/default/js/tools.js @@ -95,7 +95,7 @@ function formatCurrency(price, currencyFormat, currencySign, currencyBlank) if (currencyFormat == 4) return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign); if (currencyFormat == 5) - return (formatNumber(price, priceDisplayPrecision, ' ', '.') + blank + currencySign); + return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.')); return price; } From 1358c696cdf34b5ff38f1f7c676a38c1f5b44eb8 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 11:37:15 +0200 Subject: [PATCH 017/186] [-] BO : Fix #PSCFV-10678 warning in chrome --- .../controllers/orders/_print_pdf_icon.tpl | 4 +-- .../controllers/orders/helpers/view/view.tpl | 28 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl b/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl index f88070aa3..d2cba5c83 100644 --- a/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl @@ -26,7 +26,7 @@ {* Generate HTML code for printing Invoice Icon with link *} {if ($order_state->invoice || $order->invoice_number)} - invoice + invoice {else} - {/if} @@ -35,7 +35,7 @@ {* Generate HTML code for printing Delivery Icon with link *} {if ($order_state->delivery || $order->delivery_number)} - delivery + delivery {else} - {/if} 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 af01d0657..2809e5043 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 @@ -65,7 +65,7 @@
    {if (count($invoices_collection))} - + {l s='View invoice'} {l s='View invoice'} {else} @@ -73,7 +73,7 @@ {/if} | {if (($currentState && $currentState->delivery) || $order->delivery_number)} - + {l s='View delivery slip'} {l s='View delivery slip'} {else} @@ -124,10 +124,10 @@ - - - - + + + + {foreach from=$history item=row key=key} {if ($key == 0)} @@ -299,12 +299,12 @@
    - - - - - - + + + + + + @@ -787,8 +787,6 @@ {/if} - -
     


    {l s='Back to list'}
    -{/block} +{/block} \ No newline at end of file From 2a54296b962a22edd171c090749dfcb4c62d007d Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 12:11:47 +0200 Subject: [PATCH 018/186] [-] BO : Fix bug #PSCFV-10692, AdminImport bad utf8 cars for subst --- controllers/admin/AdminImportController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 58fa8f527..0bf22ae51 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -455,8 +455,8 @@ class AdminImportControllerCore extends AdminController } - $this->separator = substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1); - $this->multiple_value_separator = substr(strval(trim(Tools::getValue('multiple_value_separator', ','))), 0, 1); + $this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1); + $this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ','))), 0, 1); parent::__construct(); } @@ -632,7 +632,7 @@ class AdminImportControllerCore extends AdminController $html .= ''; foreach ($line as $nb_c => $column) if ((MAX_COLUMNS * (int)$current_table <= $nb_c) && ((int)$nb_c < MAX_COLUMNS * ((int)$current_table + 1))) - $html .= ''; + $html .= ''; $html .= ''; } $html .= '
    '.htmlentities(substr($column, 0, 200), ENT_QUOTES, 'UTF-8').''.htmlentities(Tools::substr($column, 0, 200), ENT_QUOTES, 'UTF-8').'
    '; @@ -2111,7 +2111,7 @@ class AdminImportControllerCore extends AdminController $country->active = 1; $country->name = AdminImportController::createMultiLangField($address->country); $country->id_zone = 0; // Default zone for country to create - $country->iso_code = strtoupper(substr($address->country, 0, 2)); // Default iso for country to create + $country->iso_code = Tools::strtoupper(Tools::substr($address->country, 0, 2)); // Default iso for country to create $country->contains_states = 0; // Default value for country to create $lang_field_error = $country->validateFieldsLang(UNFRIENDLY_ERROR, true); if (($field_error = $country->validateFields(UNFRIENDLY_ERROR, true)) === true && @@ -2142,7 +2142,7 @@ class AdminImportControllerCore extends AdminController $state->name = $address->state; $state->id_country = isset($country->id) ? (int)$country->id : 0; $state->id_zone = 0; // Default zone for state to create - $state->iso_code = strtoupper(substr($address->state, 0, 2)); // Default iso for state to create + $state->iso_code = Tools::strtoupper(Tools::substr($address->state, 0, 2)); // Default iso for state to create $state->tax_behavior = 0; if (($field_error = $state->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $state->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && $state->add()) From f8edca8ac8e6c470eaf0f5270ace0577bae5819d Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 13:59:19 +0200 Subject: [PATCH 019/186] [-] IN : Fix bug #PSCFV-10539 duplicate "address" url rewrite in meta.xml for Russian --- install-dev/langs/ru/data/meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-dev/langs/ru/data/meta.xml b/install-dev/langs/ru/data/meta.xml index f53ef2f4a..7c86b7653 100755 --- a/install-dev/langs/ru/data/meta.xml +++ b/install-dev/langs/ru/data/meta.xml @@ -70,7 +70,7 @@ Адреса - address + addresses Аутентификация From c6e3e28894063d4fafb4e8366a135fd1ba01e155 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 14:20:11 +0200 Subject: [PATCH 020/186] [-] FO : Fix bug #PSCFV-10690 could not index a category beacause of robot.txt --- controllers/admin/AdminMetaController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index 9fad901c9..44cdf9ddd 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -393,7 +393,7 @@ class AdminMetaControllerCore extends AdminController { fwrite($write_fd, "# Private pages\n"); foreach ($this->rb_data['GB'] as $gb) - fwrite($write_fd, 'Disallow: /*'.$gb."\n"); + fwrite($write_fd, 'Disallow: */'.$gb."\n"); } // Directories @@ -401,7 +401,7 @@ class AdminMetaControllerCore extends AdminController { fwrite($write_fd, "# Directories\n"); foreach ($this->rb_data['Directories'] as $dir) - fwrite($write_fd, 'Disallow: /*'.$dir."\n"); + fwrite($write_fd, 'Disallow: */'.$dir."\n"); } // Files @@ -410,7 +410,7 @@ class AdminMetaControllerCore extends AdminController fwrite($write_fd, "# Files\n"); foreach ($this->rb_data['Files'] as $iso_code => $files) foreach ($files as $file) - fwrite($write_fd, 'Disallow: /*'.$iso_code.'/'.$file."\n"); + fwrite($write_fd, 'Disallow: */'.$iso_code.'/'.$file."\n"); } // Sitemap From 50002ec71431157507af902623e2680db1a47f80 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 14:23:26 +0200 Subject: [PATCH 021/186] [-] FO : Fix #PSCFV-10690 again, change just on directories --- controllers/admin/AdminMetaController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index 44cdf9ddd..0d0bb10be 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -393,7 +393,7 @@ class AdminMetaControllerCore extends AdminController { fwrite($write_fd, "# Private pages\n"); foreach ($this->rb_data['GB'] as $gb) - fwrite($write_fd, 'Disallow: */'.$gb."\n"); + fwrite($write_fd, 'Disallow: /*'.$gb."\n"); } // Directories @@ -410,7 +410,7 @@ class AdminMetaControllerCore extends AdminController fwrite($write_fd, "# Files\n"); foreach ($this->rb_data['Files'] as $iso_code => $files) foreach ($files as $file) - fwrite($write_fd, 'Disallow: */'.$iso_code.'/'.$file."\n"); + fwrite($write_fd, 'Disallow: /*'.$iso_code.'/'.$file."\n"); } // Sitemap From 80f6f4e223c0596b5604b43ff09b594bd9eb236f Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 15:34:47 +0200 Subject: [PATCH 022/186] [-] FO : Fix bug #PSCFV-10688, bad priceDisplay in order-carrier --- themes/default/order-carrier.tpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/themes/default/order-carrier.tpl b/themes/default/order-carrier.tpl index aac6efad1..9a8f40adc 100644 --- a/themes/default/order-carrier.tpl +++ b/themes/default/order-carrier.tpl @@ -171,10 +171,13 @@
    {if $option.total_price_with_tax && (!isset($free_shipping) || (isset($free_shipping) && !$free_shipping))} + {if $use_taxes == 1} - {convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'} - {else} - {convertPrice price=$option.total_price_without_tax} {l s='(tax excl.)'} + {if $priceDisplay == 1} + {convertPrice price=$option.total_price_without_tax} {l s='(tax excl.)'} + {else} + {convertPrice price=$option.total_price_with_tax} {l s='(tax incl.)'} + {/if} {/if} {else} {l s='Free'} From cc8ec4fd4583d6439a47292e43f45ed451aa141b Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 14 Oct 2013 16:03:50 +0200 Subject: [PATCH 023/186] [-] CORE : Fix bug #PSCFV-10687 bad conversion for accentuated Y and W, thanks @mike15 --- classes/Tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Tools.php b/classes/Tools.php index 4a750e577..849877423 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1162,7 +1162,7 @@ class ToolsCore $replacements = array( 'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe', - 'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE' + 'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'W', 'Y', 'Z', 'AE', 'OE' ); return preg_replace($patterns, $replacements, $str); From 6f4b85430cb77ca53ae6145007de9f5d9431c426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 14 Oct 2013 18:52:48 +0200 Subject: [PATCH 024/186] // Fix listings and sort --- classes/controller/AdminController.php | 2 +- classes/helper/HelperList.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index d202ccada..8ec50408e 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2284,7 +2284,7 @@ class AdminControllerCore extends Controller (isset($this->_filter) ? $this->_filter : '').$where_shop.' '.(isset($this->_group) ? $this->_group.' ' : '').' '.$having_clause.' - ORDER BY '.(($order_by == $this->identifier || $order_by == 'quantity') ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). + ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : ''); diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index 8f2ed09f0..001e24a65 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -513,7 +513,7 @@ class HelperListCore extends Helper if (Tools::getIsset($this->table.'Orderby')) $order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay)); - $action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table; + $action = $this->currentIndex.$identifier.'&token='.$token.'#'.$this->table; /* Determine current page number */ $page = (int)Tools::getValue('submitFilter'.$this->list_id); From f25a41878503bd00ae50cb230da1d500b755e82f Mon Sep 17 00:00:00 2001 From: indesign47 Date: Mon, 14 Oct 2013 19:20:38 +0200 Subject: [PATCH 025/186] Update Alias.php --- classes/Alias.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Alias.php b/classes/Alias.php index 932495206..386aa741d 100644 --- a/classes/Alias.php +++ b/classes/Alias.php @@ -127,7 +127,7 @@ class AliasCore extends ObjectModel /** * This method is allow to know if a alias exist for AdminImportController - * @since 1.5.7 + * @since 1.5.6.0 * @return bool */ public static function aliasExists($id_alias) From fd2dc4ff64551dae6c78daecca5f4c8f1f550209 Mon Sep 17 00:00:00 2001 From: Francois Gaillard Date: Tue, 15 Oct 2013 09:14:49 +0200 Subject: [PATCH 026/186] [-] Classes : Modules listing and case insensitive --- classes/module/Module.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/classes/module/Module.php b/classes/module/Module.php index 9ddea6f73..e190ff30a 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -1234,11 +1234,7 @@ abstract class ModuleCore $module->interest = 0; } - usort($module_list, create_function('$a,$b', ' - if ($a->displayName == $b->displayName) - return 0; - return ($a->displayName < $b->displayName) ? -1 : 1; - ')); + usort($module_list, create_function('$a,$b', 'return strnatcasecmp($a->displayName, $b->displayName);')); if ($errors) { From 9c861642a5dcd0719a58c01b7b88694b5c9fa6fd Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 15 Oct 2013 10:09:16 +0200 Subject: [PATCH 027/186] [-] BO : AdminImport, wrong default separators --- controllers/admin/AdminImportController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 0c315bad0..249f64276 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -472,8 +472,8 @@ class AdminImportControllerCore extends AdminController } - $this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ';'))), 0, 1); - $this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ','))), 0, 1); + $this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ','))), 0, 1); + $this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ';'))), 0, 1); parent::__construct(); } From 837ca34e7e2b7076dfc751fa079fa9e2441bc5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 15 Oct 2013 10:30:48 +0200 Subject: [PATCH 028/186] [-] Core: Product::getPriceStatic called with 1 quantity return the specific price for 1 qty if called with id_cart = 0 --- classes/SpecificPrice.php | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index 11e67f1f5..0db0c487e 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -94,7 +94,7 @@ class SpecificPriceCore extends ObjectModel if (parent::add($autodate, $nullValues)) { // Flush cache when we adding a new specific price - self::$_specificPriceCache = array(); + SpecificPrice::$_specificPriceCache = array(); Product::flushPriceCache(); // Set cache of feature detachable to true Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', '1'); @@ -108,7 +108,7 @@ class SpecificPriceCore extends ObjectModel if (parent::update($null_values)) { // Flush cache when we updating a new specific price - self::$_specificPriceCache = array(); + SpecificPrice::$_specificPriceCache = array(); Product::flushPriceCache(); return true; } @@ -120,7 +120,7 @@ class SpecificPriceCore extends ObjectModel if (parent::delete()) { // Flush cache when we deletind a new specific price - self::$_specificPriceCache = array(); + SpecificPrice::$_specificPriceCache = array(); Product::flushPriceCache(); // Refresh cache of feature detachable Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table'])); @@ -180,9 +180,9 @@ class SpecificPriceCore extends ObjectModel if (!SpecificPrice::isFeatureActive()) return explode(';', Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES')); - if (!isset(self::$_cache_priorities[(int)$id_product])) + if (!isset(SpecificPrice::$_cache_priorities[(int)$id_product])) { - self::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' + SpecificPrice::$_cache_priorities[(int)$id_product] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT `priority`, `id_specific_price_priority` FROM `'._DB_PREFIX_.'specific_price_priority` WHERE `id_product` = '.(int)$id_product.' @@ -190,7 +190,7 @@ class SpecificPriceCore extends ObjectModel '); } - $priority = self::$_cache_priorities[(int)$id_product]; + $priority = SpecificPrice::$_cache_priorities[(int)$id_product]; if (!$priority) $priority = Configuration::get('PS_SPECIFIC_PRICE_PRIORITIES'); @@ -209,11 +209,11 @@ class SpecificPriceCore extends ObjectModel */ $key = ((int)$id_product.'-'.(int)$id_shop.'-'.(int)$id_currency.'-'.(int)$id_country.'-'.(int)$id_group.'-'.(int)$quantity.'-'.(int)$id_product_attribute.'-'.(int)$id_cart.'-'.(int)$id_customer.'-'.(int)$real_quantity); - if (!array_key_exists($key, self::$_specificPriceCache)) + if (!array_key_exists($key, SpecificPrice::$_specificPriceCache)) { $now = date('Y-m-d H:i:s'); - self::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' - SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).' + $query = ' + SELECT *, '.SpecificPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer).' FROM `'._DB_PREFIX_.'specific_price` WHERE `id_product` IN (0, '.(int)$id_product.') AND `id_product_attribute` IN (0, '.(int)$id_product_attribute.') @@ -228,11 +228,22 @@ class SpecificPriceCore extends ObjectModel AND (`to` = \'0000-00-00 00:00:00\' OR \''.$now.'\' <= `to`) ) - AND id_cart IN (0, '.(int)$id_cart.')'. - (($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) ? ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')' : 'AND `from_quantity` <= '.max(1, (int)$real_quantity)).' - ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC'); + AND id_cart IN (0, '.(int)$id_cart.') '; + + if ($real_quantity != 0 && !Configuration::get('PS_QTY_DISCOUNT_ON_COMBINATION')) + $query .= ' AND IF(`from_quantity` > 1, `from_quantity`, 0) <= IF(id_product_attribute=0,'.(int)$quantity.' ,'.(int)$real_quantity.')'; + else + { + $qty_to_use = $id_cart ? (int)$quantity : (int)$real_quantity; + $query .= 'AND `from_quantity` <= '.max(1, $qty_to_use); + } + + $query .= ' ORDER BY `id_product_attribute` DESC, `from_quantity` DESC, `id_specific_price_rule` ASC, `score` DESC'; + + SpecificPrice::$_specificPriceCache[$key] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($query); + } - return self::$_specificPriceCache[$key]; + return SpecificPrice::$_specificPriceCache[$key]; } public static function setPriorities($priorities) From 81497be5ab1e7408c8c56713d16abdafb7df6b7e Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 15 Oct 2013 14:53:44 +0200 Subject: [PATCH 029/186] [-] Fo : Fix bug #PSCFV-10640, redirect loop when country address is not among active countries in OPC --- controllers/front/ParentOrderController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 15d8e4289..097aa2f7d 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -464,8 +464,17 @@ class ParentOrderControllerCore extends FrontController { $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById($address->id); - if (!Address::isCountryActiveById((int)($this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)($this->context->cart->id_address_invoice))) - Tools::redirect('index.php?controller=order&step=1'); + $bad_delivery = false; + if ($bad_delivery = !Address::isCountryActiveById((int)$this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) + { + if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc') + { + $back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, array('step' => Tools::getValue('step'), 'multi-shipping' => (int)Tools::getValue('multi-shipping'))); + $params = array('multi-shipping' => (int)Tools::getValue('multi-shipping'), 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice), 'back' => $back_url); + Tools::redirect($this->context->link->getPageLink('address', true, (int)$this->context->language->id, $params)); + } + Tools::redirect('index.php?controller=order&step=1'); + } $carriers = $this->context->cart->simulateCarriersOutput(); $checked = $this->context->cart->simulateCarrierSelectedOutput(); $delivery_option_list = $this->context->cart->getDeliveryOptionList(); From 7ae9832992fec88f80b30f18b6c4b7ffbdb4b1e2 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 15 Oct 2013 14:56:25 +0200 Subject: [PATCH 030/186] // small cast --- controllers/front/ParentOrderController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index 097aa2f7d..f3cf226d0 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -465,7 +465,7 @@ class ParentOrderControllerCore extends FrontController $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById($address->id); $bad_delivery = false; - if ($bad_delivery = !Address::isCountryActiveById((int)$this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) + if ($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) { if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc') { From 237b950eb6c8e054108ba437d668be3576828dd7 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 15 Oct 2013 16:35:58 +0200 Subject: [PATCH 031/186] [-] FO : #PSCFV-10640 again, bad assignement --- controllers/front/ParentOrderController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index f3cf226d0..3262669cc 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -465,7 +465,7 @@ class ParentOrderControllerCore extends FrontController $address = new Address($this->context->cart->id_address_delivery); $id_zone = Address::getZoneById($address->id); $bad_delivery = false; - if ($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) + if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || (!Address::isCountryActiveById((int)$this->context->cart->id_address_invoice))) { if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1 && Dispatcher::getInstance()->getController() != 'order-opc') { From 6ee538c710f5d1496af7a8b7faafd57d2370e9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 15 Oct 2013 19:53:59 +0200 Subject: [PATCH 032/186] // fix on ps_cleaner --- modules/pscleaner/pscleaner.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/pscleaner/pscleaner.php b/modules/pscleaner/pscleaner.php index 7f92c7be9..99915bcd2 100644 --- a/modules/pscleaner/pscleaner.php +++ b/modules/pscleaner/pscleaner.php @@ -151,7 +151,7 @@ class PSCleaner extends Module // Remove inexisting or monolanguage configuration value from configuration_lang $query = 'DELETE FROM `'._DB_PREFIX_.'configuration_lang` WHERE `id_configuration` NOT IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration`) - OR `id_configuration` IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration` WHERE name IS NOT NULL AND name != "")'; + OR `id_configuration` IN (SELECT `id_configuration` FROM `'._DB_PREFIX_.'configuration` WHERE name IS NULL OR name = "")'; if ($db->Execute($query)) if ($affected_rows = $db->Affected_Rows()) $logs[$query] = $affected_rows; @@ -300,8 +300,6 @@ class PSCleaner extends Module array('stock', 'id_warehouse', 'warehouse', 'id_warehouse'), array('stock', 'id_product', 'product', 'id_product'), array('stock_available', 'id_product', 'product', 'id_product'), - array('stock_available', 'id_shop', 'shop', 'id_shop'), - array('stock_available', 'id_shop_group', 'shop_group', 'id_shop_group'), array('stock_mvt', 'id_stock', 'stock', 'id_stock'), array('tab_module_preference', 'id_employee', 'employee', 'id_employee'), array('tab_module_preference', 'id_tab', 'tab', 'id_tab'), @@ -367,7 +365,13 @@ class PSCleaner extends Module if ($affected_rows = $db->Affected_Rows()) $logs[$query] = $affected_rows; } - + + // stock_available + $query = 'DELETE FROM `'._DB_PREFIX_.'stock_available` WHERE `id_shop` NOT IN (SELECT `id_shop` FROM `'._DB_PREFIX_.'shop`) AND `id_shop_group` NOT IN (SELECT `id_shop_group` FROM `'._DB_PREFIX_.'shop_group`)'; + if ($db->Execute($query)) + if ($affected_rows = $db->Affected_Rows()) + $logs[$query] = $affected_rows; + Category::regenerateEntireNtree(); // @Todo: Remove attachment files, images... From ad27dbe8d16614fd8864d325d27d3faf841bec2e Mon Sep 17 00:00:00 2001 From: MustangZhong Date: Wed, 16 Oct 2013 10:14:14 +0800 Subject: [PATCH 033/186] Update Cart.php The field "id_address_delivery" is missing in getWsCartRows. Since id_address_delivery is required in the web service field definition. --- classes/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Cart.php b/classes/Cart.php index d363905dd..f38015171 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -3219,7 +3219,7 @@ class CartCore extends ObjectModel public function getWsCartRows() { return Db::getInstance()->executeS(' - SELECT id_product, id_product_attribute, quantity + SELECT id_product, id_product_attribute, quantity, id_address_delivery FROM `'._DB_PREFIX_.'cart_product` WHERE id_cart = '.(int)$this->id.' AND id_shop = '.(int)Context::getContext()->shop->id ); From 3ba590504274a5efdb4930c1f9cb275faebe070e Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 16 Oct 2013 16:25:40 +0200 Subject: [PATCH 034/186] [-] BO : Could not order by reserved words like 'key' --- classes/controller/AdminController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 8ec50408e..aa184d885 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2284,7 +2284,7 @@ class AdminControllerCore extends Controller (isset($this->_filter) ? $this->_filter : '').$where_shop.' '.(isset($this->_group) ? $this->_group.' ' : '').' '.$having_clause.' - ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way). + ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way). ($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : ''). (($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : ''); From e4faa2bb7512f545a9549e6c887b292525f084dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 17 Oct 2013 10:28:14 +0200 Subject: [PATCH 035/186] [-] Core: Out of stock status should be setted after the first order history --- classes/PaymentModule.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 9d638ecd3..69520408e 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -536,6 +536,13 @@ abstract class PaymentModuleCore extends Module if ($order_status->logable) ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); + // Set the order state + $new_history = new OrderHistory(); + $new_history->id_order = (int)$order->id; + $new_history->changeIdOrderState((int)$id_order_state, $order, true); + $new_history->addWithemail(true, $extra_vars); + + // Switch to back order if needed if (Configuration::get('PS_STOCK_MANAGEMENT') && $order_detail->getStockState()) { $history = new OrderHistory(); @@ -544,13 +551,6 @@ abstract class PaymentModuleCore extends Module $history->addWithemail(); } - // Set order state in order history ONLY even if the "out of stock" status has not been yet reached - // So you migth have two order states - $new_history = new OrderHistory(); - $new_history->id_order = (int)$order->id; - $new_history->changeIdOrderState((int)$id_order_state, $order, true); - $new_history->addWithemail(true, $extra_vars); - unset($order_detail); // Order is reloaded because the status just changed From f1ea9ba5b44bd47467a1b944dc0b52a1ed8d5c90 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 17 Oct 2013 10:53:20 +0200 Subject: [PATCH 036/186] [-] BO : Fix bug #PSCFV-10709 rename root category with slashes in it --- .../template/helpers/form/form_category.tpl | 8 ++++---- classes/helper/Helper.php | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/admin-dev/themes/default/template/helpers/form/form_category.tpl b/admin-dev/themes/default/template/helpers/form/form_category.tpl index 55452b132..d7c255ccf 100644 --- a/admin-dev/themes/default/template/helpers/form/form_category.tpl +++ b/admin-dev/themes/default/template/helpers/form/form_category.tpl @@ -24,11 +24,11 @@ *} {if count($categories) && isset($categories)} @@ -90,6 +101,10 @@ $(document).ready(function() { submitFunction(); return false; }); + $('#invoice_address').click(function() { + bindCheckbox(); + }); + bindCheckbox(); }); function submitFunction() { @@ -140,6 +155,24 @@ $(document).ready(function() { } }); } + function bindCheckbox() + { + if ($('#invoice_address:checked').length > 0) + { + $('#opc_invoice_address').slideDown('slow'); + if ($('#company_invoice').val() == '') + $('#vat_number_block_invoice').hide(); + updateState('invoice'); + updateNeedIDNumber('invoice'); + updateZipCode('invoice'); +{/literal} + $('.id_state option[value={if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}]').prop('selected', true); + $('.id_state_invoice option[value={if isset($smarty.post.id_state_invoice)}{$smarty.post.id_state_invoice|intval}{/if}]').prop('selected', true); +{literal} + } + else + $('#opc_invoice_address').slideUp('slow'); + } {/literal} - {elseif $field_name eq "Country:name" || $field_name eq "country"} + {elseif $field_name eq "Country:name" || $field_name eq "country"}

    - {elseif $field_name eq "State:name"} + {elseif $field_name eq "State:name"} {assign var='stateExist' value=true}

    @@ -319,11 +357,6 @@ $(document).ready(function() {

    - {elseif $field_name eq "phone"} -

    - - -

    {/if} {/foreach} {if $stateExist eq false} @@ -340,19 +373,106 @@ $(document).ready(function() {

    {/if} +

    + + +

    - +

    + + +

    +
    - {$HOOK_CREATE_ACCOUNT_FORM}

    *{l s='Required field'} @@ -532,7 +652,7 @@ $(document).ready(function() {

    @@ -565,13 +685,13 @@ $(document).ready(function() {

    {if isset($one_phone_at_least) && $one_phone_at_least} -

    {l s='You must register at least one phone number.'}

    - {/if} +

    {l s='You must register at least one phone number.'}

    + {/if}

    -

    +

    diff --git a/themes/default/js/order-opc.js b/themes/default/js/order-opc.js index 6480375fb..cbfb44f9c 100644 --- a/themes/default/js/order-opc.js +++ b/themes/default/js/order-opc.js @@ -308,7 +308,7 @@ function saveAddress(type) params += 'address2='+encodeURIComponent($('#address2'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; params += 'postcode='+encodeURIComponent($('#postcode'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; params += 'city='+encodeURIComponent($('#city'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; - params += 'id_country='+encodeURIComponent($('#id_country').val())+'&'; + params += 'id_country='+encodeURIComponent($('#id_country'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; if ($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val()) params += 'id_state='+encodeURIComponent($('#id_state'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; params += 'other='+encodeURIComponent($('#other'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; diff --git a/themes/default/order-opc-new-account.tpl b/themes/default/order-opc-new-account.tpl index 676ee7b11..c96437cc3 100644 --- a/themes/default/order-opc-new-account.tpl +++ b/themes/default/order-opc-new-account.tpl @@ -86,7 +86,6 @@ else $('#vat_number_block_invoice').hide(); } - $(document).ready(function() { $('#company').on('input',function(){ vat_number(); @@ -96,6 +95,10 @@ }); vat_number(); vat_number_invoice(); + {/literal} + $('.id_state option[value={if isset($guestInformations.id_state)}{$guestInformations.id_state|intval}{/if}]').prop('selected', true); + $('.id_state_invoice option[value={if isset($guestInformations.id_state_invoice)}{$guestInformations.id_state_invoice|intval}{/if}]').prop('selected', true); + {literal} }); {/literal} @@ -279,7 +282,7 @@

    - +

    @@ -289,7 +292,7 @@

    {l s='Invoice address'}

    {foreach from=$inv_all_fields item=field_name} {if $field_name eq "company" && $b2b_enable} -

    +

    @@ -375,13 +378,13 @@

    {if isset($one_phone_at_least) && $one_phone_at_least} -

    {l s='You must register at least one phone number.'}

    +

    {l s='You must register at least one phone number.'}

    {/if} -

    +

    -

    +

    From c9d20f35b30d4c5859ab7eef9cb6d62adb785d76 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 00:00:17 +0200 Subject: [PATCH 048/186] // norms --- controllers/front/AddressController.php | 6 +++--- themes/default/authentication.tpl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/front/AddressController.php b/controllers/front/AddressController.php index dcb34df88..a6dbe02e4 100644 --- a/controllers/front/AddressController.php +++ b/controllers/front/AddressController.php @@ -225,11 +225,11 @@ class AddressControllerCore extends FrontController else // Update cart address $this->context->cart->autosetProductAddress(); - if ((bool)(Tools::getValue('select_address', false)) == true OR (Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE'))) - $this->context->cart->id_address_invoice = (int)$address->id; + if ((bool)(Tools::getValue('select_address', false)) == true OR (Tools::getValue('type') == 'invoice' && Configuration::get('PS_ORDER_PROCESS_TYPE'))) + $this->context->cart->id_address_invoice = (int)$address->id; elseif (Configuration::get('PS_ORDER_PROCESS_TYPE')) $this->context->cart->id_address_invoice = (int)$this->context->cart->id_address_delivery; - $this->context->cart->update(); + $this->context->cart->update(); if ($this->ajax) { diff --git a/themes/default/authentication.tpl b/themes/default/authentication.tpl index 043854730..de7859286 100644 --- a/themes/default/authentication.tpl +++ b/themes/default/authentication.tpl @@ -303,7 +303,7 @@ $(document).ready(function() { {/if}

    {l s='Delivery address'}

    {foreach from=$dlv_all_fields item=field_name} - {if $field_name eq "company" && $b2b_enable} + {if $field_name eq "company" && $b2b_enable}

    From 332c8ff49f39ac192e87660b80028436f9810c54 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 00:28:41 +0200 Subject: [PATCH 049/186] [-] CORE : Fix bug #PSCFV-10687 again, #PSCFV-10752 replaceAccentedChars() // sorry for that --- classes/Tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Tools.php b/classes/Tools.php index 849877423..d10f4929a 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1162,7 +1162,7 @@ class ToolsCore $replacements = array( 'a', 'c', 'd', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'w', 'z', 'ae', 'oe', - 'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'W', 'Y', 'Z', 'AE', 'OE' + 'A', 'C', 'D', 'E', 'G', 'H', 'I', 'J', 'K', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Y', 'W', 'Z', 'AE', 'OE' ); return preg_replace($patterns, $replacements, $str); From 9b8a7edad82270bfe1abbab39dccc91f5bc8cd86 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 01:05:18 +0200 Subject: [PATCH 050/186] // small refacto --- controllers/front/AuthController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 58582cff2..d8852cebc 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -327,7 +327,7 @@ class AuthControllerCore extends FrontController if (!$this->ajax) { - if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer(Tools::getValue('back'))) + if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); Tools::redirect('index.php?controller='.(($this->authRedirection !== false) ? urlencode($this->authRedirection) : 'my-account')); } @@ -464,7 +464,7 @@ class AuthControllerCore extends FrontController die(Tools::jsonEncode($return)); } - if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer(Tools::getValue('back'))) + if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); // redirection: if cart is not empty : redirection to the cart if (count($this->context->cart->getProducts(true)) > 0) @@ -624,7 +624,7 @@ class AuthControllerCore extends FrontController if (!Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && !$this->ajax && !Tools::isSubmit('submitGuestAccount')) Tools::redirect('index.php?controller=address'); - if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer(Tools::getValue('back'))) + if (($back = Tools::getValue('back')) && $back == Tools::secureReferrer($back)) Tools::redirect(html_entity_decode($back)); // redirection: if cart is not empty : redirection to the cart From 198e75245d83ff11bb29dfdc1095a91a56fd83cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 21 Oct 2013 09:41:00 +0200 Subject: [PATCH 051/186] [-] FO: Don't auto detect language if it not associated to the shop #PSCFV-10273 --- classes/Tools.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index d10f4929a..c7a82201d 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -357,13 +357,11 @@ class ToolsCore if (Validate::isLanguageIsoCode($string)) { $lang = new Language(Language::getIdByIso($string)); - if (Validate::isLoadedObject($lang) && $lang->active) - { - $language = new Language((int)$lang->id); - if (Validate::isLoadedObject($language)) - Context::getContext()->language = $language; + if (Validate::isLoadedObject($lang) && $lang->active && $lang->isAssociatedToShop()) + { + Context::getContext()->language = $lang; $cookie->id_lang = (int)$lang->id; - } + } } } From 35df3f463c222f3da103a490fcc47743fa3cc871 Mon Sep 17 00:00:00 2001 From: PhpMadman Date: Mon, 21 Oct 2013 10:10:28 +0200 Subject: [PATCH 052/186] Removed unsed code I looked through the code. And I can't see that that code is used. everything is handled in PDF class. --- controllers/front/PdfInvoiceController.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/controllers/front/PdfInvoiceController.php b/controllers/front/PdfInvoiceController.php index b02453342..a4d6b2429 100644 --- a/controllers/front/PdfInvoiceController.php +++ b/controllers/front/PdfInvoiceController.php @@ -63,23 +63,8 @@ class PdfInvoiceControllerCore extends FrontController $order_invoice_list = $this->order->getInvoicesCollection(); Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list)); - $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty, $this->context->language->id); + $pdf = new PDF($order_invoice_list, PDF::TEMPLATE_INVOICE, $this->context->smarty); $pdf->render(); } - - /** - * Returns the invoice template associated to the country iso_code - * @param string $iso_user - */ - public function getTemplate($iso_country) - { - $template = _PS_THEME_PDF_DIR_.'/invoice.tpl'; - - $iso_template = _PS_THEME_PDF_DIR_.'/invoice.'.$iso_country.'.tpl'; - if (file_exists($iso_template)) - $template = $iso_template; - - return $template; - } -} \ No newline at end of file +} From 15cd0b9fbc9da577a7a8afc4c103d2df4e5e80db Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 12:21:49 +0200 Subject: [PATCH 053/186] [-] BO : Report of https://github.com/PrestaShop/PrestaShop/commit/fd86a29c5c369ec5da0f91bbe97c584a00d02d0d --- .../default/template/controllers/modules/tab_module_line.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl b/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl index 044183bf6..b76532dd0 100644 --- a/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl +++ b/admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl @@ -34,6 +34,7 @@

    + {$module->name} {$module->displayName|truncate:36:'…'} {$module->version} {if isset($module->id) && $module->id gt 0 } {if $module->active} From 5d8c0a0fc2c07028e7a786078cd829265a025174 Mon Sep 17 00:00:00 2001 From: Samy Rabih Date: Mon, 21 Oct 2013 14:08:30 +0200 Subject: [PATCH 054/186] duplicateFeatures doesn't protect feature values The features values are not protected using pSQL during the features duplication --- classes/Product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/Product.php b/classes/Product.php index 5d7330cff..0d54b9752 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3590,6 +3590,7 @@ class ProductCore extends ObjectModel if ($result3) { $result3['id_feature_value'] = $new_id_feature_value; + $result3['value'] = pSQL($result3['value']); $return &= Db::getInstance()->insert('feature_value_lang', $result3); } } From d25b41ef976fd7d31ef8ed0aeb8500489d2fc4b2 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 14:34:59 +0200 Subject: [PATCH 055/186] [-] BO : wrong csv files name --- controllers/admin/AdminImportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 249f64276..1fcc0f353 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -2876,7 +2876,7 @@ class AdminImportControllerCore extends AdminController if (Tools::isSubmit('submitFileUpload')) { - $path = _PS_ADMIN_DIR_.'/import/'.date('Ymdhis').'-'; + $path = _PS_ADMIN_DIR_.'/import/'.date('YmdHis').'-'; if (isset($_FILES['file']) && !empty($_FILES['file']['error'])) { switch ($_FILES['file']['error']) From a9e45fccf3d56e331ebd6514fae471a3c1b9eede Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 14:35:23 +0200 Subject: [PATCH 056/186] [-] MO : ScrollTo not loaded --- modules/crossselling/crossselling.php | 1 + modules/productscategory/productscategory.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index 31262888d..14620d283 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -117,6 +117,7 @@ class CrossSelling extends Module { $this->context->controller->addCSS(($this->_path).'crossselling.css', 'all'); $this->context->controller->addJS(($this->_path).'js/crossselling.js'); + $this->context->controller->addJqueryPlugin('scrollTo', 'serialScroll'); } /** diff --git a/modules/productscategory/productscategory.php b/modules/productscategory/productscategory.php index fb1f74e36..203838fc8 100644 --- a/modules/productscategory/productscategory.php +++ b/modules/productscategory/productscategory.php @@ -186,7 +186,7 @@ class productsCategory extends Module { $this->context->controller->addCSS($this->_path.'productscategory.css', 'all'); $this->context->controller->addJS($this->_path.'productscategory.js'); - $this->context->controller->addJqueryPlugin('serialScroll'); + $this->context->controller->addJqueryPlugin('scrollTo', 'serialScroll'); } public function hookAddProduct($params) From a05c748e81ea9d703de47748b3e3de3498c77eea Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 15:05:03 +0200 Subject: [PATCH 057/186] // addJqueryPlugin receives array in first argument --- modules/crossselling/crossselling.php | 2 +- modules/productscategory/productscategory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index 14620d283..0df37e319 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -117,7 +117,7 @@ class CrossSelling extends Module { $this->context->controller->addCSS(($this->_path).'crossselling.css', 'all'); $this->context->controller->addJS(($this->_path).'js/crossselling.js'); - $this->context->controller->addJqueryPlugin('scrollTo', 'serialScroll'); + $this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll')); } /** diff --git a/modules/productscategory/productscategory.php b/modules/productscategory/productscategory.php index 203838fc8..dd4674de2 100644 --- a/modules/productscategory/productscategory.php +++ b/modules/productscategory/productscategory.php @@ -186,7 +186,7 @@ class productsCategory extends Module { $this->context->controller->addCSS($this->_path.'productscategory.css', 'all'); $this->context->controller->addJS($this->_path.'productscategory.js'); - $this->context->controller->addJqueryPlugin('scrollTo', 'serialScroll'); + $this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll')); } public function hookAddProduct($params) From 61884ec223a71cb9a3a10132d0253f7a7274a938 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 16:31:56 +0200 Subject: [PATCH 058/186] // norms --- admin-dev/themes/default/template/header.tpl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/admin-dev/themes/default/template/header.tpl b/admin-dev/themes/default/template/header.tpl index 1ddf6bffc..327fb5a8f 100644 --- a/admin-dev/themes/default/template/header.tpl +++ b/admin-dev/themes/default/template/header.tpl @@ -43,11 +43,11 @@ var roundMode = {$round_mode}; {if isset($shop_context)} {if $shop_context == Shop::CONTEXT_ALL} - var youEditFieldFor = "{l s='A modification of this field will be applied for all shops' slashes=1 }"; + var youEditFieldFor = '{l s='A modification of this field will be applied for all shops' slashes=1}'; {elseif $shop_context == Shop::CONTEXT_GROUP} - var youEditFieldFor = "{l s='A modification of this field will be applied for all shops of group ' slashes=1 }{$shop_name}"; + var youEditFieldFor = '{l s='A modification of this field will be applied for all shops of group' slashes=1} {$shop_name}'; {else} - var youEditFieldFor = "{l s='A modification of this field will be applied for the shop ' slashes=1 }{$shop_name}"; + var youEditFieldFor = '{l s='A modification of this field will be applied for the shop' slashes=1} {$shop_name}'; {/if} {else} var youEditFieldFor = ''; @@ -65,11 +65,11 @@ var new_msg = '{l s='A new message posted on your shop.' slashes=1}'; var excerpt_msg = '{l s='Excerpt: ' slashes=1}'; var see_msg = '{l s='Read this message' slashes=1}'; - var token_admin_orders = '{getAdminToken tab='AdminOrders' slashes=1}'; - var token_admin_customers = '{getAdminToken tab='AdminCustomers' slashes=1}'; - var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads' slashes=1}'; + var token_admin_orders = '{getAdminToken tab='AdminOrders'}'; + var token_admin_customers = '{getAdminToken tab='AdminCustomers'}'; + var token_admin_customer_threads = '{getAdminToken tab='AdminCustomerThreads'}'; var currentIndex = '{$currentIndex}'; - var choose_language_translate = "{l s='Choose language' slashes=1 }"; + var choose_language_translate = '{l s='Choose language' slashes=1}'; {/if} From 16ffbd8ee5794a840a5851c1d547f2815a519788 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 16:46:22 +0200 Subject: [PATCH 059/186] // norms --- admin-dev/themes/default/template/header.tpl | 77 ++++++++++---------- 1 file changed, 37 insertions(+), 40 deletions(-) diff --git a/admin-dev/themes/default/template/header.tpl b/admin-dev/themes/default/template/header.tpl index 327fb5a8f..b2c8bb92d 100644 --- a/admin-dev/themes/default/template/header.tpl +++ b/admin-dev/themes/default/template/header.tpl @@ -34,54 +34,51 @@ {$meta_title} - PrestaShop™ {if $display_header} {/if} - {if isset($css_files)} - {foreach from=$css_files key=css_uri item=media} - - {/foreach} +{foreach from=$css_files key=css_uri item=media} + +{/foreach} {/if} {if isset($js_files)} - {foreach from=$js_files item=js_uri} - - {/foreach} +{foreach from=$js_files item=js_uri} + +{/foreach} {/if} From c1ecf43be873930a88fabac5e7ac0f60c48221b7 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Mon, 21 Oct 2013 17:39:20 +0200 Subject: [PATCH 060/186] [-] MO : Fix bug #PSCFV-10775, could not upload .jpeg in TinyMCE --- admin-dev/ajaxfilemanager/inc/config.base.php | 4 ++-- admin-dev/ajaxfilemanager/inc/config.tinymce.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin-dev/ajaxfilemanager/inc/config.base.php b/admin-dev/ajaxfilemanager/inc/config.base.php index 28155f21e..5b57feed0 100755 --- a/admin-dev/ajaxfilemanager/inc/config.base.php +++ b/admin-dev/ajaxfilemanager/inc/config.base.php @@ -78,9 +78,9 @@ define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste - define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png');// // + define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png');// // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// - define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,png'); + define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,jpg,jpeg,jpeg,png'); //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // define('CONFIG_UPLOAD_INVALID_EXTS', ''); diff --git a/admin-dev/ajaxfilemanager/inc/config.tinymce.php b/admin-dev/ajaxfilemanager/inc/config.tinymce.php index c406f47e5..9070323a2 100755 --- a/admin-dev/ajaxfilemanager/inc/config.tinymce.php +++ b/admin-dev/ajaxfilemanager/inc/config.tinymce.php @@ -73,9 +73,9 @@ define('CONFIG_EDITABLE_VALID_EXTS', 'txt,htm,html,xml,js,css'); //make you include all these extension in CONFIG_UPLOAD_VALID_EXTS if you want all valid define('CONFIG_OVERWRITTEN', false); //overwirte when processing paste - define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // + define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,jpeg,png,txt'); // //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,bmp,tif,zip,sit,rar,gz,tar,htm,html,mov,mpg,avi,asf,mpeg,wmv,aif,aiff,wav,mp3,swf,ppt,rtf,doc,pdf,xls,txt,xml,xsl,dtd');// - define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); + define("CONFIG_VIEWABLE_VALID_EXTS", 'gif,bmp,txt,jpg,jpeg,png,tif,html,htm,js,css,xml,xsl,dtd,mp3,wav,wmv,wma,rm,rmvb,mov,swf'); //define('CONFIG_UPLOAD_VALID_EXTS', 'gif,jpg,png,txt'); // define('CONFIG_UPLOAD_INVALID_EXTS', ''); From 2aa52356ade9bffb8d9526942475b6adf89a9cd4 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 22 Oct 2013 09:39:59 +0200 Subject: [PATCH 061/186] [-] BO : Fix bug #PSCFV-10607 one upload name --- .../default/template/controllers/products/virtualproduct.tpl | 1 + 1 file changed, 1 insertion(+) diff --git a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl index 0a6c0d865..227e3ea44 100644 --- a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl +++ b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl @@ -58,6 +58,7 @@ $('#file_missing').hide(); $('#virtual_product_name').attr('value', fileName); $("#upload-confirmation .error").remove(); + $('#upload-confirmation div').find('span').remove() $('#upload-confirmation div').prepend('{l s='The file'} "'+fileName+'" {l s='has successfully been uploaded'}' + ''); $("#upload-confirmation").show(); From ce8d01ad4c8a56a9fb0631881607bf85dc690eb0 Mon Sep 17 00:00:00 2001 From: Gaelle ITZKOVITZ Date: Tue, 22 Oct 2013 11:09:53 +0200 Subject: [PATCH 062/186] [-] MO : if customer is logged we do not recreate it --- modules/loyalty/LoyaltyModule.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/loyalty/LoyaltyModule.php b/modules/loyalty/LoyaltyModule.php index 5d8ef5c9a..c4511439c 100644 --- a/modules/loyalty/LoyaltyModule.php +++ b/modules/loyalty/LoyaltyModule.php @@ -87,7 +87,9 @@ class LoyaltyModule extends ObjectModel { $context = Context::getContext(); $context->cart = $cart; - $context->customer = new Customer($context->cart->id_customer); + // if customer is logged we do not recreate it + if(!$context->customer->isLogged(true)) + $context->customer = new Customer($context->cart->id_customer); $context->language = new Language($context->cart->id_lang); $context->shop = new Shop($context->cart->id_shop); $context->currency = new Currency($context->cart->id_currency, null, $context->shop->id); From d20aea056331fb484072ad94e2c4f061881aaa88 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 22 Oct 2013 11:27:45 +0200 Subject: [PATCH 063/186] [-] BO : Fix bug #PSCFV-10767, could not retrieve feature value when product IDs not forced --- classes/FeatureValue.php | 4 +- controllers/admin/AdminImportController.php | 109 ++++++++++++-------- 2 files changed, 67 insertions(+), 46 deletions(-) diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index 97b07476e..25c0fb4fd 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -130,6 +130,7 @@ class FeatureValueCore extends ObjectModel public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null) { + $id_feature_value = false; if (!is_null($id_product) && $id_product) { $id_feature_value = Db::getInstance()->getValue(' @@ -145,7 +146,8 @@ class FeatureValueCore extends ObjectModel WHERE `id_feature_value` = '.(int)$id_feature_value.' AND `id_lang` = '.(int)$id_lang); } - else + + if (!$id_feature_value) $id_feature_value = Db::getInstance()->getValue(' SELECT fv.`id_feature_value` FROM '._DB_PREFIX_.'feature_value fv diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 1fcc0f353..8ae22ff07 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -1086,11 +1086,11 @@ class AdminImportControllerCore extends AdminController // Get shops for each attributes $info['shop'] = explode($this->multiple_value_separator, $info['shop']); - + foreach ($info['shop'] as $shop) - if (!is_numeric($shop)) + if (!empty($shop) && !is_numeric($shop)) $category->addShop(Shop::getIdByName($shop)); - else + elseif (!empty($shop)) $category->addShop($shop); } } @@ -1162,9 +1162,9 @@ class AdminImportControllerCore extends AdminController // link product to shops $product->id_shop_list = array(); foreach (explode($this->multiple_value_separator, $product->shop) as $shop) - if (!is_numeric($shop)) + if (!empty($shop) && !is_numeric($shop)) $product->id_shop_list[] = Shop::getIdByName($shop); - else + elseif (!empty($shop)) $product->id_shop_list[] = $shop; if ((int)$product->id_tax_rules_group != 0) @@ -1405,8 +1405,10 @@ class AdminImportControllerCore extends AdminController $product_shop = explode($this->multiple_value_separator, $product->shop); foreach ($product_shop as $shop) { + if (empty($shop)) + continue; $shop = trim($shop); - if (!is_numeric($shop)) + if (!empty($shop) && !is_numeric($shop)) $shop = Shop::getIdByName($shop); if (in_array($shop, $shop_ids)) @@ -1458,36 +1460,36 @@ class AdminImportControllerCore extends AdminController $id_shop_list = array(); foreach ($info['shop'] as $shop) - if (!is_numeric($shop)) + if (!empty($shop) && !is_numeric($shop)) $id_shop_list[] = (int)Shop::getIdByName($shop); - else + elseif (!empty($shop)) $id_shop_list[] = $shop; - if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0)) - foreach($id_shop_list as $id_shop) - { - $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0); + if ((isset($info['reduction_price']) && $info['reduction_price'] > 0) || (isset($info['reduction_percent']) && $info['reduction_percent'] > 0)) + foreach($id_shop_list as $id_shop) + { + $specific_price = SpecificPrice::getSpecificPrice($product->id, $id_shop, 0, 0, 0, 1, 0, 0, 0, 0); - if (is_array($specific_price) && isset($specific_price['id_specific_price'])) - $specific_price = new SpecificPrice((int)$specific_price['id_specific_price']); - else - $specific_price = new SpecificPrice(); - $specific_price->id_product = (int)$product->id; - $specific_price->id_specific_price_rule = 0; - $specific_price->id_shop = $id_shop; - $specific_price->id_currency = 0; - $specific_price->id_country = 0; - $specific_price->id_group = 0; - $specific_price->price = -1; - $specific_price->id_customer = 0; - $specific_price->from_quantity = 1; - $specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100; - $specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage'; - $specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00'; - $specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00'; - if (!$specific_price->save()) - $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid')); - } + if (is_array($specific_price) && isset($specific_price['id_specific_price'])) + $specific_price = new SpecificPrice((int)$specific_price['id_specific_price']); + else + $specific_price = new SpecificPrice(); + $specific_price->id_product = (int)$product->id; + $specific_price->id_specific_price_rule = 0; + $specific_price->id_shop = $id_shop; + $specific_price->id_currency = 0; + $specific_price->id_country = 0; + $specific_price->id_group = 0; + $specific_price->price = -1; + $specific_price->id_customer = 0; + $specific_price->from_quantity = 1; + $specific_price->reduction = (isset($info['reduction_price']) && $info['reduction_price']) ? $info['reduction_price'] : $info['reduction_percent'] / 100; + $specific_price->reduction_type = (isset($info['reduction_price']) && $info['reduction_price']) ? 'amount' : 'percentage'; + $specific_price->from = (isset($info['reduction_from']) && Validate::isDate($info['reduction_from'])) ? $info['reduction_from'] : '0000-00-00 00:00:00'; + $specific_price->to = (isset($info['reduction_to']) && Validate::isDate($info['reduction_to'])) ? $info['reduction_to'] : '0000-00-00 00:00:00'; + if (!$specific_price->save()) + $this->addProductWarning(Tools::safeOutput($info['name']), $product->id, $this->l('Discount is invalid')); + } if (isset($product->tags) && !empty($product->tags)) { @@ -1501,7 +1503,8 @@ class AdminImportControllerCore extends AdminController if (is_array($product->tags) && count($product->tags)) { foreach ($product->tags as $key => $tag) - $product->tags[$key] = trim($tag); + if (!empty($tag)) + $product->tags[$key] = trim($tag); $tags[$id_lang] = $product->tags; $product->tags = $tags; } @@ -1509,7 +1512,7 @@ class AdminImportControllerCore extends AdminController } // Delete tags for this id product, for no duplicating error Tag::deleteTagsForProduct($product->id); - if (!is_array($product->tags)) + if (!is_array($product->tags) && !empty($product->tags)) { $product->tags = AdminImportController::createMultiLangField($product->tags); foreach ($product->tags as $key => $tags) @@ -1593,14 +1596,19 @@ class AdminImportControllerCore extends AdminController if (isset($features['features']) && !empty($features['features'])) foreach (explode($this->multiple_value_separator, $features['features']) as $single_feature) { + if (empty($single_feature)) + continue; $tab_feature = explode(':', $single_feature); - $feature_name = trim($tab_feature[0]); - $feature_value = trim($tab_feature[1]); - $position = isset($tab_feature[2]) ? $tab_feature[2]: false; + $feature_name = isset($tab_feature[0]) ? trim($tab_feature[0]) : ''; + $feature_value = isset($tab_feature[1]) ? trim($tab_feature[1]) : ''; + $position = isset($tab_feature[2]) ? (int)$tab_feature[2] : false; if(!empty($feature_name) && !empty($feature_value)) { - $id_feature = Feature::addFeatureImport($feature_name, $position); - $id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value, $product->id, $id_lang); + $id_feature = (int)Feature::addFeatureImport($feature_name, $position); + $id_product = null; + if (Tools::getValue('forceIDs') || Tools::getValue('match_ref')) + $id_product = (int)$product->id; + $id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang); Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value); } } @@ -1658,11 +1666,12 @@ class AdminImportControllerCore extends AdminController $info['shop'] = explode($this->multiple_value_separator, $info['shop']); $id_shop_list = array(); - foreach ($info['shop'] as $shop) - if (!is_numeric($shop)) - $id_shop_list[] = Shop::getIdByName($shop); - else - $id_shop_list[] = $shop; + if (is_array($info['shop']) && count($info['shop'])) + foreach ($info['shop'] as $shop) + if (!empty($shop) && !is_numeric($shop)) + $id_shop_list[] = Shop::getIdByName($shop); + elseif (!empty($shop)) + $id_shop_list[] = $shop; if(isset($info['id_product'])) $product = new Product((int)$info['id_product'], false, $default_language); @@ -1736,12 +1745,14 @@ class AdminImportControllerCore extends AdminController if(isset($info['group'])) foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) { + if (empty($group)) + continue; $tab_group = explode(':', $group); $group = trim($tab_group[0]); if (!isset($tab_group[1])) $type = 'select'; else - $type = trim($tab_group[1]); + $type = trim($tab_group[1]); // sets group $groups_attributes[$key]['group'] = $group; @@ -1791,6 +1802,8 @@ class AdminImportControllerCore extends AdminController if(isset($info['attribute'])) foreach (explode($this->multiple_value_separator, $info['attribute']) as $key => $attribute) { + if (empty($attribute)) + continue; $tab_attribute = explode(':', $attribute); $attribute = trim($tab_attribute[0]); // if position is filled @@ -2002,6 +2015,8 @@ class AdminImportControllerCore extends AdminController { foreach ($id_shop_list as $id_shop) { + if (empty($id_shop)) + continue; $shop = new Shop((int)$id_shop); $group_shop = $shop->getGroup(); if ($group_shop->share_customer) @@ -2357,6 +2372,8 @@ class AdminImportControllerCore extends AdminController $shops = array(); foreach ($manufacturer->shop as $shop) { + if (empty($shop)) + continue; $shop = trim($shop); if (!is_numeric($shop)) $shop = ShopGroup::getIdByName($shop); @@ -2434,6 +2451,8 @@ class AdminImportControllerCore extends AdminController $shops = array(); foreach ($supplier->shop as $shop) { + if (empty($shop)) + continue; $shop = trim($shop); if (!is_numeric($shop)) $shop = ShopGroup::getIdByName($shop); From 1ae587475b5b58c80744ece54554e576193d2f6d Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 22 Oct 2013 12:19:58 +0200 Subject: [PATCH 064/186] [-] MO : Fix bug #PSCFV-10787, cms associated to all shops --- modules/blockcms/BlockCMSModel.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/blockcms/BlockCMSModel.php b/modules/blockcms/BlockCMSModel.php index d0c63ee10..88c2a969f 100644 --- a/modules/blockcms/BlockCMSModel.php +++ b/modules/blockcms/BlockCMSModel.php @@ -364,15 +364,20 @@ class BlockCMSModel extends ObjectModel return Db::getInstance()->executeS($sql); } - public static function getCMSBlockPages($id_block) + public static function getCMSBlockPages($id_block, $id_shop = false) { + $id_shop = ($id_shop !== false) ? $id_shop : Context::getContext()->shop->id; + $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) + INNER JOIN `'._DB_PREFIX_.'cms_shop` cs + ON (c.`id_cms` = cs.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' + AND cs.`id_shop` = '.(int)$id_shop.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 @@ -534,8 +539,7 @@ class BlockCMSModel extends ObjectModel { $key = (int)$cmsCategory['id_cms_block']; $content[$key]['display_store'] = $cmsCategory['display_store']; - $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); - + $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block'], $id_shop); $links = array(); if (count($content[$key]['cms'])) { From e857fb59781eed1f5c431825bc5ec65abbb4793f Mon Sep 17 00:00:00 2001 From: PhpMadman Date: Tue, 22 Oct 2013 13:34:52 +0200 Subject: [PATCH 065/186] [*] FO: Removed missplaced on mobile theme --- themes/default/mobile/order-detail.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/mobile/order-detail.tpl b/themes/default/mobile/order-detail.tpl index feaf3fee9..c51274600 100644 --- a/themes/default/mobile/order-detail.tpl +++ b/themes/default/mobile/order-detail.tpl @@ -51,7 +51,7 @@ {if $invoice AND $invoiceAllowed}
  • - {l s='Download your invoice as a PDF file.'}
  • + {l s='Download your invoice as a PDF file.'} {/if} {if $order->recyclable} From 2989538ce136f66c9f42118544ae17fba2570c67 Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Tue, 22 Oct 2013 15:53:20 +0200 Subject: [PATCH 066/186] [*] BO Module mailalerts: send e-mail to merchand when product is out of stock --- modules/mailalerts/mailalerts.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index f10151f81..485240d43 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -452,16 +452,20 @@ class MailAlerts extends Module public function hookActionUpdateQuantity($params) { $id_product = (int)$params['id_product']; + $product = new Product($id_product); + $product_has_attributes = $product->hasAttributes(); $id_product_attribute = (int)$params['id_product_attribute']; $quantity = (int)$params['quantity']; $context = Context::getContext(); $id_shop = (int)$context->shop->id; $id_lang = (int)$context->language->id; $product = new Product($id_product, true, $id_lang, $id_shop, $context); - $configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), $id_lang, null, $id_shop); + $configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), null, null, $id_shop); $ma_last_qties = (int)$configuration['MA_LAST_QTIES']; - - if ($product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT']) + + $check_oos = ($product_has_attributes && $id_product_attribute) || (!$product_has_attributes && !$id_product_attribute); + + if ($check_oos && $product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT']) { $iso = Language::getIsoById($id_lang); $product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang); From 7cbaada8443edbb1089f32b16ca6d7c233239fc8 Mon Sep 17 00:00:00 2001 From: ldecoker Date: Tue, 22 Oct 2013 17:00:56 +0200 Subject: [PATCH 067/186] [BO][-] Notice messages when accessing the BO translation page When accessing the translation part with "core translation" , you got 2 errors: Notice: Use of undefined constant _PS_THEME_SELECTED_DIR_ - assumed '_PS_THEME_SELECTED_DIR_' in controllers\admin\AdminTranslationsController.php on line 1018 Notice: Use of undefined constant _PS_THEME_SELECTED_DIR_ - assumed '_PS_THEME_SELECTED_DIR_' in \controllers\admin\AdminTranslationsController.php on line 1026 It's because the variable $this->theme_selected is not set for that case. --- controllers/admin/AdminTranslationsController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index 57ad71856..d5fe4b7db 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -1221,6 +1221,8 @@ class AdminTranslationsControllerCore extends AdminController // Set the path of selected theme if ($this->theme_selected) define('_PS_THEME_SELECTED_DIR_', _PS_ROOT_DIR_.'/themes/'.$this->theme_selected.'/'); + else + define('_PS_THEME_SELECTED_DIR_', ''); // Get type of translation if (($type = Tools::getValue('type')) && !is_array($type)) From e6e2db8400133b2c54dabb61ab01057b54dd7f51 Mon Sep 17 00:00:00 2001 From: ldecoker Date: Tue, 22 Oct 2013 18:55:32 +0200 Subject: [PATCH 068/186] [PDF] [-] {else if} instead of {elseif} --- pdf/invoice.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf/invoice.tpl b/pdf/invoice.tpl index 1f48322ce..918cdb15d 100755 --- a/pdf/invoice.tpl +++ b/pdf/invoice.tpl @@ -147,7 +147,7 @@ {if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)} -{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount} - {else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} + {elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} -{$order_detail.reduction_percent}% {else} -- From ce4170574c3b2b01c125f27dbda6ea466f4b68d2 Mon Sep 17 00:00:00 2001 From: ldecoker Date: Tue, 22 Oct 2013 18:57:12 +0200 Subject: [PATCH 069/186] [PDF] [-] {else if} instead of {elseif} (B2B invoice template) --- pdf/invoice-b2b.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pdf/invoice-b2b.tpl b/pdf/invoice-b2b.tpl index 0fc86cba0..6f7ba9462 100755 --- a/pdf/invoice-b2b.tpl +++ b/pdf/invoice-b2b.tpl @@ -151,7 +151,7 @@ {if (isset($order_detail.reduction_amount) && $order_detail.reduction_amount > 0)} -{displayPrice currency=$order->id_currency price=$order_detail.reduction_amount} - {else if (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} + {elseif (isset($order_detail.reduction_percent) && $order_detail.reduction_percent > 0)} -{$order_detail.reduction_percent}% {else} -- @@ -289,4 +289,4 @@ {/if} -

    \ No newline at end of file +
    From 5d28d38a2250f497a78b4c6b7b855578aab4d7be Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 01:18:09 +0200 Subject: [PATCH 070/186] [-] BO : Fix bug #PSCFV-7907 AdminImport, add custom field to features --- classes/FeatureValue.php | 24 ++++++++++++--------- controllers/admin/AdminImportController.php | 15 ++++++------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index 25c0fb4fd..b43abfb58 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -128,32 +128,36 @@ class FeatureValueCore extends ObjectModel return $tab['value']; } - public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null) + public static function addFeatureValueImport($id_feature, $value, $id_product, $id_lang = null, $custom = false) { $id_feature_value = false; if (!is_null($id_product) && $id_product) { $id_feature_value = Db::getInstance()->getValue(' - SELECT `id_feature_value` - FROM '._DB_PREFIX_.'feature_product - WHERE `id_feature` = '.(int)$id_feature.' - AND `id_product` = '.(int)$id_product); + SELECT fp.`id_feature_value` + FROM '._DB_PREFIX_.'feature_product fp + INNER JOIN '._DB_PREFIX_.'feature_value fv USING (`id_feature_value`) + WHERE fp.`id_feature` = '.(int)$id_feature.' + AND fv.`custom` = '.(int)$custom.' + AND fp.`id_product` = '.(int)$id_product); - if ($id_feature_value && !is_null($id_lang) && $id_lang) + if ($custom && $id_feature_value && !is_null($id_lang) && $id_lang) Db::getInstance()->execute(' UPDATE '._DB_PREFIX_.'feature_value_lang SET `value` = \''.pSQL($value).'\' WHERE `id_feature_value` = '.(int)$id_feature_value.' + AND `value` != \''.pSQL($value).'\' AND `id_lang` = '.(int)$id_lang); } - - if (!$id_feature_value) + + if (!$custom) $id_feature_value = Db::getInstance()->getValue(' SELECT fv.`id_feature_value` FROM '._DB_PREFIX_.'feature_value fv - LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value`) + LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.`id_feature_value` = fv.`id_feature_value` AND fvl.`id_lang` = '.(int)$id_lang.') WHERE `value` = \''.pSQL($value).'\' AND fv.`id_feature` = '.(int)$id_feature.' + AND fv.`custom` = 0 GROUP BY fv.`id_feature_value`'); if ($id_feature_value) @@ -162,7 +166,7 @@ class FeatureValueCore extends ObjectModel // Feature doesn't exist, create it $feature_value = new FeatureValue(); $feature_value->id_feature = (int)$id_feature; - $feature_value->custom = 0; + $feature_value->custom = (bool)$custom; foreach (Language::getLanguages() as $language) $feature_value->value[$language['id_lang']] = $value; $feature_value->add(); diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index 8ae22ff07..e80ce48c0 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -247,7 +247,7 @@ class AdminImportControllerCore extends AdminController 'delete_existing_images' => array( 'label' => $this->l('Delete existing images (0 = No, 1 = Yes)') ), - 'features' => array('label' => $this->l('Feature(Name:Value:Position)')), + 'features' => array('label' => $this->l('Feature(Name:Value:Position:Customized)')), 'online_only' => array('label' => $this->l('Available online only (0 = No, 1 = Yes)')), 'condition' => array('label' => $this->l('Condition')), 'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')), @@ -472,9 +472,8 @@ class AdminImportControllerCore extends AdminController } - $this->separator = Tools::substr(strval(trim(Tools::getValue('separator', ','))), 0, 1); - $this->multiple_value_separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator', ';'))), 0, 1); - + $this->separator = ($separator = Tools::substr(strval(trim(Tools::getValue('separator'))), 0, 1)) ? $separator : ';'; + $this->multiple_value_separator = ($separator = Tools::substr(strval(trim(Tools::getValue('multiple_value_separator'))), 0, 1)) ? $separator : ','; parent::__construct(); } @@ -569,8 +568,8 @@ class AdminImportControllerCore extends AdminController $this->context->cookie->entity_selected = (int)Tools::getValue('entity'); $this->context->cookie->iso_lang_selected = base64_encode(Tools::getValue('iso_lang')); - $this->context->cookie->separator_selected = base64_encode(Tools::getValue('separator')); - $this->context->cookie->multiple_value_separator_selected = base64_encode(Tools::getValue('multiple_value_separator')); + $this->context->cookie->separator_selected = base64_encode($this->separator); + $this->context->cookie->multiple_value_separator_selected = base64_encode($this->multiple_value_separator); $this->context->cookie->csv_selected = base64_encode(Tools::getValue('csv')); $this->tpl_view_vars = array( @@ -1602,13 +1601,14 @@ class AdminImportControllerCore extends AdminController $feature_name = isset($tab_feature[0]) ? trim($tab_feature[0]) : ''; $feature_value = isset($tab_feature[1]) ? trim($tab_feature[1]) : ''; $position = isset($tab_feature[2]) ? (int)$tab_feature[2] : false; + $custom = isset($tab_feature[3]) ? (int)$tab_feature[3] : false; if(!empty($feature_name) && !empty($feature_value)) { $id_feature = (int)Feature::addFeatureImport($feature_name, $position); $id_product = null; if (Tools::getValue('forceIDs') || Tools::getValue('match_ref')) $id_product = (int)$product->id; - $id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang); + $id_feature_value = (int)FeatureValue::addFeatureValueImport($id_feature, $feature_value, $id_product, $id_lang, $custom); Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value); } } @@ -1626,7 +1626,6 @@ class AdminImportControllerCore extends AdminController StockAvailable::setQuantity((int)$product->id, 0, $product->quantity, $this->context->shop->id); } - $this->closeCsvFile($handle); } From feca06417f58cbc5f431662b56495ee19beb95da Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 01:23:35 +0200 Subject: [PATCH 071/186] // definition on addFeatureValueImport --- classes/FeatureValue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index b43abfb58..4580966c3 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -128,7 +128,7 @@ class FeatureValueCore extends ObjectModel return $tab['value']; } - public static function addFeatureValueImport($id_feature, $value, $id_product, $id_lang = null, $custom = false) + public static function addFeatureValueImport($id_feature, $value, $id_product = null, $id_lang = null, $custom = false) { $id_feature_value = false; if (!is_null($id_product) && $id_product) From ae63336a378a2831614a4b9008f02980fbb075f2 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 01:41:05 +0200 Subject: [PATCH 072/186] [-] BO : Fix bug #PSCFV-10638, Admin Import by reference moves products to home category --- controllers/admin/AdminImportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index e80ce48c0..c8ea39bb2 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -1137,7 +1137,7 @@ class AdminImportControllerCore extends AdminController else $product = new Product(); - if (array_key_exists('id', $info) && (int)$info['id'] && Product::existsInDatabase((int)$info['id'], 'product')) + if (isset($product->id) && $product->id && Product::existsInDatabase((int)$product->id, 'product')) { $product->loadStockData(); $category_data = Product::getProductCategories((int)$product->id); From 6cddb57ce3b8ab3e3a83a64f734a636e7f48fd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 23 Oct 2013 10:34:00 +0200 Subject: [PATCH 073/186] [-] BO: Synchronize stock available after receipt supply order items #PSCFV-10724 --- controllers/admin/AdminSupplyOrdersController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 5d581be0f..659d8fc07 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -1387,7 +1387,9 @@ class AdminSupplyOrdersControllerCore extends AdminController true, $supply_order->id); - if (!$res) + if ($res) + StockAvailable::synchronize($supply_order_detail->id_product); + else $this->errors[] = Tools::displayError($this->l('Something went wrong when adding products to the warehouse.')); $location = Warehouse::getProductLocation($supply_order_detail->id_product, From 5fd3ad5adf8ba40017fd8aac32f28576c5e48f74 Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Wed, 23 Oct 2013 10:55:23 +0200 Subject: [PATCH 074/186] [*] FO ProductSale: improves calculation of most selled products when there are a lot of products in shop --- classes/ProductSale.php | 61 +++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/classes/ProductSale.php b/classes/ProductSale.php index 2e6d2973c..7acfa7d9b 100644 --- a/classes/ProductSale.php +++ b/classes/ProductSale.php @@ -74,11 +74,22 @@ class ProductSaleCore $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; + + //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage + $sql = 'SELECT cp.`id_product` + FROM `'._DB_PREFIX_.'category_group` cg + LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) + WHERE cg.`id_group` '.$sql_groups; + $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + $ids = array(); + foreach ($products as $product) + $ids[$product['id_product']] = 1; + $ids = array_keys($ids); + sort($ids); + $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; - $prefix = ''; + //Main query if ($order_by == 'date_add') - $prefix = 'p.'; - $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, @@ -103,13 +114,8 @@ class ProductSaleCore LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) '.Product::sqlStock('p').' WHERE product_shop.`active` = 1 - AND product_shop.`visibility` != \'none\' - AND p.`id_product` IN ( - SELECT cp.`id_product` - FROM `'._DB_PREFIX_.'category_group` cg - LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) - WHERE cg.`id_group` '.$sql_groups.' - ) + AND p.`visibility` != \'none\' + AND p.`id_product` IN ('.$ids.') GROUP BY product_shop.id_product ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; @@ -141,11 +147,27 @@ class ProductSaleCore $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); + //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage + $sql = 'SELECT cp.`id_product` + FROM `'._DB_PREFIX_.'category_group` cg + LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) + WHERE cg.`id_group` '.$sql_groups.' AND cp.`id_product` IS NOT NULL'; + $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); + $ids = array(); + foreach ($products as $product) + $ids[$product['id_product']] = 1; + $ids = array_keys($ids); + sort($ids); + $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; + + //Main query $sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, MAX(image_shop.`id_image`) id_image, il.`legend`, - ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category + ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, p.quantity, p.customizable, + IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, p.out_of_stock FROM `'._DB_PREFIX_.'product_sale` ps LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` '.Shop::addSqlAssociation('product', 'p').' + LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (ps.`id_product` = pa.`id_product` AND pa.default_on = 1) LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' @@ -156,16 +178,12 @@ class ProductSaleCore ON cl.`id_category` = product_shop.`id_category_default` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' WHERE product_shop.`active` = 1 - AND product_shop.`visibility` != \'none\' - AND p.`id_product` IN ( - SELECT cp.`id_product` - FROM `'._DB_PREFIX_.'category_group` cg - LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) - WHERE cg.`id_group` '.$sql_groups.' - ) + AND p.`visibility` != \'none\' + AND p.`id_product` IN ('.$ids.') GROUP BY product_shop.id_product ORDER BY sales DESC LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; + if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) return false; @@ -173,6 +191,13 @@ class ProductSaleCore { $row['link'] = $context->link->getProductLink($row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']); $row['id_image'] = Product::defineProductImage($row, $id_lang); + $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']); + $row['price_tax_exc'] = Product::getPriceStatic( + (int)$row['id_product'], + false, + ((isset($row['id_product_attribute']) && !empty($row['id_product_attribute'])) ? (int)$row['id_product_attribute'] : null), + (Product::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6) + ); } return $result; } From 3e999ab5912a2f2271ea4942e79bd25227f69512 Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Wed, 23 Oct 2013 10:56:48 +0200 Subject: [PATCH 075/186] [-] MO blockcart #PNM-1685 - [CODE] incorrect spelled variable in ajax-cart.js --- modules/blockcart/ajax-cart.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index c8348b3e6..e4b5d8a7d 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -175,7 +175,7 @@ var ajaxCart = { }, // add a product in the cart via ajax - add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist){ + add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, wishlist){ if (addedFromProductPage && !checkCustomizations()) { alert(fieldRequired); @@ -204,9 +204,9 @@ var ajaxCart = { data: 'controller=cart&add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): ''), success: function(jsonData,textStatus,jqXHR) { - // add appliance to whishlist module - if (whishlist && !jsonData.errors) - WishlistAddProductCart(whishlist[0], idProduct, idCombination, whishlist[1]); + // add appliance to wishlist module + if (wishlist && !jsonData.errors) + WishlistAddProductCart(wishlist[0], idProduct, idCombination, wishlist[1]); // add the picture to the cart var $element = $(callerElement).parent().parent().find('a.product_image img,a.product_img_link img'); From ad4ecefcf97d356308f7ebbb99a3755e4ee7793a Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 11:44:12 +0200 Subject: [PATCH 076/186] [-] FO : Prevent fatal error on getUniqReference when order not loaded --- themes/default/order-detail.tpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/default/order-detail.tpl b/themes/default/order-detail.tpl index d7fb91517..bfc8d7a9f 100644 --- a/themes/default/order-detail.tpl +++ b/themes/default/order-detail.tpl @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} - +{if isset($order)}
    @@ -424,3 +424,4 @@ {else}

     {l s='You cannot return merchandise with a guest account'}

    {/if} +{/if} \ No newline at end of file From 373604fc976ba8d74571ca676d9809223bcf89a4 Mon Sep 17 00:00:00 2001 From: PhpMadman Date: Wed, 23 Oct 2013 11:52:35 +0200 Subject: [PATCH 077/186] [-] FO: removed width on message product select Limiting select could make the user think the select is not working if they click to much to the left on bigger screens --- themes/default/mobile/order-detail.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/mobile/order-detail.tpl b/themes/default/mobile/order-detail.tpl index c51274600..5bb34f101 100644 --- a/themes/default/mobile/order-detail.tpl +++ b/themes/default/mobile/order-detail.tpl @@ -278,7 +278,7 @@

    {l s='If you would like to add a comment about your order, please write it in the field below.'}

    - {foreach from=$products item=product name=products} From 747ec9a2c464a766f3baf87d64dff22d6e8728e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 23 Oct 2013 14:50:30 +0200 Subject: [PATCH 078/186] // notice on carrierwizard when step back --- controllers/admin/AdminCarrierWizardController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index 7ec5071dc..ca726c228 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -884,7 +884,7 @@ class AdminCarrierWizardControllerCore extends AdminController $step_number = Tools::getValue('step_number'); if ($step_number == 4 && !Shop::isFeatureActive() || $step_number == 5 && Shop::isFeatureActive()) - return array(); + return array('fields' => array()); $step_fields = array( 1 => array('name', 'delay', 'grade', 'url'), @@ -903,7 +903,7 @@ class AdminCarrierWizardControllerCore extends AdminController foreach ($definition['fields'] as $field => $def) if (!in_array($field, $step_fields[$step_number])) unset($definition['fields'][$field]); - + return $definition; } From 554ab9414f51331dcf22729d6e85da18dec42fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 23 Oct 2013 15:08:02 +0200 Subject: [PATCH 079/186] [-] BO: product listing should call Product::getPriceStatic() with the product default shop in the context when it is not a shop context --- controllers/admin/AdminProductsController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index d6b44706c..4c50f38de 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -174,7 +174,7 @@ class AdminProductsControllerCore extends AdminController LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.')'; - $this->_select .= 'shop.name as shopname, '; + $this->_select .= 'shop.name as shopname, a.id_shop_default, '; $this->_select .= 'MAX('.$alias_image.'.id_image) id_image, cl.name `name_category`, '.$alias.'.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`'; if ($join_category) @@ -331,12 +331,17 @@ class AdminProductsControllerCore extends AdminController $nb = count($this->_list); if ($this->_list) { + $context = $this->context->cloneContext(); + $context->shop = clone($context->shop); /* update product final price */ for ($i = 0; $i < $nb; $i++) { + if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP) + $context->shop = new Shop((int)$this->_list[$i]['id_shop_default']); + // convert price with the currency from context $this->_list[$i]['price'] = Tools::convertPrice($this->_list[$i]['price'], $this->context->currency, true, $this->context); - $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true); + $this->_list[$i]['price_tmp'] = Product::getPriceStatic($this->_list[$i]['id_product'], true, null, 2, null, false, true, 1, true, null, null, null, $nothing, true, true, $context); } } From 03ad842697bfd9923ee50b7e06cb36f9f41b498a Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 16:07:28 +0200 Subject: [PATCH 080/186] [-] BO : Fix bug #PSCFV-10790, Customer group names not exploded --- controllers/admin/AdminImportController.php | 69 ++++++++++++--------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index c8ea39bb2..ec8c31c92 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -958,7 +958,7 @@ class AdminImportControllerCore extends AdminController } elseif (isset($category->parent) && is_string($category->parent)) { - $category_parent = Category::searchByName($default_language_id, $category->parent, true); + $category_parent = Category::searchByName($id_lang, $category->parent, true); if ($category_parent['id_category']) { $category->id_parent = (int)$category_parent['id_category']; @@ -979,7 +979,7 @@ class AdminImportControllerCore extends AdminController { $this->errors[] = sprintf( Tools::displayError('%1$s (ID: %2$s) cannot be saved'), - $category_to_create->name[$default_language_id], + $category_to_create->name[$id_lang], (isset($category_to_create->id) && !empty($category_to_create->id))? $category_to_create->id : 'null' ); $this->errors[] = ($field_error !== true ? $field_error : '').(isset($lang_field_error) && $lang_field_error !== true ? $lang_field_error : ''). @@ -1021,8 +1021,8 @@ class AdminImportControllerCore extends AdminController ($lang_field_error = $category->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true && empty($this->errors)) { $category_already_created = Category::searchByNameAndParentCategoryId( - $default_language_id, - $category->name[$default_language_id], + $id_lang, + $category->name[$id_lang], $category->id_parent ); @@ -1286,7 +1286,7 @@ class AdminImportControllerCore extends AdminController } else if (is_string($value) && !empty($value)) { - $category = Category::searchByName($default_language_id, trim($value), true); + $category = Category::searchByName($id_lang, trim($value), true); if ($category['id_category']) $product->id_category[] = (int)$category['id_category']; else @@ -1949,6 +1949,9 @@ class AdminImportControllerCore extends AdminController $this->receiveTab(); $handle = $this->openCsvFile(); $default_language_id = (int)Configuration::get('PS_LANG_DEFAULT'); + $id_lang = Language::getIdByIso(Tools::getValue('iso_lang')); + if (!Validate::isUnsignedId($id_lang)) + $id_lang = $default_language_id; AdminImportController::setLocale(); for ($current_line = 0; $line = fgetcsv($handle, MAX_LINE_SIZE, $this->separator); $current_line++) { @@ -1976,31 +1979,40 @@ class AdminImportControllerCore extends AdminController $customer_exist = true; $customer_groups = $customer->getGroups(); $addresses = $customer->getAddresses((int)Configuration::get('PS_LANG_DEFAULT')); - foreach ($customer_groups as $key => $group) - if ($group == $customer->id_default_group) - unset($customer_groups[$key]); } + if (!isset($customer_groups) || count($customer_groups) == 0) + $customer_groups = array(0 => Configuration::get('PS_CUSTOMER_GROUP')); + // Group Importation if (isset($info['group']) && !empty($info['group'])) { - if (!isset($customer_groups)) - $customer_groups = array(); - - $myGroup = Group::searchByName($default_language_id, $info['group']); - - if (!$myGroup) + foreach (explode($this->multiple_value_separator, $info['group']) as $key => $group) { - $myGroup = new Group(); - $myGroup->name = Array($default_language_id => $info['group']); - $myGroup->price_display_method = 1; - $myGroup->add(); - $myGroup = Group::searchByName($default_language_id, $info['group']); + if(empty($group)) + continue; + $id_group = false; + $myGroup = Group::searchByName($id_lang, $group); + if (isset($myGroup['id_group']) && $myGroup['id_group']) + $id_group = (int)$myGroup['id_group']; + if (!$id_group) + { + $myGroup = new Group(); + $myGroup->name = Array($id_lang => $group); + if ($id_lang != $default_language_id) + $myGroup->name = array_merge($myGroup->name, array($default_language_id => $group)); + $myGroup->price_display_method = 1; + $myGroup->add(); + if (Validate::isLoadedObject($myGroup)) + $id_group = (int)$myGroup->id; + } + if ($id_group) + $customer_groups[] = (int)$id_group; } - if (isset($myGroup['0']['id_group'])) - $customer_groups[] = $myGroup['0']['id_group']; } - + elseif(empty($info['group']) && isset($customer->id) && $customer->id) + $customer_groups = array(0 => Configuration::get('PS_CUSTOMER_GROUP')); + AdminImportController::arrayWalk($info, array('AdminImportController', 'fillInfo'), $customer); if ($customer->passwd) @@ -2037,7 +2049,7 @@ class AdminImportControllerCore extends AdminController //set temporally for validate field $customer->id_shop = $default_shop->id; $customer->id_shop_group = $default_shop->getGroup()->id; - + $customer_groups = array_flip(array_flip($customer_groups)); $res = true; if (($field_error = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true && ($lang_field_error = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) @@ -2055,12 +2067,9 @@ class AdminImportControllerCore extends AdminController $customer->id = $current_id_customer; $res &= $customer->update(); } - else { $res &= $customer->add(); - if (isset($customer_groups)) - $customer->addGroups($customer_groups); if (isset($addresses)) foreach ($addresses as $address) { @@ -2069,6 +2078,8 @@ class AdminImportControllerCore extends AdminController Db::getInstance()->insert('address', $address); } } + if ($res && isset($customer_groups)) + $customer->updateGroup($customer_groups); } } else @@ -2083,8 +2094,6 @@ class AdminImportControllerCore extends AdminController else { $res &= $customer->add(); - if (isset($customer_groups)) - $customer->addGroups($customer_groups); if (isset($addresses)) foreach ($addresses as $address) { @@ -2093,9 +2102,12 @@ class AdminImportControllerCore extends AdminController Db::getInstance()->insert('address', $address); } } + if ($res && isset($customer_groups)) + $customer->updateGroup($customer_groups); } } } + unset($customer_groups); $customer_exist = false; if (!$res) { @@ -3088,3 +3100,4 @@ class AdminImportControllerCore extends AdminController } } } +?> \ No newline at end of file From 8e506ddff20568c21e3d99c583a28bb7ad41d7da Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 18:16:45 +0200 Subject: [PATCH 081/186] [-] BO : FIx bug #PSCFV-10736, could not load a product given from getBoughtProducts --- controllers/admin/AdminCustomersController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index ad841c3f2..ef2a9ac0e 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -630,6 +630,8 @@ class AdminCustomersControllerCore extends AdminController for ($i = 0; $i < $total_interested; $i++) { $product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']); + if (!Validate::isLoadedObject($product)) + continue; $interested[$i]['url'] = $this->context->link->getProductLink( $product->id, $product->link_rewrite, From 3e33a259ef0c6db435e24e9f0bc757cf2f12e6ef Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 18:33:37 +0200 Subject: [PATCH 082/186] [-] BO : FIx bug #PSCFV-10736 again, fixing query when product is not in base --- controllers/admin/AdminCustomersController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index ef2a9ac0e..33f1282f8 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -615,9 +615,10 @@ class AdminCustomersControllerCore extends AdminController $carts[$i]['name'] = $carrier->name; } - $sql = 'SELECT DISTINCT id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop + $sql = 'SELECT DISTINCT cp.id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop FROM '._DB_PREFIX_.'cart_product cp JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart) + JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product) WHERE c.id_customer = '.(int)$customer->id.' AND cp.id_product NOT IN ( SELECT product_id @@ -630,7 +631,7 @@ class AdminCustomersControllerCore extends AdminController for ($i = 0; $i < $total_interested; $i++) { $product = new Product($interested[$i]['id_product'], false, $this->default_form_language, $interested[$i]['id_shop']); - if (!Validate::isLoadedObject($product)) + if (!Validate::isLoadedObject($product)) continue; $interested[$i]['url'] = $this->context->link->getProductLink( $product->id, From 56693da6e0264bcc0d6c97f8ec8f04db00bec5c5 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 23 Oct 2013 19:02:13 +0200 Subject: [PATCH 083/186] // remove warning Notice: Undefined variable: connections in AdminCustomersController.php on line 702 --- controllers/admin/AdminCustomersController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 33f1282f8..3a15323f2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -646,6 +646,8 @@ class AdminCustomersControllerCore extends AdminController } $connections = $customer->getLastConnections(); + if (!is_array($connections)) + $connections = array(); $total_connections = count($connections); for ($i = 0; $i < $total_connections; $i++) { @@ -654,7 +656,7 @@ class AdminCustomersControllerCore extends AdminController preg_replace('/^www./', '', parse_url($connections[$i]['http_referer'], PHP_URL_HOST)) : $this->l('Direct link'); } - + $referrers = Referrer::getReferrers($customer->id); $total_referrers = count($referrers); for ($i = 0; $i < $total_referrers; $i++) From 6d3640e895924a48480ff9f52e56658e0a8621f9 Mon Sep 17 00:00:00 2001 From: Tom Panier Date: Thu, 24 Oct 2013 09:43:50 +0200 Subject: [PATCH 084/186] Conditions to hide VAT fields fail if there are no company fields "Company" fields may or may not be rendered on this form, whereas "VAT" fields are always rendered and depend on the former ones to be shown (or hidden) with CSS. This fixes an edge case where there are no "Company" fields rendered and "VAT" fields still wrongly appear, which was caused by the fact that `$('#field').val() != ''` is truthy when `$('#field').length` is zero (since `'' != undefined`). --- themes/default/order-opc-new-account.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/default/order-opc-new-account.tpl b/themes/default/order-opc-new-account.tpl index c96437cc3..cd0433f5a 100644 --- a/themes/default/order-opc-new-account.tpl +++ b/themes/default/order-opc-new-account.tpl @@ -74,14 +74,14 @@ {literal} function vat_number() { - if ($('#company').val() != '') + if (($('#company').length) && ($('#company').val() != '')) $('#vat_number_block').show(); else $('#vat_number_block').hide(); } function vat_number_invoice() { - if ($('#company_invoice').val() != '') + if (($('#company_invoice').length) && ($('#company_invoice').val() != '')) $('#vat_number_block_invoice').show(); else $('#vat_number_block_invoice').hide(); @@ -405,4 +405,4 @@
    -
    \ No newline at end of file +
    From b9de912dd30f731b0c5757ba961937e09ff2b099 Mon Sep 17 00:00:00 2001 From: Fabio Chelly Date: Thu, 24 Oct 2013 09:53:16 +0200 Subject: [PATCH 085/186] [-] MO : Fixed bug PNM-1431 - referralprogram Lack the % sign --- modules/referralprogram/controllers/front/program.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/referralprogram/controllers/front/program.php b/modules/referralprogram/controllers/front/program.php index 2b4d04dcd..68cf153b1 100755 --- a/modules/referralprogram/controllers/front/program.php +++ b/modules/referralprogram/controllers/front/program.php @@ -183,6 +183,8 @@ class ReferralprogramProgramModuleFrontController extends ModuleFrontController if ((int)($stats['nb_orders']) >= $orderQuantity) $canSendInvitations = true; + + $discountInPercent = Tools::getValue('discount_type', Configuration::get('REFERRAL_DISCOUNT_TYPE')) == 1; // Smarty display $this->context->smarty->assign(array( @@ -199,7 +201,7 @@ class ReferralprogramProgramModuleFrontController extends ModuleFrontController 'nbRevive' => $nbRevive, 'subscribeFriends' => ReferralProgramModule::getSponsorFriend((int)($this->context->customer->id), 'subscribed'), 'mails_exists' => (isset($mails_exists) ? $mails_exists : array()), - 'currencySign' => $this->context->currency->sign + 'currencySign' => ($discountInPercent ? '%' : $this->context->currency->sign) )); $this->setTemplate('program.tpl'); } From 81945cef71fe56ad15b2719e3143ae490a97290f Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 24 Oct 2013 10:00:19 +0200 Subject: [PATCH 086/186] [-] FO : Follow up https://github.com/PrestaShop/PrestaShop/pull/879 --- themes/default/authentication.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/authentication.tpl b/themes/default/authentication.tpl index de7859286..b8bdf025d 100644 --- a/themes/default/authentication.tpl +++ b/themes/default/authentication.tpl @@ -64,14 +64,14 @@ $(document).ready(function() { }); function vat_number() { - if ($('#company').val() != '') + if (($('#company').length) && ($('#company').val() != '')) $('#vat_number').show(); else $('#vat_number').hide(); } function vat_number_invoice() { - if ($('#company_invoice').val() != '') + if (($('#company_invoice').length) && ($('#company_invoice').val() != '')) $('#vat_number_block_invoice').show(); else $('#vat_number_block_invoice').hide(); From fc9b39968b9ac3fbe039c756ec85f4119c28730e Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 24 Oct 2013 11:46:09 +0200 Subject: [PATCH 087/186] // remove notice --- modules/productscategory/productscategory.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/productscategory/productscategory.tpl b/modules/productscategory/productscategory.tpl index 8b9b9f6cb..409c21e30 100644 --- a/modules/productscategory/productscategory.tpl +++ b/modules/productscategory/productscategory.tpl @@ -23,7 +23,7 @@ * International Registered Trademark & Property of PrestaShop SA *} -{if count($categoryProducts) > 0 && $categoryProducts !== false} +{if isset($categoryProducts) && count($categoryProducts) > 0 && $categoryProducts !== false}

    {$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}

    From 971722a13f6215ae57e4b4d635647205f90cec98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 24 Oct 2013 11:51:48 +0200 Subject: [PATCH 088/186] // note updated by ajax in admincustomers should be url encoded --- .../template/controllers/customers/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl index 9a0b01041..a9087d5dc 100644 --- a/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -35,7 +35,7 @@ $.ajax({ type: "POST", url: "index.php", - data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}¬e="+noteContent, + data: "token={getAdminToken tab='AdminCustomers'}&tab=AdminCustomers&ajax=1&action=updateCustomerNote&id_customer={$customer->id}¬e="+encodeURIComponent(noteContent), async : true, success: function(r) { $('#note_feedback').html('').hide(); From 2ffc2962790e8ca0c8b2c4688fdd82dec3c76382 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 24 Oct 2013 12:03:33 +0200 Subject: [PATCH 089/186] FO : https://github.com/PrestaShop/PrestaShop/pull/878 --- themes/default/order-opc-new-account.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/order-opc-new-account.tpl b/themes/default/order-opc-new-account.tpl index cd0433f5a..4e31a068c 100644 --- a/themes/default/order-opc-new-account.tpl +++ b/themes/default/order-opc-new-account.tpl @@ -206,7 +206,7 @@ {elseif $field_name eq "address2"}

    - +

    {elseif $field_name eq "postcode"} {$postCodeExist = true} @@ -332,7 +332,7 @@ {$postCodeExist = true}

    - +

    {elseif $field_name eq "city"}

    From ea8a5277f257a3d25ec5fee4d2f59309c882cccd Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 15:44:11 +0200 Subject: [PATCH 090/186] [*] BO : AdminImport add img manufacturers-suppliers --- controllers/admin/AdminImportController.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index ec8c31c92..de6ef7545 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -382,6 +382,7 @@ class AdminImportControllerCore extends AdminController 'meta_title' => array('label' => $this->l('Meta title')), 'meta_keywords' => array('label' => $this->l('Meta keywords')), 'meta_description' => array('label' => $this->l('Meta description')), + 'image' => array('label' => $this->l('Image URL')), 'shop' => array( 'label' => $this->l('ID / Name of group shop'), 'help' => $this->l('Ignore this field if you don\'t use the Multistore tool. If you leave this field empty, the default shop will be used.'), @@ -882,6 +883,12 @@ class AdminImportControllerCore extends AdminController case 'categories': $path = _PS_CAT_IMG_DIR_.(int)$id_entity; break; + case 'manufacturers': + $path = _PS_MANU_IMG_DIR_.(int)$id_entity; + break; + case 'suppliers': + $path = _PS_SUPP_IMG_DIR_.(int)$id_entity; + break; } $url = str_replace(' ', '%20', trim($url)); @@ -2370,6 +2377,11 @@ class AdminImportControllerCore extends AdminController if (!$res) $res = $manufacturer->add(); + //copying images of manufacturer + if (isset($manufacturer->image) && !empty($manufacturer->image)) + if (!AdminImportController::copyImg($manufacturer->id, null, $manufacturer->image, 'manufacturers', !Tools::getValue('regenerate'))) + $this->warnings[] = $manufacturer->image.' '.Tools::displayError('cannot be copied.'); + if ($res) { // Associate supplier to group shop @@ -2443,6 +2455,11 @@ class AdminImportControllerCore extends AdminController if (!$res) $res = $supplier->add(); + //copying images of suppliers + if (isset($supplier->image) && !empty($supplier->image)) + if (!AdminImportController::copyImg($supplier->id, null, $supplier->image, 'suppliers', !Tools::getValue('regenerate'))) + $this->warnings[] = $supplier->image.' '.Tools::displayError('cannot be copied.'); + if (!$res) $this->errors[] = Db::getInstance()->getMsgError().' '.sprintf( Tools::displayError('%1$s (ID: %2$s) cannot be saved'), @@ -3100,4 +3117,4 @@ class AdminImportControllerCore extends AdminController } } } -?> \ No newline at end of file +?> From 4803530eed1ff0e43b124c6f193322e9634c2ae9 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 15:47:31 +0200 Subject: [PATCH 091/186] [*] BO : AdminImport add img manufacturers --- docs/csv_import/manufacturers_import.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csv_import/manufacturers_import.csv b/docs/csv_import/manufacturers_import.csv index 6c8ea7cd0..2e4ef5d24 100644 --- a/docs/csv_import/manufacturers_import.csv +++ b/docs/csv_import/manufacturers_import.csv @@ -1,3 +1,3 @@ -id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description -1;1;Apple Computer, Inc;;;;; -2;1;Shure Incorporated;;;;; \ No newline at end of file +id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL +1;1;Apple Computer, Inc;;;;;http://youdomain.com/img.jpg +2;1;Shure Incorporated;;;;;http://youdomain.com/img.jpg From f0ed5a303ce2acf4e156a2eb0ad4f5857c55114a Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 15:49:56 +0200 Subject: [PATCH 092/186] [*] BO : AdminImport add img suppliers --- docs/csv_import/suppliers_import.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/csv_import/suppliers_import.csv b/docs/csv_import/suppliers_import.csv index db319c908..c02561686 100644 --- a/docs/csv_import/suppliers_import.csv +++ b/docs/csv_import/suppliers_import.csv @@ -1,3 +1,3 @@ -id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description -1;1;Applestore;;;;; -2;1;Shure Online Store;;;;; \ No newline at end of file +id;Active (0/1);Name*;Description;Short description;Meta-title;Meta-keywords;Meta-description;Image URL +1;1;Applestore;;;;;http://youdomain.com/img.jpg +2;1;Shure Online Store;;;;;http://youdomain.com/img.jpg From 84454bbc1c7a315e232245c5e43b300b8f153473 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 16:16:29 +0200 Subject: [PATCH 093/186] [*] BO : AdminImport add img manufacturers-suppliers --- .../default/template/controllers/import/helpers/form/form.tpl | 4 ++++ 1 file changed, 4 insertions(+) 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 181508404..223545e2d 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 @@ -227,6 +227,10 @@ $(".import_products_categories, label[for=regenerate], #regenerate").show(); else $(".import_products_categories, label[for=regenerate], #regenerate").hide(); + if ($("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6) + $("label[for=regenerate], #regenerate").show() + else + $("label[for=regenerate], #regenerate").hide(); if ($("#entity > option:selected").val() == 0 || $("#entity > option:selected").val() == 1 || $("#entity > option:selected").val() == 3 || $("#entity > option:selected").val() == 5 || $("#entity > option:selected").val() == 6 || $("#entity > option:selected").val() == 7) $("label[for=forceIDs], #forceIDs").show(); else From 3cd702da4223b9e58f95f47f7940fe33e42781f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 24 Oct 2013 16:30:02 +0200 Subject: [PATCH 094/186] [-] WS: Fix stockavailables list when stock is shared between shops #PSCFV-10793 --- classes/ObjectModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 3dd0072b6..0c70cbf3c 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -1139,7 +1139,7 @@ abstract class ObjectModelCore { $vars = get_class_vars($class_name); foreach ($vars['shopIDs'] as $id_shop) - $or[] = ' main.id_shop = '.(int)$id_shop.' '; + $or[] = '(main.id_shop = '.(int)$id_shop.(isset($this->def['fields']['id_shop_group']) ? ' OR (id_shop = 0 AND id_shop_group='.(int)Shop::getGroupFromShop((int)$id_shop).')' : '').')'; $prepend = ''; if (count($or)) @@ -1658,4 +1658,4 @@ abstract class ObjectModelCore { $this->update_fields = $fields; } -} \ No newline at end of file +} From c5324a653b0efc3cdb6a1706ce868578b1f83347 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 24 Oct 2013 16:31:50 +0200 Subject: [PATCH 095/186] [-] IN: Fix bug #PSCFV-10644 no carrier available after upgrade from 1.4.x --- .../php/update_customer_default_group.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/install-dev/upgrade/php/update_customer_default_group.php b/install-dev/upgrade/php/update_customer_default_group.php index 03bb77b6c..9ce468a41 100644 --- a/install-dev/upgrade/php/update_customer_default_group.php +++ b/install-dev/upgrade/php/update_customer_default_group.php @@ -39,9 +39,27 @@ function update_customer_default_group() $str_old = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)_PS_DEFAULT_CUSTOMER_GROUP_.');'; $str_new = 'define(\'_PS_DEFAULT_CUSTOMER_GROUP_\', '.(int)$ps_customer_group.');'; $content = str_replace($str_old, $str_new, $content); + + $carriers = Db::getInstance()->executeS(' + SELECT `id_carrier` + FROM `'._DB_PREFIX_.'carrier` + WHERE `deleted` = 0'); + + $groups = Db::getInstance()->executeS(' + SELECT `value` as id_group + FROM `'._DB_PREFIX_.'configuration` + WHERE `name` IN (\'PS_UNIDENTIFIED_GROUP\', \'PS_GUEST_GROUP\')'); + $result = false; + if (count($carriers) && is_array($carriers) && count($groups) && is_array($groups)) + foreach ($carriers as $carrier) + foreach ($groups as $group) + Db::getInstance()->execute(' + INSERT IGNORE INTO `'._DB_PREFIX_.'carrier_group` + VALUES ('.(int)$carrier['id_carrier'].', '.(int)$group['id_group'].')'); + if(file_exists($filename) && is_writable($filename)) - $result = (bool)@file_put_contents($filename, $content); + $result &= (bool)@file_put_contents($filename, $content); if($result === true && file_exists($filename) && file_exists($filename_old)) { @unlink($filename_old); From c516035e0e3030db0e8df98eb1c3f018cfdf0881 Mon Sep 17 00:00:00 2001 From: PhpMadman Date: Thu, 24 Oct 2013 17:19:28 +0200 Subject: [PATCH 096/186] [-] BO : fix #PSCFV-10728, prices incorrectly formatted when creating new order from BO --- .../template/controllers/orders/form.tpl | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 6e4597092..e151b8a8a 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -715,6 +715,20 @@ $('#payment_list').html(payment_list); } + function fixPriceFormat(price) + { + if(price.indexOf(',') > 0 && price.indexOf('.') > 0) // if contains , and . + { + if(price.indexOf(',') < price.indexOf('.')) // if , is before . + { + price = price.replace(',',''); // remove , + } + } + price = price.replace(' ',''); // remove any spaces + price = price.replace(',','.'); // remove , if price did not cotain both , and . + return price; + } + function displaySummary(jsonSummary) { currency_format = jsonSummary.currency.format; @@ -750,13 +764,13 @@ if (!changed_shipping_price) $('#shipping_price').html('' + formatCurrency(parseFloat(jsonSummary.summary.total_shipping), currency_format, currency_sign, currency_blank) + ''); shipping_price_selected_carrier = jsonSummary.summary.total_shipping; - - $('#total_vouchers').html(formatCurrency(parseFloat(jsonSummary.summary.total_discounts_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank)); - $('#total_shipping').html(formatCurrency(parseFloat(jsonSummary.summary.total_shipping_tax_exc.replace(',', '.')), currency_format, currency_sign, currency_blank)); - $('#total_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_tax.replace(',', '.')), currency_format, currency_sign, currency_blank)); - $('#total_without_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price_without_tax.replace(',', '.')), currency_format, currency_sign, currency_blank)); - $('#total_with_taxes').html(formatCurrency(parseFloat(jsonSummary.summary.total_price.replace(',', '.')), currency_format, currency_sign, currency_blank)); - $('#total_products').html(formatCurrency(parseFloat(jsonSummary.summary.total_products.replace(',', '.')), currency_format, currency_sign, currency_blank)); + + $('#total_vouchers').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_discounts_tax_exc)), currency_format, currency_sign, currency_blank)); + $('#total_shipping').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_shipping_tax_exc)), currency_format, currency_sign, currency_blank)); + $('#total_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_tax)), currency_format, currency_sign, currency_blank)); + $('#total_without_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price_without_tax)), currency_format, currency_sign, currency_blank)); + $('#total_with_taxes').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_price)), currency_format, currency_sign, currency_blank)); + $('#total_products').html(formatCurrency(parseFloat(fixPriceFormat(jsonSummary.summary.total_products)), currency_format, currency_sign, currency_blank)); id_currency = jsonSummary.cart.id_currency; $('#id_currency option').removeAttr('selected'); $('#id_currency option[value="'+id_currency+'"]').attr('selected', true); From cc3363011ed3419e5bc3301281a4109f9477af97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Thu, 24 Oct 2013 17:54:44 +0200 Subject: [PATCH 097/186] // rewrited urls for feeder module --- modules/feeder/rss.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/feeder/rss.php b/modules/feeder/rss.php index caa32a3c8..046650c4e 100644 --- a/modules/feeder/rss.php +++ b/modules/feeder/rss.php @@ -26,6 +26,9 @@ include(dirname(__FILE__).'/../../config/config.inc.php'); require_once(dirname(__FILE__).'/../../init.php'); +if (!Module::getInstanceByName('feeder')->active) + exit; + // Get data $number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10); $orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby')); @@ -64,7 +67,7 @@ echo ''."\n"; if (is_array($image) AND sizeof($image)) { $imageObj = new Image($image[0]['id_image']); - echo "getExistingImgPath()."-small_default.jpg' title='".str_replace('&', '', $product['name'])."' alt='thumb' />"; + echo "getImageLink($product['link_rewrite'], $image[0]['id_image'], 'small_default')."' title='".str_replace('&', '', $product['name'])."' alt='thumb' />"; $cdata = false; } if ($cdata) @@ -76,4 +79,4 @@ echo ''."\n"; } ?> - + \ No newline at end of file From 759fe2f67101552df4de0a38164f391a88ea7afc Mon Sep 17 00:00:00 2001 From: gRoussac Date: Thu, 24 Oct 2013 18:09:21 +0200 Subject: [PATCH 098/186] // norms --- admin-dev/themes/default/template/controllers/orders/form.tpl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index e151b8a8a..28759ec10 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -718,12 +718,8 @@ function fixPriceFormat(price) { if(price.indexOf(',') > 0 && price.indexOf('.') > 0) // if contains , and . - { if(price.indexOf(',') < price.indexOf('.')) // if , is before . - { price = price.replace(',',''); // remove , - } - } price = price.replace(' ',''); // remove any spaces price = price.replace(',','.'); // remove , if price did not cotain both , and . return price; From 8cb1806e49738087309a977f92279b85b95ecb40 Mon Sep 17 00:00:00 2001 From: indesign47 Date: Thu, 24 Oct 2013 18:13:05 +0200 Subject: [PATCH 099/186] // small fixes for Width Height Depth change 0,1;0,2;0,3 to 1,2,3 --- docs/csv_import/products_import.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csv_import/products_import.csv b/docs/csv_import/products_import.csv index 2475bab46..2952a2f05 100644 --- a/docs/csv_import/products_import.csv +++ b/docs/csv_import/products_import.csv @@ -1,3 +1,3 @@ ID;Active (0/1);Name*;Categories (x,y,z,…);Price tax excl. Or Price tax excl;Tax rules id;Wholesale price;On sale (0/1);Discount amount;Discount percent;Discount from (yyy-mm-dd);Discount to (yyy-mm-dd);Reference #;Supplier reference #;Supplier;Manufacturer;EAN13;UPC;Ecotax;Width;Height;Depth;Weight;Quantity;Minimum quantity;Visibility;Additional shipping cost;Unity;Unity price ratio;Short description;Description;Tags (x,y,z,...);Meta-title;Meta-keywords;Meta-description;URL rewritten;Text when in-stock;Text if back-order allowed;Available for order (0 = No, 1 = Yes);Product available date;Product creation date;Show price (0 = No, 1 = Yes);Image URLs (x,y,z,...);Delete existing images (0 = No, 1 = Yes);Feature (Name:Value:Position);Available online only (0 = No, 1 = Yes);Condition (new,used,refurbished);Customizable;File fields;Text fields;Out of stock;Advanced stock management;ID / Name of shop -1;1;iPod Nano;Home, iPods;49;1;40;0;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;5605055055056;560505505555;0;0,1;0,2;0,3;0.5;800;1;both;0.00;;0.00;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;Meta title;Meta keywords;Meta description;ipod-nano;In stock;Out stock;1;;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;0;Music:Rock:1;0;new;0;0;0;2;0;1 -2;1;iPod shuffle;Home, iPods;66.05;1;50;0;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;5605055055057;560505505556;0;0,1;0,2;0,3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the world’s most wearabl….;You want listen to music;ipod, shuffle;Meta title;Meta keywords;Meta description;ipod-shuffle;In stock;Out stock;1;;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;0;Music:Blues:2;0;new;0;0;0;2;0;1 +1;1;iPod Nano;Home, iPods;49;1;40;0;;;;;92458844;54778855;AppleStore;Apple Computer, Inc;5605055055056;560505505555;0;1;2;3;0.5;800;1;both;0.00;;0.00;New design. New features. Now i….;Curved ahead of the curve. For those about to rock, we give you nine amazing colors. But that's only part of the story. Feel the curved, all-aluminum and glass de...;apple, ipod, nano;Meta title;Meta keywords;Meta description;ipod-nano;In stock;Out stock;1;;;1;http://youdomain.com/img.jpg, http://yourdomain.com/img1.jpg;0;Music:Rock:1;0;new;0;0;0;2;0;1 +2;1;iPod shuffle;Home, iPods;66.05;1;50;0;;;;;92458845;54778855;AppleStore;Apple Computer, Inc;5605055055057;560505505556;0;1;2;3;0.5;800;1;both;0.00;;0.00;iPod shuffle, the world’s most wearabl….;You want listen to music;ipod, shuffle;Meta title;Meta keywords;Meta description;ipod-shuffle;In stock;Out stock;1;;;1;http://youdomain.com/img25.jpg, http://yourdomain.com/img30.jpg;0;Music:Blues:2;0;new;0;0;0;2;0;1 From 6f57093f50b8a0fe783dfb226540c9c49f114929 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Thu, 24 Oct 2013 18:36:36 +0200 Subject: [PATCH 100/186] [-] BO : FixBug #PSCFV-10600 - Unmatched Boundary with mod_security --- .../default/template/controllers/modules/favorites.tpl | 4 ++-- .../template/controllers/modules_positions/list_modules.tpl | 2 +- .../template/controllers/orders/helpers/view/view.tpl | 2 +- .../default/template/controllers/products/associations.tpl | 4 ++-- .../default/template/controllers/products/combinations.tpl | 2 +- .../themes/default/template/controllers/products/prices.tpl | 2 +- .../template/controllers/referrers/helpers/view/view.tpl | 2 +- admin-dev/themes/default/template/helpers/form/form.tpl | 2 +- .../themes/default/template/helpers/list/list_header.tpl | 4 ++-- classes/AdminTab.php | 4 ++-- install-dev/dev/translate.php | 2 +- js/tiny_mce/plugins/advlink/js/advlink.js | 4 ++-- js/tiny_mce/plugins/media/js/media.js | 2 +- js/tiny_mce/themes/advanced/skins/o2k7/advlink.js | 4 ++-- js/tiny_mce/themes/advanced/skins/o2k7/media.js | 2 +- modules/importerosc/importerosc.php | 4 ++-- modules/productcomments/productcomments.php | 2 +- modules/shopimporter/shopimporter.php | 2 +- modules/statsstock/statsstock.php | 2 +- modules/watermark/config.xml | 2 +- themes/default/mobile/contact-form.tpl | 6 +++--- 21 files changed, 30 insertions(+), 30 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/modules/favorites.tpl b/admin-dev/themes/default/template/controllers/modules/favorites.tpl index 13efe0e73..911c3dd28 100755 --- a/admin-dev/themes/default/template/controllers/modules/favorites.tpl +++ b/admin-dev/themes/default/template/controllers/modules/favorites.tpl @@ -59,14 +59,14 @@ {$module->categoryName} diff --git a/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl b/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl index 623e83dde..a10cf1145 100644 --- a/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl +++ b/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl @@ -37,7 +37,7 @@ {l s='Show'} : - + {foreach from=$orderMessages item=orderMessage} {/foreach} diff --git a/admin-dev/themes/default/template/controllers/products/associations.tpl b/admin-dev/themes/default/template/controllers/products/associations.tpl index 71a1d1f53..862d779fa 100644 --- a/admin-dev/themes/default/template/controllers/products/associations.tpl +++ b/admin-dev/themes/default/template/controllers/products/associations.tpl @@ -103,11 +103,11 @@     {l s='Create new manufacturer'} diff --git a/admin-dev/themes/default/template/controllers/products/combinations.tpl b/admin-dev/themes/default/template/controllers/products/combinations.tpl index b6a3e450e..e571f0125 100644 --- a/admin-dev/themes/default/template/controllers/products/combinations.tpl +++ b/admin-dev/themes/default/template/controllers/products/combinations.tpl @@ -85,7 +85,7 @@ From 9660cef0aad55f93568616c775d163add5a6dffe Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 09:58:42 +0100 Subject: [PATCH 129/186] [-] MO : mailalert - Fix deprecated warning on displayDate --- modules/mailalerts/mailalerts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 485240d43..4dc9f0554 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -287,7 +287,7 @@ class MailAlerts extends Module $configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_COLOR'), $id_lang, null, $id_shop); $delivery = new Address((int)$order->id_address_delivery); $invoice = new Address((int)$order->id_address_invoice); - $order_date_text = Tools::displayDate($order->date_add, (int)$id_lang); + $order_date_text = Tools::displayDate($order->date_add); $carrier = new Carrier((int)$order->id_carrier); $message = $this->getAllMessages($order->id); From 1d90218e0db6051b8ab9d0f6ae6e99b0991f3db3 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 10:00:57 +0100 Subject: [PATCH 130/186] // Update mailalert module version --- modules/mailalerts/config.xml | 2 +- modules/mailalerts/mailalerts.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mailalerts/config.xml b/modules/mailalerts/config.xml index d01df2961..5cf97756c 100755 --- a/modules/mailalerts/config.xml +++ b/modules/mailalerts/config.xml @@ -2,7 +2,7 @@ mailalerts - + diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 4dc9f0554..c622d8f97 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -46,7 +46,7 @@ class MailAlerts extends Module { $this->name = 'mailalerts'; $this->tab = 'administration'; - $this->version = '2.5'; + $this->version = '2.6'; $this->author = 'PrestaShop'; $this->need_instance = 0; From 2b67d7072ce14e5e640c2d20d47dbd1140fb83d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 29 Oct 2013 10:18:29 +0100 Subject: [PATCH 131/186] // type of logger field --- .../ajaxfilemanager/ajax_file_upload.php | 20 ++++++------------- .../ajaxfilemanager/ajax_get_file_listing.php | 3 ++- classes/Logger.php | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/admin-dev/ajaxfilemanager/ajax_file_upload.php b/admin-dev/ajaxfilemanager/ajax_file_upload.php index b21a39c13..c942991ed 100755 --- a/admin-dev/ajaxfilemanager/ajax_file_upload.php +++ b/admin-dev/ajaxfilemanager/ajax_file_upload.php @@ -22,26 +22,18 @@ $upload->setInvalidFileExt(explode(",", CONFIG_UPLOAD_INVALID_EXTS)); if(CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_UPLOAD) - { $error = SYS_DISABLED; - } elseif(empty($_GET['folder']) || !isUnderRoot($_GET['folder'])) - { $error = ERR_FOLDER_PATH_NOT_ALLOWED; - }else if(!$upload->isFileUploaded('file')) - { + elseif (!$upload->isFileUploaded('file')) $error = ERR_FILE_NOT_UPLOADED; - }else if(!$upload->moveUploadedFile($_GET['folder'])) - { - $error = ERR_FILE_MOVE_FAILED; - } - elseif(!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) - { + elseif (!$upload->isPermittedFileExt(explode(",", CONFIG_UPLOAD_VALID_EXTS))) $error = ERR_FILE_TYPE_NOT_ALLOWED; - }elseif(defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) - { + elseif (defined('CONFIG_UPLOAD_MAXSIZE') && CONFIG_UPLOAD_MAXSIZE && $upload->isSizeTooBig(CONFIG_UPLOAD_MAXSIZE)) $error = sprintf(ERROR_FILE_TOO_BID, transformFileSize(CONFIG_UPLOAD_MAXSIZE)); - }else + elseif (!$upload->moveUploadedFile($_GET['folder'])) + $error = ERR_FILE_MOVE_FAILED; + else { include_once(CLASS_FILE); $path = $upload->getFilePath(); diff --git a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php index c72110344..bb85caada 100755 --- a/admin-dev/ajaxfilemanager/ajax_get_file_listing.php +++ b/admin-dev/ajaxfilemanager/ajax_get_file_listing.php @@ -24,7 +24,8 @@ if(!empty($_GET['search'])) { include_once(CLASS_SEARCH); - + if (!preg_match('/^'.Tools::pRegexp(realpath(dirname(__FILE__).'/'.$_GET['search_folder']), '/').'/i', _PS_ROOT_DIR_.'/img/cms')) + exit; $search = new Search($_GET['search_folder']); $search->addSearchKeyword('recursive', @$_GET['search_recursively']); $search->addSearchKeyword('mtime_from', @$_GET['search_mtime_from']); diff --git a/classes/Logger.php b/classes/Logger.php index ff7fb994d..f6dc77a3d 100644 --- a/classes/Logger.php +++ b/classes/Logger.php @@ -62,7 +62,7 @@ class LoggerCore extends ObjectModel 'fields' => array( 'severity' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true), 'error_code' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), - 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'required' => true), + 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'required' => true), 'object_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'object_type' => array('type' => self::TYPE_STRING, 'validate' => 'isName'), From d2e475dd3a19b637fc6690a6efca6062fffc2214 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 10:30:59 +0100 Subject: [PATCH 132/186] // Removed line from merge --- modules/mailalerts/config.xml | 2 +- modules/mailalerts/mailalerts.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/mailalerts/config.xml b/modules/mailalerts/config.xml index 5cf97756c..98984a992 100755 --- a/modules/mailalerts/config.xml +++ b/modules/mailalerts/config.xml @@ -2,7 +2,7 @@ mailalerts - + diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index c622d8f97..57ed8cb91 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -46,7 +46,7 @@ class MailAlerts extends Module { $this->name = 'mailalerts'; $this->tab = 'administration'; - $this->version = '2.6'; + $this->version = '2.7'; $this->author = 'PrestaShop'; $this->need_instance = 0; @@ -393,6 +393,7 @@ class MailAlerts extends Module '{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency), + '{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency), '{currency}' => $currency->sign, '{message}' => $message From 07222be5dd11369df5016234888cdccd87812763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 29 Oct 2013 10:53:00 +0100 Subject: [PATCH 133/186] // demo mode on ajaxfilemanager --- admin-dev/ajaxfilemanager/inc/config.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin-dev/ajaxfilemanager/inc/config.php b/admin-dev/ajaxfilemanager/inc/config.php index 2f30ed245..09b4e4200 100755 --- a/admin-dev/ajaxfilemanager/inc/config.php +++ b/admin-dev/ajaxfilemanager/inc/config.php @@ -10,6 +10,9 @@ //FILESYSTEM CONFIG
    require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "class.auth.php"); + if (_PS_MODE_DEMO_) + die('This functionality has been disabled.'); + define('CONFIG_QUERY_STRING_ENABLE', true); //Enable passed query string to setting the system configuration if(!isset($_SESSION)) { From af61191a7ef903a2869a25120e671532e021b9f8 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 29 Oct 2013 10:55:46 +0100 Subject: [PATCH 134/186] // rename field Action when out of stock --- controllers/admin/AdminImportController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminImportController.php b/controllers/admin/AdminImportController.php index de6ef7545..39da4ccab 100644 --- a/controllers/admin/AdminImportController.php +++ b/controllers/admin/AdminImportController.php @@ -253,7 +253,7 @@ class AdminImportControllerCore extends AdminController 'customizable' => array('label' => $this->l('Customizable (0 = No, 1 = Yes)')), 'uploadable_files' => array('label' => $this->l('Uploadable files (0 = No, 1 = Yes)')), 'text_fields' => array('label' => $this->l('Text fields (0 = No, 1 = Yes)')), - 'out_of_stock' => array('label' => $this->l('Out_of_stock')), + 'out_of_stock' => array('label' => $this->l('Action when out of stock')), 'advanced_stock_management' => array('label' => $this->l('Advanced stock management')), 'shop' => array( 'label' => $this->l('ID / Name of shop'), From 1bee84d26cd8daa43e06806f9679dde2e831d035 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 29 Oct 2013 10:57:33 +0100 Subject: [PATCH 135/186] [-] BO : Do not delete other default jpg when _deleteOldImages and type defined --- controllers/admin/AdminImagesController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 922fcf050..9a1e2dd9a 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -438,10 +438,11 @@ class AdminImagesControllerCore extends AdminController if (!is_dir($dir)) return false; $toDel = scandir($dir); + foreach ($toDel as $d) foreach ($type as $imageType) - if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-(.*)\.jpg$/', $d)) - if (file_exists($dir.$d)) + if (preg_match('/^[0-9]+\-'.($product ? '[0-9]+\-' : '').$imageType['name'].'\.jpg$/', $d) || preg_match('/^([[:lower:]]{2})\-default\-'.$imageType['name'].'\.jpg$/', $d)) + if (file_exists($dir.$d)) unlink($dir.$d); // delete product images using new filesystem. From d4096142225e76d02394927be3ad0396465df340 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 29 Oct 2013 11:18:53 +0100 Subject: [PATCH 136/186] [-] FO : CustomerMessage ip_address to string --- classes/CustomerMessage.php | 2 +- install-dev/upgrade/sql/1.5.6.1.sql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 install-dev/upgrade/sql/1.5.6.1.sql diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index ae8709d5b..18291b3ac 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -46,7 +46,7 @@ class CustomerMessageCore extends ObjectModel 'fields' => array( 'id_employee' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_customer_thread' => array('type' => self::TYPE_INT), - 'ip_address' => array('type' => self::TYPE_INT, 'validate' => 'isIp2Long'), + 'ip_address' => array('type' => self::TYPE_STRING, 'validate' => 'isIp2Long', 'size' => 15), 'message' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000), 'file_name' => array('type' => self::TYPE_STRING), 'user_agent' => array('type' => self::TYPE_STRING), diff --git a/install-dev/upgrade/sql/1.5.6.1.sql b/install-dev/upgrade/sql/1.5.6.1.sql new file mode 100644 index 000000000..435bb1009 --- /dev/null +++ b/install-dev/upgrade/sql/1.5.6.1.sql @@ -0,0 +1 @@ +ALTER TABLE `PREFIX_customer_message` CHANGE `ip_address` `ip_address` VARCHAR( 15 ) NULL DEFAULT NULL; \ No newline at end of file From 580e201c48cee8214bb997e86dd18c3e2db961b8 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 11:38:48 +0100 Subject: [PATCH 137/186] [-] BO : FixBug #PSCFV-9319 - display only valid order id --- .../controllers/customer_threads/message.tpl | 35 ++++++++++--------- .../admin/AdminCustomerThreadsController.php | 9 ++++- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/customer_threads/message.tpl b/admin-dev/themes/default/template/controllers/customer_threads/message.tpl index 533d12610..a181a2f79 100644 --- a/admin-dev/themes/default/template/controllers/customer_threads/message.tpl +++ b/admin-dev/themes/default/template/controllers/customer_threads/message.tpl @@ -57,14 +57,14 @@

    {l s='Sent on:'}
    -
    {$message.date_add}
    +
    {$message.date_add} 
    {if empty($message.id_employee)}
    {l s='Browser:'}
    -
    {$message.user_agent}
    +
    {$message.user_agent} 
    {/if} @@ -79,34 +79,35 @@ {/if} - {if !empty($message.id_order) && empty($message.id_employee)} + {if !empty($message.id_order) && $is_valid_order_id && empty($message.id_employee)}
    {l s='Order #'}
    -
    - {$message.id_order} {l s='View'} -
    +
    {$message.id_order} {l s='View'} +
    {/if} {if !empty($message.id_product) && empty($message.id_employee)}
    {l s='Product #'}
    -
    - {$message.id_product} {l s='View'} -
    +
    {$message.id_product} {l s='View'}
    {/if}
    - {l s='Subject:'} - +
    +
    {l s='Subject:'}
    +
    + +
    +
    diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index c53945a5b..da3f4b15c 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -605,6 +605,12 @@ class AdminCustomerThreadsControllerCore extends AdminController ENT_QUOTES, 'UTF-8') ); + $is_valid_order_id = true; + $order = new Order((int)$message['id_order']); + + if (!Validate::isLoadedObject($order)) + $is_valid_order_id = false; + $tpl->assign(array( 'current' => self::$currentIndex, 'token' => $this->token, @@ -615,7 +621,8 @@ class AdminCustomerThreadsControllerCore extends AdminController 'PS_SHOP_NAME' => Configuration::get('PS_SHOP_NAME'), 'file_name' => file_exists(_PS_UPLOAD_DIR_.$message['file_name']), 'contacts' => $contacts, - 'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])) + 'PS_CUSTOMER_SERVICE_SIGNATURE' => str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])), + 'is_valid_order_id' => $is_valid_order_id )); return $tpl->fetch(); From b605f33359a1819c56f32ab82bd83660f1095626 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 29 Oct 2013 12:07:30 +0100 Subject: [PATCH 138/186] [-] BO : FixBug #PSCFV-10866 - Tagify system not working --- .../controllers/products/informations.tpl | 13 ++++++++++++- .../default/template/helpers/form/form.tpl | 4 ++-- admin-dev/themes/default/template/toolbar.tpl | 2 +- controllers/admin/AdminProductsController.php | 17 +++++++++-------- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/products/informations.tpl b/admin-dev/themes/default/template/controllers/products/informations.tpl index 0b56c1d73..847911f7f 100644 --- a/admin-dev/themes/default/template/controllers/products/informations.tpl +++ b/admin-dev/themes/default/template/controllers/products/informations.tpl @@ -375,8 +375,19 @@ {foreach from=$languages item=language}
    + {literal} + + {/literal} + value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" class="tagify" /> {l s='Forbidden characters:'} !<;>;?=+#"°{}_$% 
    {/foreach} diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index 8593f7542..888813d50 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -68,7 +68,7 @@