addition of order return history

This commit is contained in:
Marion Muszynski 2017-05-31 16:58:27 +02:00
parent 66dea81ece
commit b615e9eadb
3 changed files with 51 additions and 0 deletions

View File

@ -234,6 +234,16 @@ class AdminOrders extends AdminTab
)
');
$id_order_return = Db::getInstance()->Insert_ID();
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'order_return_history`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
'.(int) $id_order_return.',
2,
NOW()
)
');
foreach($return_reasons as $return_reason) {
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'order_return_detail_qty` (`id_order_return`, `id_order_detail`, `qty`, `reason`, `instruction`)

View File

@ -99,6 +99,16 @@ class AdminReturn extends AdminTab
if ($orderReturn->save())
{
$orderReturnState = new OrderReturnState($orderReturn->state);
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'order_return_history`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
'.(int) $orderReturn->id.',
'.(int) $orderReturn->state.',
NOW()
)
');
$vars = array(
'{lastname}' => $customer->lastname,
'{firstname}' => $customer->firstname,

View File

@ -110,6 +110,16 @@ class AdminAntReturnprocess extends AdminTab
if ($orderReturn->save())
{
$orderReturnState = new OrderReturnState($orderReturn->state);
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'order_return_history`
VALUES (
DEFAULT,
'.(int) $cookie->id_employee.',
'.(int) $orderReturn->id.',
'.(int) $orderReturn->state.',
NOW()
)
');
$vars = array(
'{lastname}' => $customer->lastname,
'{firstname}' => $customer->firstname,
@ -772,6 +782,15 @@ class AdminAntReturnprocess extends AdminTab
$returnProducts = OrderReturn::getOrdersReturnProducts($orderReturn->id, $order);
$orderReturnState = new OrderReturnState($orderReturn->state);
$return_history = Db::getInstance()->ExecuteS('
SELECT rh.*, orsl.`name` as state, CONCAT(e.`firstname`,\' \',e.`lastname`) as employee
FROM '._DB_PREFIX_.'order_return_history rh
LEFT JOIN '._DB_PREFIX_.'order_return_state_lang orsl ON (orsl.`id_order_return_state` = rh.`id_order_return_state` AND orsl.`id_lang` = '.(int)($cookie->id_lang).')
LEFT JOIN '._DB_PREFIX_.'employee e ON (e.`id_employee` = rh.`id_employee`)
WHERE rh.`id_order_return` = '.(int)$orderReturn->id.'
ORDER BY rh.`date_add` DESC
');
$other_returnProducts = Db::getInstance()->ExecuteS('
SELECT a.*, orsl.`name`, ord.`id_order_detail`, ord.`qty`
FROM '._DB_PREFIX_.'order_return a
@ -862,6 +881,18 @@ class AdminAntReturnprocess extends AdminTab
</table>
</div>
<div class="col-md-offset-1 col-md-4">
<p style="margin-bottom:0;">'.$this->l('Historique statut:').'</p>
<table class="table">';
foreach ($return_history as $key => $history) {
$html .= '
<tr>
<td style="font-size:11px;">'.date('d/m/Y H:i',strtotime($history['date_add'])).'</td>
<td style="font-size:11px;font-weight:bold">'.$history['state'].'</td>
<td style="font-size:11px;">'.$history['employee'].'</td>
</tr>';
}
$html .= '
</table>
<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">'.$this->l('Changer le statut du retour').'</h5>
<form style="padding:10px 20px;background:#efefef;" action="'.$currentIndex.'&submitAddorder_return=1&updateorder_return&id_order_return='.(int)$orderReturn->id.'&token='.$this->token.'" method="post">
<input type="hidden" name="id_order" value="'.$orderReturn->id_order.'" />