// fix norme
This commit is contained in:
@@ -32,7 +32,7 @@ class AdminAccountingRegisteredNumberControllerCore extends AdminController
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->className = 'Accounting';
|
$this->className = 'Accounting';
|
||||||
$id_lang = $this->context->language->id;
|
$id_lang = $this->context->language->id;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class AdminAccountingRegisteredNumberControllerCore extends AdminController
|
|||||||
// Gift wrapping definition
|
// Gift wrapping definition
|
||||||
'gift_wrapping' => array(
|
'gift_wrapping' => array(
|
||||||
'func_call' => 'getAccountingNumberConfiguration',
|
'func_call' => 'getAccountingNumberConfiguration',
|
||||||
'key' => 'account_gift_wripping',
|
'key' => 'account_gift_wripping',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'account_number' => $this->l('Account number'),
|
'account_number' => $this->l('Account number'),
|
||||||
'total' => $this->l('Number of gift-wrapping associated to this account')
|
'total' => $this->l('Number of gift-wrapping associated to this account')
|
||||||
@@ -74,27 +74,27 @@ class AdminAccountingRegisteredNumberControllerCore extends AdminController
|
|||||||
'title' => $this->l('Gift wrapping account number list'),
|
'title' => $this->l('Gift wrapping account number list'),
|
||||||
'list' => array()),
|
'list' => array()),
|
||||||
|
|
||||||
// Submited shipping charge definition
|
// Submited shipping charge definition
|
||||||
'submited_shipping_charge' => array(
|
'submited_shipping_charge' => array(
|
||||||
'func_call' => 'getAccountingNumberConfiguration',
|
'func_call' => 'getAccountingNumberConfiguration',
|
||||||
'key' => 'account_submit_shipping_charge',
|
'key' => 'account_submit_shipping_charge',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'account_number' => $this->l('Account number'),
|
'account_number' => $this->l('Account number'),
|
||||||
'total' => $this->l('Number of submited shipping charge associated to this account')
|
'total' => $this->l('Number of submited shipping charge associated to this account')
|
||||||
),
|
),
|
||||||
'title' => $this->l('Submited shipping charge account number list'),
|
'title' => $this->l('Submited shipping charge account number list'),
|
||||||
'list' => array()),
|
'list' => array()),
|
||||||
|
|
||||||
// Unsubmited shipping charge definition
|
// Unsubmited shipping charge definition
|
||||||
'unsubmited_shipping_charge' => array(
|
'unsubmited_shipping_charge' => array(
|
||||||
'func_call' => 'getAccountingNumberConfiguration',
|
'func_call' => 'getAccountingNumberConfiguration',
|
||||||
'key' => 'account_unsubmit_shipping_charge',
|
'key' => 'account_unsubmit_shipping_charge',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'account_number' => $this->l('Account number'),
|
'account_number' => $this->l('Account number'),
|
||||||
'total' => $this->l('Number of unsubmited shipping charge associated to this account')
|
'total' => $this->l('Number of unsubmited shipping charge associated to this account')
|
||||||
),
|
),
|
||||||
'title' => $this->l('Unsubmited shipping charge account number list'),
|
'title' => $this->l('Unsubmited shipping charge account number list'),
|
||||||
'list' => array()),
|
'list' => array()),
|
||||||
|
|
||||||
// Customer definition
|
// Customer definition
|
||||||
'customer' => array(
|
'customer' => array(
|
||||||
@@ -142,48 +142,50 @@ class AdminAccountingRegisteredNumberControllerCore extends AdminController
|
|||||||
parent::initContent();
|
parent::initContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value configuration requested.
|
* Return the value configuration requested.
|
||||||
*
|
*
|
||||||
* @TODO : Add the possibility to check in all shop
|
* @TODO : Add the possibility to check in all shop
|
||||||
* @param string $key of the Accounting configuration
|
* @param string $key of the Accounting configuration
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAccountingNumberConfiguration($key)
|
public function getAccountingNumberConfiguration($key)
|
||||||
{
|
{
|
||||||
if (($num = Accounting::getConfiguration($key)))
|
if (($num = Accounting::getConfiguration($key)))
|
||||||
return array(array($num, '1'));
|
return array(array($num, '1'));
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initAccountNumberList()
|
public function initAccountNumberList()
|
||||||
{
|
{
|
||||||
foreach ($this->account_number_list as $name => &$detail)
|
foreach ($this->account_number_list as $name => &$detail)
|
||||||
{
|
{
|
||||||
if (isset($detail['table']) && !empty($detail['table']))
|
if (isset($detail['table']) && !empty($detail['table']))
|
||||||
{
|
{
|
||||||
$join = '';
|
$join = '';
|
||||||
|
|
||||||
if (isset($detail['left_join']))
|
if (isset($detail['left_join']))
|
||||||
{
|
{
|
||||||
$join = 'LEFT JOIN '._DB_PREFIX_.$detail['left_join']['table'].' s ON (';
|
$join = 'LEFT JOIN '._DB_PREFIX_.$detail['left_join']['table'].' s ON (';
|
||||||
foreach ($detail['left_join']['on'] as $on)
|
foreach ($detail['left_join']['on'] as $on)
|
||||||
$join .= 'p.'.$on.' = s.'.$on.' AND ';
|
$join .= 'p.'.$on.' = s.'.$on.' AND ';
|
||||||
$join = rtrim($join, ' AND ').')';
|
$join = rtrim($join, ' AND ').')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
SELECT '.implode(', ', array_keys($detail['fields'])).'
|
SELECT '.implode(', ', array_keys($detail['fields'])).'
|
||||||
FROM `'._DB_PREFIX_.$detail['table'].'` p '.$join.'
|
FROM `'._DB_PREFIX_.$detail['table'].'` p '.$join.'
|
||||||
WHERE '.$detail['condition'];
|
WHERE '.$detail['condition'];
|
||||||
|
|
||||||
if (isset($detail['group_by']))
|
if (isset($detail['group_by']))
|
||||||
$query .= ' GROUP BY '.$detail['group_by'];
|
$query .= ' GROUP BY '.$detail['group_by'];
|
||||||
|
|
||||||
$detail['list'] = Db::getInstance()->executeS($query);
|
$detail['list'] = Db::getInstance()->executeS($query);
|
||||||
}
|
}
|
||||||
else if (isset($detail['func_call']) && isset($detail['key']) && method_exists($this, $detail['func_call']))
|
else if (isset($detail['func_call']) &&
|
||||||
$detail['list'] = $this->{$detail['func_call']}($detail['key']);
|
isset($detail['key']) &&
|
||||||
}
|
method_exists($this, $detail['func_call']))
|
||||||
}
|
$detail['list'] = $this->{$detail['func_call']}($detail['key']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user