[*] BO : Rights verification for multi-shop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9198 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+29
-1
@@ -440,6 +440,7 @@ class ShopCore extends ObjectModel
|
||||
public static function getShops($active = true, $id_group_shop = null, $get_as_list_id = false)
|
||||
{
|
||||
Shop::cacheShops();
|
||||
|
||||
$results = array();
|
||||
foreach (self::$shops as $group_id => $group_data)
|
||||
foreach ($group_data['shops'] as $id => $shop_data)
|
||||
@@ -492,12 +493,29 @@ class ShopCore extends ObjectModel
|
||||
return count(Shop::getShops($active));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Total of shops
|
||||
*/
|
||||
public static function getTotalShopsWhoExists()
|
||||
{
|
||||
return (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop`');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int Total of shops
|
||||
*/
|
||||
public static function getTotalShopsByIdGroupShop($id)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM '._DB_PREFIX_.'shop WHERE id_group_shop = %d', (int)$id));
|
||||
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM `'._DB_PREFIX_.'shop` WHERE `id_group_shop` = %d', (int)$id));
|
||||
}
|
||||
|
||||
public static function getIdShopsByIdGroupShop($id)
|
||||
{
|
||||
$result = Db::getInstance()->executeS(sprintf('SELECT `id_shop`, `id_group_shop` FROM `'._DB_PREFIX_.'shop` WHERE `id_group_shop` = %d', (int)$id));
|
||||
$data = array();
|
||||
foreach ($result as $group_data)
|
||||
$data[] = (int)$group_data['id_shop'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -762,4 +780,14 @@ class ShopCore extends ObjectModel
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public function checkIfShopExist($id)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'shop` WHERE `id_shop` = %d', (int)$id));
|
||||
}
|
||||
|
||||
public function checkIfGroupShopExist($id)
|
||||
{
|
||||
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'group_shop` WHERE `id_group_shop` = %d', (int)$id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user