From bdad515233ecfaaf06b828f4917ef9de46e838fa Mon Sep 17 00:00:00 2001 From: aFolletete Date: Wed, 4 Jan 2012 15:52:25 +0000 Subject: [PATCH] // fixed small bug git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12147 b9a71923-0436-4b27-9f14-aed3839534dd --- install-new/data/theme.sql | 4 +-- .../ProductCommentCriterion.php | 33 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/install-new/data/theme.sql b/install-new/data/theme.sql index 4b260fdbd..c947d9ad3 100644 --- a/install-new/data/theme.sql +++ b/install-new/data/theme.sql @@ -55,7 +55,7 @@ UPDATE `PREFIX_configuration` SET value = 'http://www.facebook.com/prestashop' W UPDATE `PREFIX_configuration` SET value = 'http://www.twitter.com/prestashop' WHERE name = 'blocksocial_twitter'; UPDATE `PREFIX_configuration` SET value = 'RSS' WHERE name = 'blocksocial_rss'; UPDATE `PREFIX_configuration` SET value = 'Prestashop' WHERE name = 'blockcontactinfos_company'; -UPDATE `PREFIX_configuration` SET value = '41, boulevard des capucines, 75002 Paris, France' WHERE name = 'blockcontactinfos_address'; +UPDATE `PREFIX_configuration` SET value = '41, boulevard des capucines\n75002 Paris\nFrance' WHERE name = 'blockcontactinfos_address'; UPDATE `PREFIX_configuration` SET value = '+33 (0)1.40.18.30.04' WHERE name = 'blockcontactinfos_phone'; UPDATE `PREFIX_configuration` SET value = 'pub@prestashop.com' WHERE name = 'blockcontactinfos_email'; UPDATE `PREFIX_configuration` SET value = '+33 (0)1.40.18.30.04' WHERE name = 'blockcontact_telnumber'; @@ -81,7 +81,6 @@ INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VAL INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcms'), 5); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockstore'), 6); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcontact'), 7); -INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayRightColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocknewsletter'), 8); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocktags'), 2); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcategories'), 3); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockviewed'), 4); @@ -90,6 +89,7 @@ INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VAL INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockcms'), 6); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockadvertising'), 7); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockpaymentlogo'), 8); +INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayLeftColumn'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blocknewsletter'), 9); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayHome'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'homeslider'), 1); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayHome'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'homefeatured'), 2); INSERT IGNORE INTO `PREFIX_hook_module` (`id_hook`, `id_module`, `position`) VALUES ((SELECT id_hook FROM `PREFIX_hook` WHERE name = 'displayHeader'), (SELECT id_module FROM `PREFIX_module` WHERE name = 'blockpaymentlogo'), 2); diff --git a/modules/productcomments/ProductCommentCriterion.php b/modules/productcomments/ProductCommentCriterion.php index 10363c251..8a109a6ba 100644 --- a/modules/productcomments/ProductCommentCriterion.php +++ b/modules/productcomments/ProductCommentCriterion.php @@ -1,6 +1,6 @@ 'product_comment_criterion', 'primary' => 'id_product_comment_criterion', + 'multilang' => true, 'fields' => array( 'id_product_comment_criterion_type' => array('type' => self::TYPE_INT), 'active' => array('type' => self::TYPE_BOOL), // Lang fields - 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), + 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), ) ); @@ -64,7 +65,7 @@ class ProductCommentCriterion extends ObjectModel return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_grade` WHERE `id_product_comment_criterion` = '.(int)$this->id); } - + public function update($nullValues = false) { $previousUpdate = new self((int)$this->id); @@ -81,7 +82,7 @@ class ProductCommentCriterion extends ObjectModel } return true; } - + /** * Link a Comment Criterion to a product * @@ -91,10 +92,10 @@ class ProductCommentCriterion extends ObjectModel { if (!Validate::isUnsignedId($id_product)) die(Tools::displayError()); - return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_product` (`id_product_comment_criterion`, `id_product`) + return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_product` (`id_product_comment_criterion`, `id_product`) VALUES('.(int)$this->id.','.(int)$id_product.')')); } - + /** * Link a Comment Criterion to a category * @@ -104,10 +105,10 @@ class ProductCommentCriterion extends ObjectModel { if (!Validate::isUnsignedId($id_category)) die(Tools::displayError()); - return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_category` (`id_product_comment_criterion`, `id_category`) + return (Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'product_comment_criterion_category` (`id_product_comment_criterion`, `id_category`) VALUES('.(int)$this->id.','.(int)$id_category.')')); } - + /** * Add grade to a criterion * @@ -128,7 +129,7 @@ class ProductCommentCriterion extends ObjectModel '.(int)$this->id.', '.(int)($grade).')')); } - + /** * Get criterion by Product * @@ -149,7 +150,7 @@ class ProductCommentCriterion extends ObjectModel WHERE pccl.`id_lang` = '.(int)($id_lang).' AND (pccp.id_product IS NOT NULL OR p.id_product IS NOT NULL OR pcc.id_product_comment_criterion_type = 1) AND pcc.active = 1 GROUP BY pcc.id_product_comment_criterion'); } - + /** * Get Criterions * @@ -166,7 +167,7 @@ class ProductCommentCriterion extends ObjectModel WHERE pccl.`id_lang` = '.(int)$id_lang.($active ? ' AND active = 1' : '').($type ? ' AND id_product_comment_criterion_type = '.(int)$type : '').' ORDER BY pccl.`name` ASC')); } - + public function getProducts() { $res = Db::getInstance()->executeS(' @@ -179,7 +180,7 @@ class ProductCommentCriterion extends ObjectModel $products[] = (int)$row['id_product']; return $products; } - + public function getCategories() { $res = Db::getInstance()->executeS(' @@ -192,17 +193,17 @@ class ProductCommentCriterion extends ObjectModel $criterions[] = (int)$row['id_category']; return $criterions; } - + public function deleteCategories() { return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_category` WHERE `id_product_comment_criterion` = '.(int)$this->id); } - + public function deleteProducts() { return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_comment_criterion_product` WHERE `id_product_comment_criterion` = '.(int)$this->id); } - + public static function getTypes() { return array(1 => Tools::displayError('Valid for the entire catalog'), 2 => Tools::displayError('Restricted to some categories'), 3 => Tools::displayError('Restricted to some products'));