[-] BO : #PSCFV-3011 - Add details of refund and returned products on the BO order page.
This commit is contained in:
@@ -499,3 +499,31 @@ ul.listForm li {padding-bottom:3px;}
|
|||||||
.selected-line {background:#fff1b5;}
|
.selected-line {background:#fff1b5;}
|
||||||
|
|
||||||
#changedFiles ul{list-style-type: square; padding-left: 40px;}
|
#changedFiles ul{list-style-type: square; padding-left: 40px;}
|
||||||
|
|
||||||
|
.tooltip { position: relative; }
|
||||||
|
.tooltip .tooltip_content {
|
||||||
|
z-index: 100;
|
||||||
|
text-align: left;
|
||||||
|
display: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
position: absolute;
|
||||||
|
padding: 5px 5px;
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
.tooltip .tooltip_label { cursor: pointer; }
|
||||||
|
.tooltip .title { text-align: center; padding-bottom: 5px; display: block; font-weight: bold }
|
||||||
|
.tooltip:hover .tooltip_content { display: block; }
|
||||||
|
.tooltip_button {
|
||||||
|
border: 1px solid silver;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 0 3px;
|
||||||
|
background: -moz-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: -o-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: -webkit-linear-gradient(top, #ddd, #aaa);
|
||||||
|
background: linear-gradient(top, #ddd, #aaa);
|
||||||
|
color: #666
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,38 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['product_quantity_refunded']}</td>{/if}
|
{if ($order->hasBeenPaid())}
|
||||||
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['product_quantity_return']}</td>{/if}
|
<td align="center" class="productQuantity">
|
||||||
|
{$product['product_quantity_refunded']}
|
||||||
|
{if count($product['refund_history'])}
|
||||||
|
<span class="tooltip">
|
||||||
|
<span class="tooltip_label tooltip_button">+</span>
|
||||||
|
<div class="tooltip_content">
|
||||||
|
<span class="title">{l s='Refund history'}</span>
|
||||||
|
{foreach $product['refund_history'] as $refund}
|
||||||
|
{l s='%1s - %2s' sprintf=[{dateFormat date=$refund.date_add}, {displayPrice price=$refund.amount_tax_incl}]}<br />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
|
{if $order->hasBeenDelivered() || $order->hasProductReturned()}
|
||||||
|
<td align="center" class="productQuantity">
|
||||||
|
{$product['product_quantity_return']}
|
||||||
|
{if count($product['return_history'])}
|
||||||
|
<span class="tooltip">
|
||||||
|
<span class="tooltip_label tooltip_button">+</span>
|
||||||
|
<div class="tooltip_content">
|
||||||
|
<span class="title">{l s='Return history'}</span>
|
||||||
|
{foreach $product['return_history'] as $return}
|
||||||
|
{l s='%1s - %2s - %3s' sprintf=[{dateFormat date=$return.date_add}, $return.product_quantity, $return.state]}<br />
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
{/if}
|
||||||
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
||||||
<td align="center" class="total_product">
|
<td align="center" class="total_product">
|
||||||
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
||||||
|
|||||||
@@ -590,7 +590,7 @@
|
|||||||
<th style="width: 15%; text-align: center">{l s='Unit Price'} <sup>*</sup></th>
|
<th style="width: 15%; text-align: center">{l s='Unit Price'} <sup>*</sup></th>
|
||||||
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
||||||
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
||||||
{if ($order->hasBeenDelivered())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
||||||
<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>
|
<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>
|
||||||
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
|
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
|
||||||
<th colspan="2" style="display: none;" class="add_product_fields"> </th>
|
<th colspan="2" style="display: none;" class="add_product_fields"> </th>
|
||||||
|
|||||||
@@ -755,6 +755,21 @@ class OrderCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
return count($this->getHistory((int)($this->id_lang), false, false, OrderState::FLAG_DELIVERY));
|
return count($this->getHistory((int)($this->id_lang), false, false, OrderState::FLAG_DELIVERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has products returned by the merchant or by the customer?
|
||||||
|
*/
|
||||||
|
public function hasProductReturned()
|
||||||
|
{
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
|
||||||
|
SELECT IFNULL(SUM(ord.product_quantity), SUM(product_quantity_return))
|
||||||
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
|
INNER JOIN `'._DB_PREFIX_.'order_detail` od
|
||||||
|
ON od.id_order = o.id_order
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord
|
||||||
|
ON ord.id_order_detail = od.id_order_detail
|
||||||
|
WHERE o.id_order = '.(int)$this->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function hasBeenPaid()
|
public function hasBeenPaid()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -199,5 +199,22 @@ class OrderReturnCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_return_detail` WHERE `id_order_detail` = '.(int)($id_order_detail).' AND `id_order_return` = '.(int)($id_order_return).' AND `id_customization` = '.(int)($id_customization));
|
return Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_return_detail` WHERE `id_order_detail` = '.(int)($id_order_detail).' AND `id_order_return` = '.(int)($id_order_return).' AND `id_customization` = '.(int)($id_customization));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get return details for one product line
|
||||||
|
* @param $id_order_detail
|
||||||
|
*/
|
||||||
|
public static function getProductReturnDetail($id_order_detail)
|
||||||
|
{
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
|
SELECT product_quantity, date_add, orsl.name as state
|
||||||
|
FROM `'._DB_PREFIX_.'order_return_detail` ord
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'order_return` o
|
||||||
|
ON o.id_order_return = ord.id_order_return
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'order_return_state_lang` orsl
|
||||||
|
ON orsl.id_order_return_state = o.state AND orsl.id_lang = '.(int)Context::getContext()->language->id.'
|
||||||
|
WHERE ord.`id_order_detail` = '.(int)$id_order_detail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class OrderSlipCore extends ObjectModel
|
|||||||
ORDER BY `date_add` DESC');
|
ORDER BY `date_add` DESC');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getOrdersSlipDetail($id_order_slip = true, $id_order_detail = false)
|
public static function getOrdersSlipDetail($id_order_slip = false, $id_order_detail = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
|
||||||
($id_order_detail ? 'SELECT SUM(`product_quantity`) AS `total`' : 'SELECT *').
|
($id_order_detail ? 'SELECT SUM(`product_quantity`) AS `total`' : 'SELECT *').
|
||||||
@@ -141,7 +141,12 @@ class OrderSlipCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
return $order->getProducts($resTab);
|
return $order->getProducts($resTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get resume of all refund for one product line
|
||||||
|
* @param $id_order_detail
|
||||||
|
*/
|
||||||
public static function getProductSlipResume($id_order_detail)
|
public static function getProductSlipResume($id_order_detail)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
@@ -149,6 +154,21 @@ class OrderSlipCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'order_slip_detail`
|
FROM `'._DB_PREFIX_.'order_slip_detail`
|
||||||
WHERE `id_order_detail` = '.(int)$id_order_detail);
|
WHERE `id_order_detail` = '.(int)$id_order_detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Get refund details for one product line
|
||||||
|
* @param $id_order_detail
|
||||||
|
*/
|
||||||
|
public static function getProductSlipDetail($id_order_detail)
|
||||||
|
{
|
||||||
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
|
SELECT product_quantity, amount_tax_excl, amount_tax_incl, date_add
|
||||||
|
FROM `'._DB_PREFIX_.'order_slip_detail` osd
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'order_slip` os
|
||||||
|
ON os.id_order_slip = osd.id_order_slip
|
||||||
|
WHERE osd.`id_order_detail` = '.(int)$id_order_detail);
|
||||||
|
}
|
||||||
|
|
||||||
public function getProducts()
|
public function getProducts()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1251,6 +1251,8 @@ class AdminOrdersControllerCore extends AdminController
|
|||||||
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
|
$product['quantity_refundable'] = $product['product_quantity'] - $resume['product_quantity'];
|
||||||
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
|
$product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl'];
|
||||||
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
|
$product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']);
|
||||||
|
$product['refund_history'] = OrderSlip::getProductSlipDetail($product['id_order_detail']);
|
||||||
|
$product['return_history'] = OrderReturn::getProductReturnDetail($product['id_order_detail']);
|
||||||
|
|
||||||
// if the current stock requires a warning
|
// if the current stock requires a warning
|
||||||
if ($product['current_stock'] == 0 && $display_out_of_stock_warning)
|
if ($product['current_stock'] == 0 && $display_out_of_stock_warning)
|
||||||
|
|||||||
Reference in New Issue
Block a user