[-] BO : Fix #PSCFV-5223 add product should be available when the package is not shipped

This commit is contained in:
rGaillard
2012-10-29 14:40:13 +00:00
parent ff0778a54b
commit eb78200029
+5 -3
View File
@@ -1474,14 +1474,14 @@ class AdminOrdersControllerCore extends AdminController
public function ajaxProcessAddProductOnOrder() public function ajaxProcessAddProductOnOrder()
{ {
// Load object // Load object
$order = new Order(Tools::getValue('id_order')); $order = new Order((int)Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order)) if (!Validate::isLoadedObject($order))
die(Tools::jsonEncode(array( die(Tools::jsonEncode(array(
'result' => false, 'result' => false,
'error' => Tools::displayError('Can\'t load Order object') 'error' => Tools::displayError('Can\'t load Order object')
))); )));
if ($order->hasBeenDelivered()) if ($order->hasBeenShipped())
die(Tools::jsonEncode(array( die(Tools::jsonEncode(array(
'result' => false, 'result' => false,
'error' => Tools::displayError('Can\'t add a product on delivered order') 'error' => Tools::displayError('Can\'t add a product on delivered order')
@@ -1702,10 +1702,12 @@ class AdminOrdersControllerCore extends AdminController
// Get the last product // Get the last product
$product = end($products); $product = end($products);
$resume = OrderSlip::getProductSlipResume($product['id_order_detail']); $resume = OrderSlip::getProductSlipResume((int)$product['id_order_detail']);
$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['return_history'] = OrderReturn::getProductReturnDetail((int)$product['id_order_detail']);
$product['refund_history'] = OrderSlip::getProductSlipDetail((int)$product['id_order_detail']);
// Get invoices collection // Get invoices collection
$invoice_collection = $order->getInvoicesCollection(); $invoice_collection = $order->getInvoicesCollection();