[*] BO : added right of multi-shop

This commit is contained in:
lLefevre
2011-10-07 15:39:55 +00:00
parent a89f7e73b5
commit 7e7793ec5b
10 changed files with 367 additions and 258 deletions
+6 -5
View File
@@ -408,13 +408,14 @@ function generateShopList()
$value = '';
// Generate HTML
$url = $_SERVER['REQUEST_URI'] . (($_SERVER['QUERY_STRING']) ? '&' : '?') . 'setShopContext=';
$url = $_SERVER['REQUEST_URI'].(($_SERVER['QUERY_STRING']) ? '&' : '?').'setShopContext=';
$html = '<select class="shopList" onchange="location.href = \''.$url.'\'+$(this).val();">';
$html .= '<option value="" class="first">'.translate('All shops').'</option>';
foreach ($tree as $gID => $groupData)
$html .= (Context::getContext()->employee->id_profile == _PS_ADMIN_PROFILE_) ? '<option value="" class="first">'.translate('All shops').'</option>' : '';
foreach ($tree as $gID => $group_data)
{
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').'>'.htmlspecialchars($groupData['name']).'</option>';
foreach ($groupData['shops'] as $sID => $shopData)
$disabled = ($group_data['totalShops'] != count($group_data['shops'])) ? 'disabled="disabled"' : '';
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').' '.$disabled.'>'.htmlspecialchars($group_data['name']).'</option>';
foreach ($group_data['shops'] as $sID => $shopData)
if ($shopData['active'])
$html .= '<option value="s-'.$sID.'" class="shop" '.(($value == 's-'.$sID) ? 'selected="selected"' : '').'>&raquo; '.$shopData['name'].'</option>';
}
+50 -24
View File
@@ -34,21 +34,21 @@ class AdminEmployees extends AdminTab
{
$this->context = Context::getContext();
$this->table = 'employee';
$this->className = 'Employee';
$this->className = 'Employee';
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->delete = true;
$this->_select = 'pl.`name` AS profile';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'profile` p ON a.`id_profile` = p.`id_profile`
LEFT JOIN `'._DB_PREFIX_.'profile_lang` pl ON (pl.`id_profile` = p.`id_profile` AND pl.`id_lang` = '.(int)$this->context->language->id.')';
$profiles = Profile::getProfiles($this->context->language->id);
if (!$profiles)
$this->_errors[] = Tools::displayError('No profile');
else
foreach ($profiles AS $profile)
foreach ($profiles as $profile)
$this->profilesArray[$profile['name']] = $profile['name'];
$this->fieldsDisplay = array(
'id_employee' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'lastname' => array('title' => $this->l('Last name'), 'width' => 130),
@@ -64,8 +64,8 @@ class AdminEmployees extends AdminTab
'fields' => array(
'PS_PASSWD_TIME_BACK' => array('title' => $this->l('Password regenerate:'), 'desc' => $this->l('Security minimum time to wait to regenerate a new password'), 'cast' => 'intval', 'size' => 5, 'type' => 'text', 'suffix' => ' '.$this->l('minutes'), 'visibility' => Shop::CONTEXT_ALL),
'PS_BO_ALLOW_EMPLOYEE_FORM_LANG' => array('title' => $this->l('Memorize form language:'), 'desc' => $this->l('Allow employees to save their own default form language'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
'0' => array('value' => 0, 'name' => $this->l('No')),
'1' => array('value' => 1, 'name' => $this->l('Yes'))
), 'visibility' => Shop::CONTEXT_ALL)
),
),
@@ -73,22 +73,22 @@ class AdminEmployees extends AdminTab
parent::__construct();
}
protected function _childValidation()
protected function _childValidation()
{
if (!($obj = $this->loadObject(true)))
return false;
$email = $this->getFieldValue($obj, 'email');
if (!Validate::isEmail($email))
$this->_errors[] = Tools::displayError('Invalid e-mail');
else if (Employee::employeeExists($email) AND !Tools::getValue('id_employee'))
else if (Employee::employeeExists($email) && !Tools::getValue('id_employee'))
$this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$email;
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
$profiles = Profile::getProfiles($this->context->language->id);
@@ -138,7 +138,7 @@ class AdminEmployees extends AdminTab
<select name="bo_theme">';
$path = dirname(__FILE__).'/../themes/';
foreach (scandir($path) as $theme)
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
if ($theme[0] != '.' && file_exists($path.$theme.'/admin.css'))
echo ' <option value="'.Tools::htmlentitiesUTF8($theme).'" '.($this->getFieldValue($obj, 'bo_theme') == $theme ? 'selected="selected"' : '').'>'.Tools::htmlentitiesUTF8($theme).'</option>';
echo ' </select> <sup>*</sup>
</div>';
@@ -172,10 +172,32 @@ class AdminEmployees extends AdminTab
<div class="margin-form">
<select name="id_profile">
<option value="">'.$this->l('-- Choose --').'</option>';
foreach ($profiles AS $profile)
foreach ($profiles as $profile)
echo '<option value="'.$profile['id_profile'].'"'.($profile['id_profile'] === $this->getFieldValue($obj, 'id_profile') ? ' selected="selected"' : '').'>'.$profile['name'].'</option>';
echo '</select> <sup>*</sup>
</div>';
if (Shop::isMultiShopActivated())
{
echo '
<script type="text/javascript">
$(document).ready(function(){
$(\'select[name=id_profile]\').change(function(){
var val = $(this).val();
if(val == '._PS_ADMIN_PROFILE_.')
{
$(\'.assoShop input[type=checkbox]\').attr(\'disabled\', \'disabled\');
$(\'.assoShop input[type=checkbox]\').attr(\'checked\', \'checked\');
}
else
$(\'.assoShop input[type=checkbox]\').attr(\'disabled\', \'\');
});
});
</script>
';
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
echo '</div>';
}
}
echo '<div class="clear">&nbsp;</div>
<center>
@@ -185,47 +207,51 @@ class AdminEmployees extends AdminTab
</fieldset>
</form>';
}
public function postProcess()
{
$this->context = Context::getContext();
if (Tools::isSubmit('deleteemployee') OR Tools::isSubmit('status') OR Tools::isSubmit('statusemployee'))
$this->context = Context::getContext();
if (Tools::isSubmit('deleteemployee') || Tools::isSubmit('status') || Tools::isSubmit('statusemployee'))
{
if ($this->context->employee->id == Tools::getValue('id_employee'))
{
$this->_errors[] = Tools::displayError('You cannot disable or delete your own account.');
return false;
}
$employee = new Employee(Tools::getValue('id_employee'));
if ($employee->isLastAdmin())
if ($employee->isLastAdmin())
{
$this->_errors[] = Tools::displayError('You cannot disable or delete the last administrator account.');
return false;
}
}
elseif (Tools::isSubmit('submitAddemployee'))
else if (Tools::isSubmit('submitAddemployee'))
{
$employee = new Employee((int)Tools::getValue('id_employee'));
if (!(int)$this->tabAccess['edit'])
$_POST['id_profile'] = $_GET['id_profile'] = $employee->id_profile;
if ($employee->isLastAdmin())
if ($employee->isLastAdmin())
{
if (Tools::getValue('id_profile') != (int)_PS_ADMIN_PROFILE_)
if (Tools::getValue('id_profile') != (int)_PS_ADMIN_PROFILE_)
{
$this->_errors[] = Tools::displayError('You should have at least one employee in the administrator group.');
return false;
}
if (Tools::getvalue('active') == 0)
{
$this->_errors[] = Tools::displayError('You cannot disable or delete the last administrator account.');
return false;
}
}
$assos = self::getAssoShop($this->table);
if (!count($assos[0]) && $this->table = 'employee')
$this->_errors[] = Tools::displayError('The employee must be associated with at least one shop');
}
return parent::postProcess();
}
}
+6 -6
View File
@@ -32,12 +32,12 @@ class AdminShop extends AdminTab
{
$this->context = Context::getContext();
$this->table = 'shop';
$this->className = 'Shop';
$this->className = 'Shop';
$this->edit = true;
$this->delete = false;
$this->deleted = false;
$this->_select = 'gs.name group_shop_name, cl.name category_name';
$this->_select = 'gs.name group_shop_name, cl.name category_name';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop)
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')';
$this->_group = 'GROUP BY a.id_shop';
@@ -66,7 +66,7 @@ class AdminShop extends AdminTab
if (Tools::getValue('useImportData') && ($importData = Tools::getValue('importData')) && is_array($importData))
$newShop->copyShopData((int)Tools::getValue('importFromShop'), $importData);
}
public function afterUpdate($newShop)
{
if (Tools::getValue('useImportData') && ($importData = Tools::getValue('importData')) && is_array($importData))
@@ -82,7 +82,7 @@ class AdminShop extends AdminTab
else if (Shop::getTotalShops() == 1)
$this->_errors[] = Tools::displayError('You cannot disable the last shop.');
}
if ($this->_errors)
return false;
return parent::postProcess();
@@ -133,7 +133,7 @@ class AdminShop extends AdminTab
else
{
echo '<select '.$disabled.' name="id_group_shop" id="id_group_shop">';
foreach (GroupShop::getGroupShops() AS $group)
foreach (GroupShop::getGroupShops() as $group)
echo '<option value="'.(int)$group['id_group_shop'].'" '.($obj->id_group_shop == $group['id_group_shop'] ? 'selected="selected"' : '').'">'.$group['name'].'</option>';
echo '</select>';
}
+14 -8
View File
@@ -898,11 +898,21 @@ abstract class AdminTabCore
if (!Shop::isMultiShopActivated())
return ;
$assos = self::getAssoShop($this->table, $id_object);
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$assos[1].($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
foreach ($assos[0] as $asso)
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$assos[1].' (`'.pSQL($this->identifier).'`, id_'.$assos[1].')
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$assos[1]].')');
}
protected static function getAssoShop($table, $id_object = false)
{
$shopAsso = Shop::getAssoTables();
$groupShopAsso = GroupShop::getAssoTables();
if (isset($shopAsso[$this->table]) && $shopAsso[$this->table]['type'] == 'shop')
if (isset($shopAsso[$table]) && $shopAsso[$table]['type'] == 'shop')
$type = 'shop';
else if (isset($groupShopAsso[$this->table]) && $groupShopAsso[$this->table]['type'] == 'group_shop')
else if (isset($groupShopAsso[$table]) && $groupShopAsso[$table]['type'] == 'group_shop')
$type = 'group_shop';
else
return ;
@@ -910,16 +920,12 @@ abstract class AdminTabCore
$assos = array();
foreach ($_POST as $k => $row)
{
if (!preg_match('/^checkBox'.Tools::toCamelCase($type, true).'Asso_'.$this->table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
if (!preg_match('/^checkBox'.Tools::toCamelCase($type, true).'Asso_'.$table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
continue;
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
$assos[] = array('id_object' => (int)$id_asso_object, 'id_'.$type => (int)$res[2]);
}
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_'.$type.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
foreach ($assos as $asso)
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_'.$type.' (`'.pSQL($this->identifier).'`, id_'.$type.')
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_'.$type].')');
return array($assos, $type);
}
/**
+112 -84
View File
@@ -69,6 +69,7 @@ class ShopCore extends ObjectModel
'country' => array('type' => 'shop'),
'currency' => array('type' => 'shop'),
'discount' => array('type' => 'shop'),
'employee' => array('type' => 'shop'),
'hook_module' => array('type' => 'fk_shop'),
'hook_module_exceptions' => array('type' => 'fk_shop', 'primary' => 'id_hook_module_exceptions'),
'image' => array('type' => 'shop'),
@@ -159,7 +160,7 @@ class ShopCore extends ObjectModel
if (!$res = parent::delete())
return false;
foreach (Shop::getAssoTables() AS $table_name => $row)
foreach (Shop::getAssoTables() as $table_name => $row)
{
// Special case for stock if current shop is in a share stock group
if ($table_name == 'stock')
@@ -204,8 +205,8 @@ class ShopCore extends ObjectModel
$dirname = dirname(__FILE__);
$directories = scandir($dirname.'/../');
$excluded_uris = array();
foreach ($directories AS $directory)
if (is_dir($dirname.'/../'.$directory) AND (!preg_match ('/^\./', $directory)))
foreach ($directories as $directory)
if (is_dir($dirname.'/../'.$directory) && (!preg_match ('/^\./', $directory)))
$excluded_uris[] = $directory;
// Find current shop from URL
@@ -236,11 +237,11 @@ class ShopCore extends ObjectModel
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
// No shop found ... too bad, let's redirect to default shop
$defaultShop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
if (!$defaultShop)
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
if (!$default_shop)
// Hmm there is something really bad in your Prestashop !
die('Shop not found');
$url = 'http://'.$defaultShop->domain.$defaultShop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
header('location: '.$url);
exit;
}
@@ -301,9 +302,9 @@ class ShopCore extends ObjectModel
*
* @return int
*/
public function getID($useDefault = false)
public function getID($use_default = false)
{
return (!$this->id && $useDefault) ? (int)Configuration::get('PS_SHOP_DEFAULT') : (int)$this->id;
return (!$this->id && $use_default) ? (int)Configuration::get('PS_SHOP_DEFAULT') : (int)$this->id;
}
/**
@@ -372,17 +373,35 @@ class ShopCore extends ObjectModel
if (self::$shops && !$refresh)
return;
$sql = 'SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri
FROM '._DB_PREFIX_.'group_shop gs
LEFT JOIN '._DB_PREFIX_.'shop s
ON s.id_group_shop = gs.id_group_shop
LEFT JOIN '._DB_PREFIX_.'shop_url su
ON s.id_shop = su.id_shop AND su.main = 1
WHERE s.deleted = 0
AND gs.deleted = 0
$select = '';
$from = '';
$where = '';
$employee = Context::getContext()->employee;
/* if the profile isn't a superAdmin */
if ($employee->id_profile != _PS_ADMIN_PROFILE_)
{
$select .= ', es.id_employee';
$from .= 'LEFT JOIN '._DB_PREFIX_.'employee_shop es ON es.id_shop = s.id_shop';
$where .= 'AND es.id_employee = '.$employee->id;
}
$sql = 'SELECT gs.*, s.*, gs.name AS group_name, s.name AS shop_name, s.active, su.domain, su.domain_ssl, su.physical_uri, su.virtual_uri'.$select.'
FROM '._DB_PREFIX_.'group_shop gs
LEFT JOIN '._DB_PREFIX_.'shop s
ON s.id_group_shop = gs.id_group_shop
LEFT JOIN '._DB_PREFIX_.'shop_url su
ON s.id_shop = su.id_shop AND su.main = 1
'.$from.'
WHERE s.deleted = 0
AND gs.deleted = 0
'.$where.'
ORDER BY gs.name, s.name';
if ($results = Db::getInstance()->ExecuteS($sql))
{
$group_shop = new GroupShop();
foreach ($results as $row)
{
if (!isset(self::$shops[$row['id_group_shop']]))
@@ -392,6 +411,7 @@ class ShopCore extends ObjectModel
'share_customer' => $row['share_customer'],
'share_order' => $row['share_order'],
'share_stock' => $row['share_stock'],
'totalShops' => self::getTotalShopsByIdGroupShop($row['id_group_shop']),
'shops' => array(),
);
@@ -415,20 +435,20 @@ class ShopCore extends ObjectModel
*
* @param bool $active
* @param int $id_group_shop
* @param bool $getAsListID
* @param bool $get_as_list_id
*/
public static function getShops($active = true, $id_group_shop = null, $getAsListID = false)
public static function getShops($active = true, $id_group_shop = null, $get_as_list_id = false)
{
Shop::cacheShops();
$results = array();
foreach (self::$shops as $groupID => $groupData)
foreach ($groupData['shops'] as $id => $shopData)
if ((!$active || $shopData['active']) && (!$id_group_shop || $id_group_shop == $groupID))
foreach (self::$shops as $group_id => $group_data)
foreach ($group_data['shops'] as $id => $shop_data)
if ((!$active || $shop_data['active']) && (!$id_group_shop || $id_group_shop == $group_id))
{
if ($getAsListID)
if ($get_as_list_id)
$results[] = $id;
else
$results[] = $shopData;
$results[] = $shop_data;
}
return $results;
}
@@ -436,15 +456,15 @@ class ShopCore extends ObjectModel
/**
* Return some informations cached for one shop
*
* @param int $shopID
* @param int $shop_id
* @return array
*/
public static function getShop($shopID)
public static function getShop($shop_id)
{
Shop::cacheShops();
foreach (self::$shops as $groupID => $groupData)
if (array_key_exists($shopID, $groupData['shops']))
return $groupData['shops'][$shopID];
foreach (self::$shops as $group_id => $group_data)
if (array_key_exists($shop_id, $group_data['shops']))
return $group_data['shops'][$shop_id];
return false;
}
@@ -457,10 +477,10 @@ class ShopCore extends ObjectModel
public static function getIdByName($name)
{
Shop::cacheShops();
foreach (self::$shops as $groupData)
foreach ($groupData['shops'] as $shopID => $shopData)
if (Tools::strtolower($shopData['name']) == Tools::strtolower($name))
return $shopID;
foreach (self::$shops as $group_data)
foreach ($group_data['shops'] as $shop_id => $shop_data)
if (Tools::strtolower($shop_data['name']) == Tools::strtolower($name))
return $shop_id;
return false;
}
@@ -472,38 +492,46 @@ class ShopCore extends ObjectModel
return count(Shop::getShops($active));
}
/**
* @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));
}
/**
* Retrieve group ID of a shop
*
* @param int $shopID Shop ID
* @param int $shop_id Shop ID
* @return int Group ID
*/
public static function getGroupFromShop($shopID, $asID = true)
public static function getGroupFromShop($shop_id, $as_id = true)
{
Shop::cacheShops();
foreach (self::$shops as $groupID => $groupData)
if (array_key_exists($shopID, $groupData['shops']))
return ($asID) ? $groupID : $groupData;
foreach (self::$shops as $group_id => $group_data)
if (array_key_exists($shop_id, $group_data['shops']))
return ($as_id) ? $group_id : $group_data;
return false;
}
/**
* If the shop group has the option $type activated, get all shops ID of this group, else get current shop ID
*
* @param int $shopID
* @param int $shop_id
* @param int $type Shop::SHARE_CUSTOMER | Shop::SHARE_ORDER | Shop::SHARE_STOCK
* @return array
*/
public static function getSharedShops($shopID, $type)
public static function getSharedShops($shop_id, $type)
{
if (!in_array($type, array(Shop::SHARE_CUSTOMER, Shop::SHARE_ORDER, Shop::SHARE_STOCK)))
die('Wrong argument ($type) in Shop::getSharedShops() method');
Shop::cacheShops();
foreach (self::$shops as $groupData)
if (array_key_exists($shopID, $groupData['shops']) && $groupData[$type])
return array_keys($groupData['shops']);
return array($shopID);
foreach (self::$shops as $group_data)
if (array_key_exists($shop_id, $group_data['shops']) && $group_data[$type])
return array_keys($group_data['shops']);
return array($shop_id);
}
/**
@@ -514,13 +542,13 @@ class ShopCore extends ObjectModel
*/
public function getListOfID($share = false)
{
$shopID = $this->getID();
$shopGroupID = $this->getGroupID();
$shop_id = $this->getID();
$shop_group_id = $this->getGroupID();
if ($shopID)
$list = ($share) ? Shop::getSharedShops($shopID, $share) : array($shopID);
else if ($shopGroupID)
$list = Shop::getShops(true, $shopGroupID, true);
if ($shop_id)
$list = ($share) ? Shop::getSharedShops($shop_id, $share) : array($shop_id);
else if ($shop_group_id)
$list = Shop::getShops(true, $shop_group_id, true);
else
$list = Shop::getShops(true, null, true);
@@ -539,8 +567,8 @@ class ShopCore extends ObjectModel
if (!isset($context->shop))
return ($type == 'shop' || $type == 'group') ? '' : array('', '');
$shopID = $context->shop->id;
$shopGroupID = $context->shop->id_group_shop;
$shop_id = $context->shop->id;
$shop_group_id = $context->shop->id_group_shop;
if (defined('_PS_ADMIN_DIR_'))
{
if (!isset($context->cookie) || !$context->cookie->shopContext)
@@ -549,14 +577,14 @@ class ShopCore extends ObjectModel
// Parse shopContext cookie value (E.g. s-2, g-4)
$split = explode('-', $context->cookie->shopContext);
if (count($split) == 2 && $split[0] == 'g')
$shopGroupID = (int)$split[1];
$shop_group_id = (int)$split[1];
}
if ($type == 'shop')
return $shopID;
return $shop_id;
else if ($type == 'group')
return $shopGroupID;
return array($shopID, $shopGroupID);
return $shop_group_id;
return array($shop_id, $shop_group_id);
if (!$executed)
{
@@ -572,28 +600,28 @@ class ShopCore extends ObjectModel
if (count($split) == 2)
{
if ($split[0] == 's')
$shopID = (int)$split[1];
$shop_id = (int)$split[1];
else if ($split[0] == 'g')
$shopGroupID = (int)$split[1];
$shop_group_id = (int)$split[1];
if ($shopID && !$shopGroupID)
$shopGroupID = Shop::getGroupFromShop($shopID);
if ($shop_id && !$shop_group_id)
$shop_group_id = Shop::getGroupFromShop($shop_id);
}
}
else
{
$shopID = (int)$context->shop->getID();
$shopGroupID = (int)$context->shop->id_group_shop;
$shop_id = (int)$context->shop->getID();
$shop_group_id = (int)$context->shop->id_group_shop;
}
$executed = true;
}
if ($type == 'shop')
return $shopID;
return $shop_id;
else if ($type == 'group')
return $shopGroupID;
return array($shopID, $shopGroupID);
return $shop_group_id;
return array($shop_id, $shop_group_id);
}
/**
@@ -623,10 +651,10 @@ class ShopCore extends ObjectModel
*/
public function getContextType()
{
list($shopID, $shopGroupID) = Shop::getContext();
if ($shopID)
list($shop_id, $shop_group_id) = Shop::getContext();
if ($shop_id)
return Shop::CONTEXT_SHOP;
else if ($shopGroupID)
else if ($shop_group_id)
return Shop::CONTEXT_GROUP;
return Shop::CONTEXT_ALL;
}
@@ -647,19 +675,19 @@ class ShopCore extends ObjectModel
$alias .= '.';
$restriction = '';
$shopID = $this->getID();
$shopGroupID = $this->getGroupID();
$shop_id = $this->getID();
$shop_group_id = $this->getGroupID();
if ($type == 'group_shop')
{
if ($shopID)
$restriction = ' AND '.$alias.'id_group_shop = '.Shop::getGroupFromShop($shopID).' ';
else if ($shopGroupID)
$restriction = ' AND '.$alias.'id_group_shop = '.$shopGroupID.' ';
if ($shop_id)
$restriction = ' AND '.$alias.'id_group_shop = '.Shop::getGroupFromShop($shop_id).' ';
else if ($shop_group_id)
$restriction = ' AND '.$alias.'id_group_shop = '.$shop_group_id.' ';
}
else
{
if ($shopID || $shopGroupID)
if ($shop_id || $shop_group_id)
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', $this->getListOfID($share)).') ';
else if ($share == Shop::SHARE_STOCK)
$restriction = ' AND '.$alias.'id_shop = '.$this->getID(true);
@@ -673,23 +701,23 @@ class ShopCore extends ObjectModel
*
* @param string $table Table name (E.g. product, module, etc.)
* @param string $alias Alias of table
* @param bool $innerJoin Use or not INNER JOIN
* @param bool $inner_join Use or not INNER JOIN
* @param Context $context
* @return string
*/
public function sqlAsso($table, $alias, $innerJoin = true)
public function sqlAsso($table, $alias, $inner_join = true)
{
$tableAlias = ' asso_shop_'.$table;
$table_alias = ' asso_shop_'.$table;
if (strpos($table, '.') !== false)
list($tableAlias, $table) = explode('.', $table);
list($table_alias, $table) = explode('.', $table);
$asso_tables = Shop::getAssoTables();
if (!isset($asso_tables[$table]) || $asso_tables[$table]['type'] != 'shop')
return ;
return;
$sql = (($innerJoin) ? ' INNER' : ' LEFT').' JOIN '._DB_PREFIX_.$table.'_shop '.$tableAlias.'
ON '.$tableAlias.'.id_'.$table.' = '.$alias.'.id_'.$table.'
AND '.$tableAlias.'.id_shop IN('.implode(', ', $this->getListOfID()).') ';
$sql = (($inner_join) ? ' INNER' : ' LEFT').' JOIN '._DB_PREFIX_.$table.'_shop '.$table_alias.'
ON '.$table_alias.'.id_'.$table.' = '.$alias.'.id_'.$table.'
AND '.$table_alias.'.id_shop IN('.implode(', ', $this->getListOfID()).') ';
return $sql;
}
@@ -702,7 +730,7 @@ class ShopCore extends ObjectModel
*/
public function sqlLang($alias = null)
{
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$this->getID(true). ' ';
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$this->getID(true).' ';
}
/**
@@ -730,7 +758,7 @@ class ShopCore extends ObjectModel
public function copyShopData($old_id, $tables_import = false, $deleted = false)
{
foreach (Shop::getAssoTables() AS $table_name => $row)
foreach (Shop::getAssoTables() as $table_name => $row)
{
if ($tables_import && !isset($tables_import[$table_name]))
continue;
+7
View File
@@ -641,6 +641,13 @@ CREATE TABLE `PREFIX_employee` (
KEY `id_profile` (`id_profile`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_employee_shop` (
`id_employee` INT( 11 ) UNSIGNED NOT NULL ,
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `id_employee` , `id_shop` ),
KEY `id_shop` (`id_shop`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_feature` (
`id_feature` int(10) unsigned NOT NULL auto_increment,
`position` int(10) unsigned NOT NULL default '0',
+133 -129
View File
@@ -59,7 +59,7 @@ INSERT INTO `PREFIX_module` (`id_module`, `name`, `active`) VALUES (1, 'homefeat
(47, 'statsbestvouchers', 1),(48, 'statsbestsuppliers', 1),(49, 'statscarrier', 1),(50, 'statsnewsletter', 1),(51, 'statssearch', 1),(52, 'statscheckup', 1),(53, 'statsstock', 1),
(54, 'blockstore', 1),(55, 'statsforecast', 1);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 1, id_module, 1, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 1, `id_module`, 1, 1 FROM `PREFIX_module`);
INSERT INTO `PREFIX_module_shop` (`id_module`, `id_shop`) (SELECT `id_module`, 1 FROM `PREFIX_module`);
@@ -857,111 +857,30 @@ INSERT INTO `PREFIX_search_word` (`id_word`, `id_lang`, `word`) VALUES (1, 1, 'i
(1543, 3, 'khz)'),(1544, 3, 'frecuencias'),(1545, 3, 'longitud'),(1546, 3, 'alargador'),(1547, 3, 'caja'),(1548, 3, 'altavoces'),(1549, 3, '(almohadillas'),
(1550, 3, 'sonoro,'),(1551, 3, 'transporte)'),(1552, 3, 'incorporated');
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 2, id_tab, 1, 1, 1, 1 FROM PREFIX_tab);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES
(2, 1, 1, 1, 1, 1),
(2, 2, 1, 1, 1, 1),
(2, 3, 1, 1, 1, 1),
(2, 4, 0, 0, 0, 0),
(2, 5, 1, 1, 1, 1),
(2, 6, 0, 0, 0, 0),
(2, 7, 0, 0, 0, 0),
(2, 8, 0, 0, 0, 0),
(2, 9, 0, 0, 0, 0),
(2, 10, 0, 0, 0, 0),
(2, 11, 0, 0, 0, 0),
(2, 12, 1, 1, 1, 1),
(2, 13, 1, 1, 1, 1),
(2, 14, 0, 0, 0, 0),
(2, 15, 0, 0, 0, 0),
(2, 16, 0, 0, 0, 0),
(2, 17, 1, 1, 1, 1),
(2, 18, 0, 0, 0, 0),
(2, 19, 0, 0, 0, 0),
(2, 20, 1, 1, 1, 1),
(2, 21, 1, 1, 1, 1),
(2, 22, 0, 0, 0, 0),
(2, 23, 0, 0, 0, 0),
(2, 24, 0, 0, 0, 0),
(2, 26, 0, 0, 0, 0),
(2, 27, 0, 0, 0, 0),
(2, 28, 0, 0, 0, 0),
(2, 29, 0, 0, 0, 0),
(2, 30, 0, 0, 0, 0),
(2, 31, 0, 0, 0, 0),
(2, 32, 0, 0, 0, 0),
(2, 33, 0, 0, 0, 0),
(2, 34, 1, 1, 1, 1),
(2, 35, 0, 0, 0, 0),
(2, 36, 0, 0, 0, 0),
(2, 37, 0, 0, 0, 0),
(2, 38, 0, 0, 0, 0),
(2, 39, 0, 0, 0, 0),
(2, 40, 0, 0, 0, 0),
(2, 41, 0, 0, 0, 0),
(2, 42, 1, 1, 1, 1),
(2, 43, 0, 0, 0, 0),
(2, 44, 0, 0, 0, 0),
(2, 46, 0, 0, 0, 0),
(2, 47, 1, 1, 1, 1),
(2, 48, 0, 0, 0, 0),
(2, 49, 1, 1, 1, 1),
(2, 51, 0, 0, 0, 0),
(2, 52, 0, 0, 0, 0),
(2, 53, 0, 0, 0, 0),
(2, 54, 0, 0, 0, 0),
(2, 55, 1, 1, 1, 1),
(2, 56, 0, 0, 0, 0),
(2, 57, 0, 0, 0, 0),
(2, 58, 0, 0, 0, 0),
(2, 59, 1, 1, 1, 1),
(2, 60, 1, 1, 1, 1),
(2, 61, 0, 0, 0, 0),
(2, 62, 0, 0, 0, 0),
(2, 63, 0, 0, 0, 0),
(2, 64, 0, 0, 0, 0),
(2, 65, 0, 0, 0, 0),
(2, 66, 0, 0, 0, 0),
(2, 67, 0, 0, 0, 0),
(2, 68, 0, 0, 0, 0),
(2, 69, 0, 0, 0, 0),
(2, 70, 0, 0, 0, 0),
(2, 71, 0, 0, 0, 0),
(2, 72, 0, 0, 0, 0),
(2, 73, 1, 1, 1, 1),
(2, 80, 0, 0, 0, 0),
(2, 81, 0, 0, 0, 0),
(2, 82, 0, 0, 0, 0),
(2, 83, 0, 0, 0, 0),
(2, 84, 0, 0, 0, 0),
(2, 85, 0, 0, 0, 0),
(2, 86, 0, 0, 0, 0),
(2, 87, 0, 0, 0, 0),
(2, 88, 1, 1, 1, 1),
(2, 89, 0, 0, 0, 0),
(2, 90, 0, 0, 0, 0),
(2, 91, 0, 0, 0, 0),
(2, 92, 0, 0, 0, 0),
(3, 1, 1, 1, 1, 1),
(3, 2, 0, 0, 0, 0),
(3, 3, 0, 0, 0, 0),
(3, 2, 1, 1, 1, 1),
(3, 3, 1, 1, 1, 1),
(3, 4, 0, 0, 0, 0),
(3, 5, 0, 0, 0, 0),
(3, 5, 1, 1, 1, 1),
(3, 6, 0, 0, 0, 0),
(3, 7, 0, 0, 0, 0),
(3, 8, 0, 0, 0, 0),
(3, 9, 1, 0, 0, 0),
(3, 9, 0, 0, 0, 0),
(3, 10, 0, 0, 0, 0),
(3, 11, 0, 0, 0, 0),
(3, 12, 0, 0, 0, 0),
(3, 13, 0, 0, 0, 0),
(3, 12, 1, 1, 1, 1),
(3, 13, 1, 1, 1, 1),
(3, 14, 0, 0, 0, 0),
(3, 15, 0, 0, 0, 0),
(3, 16, 0, 0, 0, 0),
(3, 17, 0, 0, 0, 0),
(3, 17, 1, 1, 1, 1),
(3, 18, 0, 0, 0, 0),
(3, 19, 0, 0, 0, 0),
(3, 20, 0, 0, 0, 0),
(3, 21, 0, 0, 0, 0),
(3, 20, 1, 1, 1, 1),
(3, 21, 1, 1, 1, 1),
(3, 22, 0, 0, 0, 0),
(3, 23, 0, 0, 0, 0),
(3, 24, 0, 0, 0, 0),
@@ -971,9 +890,9 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 29, 0, 0, 0, 0),
(3, 30, 0, 0, 0, 0),
(3, 31, 0, 0, 0, 0),
(3, 32, 1, 1, 1, 1),
(3, 33, 1, 1, 1, 1),
(3, 34, 0, 0, 0, 0),
(3, 32, 0, 0, 0, 0),
(3, 33, 0, 0, 0, 0),
(3, 34, 1, 1, 1, 1),
(3, 35, 0, 0, 0, 0),
(3, 36, 0, 0, 0, 0),
(3, 37, 0, 0, 0, 0),
@@ -981,23 +900,23 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 39, 0, 0, 0, 0),
(3, 40, 0, 0, 0, 0),
(3, 41, 0, 0, 0, 0),
(3, 42, 0, 0, 0, 0),
(3, 43, 1, 0, 0, 0),
(3, 42, 1, 1, 1, 1),
(3, 43, 0, 0, 0, 0),
(3, 44, 0, 0, 0, 0),
(3, 46, 0, 0, 0, 0),
(3, 47, 0, 0, 0, 0),
(3, 47, 1, 1, 1, 1),
(3, 48, 0, 0, 0, 0),
(3, 49, 0, 0, 0, 0),
(3, 49, 1, 1, 1, 1),
(3, 51, 0, 0, 0, 0),
(3, 52, 0, 0, 0, 0),
(3, 53, 0, 0, 0, 0),
(3, 54, 0, 0, 0, 0),
(3, 55, 0, 0, 0, 0),
(3, 55, 1, 1, 1, 1),
(3, 56, 0, 0, 0, 0),
(3, 57, 1, 1, 1, 1),
(3, 57, 0, 0, 0, 0),
(3, 58, 0, 0, 0, 0),
(3, 59, 0, 0, 0, 0),
(3, 60, 0, 0, 0, 0),
(3, 59, 1, 1, 1, 1),
(3, 60, 1, 1, 1, 1),
(3, 61, 0, 0, 0, 0),
(3, 62, 0, 0, 0, 0),
(3, 63, 0, 0, 0, 0),
@@ -1010,7 +929,7 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 70, 0, 0, 0, 0),
(3, 71, 0, 0, 0, 0),
(3, 72, 0, 0, 0, 0),
(3, 73, 0, 0, 0, 0),
(3, 73, 1, 1, 1, 1),
(3, 80, 0, 0, 0, 0),
(3, 81, 0, 0, 0, 0),
(3, 82, 0, 0, 0, 0),
@@ -1019,23 +938,23 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(3, 85, 0, 0, 0, 0),
(3, 86, 0, 0, 0, 0),
(3, 87, 0, 0, 0, 0),
(3, 88, 1, 1, 1, 1),
(3, 88, 0, 0, 0, 0),
(3, 89, 0, 0, 0, 0),
(3, 90, 0, 0, 0, 0),
(3, 91, 0, 0, 0, 0),
(3, 92, 0, 0, 0, 0),
(4, 1, 1, 1, 1, 1),
(4, 2, 1, 1, 1, 1),
(4, 3, 1, 1, 1, 1),
(4, 2, 0, 0, 0, 0),
(4, 3, 0, 0, 0, 0),
(4, 4, 0, 0, 0, 0),
(4, 5, 0, 0, 0, 0),
(4, 6, 1, 1, 1, 1),
(4, 6, 0, 0, 0, 0),
(4, 7, 0, 0, 0, 0),
(4, 8, 0, 0, 0, 0),
(4, 9, 0, 0, 0, 0),
(4, 10, 1, 0, 0, 0),
(4, 9, 1, 0, 0, 0),
(4, 10, 0, 0, 0, 0),
(4, 11, 0, 0, 0, 0),
(4, 12, 1, 1, 1, 1),
(4, 12, 0, 0, 0, 0),
(4, 13, 0, 0, 0, 0),
(4, 14, 0, 0, 0, 0),
(4, 15, 0, 0, 0, 0),
@@ -1054,8 +973,8 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(4, 29, 0, 0, 0, 0),
(4, 30, 0, 0, 0, 0),
(4, 31, 0, 0, 0, 0),
(4, 32, 0, 0, 0, 0),
(4, 33, 0, 0, 0, 0),
(4, 32, 1, 1, 1, 1),
(4, 33, 1, 1, 1, 1),
(4, 34, 0, 0, 0, 0),
(4, 35, 0, 0, 0, 0),
(4, 36, 0, 0, 0, 0),
@@ -1064,28 +983,28 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(4, 39, 0, 0, 0, 0),
(4, 40, 0, 0, 0, 0),
(4, 41, 0, 0, 0, 0),
(4, 42, 1, 1, 1, 1),
(4, 42, 0, 0, 0, 0),
(4, 43, 1, 0, 0, 0),
(4, 44, 0, 0, 0, 0),
(4, 46, 0, 0, 0, 0),
(4, 47, 0, 0, 0, 0),
(4, 48, 0, 0, 0, 0),
(4, 49, 1, 1, 1, 1),
(4, 49, 0, 0, 0, 0),
(4, 51, 0, 0, 0, 0),
(4, 52, 0, 0, 0, 0),
(4, 53, 0, 0, 0, 0),
(4, 54, 1, 1, 1, 1),
(4, 54, 0, 0, 0, 0),
(4, 55, 0, 0, 0, 0),
(4, 56, 0, 0, 0, 0),
(4, 57, 0, 0, 0, 0),
(4, 57, 1, 1, 1, 1),
(4, 58, 0, 0, 0, 0),
(4, 59, 1, 1, 1, 1),
(4, 59, 0, 0, 0, 0),
(4, 60, 0, 0, 0, 0),
(4, 61, 0, 0, 0, 0),
(4, 62, 1, 1, 1, 1),
(4, 63, 1, 1, 1, 1),
(4, 62, 0, 0, 0, 0),
(4, 63, 0, 0, 0, 0),
(4, 64, 0, 0, 0, 0),
(4, 65, 1, 1, 1, 1),
(4, 65, 0, 0, 0, 0),
(4, 66, 0, 0, 0, 0),
(4, 67, 0, 0, 0, 0),
(4, 68, 0, 0, 0, 0),
@@ -1096,27 +1015,112 @@ INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `del
(4, 73, 0, 0, 0, 0),
(4, 80, 0, 0, 0, 0),
(4, 81, 0, 0, 0, 0),
(4, 82, 1, 1, 1, 1),
(4, 82, 0, 0, 0, 0),
(4, 83, 0, 0, 0, 0),
(4, 84, 0, 0, 0, 0),
(4, 85, 0, 0, 0, 0),
(4, 86, 0, 0, 0, 0),
(4, 87, 0, 0, 0, 0),
(4, 88, 1, 1, 1, 1),
(4, 88, 0, 0, 0, 0),
(4, 89, 0, 0, 0, 0),
(4, 90, 0, 0, 0, 0),
(4, 91, 0, 0, 0, 0),
(4, 92, 0, 0, 0, 0);
(4, 92, 0, 0, 0, 0),
(5, 1, 1, 1, 1, 1),
(5, 2, 1, 1, 1, 1),
(5, 3, 1, 1, 1, 1),
(5, 4, 0, 0, 0, 0),
(5, 5, 0, 0, 0, 0),
(5, 6, 1, 1, 1, 1),
(5, 7, 0, 0, 0, 0),
(5, 8, 0, 0, 0, 0),
(5, 9, 0, 0, 0, 0),
(5, 10, 1, 0, 0, 0),
(5, 11, 0, 0, 0, 0),
(5, 12, 1, 1, 1, 1),
(5, 13, 0, 0, 0, 0),
(5, 14, 0, 0, 0, 0),
(5, 15, 0, 0, 0, 0),
(5, 16, 0, 0, 0, 0),
(5, 17, 0, 0, 0, 0),
(5, 18, 0, 0, 0, 0),
(5, 19, 0, 0, 0, 0),
(5, 20, 0, 0, 0, 0),
(5, 21, 0, 0, 0, 0),
(5, 22, 0, 0, 0, 0),
(5, 23, 0, 0, 0, 0),
(5, 24, 0, 0, 0, 0),
(5, 26, 0, 0, 0, 0),
(5, 27, 0, 0, 0, 0),
(5, 28, 0, 0, 0, 0),
(5, 29, 0, 0, 0, 0),
(5, 30, 0, 0, 0, 0),
(5, 31, 0, 0, 0, 0),
(5, 32, 0, 0, 0, 0),
(5, 33, 0, 0, 0, 0),
(5, 34, 0, 0, 0, 0),
(5, 35, 0, 0, 0, 0),
(5, 36, 0, 0, 0, 0),
(5, 37, 0, 0, 0, 0),
(5, 38, 0, 0, 0, 0),
(5, 39, 0, 0, 0, 0),
(5, 40, 0, 0, 0, 0),
(5, 41, 0, 0, 0, 0),
(5, 42, 1, 1, 1, 1),
(5, 43, 1, 0, 0, 0),
(5, 44, 0, 0, 0, 0),
(5, 46, 0, 0, 0, 0),
(5, 47, 0, 0, 0, 0),
(5, 48, 0, 0, 0, 0),
(5, 49, 1, 1, 1, 1),
(5, 51, 0, 0, 0, 0),
(5, 52, 0, 0, 0, 0),
(5, 53, 0, 0, 0, 0),
(5, 54, 1, 1, 1, 1),
(5, 55, 0, 0, 0, 0),
(5, 56, 0, 0, 0, 0),
(5, 57, 0, 0, 0, 0),
(5, 58, 0, 0, 0, 0),
(5, 59, 1, 1, 1, 1),
(5, 60, 0, 0, 0, 0),
(5, 61, 0, 0, 0, 0),
(5, 62, 1, 1, 1, 1),
(5, 63, 1, 1, 1, 1),
(5, 64, 0, 0, 0, 0),
(5, 65, 1, 1, 1, 1),
(5, 66, 0, 0, 0, 0),
(5, 67, 0, 0, 0, 0),
(5, 68, 0, 0, 0, 0),
(5, 69, 0, 0, 0, 0),
(5, 70, 0, 0, 0, 0),
(5, 71, 0, 0, 0, 0),
(5, 72, 0, 0, 0, 0),
(5, 73, 0, 0, 0, 0),
(5, 80, 0, 0, 0, 0),
(5, 81, 0, 0, 0, 0),
(5, 82, 1, 1, 1, 1),
(5, 83, 0, 0, 0, 0),
(5, 84, 0, 0, 0, 0),
(5, 85, 0, 0, 0, 0),
(5, 86, 0, 0, 0, 0),
(5, 87, 0, 0, 0, 0),
(5, 88, 0, 0, 0, 0),
(5, 89, 0, 0, 0, 0),
(5, 90, 0, 0, 0, 0),
(5, 91, 0, 0, 0, 0),
(5, 92, 0, 0, 0, 0);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 2, id_module, 0, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 3, id_module, 0, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 4, id_module, 0, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 5, id_module, 0, 1 FROM PREFIX_module);
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (2),(3),(4);
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (2),(3),(4),(5);
INSERT INTO `PREFIX_profile_lang` (`id_lang`, `id_profile`, `name`) VALUES
(1, 2, 'Logistician'),(2, 2, 'Logisticien'),(3, 2, 'Logistician'),(4, 2, 'Logistiker'),(5, 2, 'Logista'),
(1, 3, 'Translator'),(2, 3, 'Traducteur'),(3, 3, 'Translator'),(4, 3, 'Übersetzer'),(5, 3, 'Traduttore'),
(1, 4, 'Salesman'),(2, 4, 'Commercial'),(3, 4, 'Salesman'),(4, 4, 'Verkäufer'),(5, 4, 'Venditore');
(1, 2, 'Administrator'),(2, 2, 'Administrateur'),(3, 2, 'Administrador'),(4, 2, 'Administrator'),(5, 2, 'Administrator'),
(1, 3, 'Logistician'),(2, 3, 'Logisticien'),(3, 3, 'Logistician'),(4, 3, 'Logistiker'),(5, 3, 'Logista'),
(1, 4, 'Translator'),(2, 4, 'Traducteur'),(3, 4, 'Translator'),(4, 4, 'Übersetzer'),(5, 4, 'Traduttore'),
(1, 5, 'Salesman'),(2, 5, 'Commercial'),(3, 5, 'Salesman'),(4, 5, 'Verkäufer'),(5, 5, 'Venditore');
INSERT INTO `PREFIX_store` (`id_store`, `id_country`, `id_state`, `name`, `address1`, `address2`, `city`, `postcode`, `latitude`, `longitude`, `hours`, `phone`, `fax`, `email`, `note`, `active`, `date_add`, `date_upd`) VALUES
(1, 21, 9, 'Dade County', '3030 SW 8th St Miami', '', 'Miami', ' 33135', 25.765005, -80.243797, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:53:13', '2010-11-09 10:53:13'),
+2 -2
View File
@@ -831,7 +831,7 @@ INSERT INTO `PREFIX_discount_type_lang` (`id_discount_type`, `id_lang`, `name`)
(1, 5, 'Sconto sullordine (%)'),(2, 5, 'Sconto sullordine (importo)'),(3, 5, 'Spese di porto gratuite');
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (1);
INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1, 'Administrator'),(1, 2, 'Administrateur'),(1, 3, 'Administrador'),(1, 4, 'Administrator'),(1, 5, 'Administrator');
INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1, 'SuperAdmin'),(1, 2, 'SuperAdmin'),(1, 3, 'SuperAdmin'),(1, 4, 'SuperAdmin'),(1, 5, 'SuperAdmin');
INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUES (1, 'AdminCatalog', 0, 1),(2, 'AdminCustomers', 0, 2),(3, 'AdminOrders', 0, 3),
(4, 'AdminPayment', 0, 4),(5, 'AdminShipping', 0, 5),(6, 'AdminStats', 0, 6),(7, 'AdminModules', 0, 7),(29, 'AdminEmployees', 0, 8),(8, 'AdminPreferences', 0, 9),
@@ -853,7 +853,7 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(93, 'AdminProducts', 1, 1),
(94, 'AdminCategories', 1, 2);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM PREFIX_tab);
INSERT INTO `PREFIX_access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) (SELECT 1, id_tab, 1, 1, 1, 1 FROM `PREFIX_tab`);
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 1, 'Catalog'),(1, 2, 'Customers'),(1, 3, 'Orders'),(1, 4, 'Payment'),
+36
View File
@@ -181,3 +181,39 @@ ALTER TABLE `PREFIX_product` ADD `is_virtual` TINYINT( 1 ) NOT NULL DEFAULT '0'
/* PHP:add_new_tab(AdminCategories, fr:Categories|es:Categories|en:Categories|de:Categories|it:Categories, 1); */;
/* PHP:add_default_restrictions_modules_groups(); */;
CREATE TABLE IF NOT EXISTS `PREFIX_employee_shop` (
`id_employee` INT( 11 ) UNSIGNED NOT NULL ,
`id_shop` INT( 11 ) UNSIGNED NOT NULL ,
PRIMARY KEY ( `id_employee` , `id_shop` )
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
INSERT INTO `PREFIX_employee_shop` (`id_employee`, `id_shop`) (SELECT `id_employee`, 1 FROM `PREFIX_employee`);
UPDATE `PREFIX_access` SET `view` = 0, `add` = 0, `edit` = 0, `delete` = 0 WHERE `id_tab` = 88 AND `id_profile` != 1;
INSERT INTO `PREFIX_profile` (`id_profile`) VALUES (5);
UPDATE `PREFIX_profile_lang` SET `id_profile` = 5 WHERE `id_profile` = 4;
UPDATE `PREFIX_profile_lang` SET `id_profile` = 4 WHERE `id_profile` = 3;
UPDATE `PREFIX_profile_lang` SET `id_profile` = 3 WHERE `id_profile` = 2;
UPDATE `PREFIX_profile_lang` SET `id_profile` = 2 WHERE `id_profile` = 1;
INSERT INTO `PREFIX_profile_lang` (`id_profile`, `id_lang`, `name`) VALUES (1, 1, 'SuperAdmin'),(1, 2, 'SuperAdmin'),(1, 3, 'SuperAdmin'),(1, 4, 'SuperAdmin'),(1, 5, 'SuperAdmin');
UPDATE `PREFIX_access` SET `id_profile` = 5 WHERE `id_profile` = 4;
UPDATE `PREFIX_access` SET `id_profile` = 4 WHERE `id_profile` = 3;
UPDATE `PREFIX_access` SET `id_profile` = 3 WHERE `id_profile` = 2;
UPDATE `PREFIX_access` SET `id_profile` = 2 WHERE `id_profile` = 1;
UPDATE `PREFIX_module_access` SET `id_profile` = 5 WHERE `id_profile` = 4;
UPDATE `PREFIX_module_access` SET `id_profile` = 4 WHERE `id_profile` = 3;
UPDATE `PREFIX_module_access` SET `id_profile` = 3 WHERE `id_profile` = 2;
UPDATE `PREFIX_module_access` SET `id_profile` = 2 WHERE `id_profile` = 1;
INSERT INTO `PREFIX_module_access` (`id_profile`, `id_module`, `configure`, `view`) (SELECT 1, `id_module`, 1, 1 FROM `PREFIX_module`);
+1
View File
@@ -236,6 +236,7 @@ if (isFormValid())
$sqlParams[] = "INSERT INTO "._DB_PREFIX_."configuration (name, value, date_add, date_upd) VALUES ('PS_MAIL_SMTP_PORT', '".pSQL($_GET['smtpPort'])."', NOW(), NOW())";
}
$sqlParams[] = 'INSERT INTO '._DB_PREFIX_.'employee (id_employee, lastname, firstname, email, passwd, last_passwd_gen, bo_theme, active, id_profile, id_lang, bo_show_screencast) VALUES (NULL, \''.pSQL(ToolsInstall::ucfirst($_GET['infosName'])).'\', \''.pSQL(ToolsInstall::ucfirst($_GET['infosFirstname'])).'\', \''.pSQL($_GET['infosEmail']).'\', \''.md5(pSQL(_COOKIE_KEY_.$_GET['infosPassword'])).'\', \''.date('Y-m-d h:i:s', strtotime('-360 minutes')).'\', \'oldschool\', 1, 1, (SELECT `value` FROM `'._DB_PREFIX_.'configuration` WHERE `name` = \'PS_LANG_DEFAULT\' LIMIT 1), 1)';
$sqlParams[] = 'INSERT INTO '._DB_PREFIX_.'employee_shop (id_employee, id_shop) VALUES (1 ,1)';
$sqlParams[] = 'INSERT INTO '._DB_PREFIX_.'contact (id_contact, email, customer_service) VALUES (NULL, \''.pSQL($_GET['infosEmail']).'\', 1), (NULL, \''.pSQL($_GET['infosEmail']).'\', 1)';
if (function_exists('mcrypt_encrypt'))