diff --git a/admin-dev/themes/default/template/controllers/employees/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/employees/helpers/form/form.tpl
index a6e863bd4..23a7e1f3c 100644
--- a/admin-dev/themes/default/template/controllers/employees/helpers/form/form.tpl
+++ b/admin-dev/themes/default/template/controllers/employees/helpers/form/form.tpl
@@ -41,6 +41,15 @@
>{$option|escape:'htmlall':'UTF-8'}
{/foreach}
+ {elseif $input.type == 'default_tab'}
+
{else}
{$smarty.block.parent}
{/if}
diff --git a/admin-dev/themes/default/template/controllers/login/content.tpl b/admin-dev/themes/default/template/controllers/login/content.tpl
index 99d60461d..af52b7a6e 100755
--- a/admin-dev/themes/default/template/controllers/login/content.tpl
+++ b/admin-dev/themes/default/template/controllers/login/content.tpl
@@ -59,7 +59,9 @@
-
+ {if isset($redirect)}
+
+ {/if}
diff --git a/classes/Employee.php b/classes/Employee.php
index a70de5c42..4ecf75595 100644
--- a/classes/Employee.php
+++ b/classes/Employee.php
@@ -56,6 +56,8 @@ class EmployeeCore extends ObjectModel
/** @var string Display back office background in the specified color */
public $bo_color;
+ public $default_tab;
+
/** @var string employee's chosen theme */
public $bo_theme;
@@ -86,6 +88,7 @@ class EmployeeCore extends ObjectModel
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'id_profile' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'bo_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 32),
+ 'default_tab' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'required' => true),
'bo_theme' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 32),
'bo_width' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'bo_show_screencast' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php
index 141c56439..36f19ff64 100644
--- a/controllers/admin/AdminEmployeesController.php
+++ b/controllers/admin/AdminEmployeesController.php
@@ -33,6 +33,9 @@ class AdminEmployeesControllerCore extends AdminController
/** @var array themes list*/
private $themes = array();
+ /** @var array tabs list*/
+ private $tabs_list = array();
+
public function __construct()
{
$this->table = 'employee';
@@ -111,6 +114,21 @@ class AdminEmployeesControllerCore extends AdminController
if (file_exists($path.$theme.'/css/admin.css'))
$this->themes[] = $theme;
+ $home_tab = Tab::getInstanceFromClassName('adminHome');
+ $this->tabs_list[$home_tab->id] = array(
+ 'name' => $home_tab->name[$this->context->language->id],
+ 'id_tab' => $home_tab->id,
+ 'children' => array(array('id_tab' =>$home_tab->id, 'name' => $home_tab->name[$this->context->language->id])));
+ foreach (Tab::getTabs($this->context->language->id, 0) as $tab)
+ {
+ if (Tab::checkTabRights($tab['id_tab']))
+ {
+ $this->tabs_list[$tab['id_tab']] = $tab;
+ foreach (Tab::getTabs($this->context->language->id, $tab['id_tab']) as $children)
+ if (Tab::checkTabRights($children['id_tab']))
+ $this->tabs_list[$tab['id_tab']]['children'][] = $children;
+ }
+ }
parent::__construct();
// An employee can edit its own profile
@@ -188,6 +206,13 @@ class AdminEmployeesControllerCore extends AdminController
'size' => 20,
'desc' => $this->l('Back office background will be displayed in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")'
),
+ array(
+ 'type' => 'default_tab',
+ 'label' => $this->l('Default tab'),
+ 'name' => 'default_tab',
+ 'desc' => $this->l('This tab will be displayed just after login'),
+ 'options' => $this->tabs_list
+ ),
array(
'type' => 'text',
'label' => $this->l('Back office width'),
diff --git a/controllers/admin/AdminLoginController.php b/controllers/admin/AdminLoginController.php
index 32163e1e3..ae8b3aaf6 100755
--- a/controllers/admin/AdminLoginController.php
+++ b/controllers/admin/AdminLoginController.php
@@ -78,7 +78,7 @@ class AdminLoginControllerCore extends AdminController
// Redirect to admin panel
if (isset($_GET['redirect']) && Validate::isControllerName($_GET['redirect']))
- $redirect = $_GET['redirect'];
+ $this->context->smarty->assign(array('redirect' => Tools::getValue('redirect')));
if ($nbErrors = count($this->errors))
$this->context->smarty->assign(
@@ -89,8 +89,6 @@ class AdminLoginControllerCore extends AdminController
'disableDefaultErrorOutPut' => true,
)
);
-
- $this->context->smarty->assign(array('redirect' => isset($redirect) ? $redirect : null));
$this->setMedia();
$this->initHeader();
parent::initContent();
@@ -161,7 +159,10 @@ class AdminLoginControllerCore extends AdminController
if (isset($_POST['redirect']) && Validate::isControllerName($_POST['redirect']))
$url = $this->context->link->getAdminLink($_POST['redirect']);
else
- $url = $this->context->link->getAdminLink('AdminHome');
+ {
+ $tab = new Tab((int)$this->context->employee->default_tab);
+ $url = $this->context->link->getAdminLink($tab->class_name);
+ }
if (Tools::isSubmit('ajax'))
die(Tools::jsonEncode(array('hasErrors' => false, 'redirect' => $url)));
diff --git a/install-dev/data/db_structure.sql b/install-dev/data/db_structure.sql
index 921ed7105..82b9f8134 100644
--- a/install-dev/data/db_structure.sql
+++ b/install-dev/data/db_structure.sql
@@ -693,6 +693,7 @@ CREATE TABLE `PREFIX_employee` (
`stats_date_to` date default NULL,
`bo_color` varchar(32) default NULL,
`bo_theme` varchar(32) default NULL,
+ `default_tab` int(10) unsigned NOT NULL DEFAULT 0,
`bo_width` int(10) unsigned NOT NULL DEFAULT 0,
`bo_show_screencast` tinyint(1) NOT NULL default '1',
`active` tinyint(1) unsigned NOT NULL default '0',
diff --git a/install-dev/upgrade/sql/1.5.0.9.sql b/install-dev/upgrade/sql/1.5.0.9.sql
index b2d52d7c5..b86ea6151 100644
--- a/install-dev/upgrade/sql/1.5.0.9.sql
+++ b/install-dev/upgrade/sql/1.5.0.9.sql
@@ -5,3 +5,4 @@ ALTER TABLE `PREFIX_employee`
MODIFY COLUMN `id_last_customer_message` INT(10) UNSIGNED NOT NULL DEFAULT 0,
MODIFY COLUMN `id_last_customer` INT(10) UNSIGNED NOT NULL DEFAULT 0;
+ALTER TABLE `PREFIX_employee` ADD `default_tab` int(10) unsigned NOT NULL default 0 AFTER `bo_theme`;