// Context in modules + Shop::sql* methods

This commit is contained in:
rMalie
2011-07-19 09:23:10 +00:00
parent 6551a3ece7
commit ff81f71449
25 changed files with 127 additions and 263 deletions
+14 -17
View File
@@ -1171,28 +1171,25 @@ abstract class AdminTabCore
$whereShop = Shop::sqlRestriction($this->shopShareDatas, 'a', null, null, $this->shopLinkType);
}
$filterShop = '';
if (Context::shop() != Shop::CONTEXT_ALL)
$assos = Shop::getAssoTables();
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
{
$assos = Shop::getAssoTables();
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
$filterKey = $assos[$this->table]['type'];
$idenfierShop = Shop::getListFromContext();
}
else if (Context::shop() == Shop::CONTEXT_GROUP)
{
$assos = GroupShop::getAssoTables();
if (isset($assos[$this->table]) AND $assos[$this->table]['type'] == 'group_shop')
{
$filterKey = $assos[$this->table]['type'];
$idenfierShop = Shop::getListFromContext();
$idenfierShop = array($context->shop->getGroupID());
}
else if (Context::shop() == Shop::CONTEXT_GROUP)
{
$assos = GroupShop::getAssoTables();
if (isset($assos[$this->table]) AND $assos[$this->table]['type'] == 'group_shop')
{
$filterKey = $assos[$this->table]['type'];
$idenfierShop = array($context->shop->getGroupID());
}
}
if (isset($filterKey))
$filterShop = 'JOIN `'._DB_PREFIX_.$this->table.'_'.$filterKey.'` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filterKey.' IN ('.implode(', ', $idenfierShop).'))';
}
$filterShop = '';
if (isset($filterKey))
$filterShop = 'JOIN `'._DB_PREFIX_.$this->table.'_'.$filterKey.'` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filterKey.' IN ('.implode(', ', $idenfierShop).'))';
/* Query in order to get results with all fields */
$sql = 'SELECT SQL_CALC_FOUND_ROWS