From 9a877f14c9811d3b1b86cd8a3dc624040deb40b4 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Thu, 5 Jul 2012 14:18:22 +0000 Subject: [PATCH] [-] BO : Fixed SQL crash with an empty shop list #PSCFV-2946 --- .../default/template/controllers/cart_rules/conditions.tpl | 2 +- classes/CartRule.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/cart_rules/conditions.tpl b/admin-dev/themes/default/template/controllers/cart_rules/conditions.tpl index d816fdb1c..5712c27f1 100644 --- a/admin-dev/themes/default/template/controllers/cart_rules/conditions.tpl +++ b/admin-dev/themes/default/template/controllers/cart_rules/conditions.tpl @@ -232,7 +232,7 @@ id="shop_select_add" style="text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" > - + {l s='Add'} >> diff --git a/classes/CartRule.php b/classes/CartRule.php index d6625e25e..bb6967a98 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -943,9 +943,9 @@ class CartRuleCore extends ObjectModel $shop_list = ''; if ($type == 'shop') { - $shop_list = ' AND t.id_shop IN ('; $shops = Context::getContext()->employee->getAssociatedShops(); - $shop_list .= implode(array_map('intval', $shops), ',').')'; + if (count($shops)) + $shop_list = ' AND t.id_shop IN ('.implode(array_map('intval', $shops), ',').') '; } if (!Validate::isLoadedObject($this) OR $this->{$type.'_restriction'} == 0)