[*] BO : #PSFV-94 - changes to helpers
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9500 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -46,7 +46,6 @@
|
|||||||
<li>{l s='Always check your data.'}</li>
|
<li>{l s='Always check your data.'}</li>
|
||||||
<li>{l s='Never restore a Backup on a live site.'}</li>
|
<li>{l s='Never restore a Backup on a live site.'}</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
{if $show_form}
|
{if $show_form}
|
||||||
<form action="{$current}&add{$table}&token={$token}" method="post" style="text-align: center;">
|
<form action="{$current}&add{$table}&token={$token}" method="post" style="text-align: center;">
|
||||||
<input type="submit" class="button" value="{l s='I read the disclaimer - Create a new Backup'}" style="padding: 10px; font-weight: bold; border: 1px solid;" />
|
<input type="submit" class="button" value="{l s='I read the disclaimer - Create a new Backup'}" style="padding: 10px; font-weight: bold; border: 1px solid;" />
|
||||||
|
|||||||
+97
-96
@@ -77,7 +77,11 @@ class AdminControllerCore extends Controller
|
|||||||
/** @var array Errors displayed after post processing */
|
/** @var array Errors displayed after post processing */
|
||||||
public $_errors = array();
|
public $_errors = array();
|
||||||
|
|
||||||
protected $list_display;
|
/** @var array list to be generated */
|
||||||
|
protected $fieldsDisplay;
|
||||||
|
|
||||||
|
/** @var array edit form to be generated */
|
||||||
|
protected $fields_form;
|
||||||
|
|
||||||
/** @var array list of option forms to be generated */
|
/** @var array list of option forms to be generated */
|
||||||
protected $options;
|
protected $options;
|
||||||
@@ -187,6 +191,9 @@ class AdminControllerCore extends Controller
|
|||||||
/** @var string Image type */
|
/** @var string Image type */
|
||||||
public $imageType = 'jpg';
|
public $imageType = 'jpg';
|
||||||
|
|
||||||
|
/** @var instanciation of the class associated with the AdminController */
|
||||||
|
protected $object;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// retro-compatibility : className for admin without controller
|
// retro-compatibility : className for admin without controller
|
||||||
@@ -290,6 +297,7 @@ class AdminControllerCore extends Controller
|
|||||||
|
|
||||||
// Sub included tab postProcessing
|
// Sub included tab postProcessing
|
||||||
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
|
$this->includeSubTab('postProcess', array('status', 'submitAdd1', 'submitDel', 'delete', 'submitFilter', 'submitReset'));
|
||||||
|
|
||||||
switch ($this->action)
|
switch ($this->action)
|
||||||
{
|
{
|
||||||
/* Delete object image */
|
/* Delete object image */
|
||||||
@@ -1009,111 +1017,26 @@ class AdminControllerCore extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initContent
|
* Assign smarty variables for all default views, list and form, then call other init functions
|
||||||
* Assign smarty variables for all default views, list and form
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
|
||||||
'current' => self::$currentIndex,
|
|
||||||
'token' => $this->token,
|
|
||||||
'table' => $this->table
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($this->display == 'edit' || $this->display == 'add')
|
if ($this->display == 'edit' || $this->display == 'add')
|
||||||
{
|
{
|
||||||
if (!($obj = $this->loadObject(true)))
|
if (!($this->object = $this->loadObject(true)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// init form declaration
|
|
||||||
$this->initForm();
|
$this->initForm();
|
||||||
|
|
||||||
if (isset($this->fields_form))
|
|
||||||
{
|
|
||||||
$this->getlanguages();
|
|
||||||
$helper = new HelperForm();
|
|
||||||
// Check if form template has been overriden
|
|
||||||
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'form.tpl'))
|
|
||||||
$helper->tpl = $this->tpl_folder.'form.tpl';
|
|
||||||
$helper->currentIndex = self::$currentIndex;
|
|
||||||
$helper->token = $this->token;
|
|
||||||
$helper->table = $this->table;
|
|
||||||
$helper->identifier = $this->identifier;
|
|
||||||
$helper->id = $obj->id;
|
|
||||||
$helper->languages = $this->_languages;
|
|
||||||
$helper->default_form_language = $this->default_form_language;
|
|
||||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
|
||||||
$helper->fields_value = $this->getFieldsValue($obj);
|
|
||||||
$this->content .= $helper->generateForm($this->fields_form);
|
|
||||||
}
|
}
|
||||||
else
|
else if ($this->display != 'view')
|
||||||
// TODO delete when all forms use the helper
|
|
||||||
$this->content .= $this->displayForm();
|
|
||||||
|
|
||||||
if ($this->tabAccess['view'])
|
|
||||||
{
|
{
|
||||||
if (Tools::getValue('back'))
|
|
||||||
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
|
|
||||||
else
|
|
||||||
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($this->display == 'list')
|
|
||||||
{
|
|
||||||
// init list declaration
|
|
||||||
$this->initList();
|
$this->initList();
|
||||||
|
|
||||||
$this->getList($this->context->language->id);
|
|
||||||
|
|
||||||
$helper = new HelperList();
|
|
||||||
// Check if list templates have been overriden
|
|
||||||
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_header.tpl'))
|
|
||||||
$helper->header_tpl = $this->tpl_folder.'list_header.tpl';
|
|
||||||
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_content.tpl'))
|
|
||||||
$helper->header_tpl = $this->tpl_folder.'list_content.tpl';
|
|
||||||
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_footer.tpl'))
|
|
||||||
$helper->header_tpl = $this->tpl_folder.'list_footer.tpl';
|
|
||||||
|
|
||||||
// For compatibility reasons, we have to check standard actions in class attributes
|
|
||||||
foreach ($this->actions_available as $action)
|
|
||||||
{
|
|
||||||
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action)
|
|
||||||
$this->actions[] = $action;
|
|
||||||
}
|
|
||||||
|
|
||||||
$helper->actions = $this->actions;
|
|
||||||
$helper->bulk_actions = $this->bulk_actions;
|
|
||||||
$helper->currentIndex = self::$currentIndex;
|
|
||||||
$helper->className = $this->className;
|
|
||||||
$helper->table = $this->table;
|
|
||||||
$helper->_orderBy = $this->_orderBy;
|
|
||||||
$helper->_orderWay = $this->_orderWay;
|
|
||||||
$helper->_listTotal = $this->_listTotal;
|
|
||||||
$helper->shopLink = $this->shopLink;
|
|
||||||
$helper->shopLinkType = $this->shopLinkType;
|
|
||||||
$helper->identifier = $this->identifier;
|
|
||||||
$helper->token = $this->token;
|
|
||||||
$helper->imageType = $this->imageType;
|
|
||||||
$helper->no_add = isset($this->no_add) ? $this->no_add : false;
|
|
||||||
$helper->colorOnBackground = $this->colorOnBackground;
|
|
||||||
|
|
||||||
// For each action, try to add the corresponding skip elements list
|
|
||||||
$helper->list_skip_actions = $this->list_skip_actions;
|
|
||||||
$this->content .= $helper->generateList($this->_list, $this->fieldsDisplay);
|
|
||||||
|
|
||||||
// init options declaration
|
|
||||||
$this->initOptions();
|
$this->initOptions();
|
||||||
|
|
||||||
if ($this->options)
|
|
||||||
{
|
|
||||||
$helper = new HelperOptions();
|
|
||||||
$helper->id = $this->id;
|
|
||||||
$helper->currentIndex = self::$currentIndex;
|
|
||||||
$this->content .= $helper->generateOptions($this->options);
|
|
||||||
}
|
}
|
||||||
}
|
$this->context->smarty->assign(array(
|
||||||
|
'table' => $this->table,
|
||||||
|
'current' => self::$currentIndex,
|
||||||
|
'token' => $this->token,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1141,6 +1064,48 @@ class AdminControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function initList()
|
public function initList()
|
||||||
{
|
{
|
||||||
|
if (!($this->fieldsDisplay && is_array($this->fieldsDisplay)))
|
||||||
|
return false;
|
||||||
|
$this->getList($this->context->language->id);
|
||||||
|
|
||||||
|
if (!($this->_list && is_array($this->_list)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$helper = new HelperList();
|
||||||
|
// Check if list templates have been overriden
|
||||||
|
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_header.tpl'))
|
||||||
|
$helper->header_tpl = $this->tpl_folder.'list_header.tpl';
|
||||||
|
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_content.tpl'))
|
||||||
|
$helper->header_tpl = $this->tpl_folder.'list_content.tpl';
|
||||||
|
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'list_footer.tpl'))
|
||||||
|
$helper->header_tpl = $this->tpl_folder.'list_footer.tpl';
|
||||||
|
|
||||||
|
// For compatibility reasons, we have to check standard actions in class attributes
|
||||||
|
foreach ($this->actions_available as $action)
|
||||||
|
{
|
||||||
|
if (!in_array($action, $this->actions) && isset($this->$action) && $this->$action)
|
||||||
|
$this->actions[] = $action;
|
||||||
|
}
|
||||||
|
|
||||||
|
$helper->actions = $this->actions;
|
||||||
|
$helper->bulk_actions = $this->bulk_actions;
|
||||||
|
$helper->currentIndex = self::$currentIndex;
|
||||||
|
$helper->className = $this->className;
|
||||||
|
$helper->table = $this->table;
|
||||||
|
$helper->orderBy = $this->_orderBy;
|
||||||
|
$helper->orderWay = $this->_orderWay;
|
||||||
|
$helper->listTotal = $this->_listTotal;
|
||||||
|
$helper->shopLink = $this->shopLink;
|
||||||
|
$helper->shopLinkType = $this->shopLinkType;
|
||||||
|
$helper->identifier = $this->identifier;
|
||||||
|
$helper->token = $this->token;
|
||||||
|
$helper->imageType = $this->imageType;
|
||||||
|
$helper->no_add = isset($this->no_add) ? $this->no_add : false;
|
||||||
|
$helper->colorOnBackground = $this->colorOnBackground;
|
||||||
|
|
||||||
|
// For each action, try to add the corresponding skip elements list
|
||||||
|
$helper->list_skip_actions = $this->list_skip_actions;
|
||||||
|
$this->content .= $helper->generateList($this->_list, $this->fieldsDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1148,6 +1113,35 @@ class AdminControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function initForm()
|
public function initForm()
|
||||||
{
|
{
|
||||||
|
if ($this->fields_form && is_array($this->fields_form))
|
||||||
|
{
|
||||||
|
$this->getlanguages();
|
||||||
|
$helper = new HelperForm();
|
||||||
|
// Check if form template has been overriden
|
||||||
|
if (file_exists($this->context->smarty->template_dir[0].'/'.$this->tpl_folder.'form.tpl'))
|
||||||
|
$helper->tpl = $this->tpl_folder.'form.tpl';
|
||||||
|
$helper->currentIndex = self::$currentIndex;
|
||||||
|
$helper->token = $this->token;
|
||||||
|
$helper->table = $this->table;
|
||||||
|
$helper->identifier = $this->identifier;
|
||||||
|
$helper->id = $this->object->id;
|
||||||
|
$helper->languages = $this->_languages;
|
||||||
|
$helper->default_form_language = $this->default_form_language;
|
||||||
|
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||||
|
$helper->fields_value = $this->getFieldsValue($this->object);
|
||||||
|
if ($this->tabAccess['view'])
|
||||||
|
{
|
||||||
|
if (Tools::getValue('back'))
|
||||||
|
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue('back')));
|
||||||
|
else
|
||||||
|
$this->context->smarty->assign('back', Tools::safeOutput(Tools::getValue(self::$currentIndex.'&token='.$this->token)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->content .= $helper->generateForm($this->fields_form);
|
||||||
|
}
|
||||||
|
// TODO delete when all forms use the helper
|
||||||
|
else
|
||||||
|
$this->content .= $this->displayForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1155,6 +1149,14 @@ class AdminControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function initOptions()
|
public function initOptions()
|
||||||
{
|
{
|
||||||
|
if ($this->options && is_array($this->options))
|
||||||
|
{
|
||||||
|
$helper = new HelperOptions();
|
||||||
|
$helper->id = $this->id;
|
||||||
|
$helper->token = $this->token;
|
||||||
|
$helper->currentIndex = self::$currentIndex;
|
||||||
|
$this->content .= $helper->generateOptions($this->options);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMedia()
|
public function setMedia()
|
||||||
@@ -1386,7 +1388,7 @@ class AdminControllerCore extends Controller
|
|||||||
else if (isset($_POST['submitReset'.$this->table]))
|
else if (isset($_POST['submitReset'.$this->table]))
|
||||||
$this->action = 'reset_filters';
|
$this->action = 'reset_filters';
|
||||||
/* Submit options list */
|
/* Submit options list */
|
||||||
else if (Tools::getValue('submitOptions'.$this->table))
|
else if (Tools::getValue('submitOptions'.$this->table) || Tools::getValue('submitOptions'))
|
||||||
$this->action = 'update_options';
|
$this->action = 'update_options';
|
||||||
else if (Tools::isSubmit('submitFields') && $this->requiredDatabase && $this->tabAccess['add'] === '1' && $this->tabAccess['delete'] === '1')
|
else if (Tools::isSubmit('submitFields') && $this->requiredDatabase && $this->tabAccess['add'] === '1' && $this->tabAccess['delete'] === '1')
|
||||||
$this->action = 'update_fields';
|
$this->action = 'update_fields';
|
||||||
@@ -1440,7 +1442,6 @@ class AdminControllerCore extends Controller
|
|||||||
$orderBy = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
|
$orderBy = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
|
||||||
if (empty($orderWay))
|
if (empty($orderWay))
|
||||||
$orderWay = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
|
$orderWay = $this->context->cookie->__get($this->table.'Orderway') ? $this->context->cookie->__get($this->table.'Orderway') : 'ASC';
|
||||||
|
|
||||||
$limit = (int)Tools::getValue('pagination', $limit);
|
$limit = (int)Tools::getValue('pagination', $limit);
|
||||||
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -31,7 +31,7 @@ class HelperListCore extends Helper
|
|||||||
protected $_list = array();
|
protected $_list = array();
|
||||||
|
|
||||||
/** @var integer Number of results in list */
|
/** @var integer Number of results in list */
|
||||||
public $_listTotal = 0;
|
public $listTotal = 0;
|
||||||
|
|
||||||
/** @var array WHERE clause determined by filter fields */
|
/** @var array WHERE clause determined by filter fields */
|
||||||
protected $_filter;
|
protected $_filter;
|
||||||
@@ -43,13 +43,13 @@ class HelperListCore extends Helper
|
|||||||
protected $_pagination = array(20, 50, 100, 300);
|
protected $_pagination = array(20, 50, 100, 300);
|
||||||
|
|
||||||
/** @var string ORDER BY clause determined by field/arrows in list header */
|
/** @var string ORDER BY clause determined by field/arrows in list header */
|
||||||
public $_orderBy;
|
public $orderBy;
|
||||||
|
|
||||||
/** @var string Default ORDER BY clause when $_orderBy is not defined */
|
/** @var string Default ORDER BY clause when $orderBy is not defined */
|
||||||
public $_defaultOrderBy = false;
|
public $_defaultOrderBy = false;
|
||||||
|
|
||||||
/** @var string Order way (ASC, DESC) determined by arrows in list header */
|
/** @var string Order way (ASC, DESC) determined by arrows in list header */
|
||||||
public $_orderWay;
|
public $orderWay;
|
||||||
|
|
||||||
public $identifier;
|
public $identifier;
|
||||||
|
|
||||||
@@ -425,14 +425,14 @@ class HelperListCore extends Helper
|
|||||||
else
|
else
|
||||||
$default_pagination = $this->_pagination[0];
|
$default_pagination = $this->_pagination[0];
|
||||||
|
|
||||||
$total_pages = ceil($this->_listTotal / Tools::getValue('pagination', ($default_pagination)));
|
$total_pages = ceil($this->listTotal / Tools::getValue('pagination', ($default_pagination)));
|
||||||
|
|
||||||
if (!$total_pages) $total_pages = 1;
|
if (!$total_pages) $total_pages = 1;
|
||||||
|
|
||||||
$identifier = Tools::getIsset($this->identifier) ? '&'.$this->identifier.'='.(int)Tools::getValue($this->identifier) : '';
|
$identifier = Tools::getIsset($this->identifier) ? '&'.$this->identifier.'='.(int)Tools::getValue($this->identifier) : '';
|
||||||
$order = '';
|
$order = '';
|
||||||
if (Tools::getIsset($this->table.'Orderby'))
|
if (Tools::getIsset($this->table.'Orderby'))
|
||||||
$order = '&'.$this->table.'Orderby='.urlencode($this->_orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->_orderWay));
|
$order = '&'.$this->table.'Orderby='.urlencode($this->orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->orderWay));
|
||||||
|
|
||||||
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
|
$action = $this->currentIndex.$identifier.'&token='.$token.$order.'#'.$this->table;
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ class HelperListCore extends Helper
|
|||||||
substr($this->identifier,3,strlen($this->identifier)))
|
substr($this->identifier,3,strlen($this->identifier)))
|
||||||
}
|
}
|
||||||
.' class="table'.(
|
.' class="table'.(
|
||||||
if ($is_dnd_identifier AND ($this->_orderBy != 'position 'AND $this->_orderWay != 'DESC'))
|
if ($is_dnd_identifier AND ($this->orderBy != 'position 'AND $this->orderWay != 'DESC'))
|
||||||
' tableDnD'
|
' tableDnD'
|
||||||
.'" cellpadding="0" cellspacing="0">*/
|
.'" cellpadding="0" cellspacing="0">*/
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ class HelperListCore extends Helper
|
|||||||
if (array_key_exists($this->identifier, $this->identifiersDnd) && (int)Tools::getValue($this->identifiersDnd[$this->identifier], 1))
|
if (array_key_exists($this->identifier, $this->identifiersDnd) && (int)Tools::getValue($this->identifiersDnd[$this->identifier], 1))
|
||||||
$table_id = substr($this->identifier, 3, strlen($this->identifier));
|
$table_id = substr($this->identifier, 3, strlen($this->identifier));
|
||||||
|
|
||||||
if (array_key_exists($this->identifier, $this->identifiersDnd) && ($this->_orderBy != 'position' && $this->_orderWay != 'DESC'))
|
if (array_key_exists($this->identifier, $this->identifiersDnd) && ($this->orderBy != 'position' && $this->orderWay != 'DESC'))
|
||||||
$table_dnd = true;
|
$table_dnd = true;
|
||||||
|
|
||||||
foreach ($this->fieldsDisplay as $key => $params)
|
foreach ($this->fieldsDisplay as $key => $params)
|
||||||
@@ -517,10 +517,10 @@ class HelperListCore extends Helper
|
|||||||
'total_pages' => $total_pages,
|
'total_pages' => $total_pages,
|
||||||
'selected_pagination' => $selected_pagination,
|
'selected_pagination' => $selected_pagination,
|
||||||
'pagination' => $this->_pagination,
|
'pagination' => $this->_pagination,
|
||||||
'list_total' => $this->_listTotal,
|
'list_total' => $this->listTotal,
|
||||||
'is_order_position' => array_key_exists($this->identifier, $this->identifiersDnd) && $this->_orderBy == 'position',
|
'is_order_position' => array_key_exists($this->identifier, $this->identifiersDnd) && $this->orderBy == 'position',
|
||||||
'order_way' => $this->_orderWay,
|
'order_way' => $this->orderWay,
|
||||||
'order_by' => $this->_orderBy,
|
'order_by' => $this->orderBy,
|
||||||
'token' => $this->token,
|
'token' => $this->token,
|
||||||
'fields_display' => $this->fieldsDisplay,
|
'fields_display' => $this->fieldsDisplay,
|
||||||
'delete' => in_array('delete', $this->actions),
|
'delete' => in_array('delete', $this->actions),
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class HelperOptionsCore extends Helper
|
|||||||
'option_list' => $option_list,
|
'option_list' => $option_list,
|
||||||
'current_id_lang' => $this->context->language->id,
|
'current_id_lang' => $this->context->language->id,
|
||||||
'required_fields' => isset($required_fields) ? $required_fields : false,
|
'required_fields' => isset($required_fields) ? $required_fields : false,
|
||||||
'languages' => isset($languages) ? $languages : false
|
'languages' => isset($languages) ? $languages : null,
|
||||||
));
|
));
|
||||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
|
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/'.$this->tpl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,14 +48,6 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
|
|
||||||
if (!Tools::getValue('realedit'))
|
if (!Tools::getValue('realedit'))
|
||||||
$this->deleted = true;
|
$this->deleted = true;
|
||||||
$this->_select = 'cl.`name` as country';
|
|
||||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
|
|
||||||
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')';
|
|
||||||
$this->_where = 'AND a.id_customer != 0';
|
|
||||||
|
|
||||||
$countries = Country::getCountries($this->context->language->id);
|
|
||||||
foreach ($countries AS $country)
|
|
||||||
$this->countriesArray[$country['id_country']] = $country['name'];
|
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||||
@@ -66,6 +58,25 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
'city' => array('title' => $this->l('City'), 'width' => 150),
|
'city' => array('title' => $this->l('City'), 'width' => 150),
|
||||||
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
|
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initList()
|
||||||
|
{
|
||||||
|
$this->_select = 'cl.`name` as country';
|
||||||
|
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
|
||||||
|
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')';
|
||||||
|
$this->_where = 'AND a.id_customer != 0';
|
||||||
|
|
||||||
|
$countries = Country::getCountries($this->context->language->id);
|
||||||
|
foreach ($countries AS $country)
|
||||||
|
$this->countriesArray[$country['id_country']] = $country['name'];
|
||||||
|
|
||||||
|
parent::initList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initForm()
|
||||||
|
{
|
||||||
$this->fields_form = array(
|
$this->fields_form = array(
|
||||||
'legend' => array(
|
'legend' => array(
|
||||||
'title' => $this->l('Addresses'),
|
'title' => $this->l('Addresses'),
|
||||||
@@ -125,133 +136,9 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
parent::__construct();
|
if (Validate::isLoadedObject($this->object))
|
||||||
}
|
|
||||||
|
|
||||||
public function postProcess()
|
|
||||||
{
|
{
|
||||||
if ($this->action == 'save')
|
$customer = new Customer($this->object->id_customer);
|
||||||
{
|
|
||||||
// Transform e-mail in id_customer for parent processing
|
|
||||||
if (Validate::isEmail(Tools::getValue('email')))
|
|
||||||
{
|
|
||||||
$customer = new Customer();
|
|
||||||
$customer->getByEmail(Tools::getValue('email'));
|
|
||||||
if (Validate::isLoadedObject($customer))
|
|
||||||
$_POST['id_customer'] = $customer->id;
|
|
||||||
else
|
|
||||||
$this->_errors[] = Tools::displayError('This e-mail address is not registered.');
|
|
||||||
}
|
|
||||||
elseif ($id_customer = Tools::getValue('id_customer'))
|
|
||||||
{
|
|
||||||
$customer = new Customer((int)($id_customer));
|
|
||||||
if (Validate::isLoadedObject($customer))
|
|
||||||
$_POST['id_customer'] = $customer->id;
|
|
||||||
else
|
|
||||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this->_errors[] = Tools::displayError('Unknown customer');
|
|
||||||
if (Country::isNeedDniByCountryId(Tools::getValue('id_country')) AND !Tools::getValue('dni'))
|
|
||||||
$this->_errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
|
||||||
|
|
||||||
/* If the selected country does not contain states */
|
|
||||||
$id_state = (int)(Tools::getValue('id_state'));
|
|
||||||
if ($id_country = Tools::getValue('id_country') AND $country = new Country((int)($id_country)) AND !(int)($country->contains_states) AND $id_state)
|
|
||||||
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
|
||||||
|
|
||||||
/* If the selected country contains states, then a state have to be selected */
|
|
||||||
if ((int)($country->contains_states) AND !$id_state)
|
|
||||||
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
|
||||||
|
|
||||||
/* Check zip code */
|
|
||||||
if ($country->need_zip_code)
|
|
||||||
{
|
|
||||||
$zip_code_format = $country->zip_code_format;
|
|
||||||
if (($postcode = Tools::getValue('postcode')) AND $zip_code_format)
|
|
||||||
{
|
|
||||||
$zip_regexp = '/^'.$zip_code_format.'$/ui';
|
|
||||||
$zip_regexp = str_replace(' ', '( |)', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('-', '(-|)', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('N', '[0-9]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
|
||||||
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
|
||||||
if (!preg_match($zip_regexp, $postcode))
|
|
||||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
|
|
||||||
}
|
|
||||||
elseif ($zip_code_format)
|
|
||||||
$this->_errors[] = Tools::displayError('Postcode required.');
|
|
||||||
elseif ($postcode AND !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
|
||||||
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this address come from order's edition and is the same as the other one (invoice or delivery one)
|
|
||||||
** we delete its id_address to force the creation of a new one */
|
|
||||||
if ((int)(Tools::getValue('id_order')))
|
|
||||||
{
|
|
||||||
$this->_redirect = false;
|
|
||||||
if (isset($_POST['address_type']))
|
|
||||||
$_POST['id_address'] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!sizeof($this->_errors))
|
|
||||||
parent::postProcess();
|
|
||||||
|
|
||||||
/* Reassignation of the order's new (invoice or delivery) address */
|
|
||||||
$address_type = ((int)(Tools::getValue('address_type')) == 2 ? 'invoice' : ((int)(Tools::getValue('address_type')) == 1 ? 'delivery' : ''));
|
|
||||||
if ($this->action == 'save' AND ($id_order = (int)(Tools::getValue('id_order'))) AND !sizeof($this->_errors) AND !empty($address_type))
|
|
||||||
{
|
|
||||||
if(!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order))
|
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
|
||||||
else
|
|
||||||
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Address formats used by the country where the address id retrieved from POST/GET is.
|
|
||||||
*
|
|
||||||
* @return array address formats
|
|
||||||
*/
|
|
||||||
protected function processAddressFormat()
|
|
||||||
{
|
|
||||||
$tmp_addr = new Address((int)Tools::getValue("id_address"));
|
|
||||||
|
|
||||||
$selectedCountry = ($tmp_addr && $tmp_addr->id_country) ? $tmp_addr->id_country :
|
|
||||||
(int)(Configuration::get('PS_COUNTRY_DEFAULT'));
|
|
||||||
|
|
||||||
$inv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry, false, true);
|
|
||||||
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry, false, true);
|
|
||||||
|
|
||||||
$inv_all_fields = array();
|
|
||||||
$dlv_all_fields = array();
|
|
||||||
|
|
||||||
$out = array();
|
|
||||||
|
|
||||||
foreach (array('inv','dlv') as $adr_type)
|
|
||||||
{
|
|
||||||
foreach (${$adr_type.'_adr_fields'} as $fields_line)
|
|
||||||
foreach(explode(' ',$fields_line) as $field_item)
|
|
||||||
${$adr_type.'_all_fields'}[] = trim($field_item);
|
|
||||||
|
|
||||||
|
|
||||||
$out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'};
|
|
||||||
$out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'};
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
if ($this->display == 'edit' || $this->display == 'add')
|
|
||||||
{
|
|
||||||
if (!($address = $this->loadObject(true)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (Validate::isLoadedObject($address))
|
|
||||||
{
|
|
||||||
$customer = new Customer($address->id_customer);
|
|
||||||
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id);
|
$tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,12 +268,124 @@ class AdminAddressesControllerCore extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// merge address format with the rest of the form
|
// merge address format with the rest of the form
|
||||||
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
|
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
|
||||||
|
|
||||||
|
parent::initForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postProcess()
|
||||||
|
{
|
||||||
|
if ($this->action == 'save')
|
||||||
|
{
|
||||||
|
// Transform e-mail in id_customer for parent processing
|
||||||
|
if (Validate::isEmail(Tools::getValue('email')))
|
||||||
|
{
|
||||||
|
$customer = new Customer();
|
||||||
|
$customer->getByEmail(Tools::getValue('email'));
|
||||||
|
if (Validate::isLoadedObject($customer))
|
||||||
|
$_POST['id_customer'] = $customer->id;
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('This e-mail address is not registered.');
|
||||||
|
}
|
||||||
|
elseif ($id_customer = Tools::getValue('id_customer'))
|
||||||
|
{
|
||||||
|
$customer = new Customer((int)($id_customer));
|
||||||
|
if (Validate::isLoadedObject($customer))
|
||||||
|
$_POST['id_customer'] = $customer->id;
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->display = 'list';
|
$this->_errors[] = Tools::displayError('Unknown customer');
|
||||||
|
if (Country::isNeedDniByCountryId(Tools::getValue('id_country')) AND !Tools::getValue('dni'))
|
||||||
|
$this->_errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
|
||||||
|
|
||||||
parent::initContent();
|
/* If the selected country does not contain states */
|
||||||
|
$id_state = (int)(Tools::getValue('id_state'));
|
||||||
|
if ($id_country = Tools::getValue('id_country') AND $country = new Country((int)($id_country)) AND !(int)($country->contains_states) AND $id_state)
|
||||||
|
$this->_errors[] = Tools::displayError('You have selected a state for a country that does not contain states.');
|
||||||
|
|
||||||
|
/* If the selected country contains states, then a state have to be selected */
|
||||||
|
if ((int)($country->contains_states) AND !$id_state)
|
||||||
|
$this->_errors[] = Tools::displayError('An address located in a country containing states must have a state selected.');
|
||||||
|
|
||||||
|
/* Check zip code */
|
||||||
|
if ($country->need_zip_code)
|
||||||
|
{
|
||||||
|
$zip_code_format = $country->zip_code_format;
|
||||||
|
if (($postcode = Tools::getValue('postcode')) AND $zip_code_format)
|
||||||
|
{
|
||||||
|
$zip_regexp = '/^'.$zip_code_format.'$/ui';
|
||||||
|
$zip_regexp = str_replace(' ', '( |)', $zip_regexp);
|
||||||
|
$zip_regexp = str_replace('-', '(-|)', $zip_regexp);
|
||||||
|
$zip_regexp = str_replace('N', '[0-9]', $zip_regexp);
|
||||||
|
$zip_regexp = str_replace('L', '[a-zA-Z]', $zip_regexp);
|
||||||
|
$zip_regexp = str_replace('C', $country->iso_code, $zip_regexp);
|
||||||
|
if (!preg_match($zip_regexp, $postcode))
|
||||||
|
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.').'<br />'.Tools::displayError('Must be typed as follows:').' '.str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $zip_code_format)));
|
||||||
|
}
|
||||||
|
elseif ($zip_code_format)
|
||||||
|
$this->_errors[] = Tools::displayError('Postcode required.');
|
||||||
|
elseif ($postcode AND !preg_match('/^[0-9a-zA-Z -]{4,9}$/ui', $postcode))
|
||||||
|
$this->_errors[] = Tools::displayError('Your zip/postal code is incorrect.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If this address come from order's edition and is the same as the other one (invoice or delivery one)
|
||||||
|
** we delete its id_address to force the creation of a new one */
|
||||||
|
if ((int)(Tools::getValue('id_order')))
|
||||||
|
{
|
||||||
|
$this->_redirect = false;
|
||||||
|
if (isset($_POST['address_type']))
|
||||||
|
$_POST['id_address'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!sizeof($this->_errors))
|
||||||
|
parent::postProcess();
|
||||||
|
|
||||||
|
/* Reassignation of the order's new (invoice or delivery) address */
|
||||||
|
$address_type = ((int)(Tools::getValue('address_type')) == 2 ? 'invoice' : ((int)(Tools::getValue('address_type')) == 1 ? 'delivery' : ''));
|
||||||
|
if ($this->action == 'save' AND ($id_order = (int)(Tools::getValue('id_order'))) AND !sizeof($this->_errors) AND !empty($address_type))
|
||||||
|
{
|
||||||
|
if(!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order))
|
||||||
|
$this->_errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
||||||
|
else
|
||||||
|
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Address formats used by the country where the address id retrieved from POST/GET is.
|
||||||
|
*
|
||||||
|
* @return array address formats
|
||||||
|
*/
|
||||||
|
protected function processAddressFormat()
|
||||||
|
{
|
||||||
|
$tmp_addr = new Address((int)Tools::getValue("id_address"));
|
||||||
|
|
||||||
|
$selectedCountry = ($tmp_addr && $tmp_addr->id_country) ? $tmp_addr->id_country :
|
||||||
|
(int)(Configuration::get('PS_COUNTRY_DEFAULT'));
|
||||||
|
|
||||||
|
$inv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry, false, true);
|
||||||
|
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry, false, true);
|
||||||
|
|
||||||
|
$inv_all_fields = array();
|
||||||
|
$dlv_all_fields = array();
|
||||||
|
|
||||||
|
$out = array();
|
||||||
|
|
||||||
|
foreach (array('inv','dlv') as $adr_type)
|
||||||
|
{
|
||||||
|
foreach (${$adr_type.'_adr_fields'} as $fields_line)
|
||||||
|
foreach(explode(' ',$fields_line) as $field_item)
|
||||||
|
${$adr_type.'_all_fields'}[] = trim($field_item);
|
||||||
|
|
||||||
|
|
||||||
|
$out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'};
|
||||||
|
$out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,13 @@ class AdminAliasesControllerCore extends AdminController
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initForm()
|
||||||
|
{
|
||||||
|
$this->fields_value = array('alias' => $this->object->getAliases());
|
||||||
|
|
||||||
|
parent::initForm();
|
||||||
|
}
|
||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
if (isset($_POST['submitAdd'.$this->table]))
|
if (isset($_POST['submitAdd'.$this->table]))
|
||||||
@@ -112,20 +119,6 @@ class AdminAliasesControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
parent::postProcess();
|
parent::postProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
if (!($obj = $this->loadObject(true)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
$this->fields_value = array('alias' => $obj->getAliases());
|
|
||||||
|
|
||||||
if ($this->display != 'edit' && $this->display != 'add')
|
|
||||||
$this->display = 'list';
|
|
||||||
|
|
||||||
parent::initContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,12 +36,13 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
$this->className = 'Backup';
|
$this->className = 'Backup';
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->addRowAction('delete');
|
|
||||||
$this->addRowAction('view');
|
$this->addRowAction('view');
|
||||||
|
$this->addRowAction('delete');
|
||||||
|
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||||
|
|
||||||
$this->deleted = false;
|
$this->deleted = false;
|
||||||
|
|
||||||
$this->requiredDatabase = false;
|
$this->requiredDatabase = false;
|
||||||
|
$this->identifier = 'filename';
|
||||||
|
|
||||||
$this->fieldsDisplay = array (
|
$this->fieldsDisplay = array (
|
||||||
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
|
'date' => array('title' => $this->l('Date'), 'type' => 'datetime', 'width' => 120, 'align' => 'right'),
|
||||||
@@ -62,7 +63,6 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
'submit' => array()
|
'submit' => array()
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$this->identifier = 'filename';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +107,6 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
$this->display = 'list';
|
$this->display = 'list';
|
||||||
$show_form = true;
|
$show_form = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'current' => self::$currentIndex,
|
'current' => self::$currentIndex,
|
||||||
'show_form' => $show_form,
|
'show_form' => $show_form,
|
||||||
@@ -115,6 +114,7 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
'how_to' => true,
|
'how_to' => true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::initContent();
|
parent::initContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,6 @@ class AdminBackupControllerCore extends AdminController
|
|||||||
|
|
||||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!Validate::isTableOrIdentifier($this->table))
|
if (!Validate::isTableOrIdentifier($this->table))
|
||||||
die('filter is corrupted');
|
die('filter is corrupted');
|
||||||
if (empty($orderBy))
|
if (empty($orderBy))
|
||||||
|
|||||||
@@ -43,20 +43,11 @@ class AdminContactsControllerCore extends AdminController
|
|||||||
'description' => array('title' => $this->l('Description'), 'width' => 150),
|
'description' => array('title' => $this->l('Description'), 'width' => 150),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->options = array(
|
parent::__construct();
|
||||||
'general' => array(
|
}
|
||||||
'title' => $this->l('Contact options'),
|
|
||||||
'fields' => array(
|
|
||||||
'PS_CUSTOMER_SERVICE_FILE_UPLOAD' => array('title' => $this->l('Allow file upload'), 'desc' => $this->l('Allow customers to upload file using contact page'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'value', 'list' => array(
|
|
||||||
'0' => array('value' => 0, 'name' => $this->l('No')),
|
|
||||||
'1' => array('value' => 1, 'name' => $this->l('Yes'))
|
|
||||||
)),
|
|
||||||
'PS_CUSTOMER_SERVICE_SIGNATURE' => array('title' => $this->l('Pre-defined message'), 'desc' => $this->l('Please fill the message that appears by default when you answer a thread on the customer service page'), 'cast' => 'pSQL', 'type' => 'textareaLang', 'identifier' => 'value', 'cols' => 40, 'rows' => 8),
|
|
||||||
),
|
|
||||||
'submit' => array()
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
|
public function initForm()
|
||||||
|
{
|
||||||
$this->fields_form = array(
|
$this->fields_form = array(
|
||||||
'legend' => array(
|
'legend' => array(
|
||||||
'title' => $this->l('Contacts'),
|
'title' => $this->l('Contacts'),
|
||||||
@@ -120,16 +111,9 @@ class AdminContactsControllerCore extends AdminController
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
parent::__construct();
|
parent::initForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
if ($this->display != 'edit')
|
|
||||||
$this->display = 'list';
|
|
||||||
|
|
||||||
parent::initContent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -274,13 +274,5 @@ class AdminCurrenciesControllerCore extends AdminController
|
|||||||
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
|
Configuration::updateValue('PS_CURRENCY_DEFAULT', $value);
|
||||||
Currency::refreshCurrencies();
|
Currency::refreshCurrencies();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
if ($this->display != 'edit' && $this->display != 'add')
|
|
||||||
$this->display = 'list';
|
|
||||||
|
|
||||||
parent::initContent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,18 +90,6 @@ class AdminEmailsControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initContent()
|
|
||||||
{
|
|
||||||
$helper = new HelperOptions();
|
|
||||||
$helper->id = $this->id;
|
|
||||||
$helper->currentIndex = self::$currentIndex;
|
|
||||||
$helper->table = $this->table;
|
|
||||||
$helper->token = $this->token;
|
|
||||||
$this->content .= $helper->generateOptions($this->options);
|
|
||||||
|
|
||||||
parent::initContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function beforeUpdateOptions()
|
public function beforeUpdateOptions()
|
||||||
{
|
{
|
||||||
/* PrestaShop demo mode */
|
/* PrestaShop demo mode */
|
||||||
|
|||||||
@@ -527,17 +527,7 @@ class AdminImagesController extends AdminController
|
|||||||
public function initContent()
|
public function initContent()
|
||||||
{
|
{
|
||||||
if ($this->display != 'edit' && $this->display != 'add')
|
if ($this->display != 'edit' && $this->display != 'add')
|
||||||
$this->display = 'list';
|
|
||||||
|
|
||||||
parent::initContent();
|
|
||||||
|
|
||||||
if ($this->display == 'list')
|
|
||||||
{
|
{
|
||||||
$helper = new HelperOptions();
|
|
||||||
$helper->id = $this->id;
|
|
||||||
$helper->currentIndex = self::$currentIndex;
|
|
||||||
$this->content .= $helper->generateOptions($this->options);
|
|
||||||
|
|
||||||
$this->initRegenerate();
|
$this->initRegenerate();
|
||||||
$this->initMoveImages();
|
$this->initMoveImages();
|
||||||
|
|
||||||
@@ -549,5 +539,7 @@ class AdminImagesController extends AdminController
|
|||||||
|
|
||||||
if ($this->display == 'edit')
|
if ($this->display == 'edit')
|
||||||
$this->warnings[] = $this->l('After modification, do not forget to regenerate thumbnails');
|
$this->warnings[] = $this->l('After modification, do not forget to regenerate thumbnails');
|
||||||
|
|
||||||
|
parent::initContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user