[-] BO : #PSCFV-3011 - Add details of refund and returned products on the BO order page.
This commit is contained in:
@@ -755,6 +755,21 @@ class OrderCore extends ObjectModel
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 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');
|
||||
}
|
||||
|
||||
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(
|
||||
($id_order_detail ? 'SELECT SUM(`product_quantity`) AS `total`' : 'SELECT *').
|
||||
@@ -141,7 +141,12 @@ class OrderSlipCore extends ObjectModel
|
||||
}
|
||||
return $order->getProducts($resTab);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Get resume of all refund for one product line
|
||||
* @param $id_order_detail
|
||||
*/
|
||||
public static function getProductSlipResume($id_order_detail)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
@@ -149,6 +154,21 @@ class OrderSlipCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'order_slip_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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user