// added customizable bulk actions for lists in BO
This commit is contained in:
@@ -40,6 +40,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$this->lang = false;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
$this->requiredDatabase = true;
|
||||
$this->addressType = 'customer';
|
||||
$this->context = Context::getContext();
|
||||
@@ -77,7 +78,8 @@ class AdminAddressesControllerCore extends AdminController
|
||||
{
|
||||
if (Validate::isEmail(Tools::getValue('email')))
|
||||
{
|
||||
$customer = new Customer(Tools::getValue('id_customer'));
|
||||
$customer = new Customer();
|
||||
$customer->getByEmail(Tools::getValue('email'));
|
||||
if (Validate::isLoadedObject($customer))
|
||||
$_POST['id_customer'] = $customer->id;
|
||||
else
|
||||
@@ -159,68 +161,6 @@ class AdminAddressesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getList($id_lang, $orderBy = NULL, $orderWay = NULL, $start = 0, $limit = NULL, $id_lang_shop = NULL)
|
||||
{
|
||||
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit);
|
||||
/* Manage default params values */
|
||||
if (empty($limit))
|
||||
$limit = ((!isset($this->context->cookie->{$this->table.'_pagination'})) ? $this->_pagination[0] : $limit = $this->context->cookie->{$this->table.'_pagination'});
|
||||
|
||||
if (!Validate::isTableOrIdentifier($this->table))
|
||||
die('filter is corrupted');
|
||||
if (empty($orderBy))
|
||||
$orderBy = Tools::getValue($this->table.'Orderby', 'id_'.$this->table);
|
||||
if (empty($orderWay))
|
||||
$orderWay = Tools::getValue($this->table.'Orderway', 'ASC');
|
||||
$limit = (int)(Tools::getValue('pagination', $limit));
|
||||
$this->context->cookie->{$this->table.'_pagination'} = $limit;
|
||||
|
||||
/* Check params validity */
|
||||
if (!Validate::isOrderBy($orderBy) OR !Validate::isOrderWay($orderWay)
|
||||
OR !is_numeric($start) OR !is_numeric($limit)
|
||||
OR !Validate::isUnsignedId($id_lang))
|
||||
die(Tools::displayError('get list params is not valid'));
|
||||
|
||||
/* Determine offset from current page */
|
||||
if ((isset($_POST['submitFilter'.$this->table]) OR
|
||||
isset($_POST['submitFilter'.$this->table.'_x']) OR
|
||||
isset($_POST['submitFilter'.$this->table.'_y'])) AND
|
||||
!empty($_POST['submitFilter'.$this->table]) AND
|
||||
is_numeric($_POST['submitFilter'.$this->table]))
|
||||
$start = (int)($_POST['submitFilter'.$this->table] - 1) * $limit;
|
||||
|
||||
/* Cache */
|
||||
$this->_lang = (int)($id_lang);
|
||||
$this->_orderBy = $orderBy;
|
||||
$this->_orderWay = Tools::strtoupper($orderWay);
|
||||
|
||||
/* SQL table : orders, but class name is Order */
|
||||
$sqlTable = $this->table == 'order' ? 'orders' : $this->table;
|
||||
|
||||
/* Query in order to get results number */
|
||||
$queryTotal = Db::getInstance()->getRow('
|
||||
SELECT COUNT(a.`id_'.$this->table.'`) AS total
|
||||
FROM `'._DB_PREFIX_.$sqlTable.'` a
|
||||
'.($this->lang ? 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`id_'.$this->table.'` = a.`id_'.$this->table.'` AND b.`id_lang` = '.(int)($id_lang).')' : '').'
|
||||
'.(isset($this->_join) ? $this->_join.' ' : '').'
|
||||
WHERE 1 '.(isset($this->_where) ? $this->_where.' ' : '').(($this->deleted OR $this->table == 'currency') ? 'AND a.`deleted` = 0 ' : '').$this->_filter.'
|
||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||
'.(isset($this->addressType) ? 'AND a.id_'.strval($this->addressType).' != 0' : ''));
|
||||
$this->_listTotal = (int)($queryTotal['total']);
|
||||
|
||||
/* Query in order to get results with all fields */
|
||||
$this->_list = Db::getInstance()->ExecuteS('
|
||||
SELECT a.*'.($this->lang ? ', b.*' : '').(isset($this->_select) ? ', '.$this->_select.' ' : '').'
|
||||
FROM `'._DB_PREFIX_.$sqlTable.'` a
|
||||
'.($this->lang ? 'LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` b ON (b.`id_'.$this->table.'` = a.`id_'.$this->table.'` AND b.`id_lang` = '.(int)($id_lang).')' : '').'
|
||||
'.(isset($this->_join) ? $this->_join.' ' : '').'
|
||||
WHERE 1 '.(isset($this->_where) ? $this->_where.' ' : '').(($this->deleted OR $this->table == 'currency') ? 'AND a.`deleted` = 0 ' : '').$this->_filter.'
|
||||
'.(isset($this->_group) ? $this->_group.' ' : '').'
|
||||
'.(isset($this->addressType) ? 'AND a.id_'.strval($this->addressType).' != 0' : '').'
|
||||
ORDER BY '.(($orderBy == 'id_'.$this->table) ? 'a.' : '').'`'.pSQL($orderBy).'` '.pSQL($orderWay).'
|
||||
LIMIT '.(int)($start).','.(int)($limit));
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
$content = parent::displayForm();
|
||||
@@ -288,8 +228,6 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$addresses_fields = $this->processAddressFormat();
|
||||
$addresses_fields = $addresses_fields["dlv_all_fields"]; // we use delivery address
|
||||
|
||||
|
||||
|
||||
foreach($addresses_fields as $addr_field_item)
|
||||
{
|
||||
if ($addr_field_item == 'company')
|
||||
|
||||
Reference in New Issue
Block a user