From 24ac8582bf6084c30d538cad6a26a84eb1c8b1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 14 Aug 2013 15:02:30 +0200 Subject: [PATCH] [*] BO: Warehouse name is now displayed on each product line orders --- .../controllers/orders/_customized_data.tpl | 2 ++ .../controllers/orders/_new_product.tpl | 1 + .../controllers/orders/_product_line.tpl | 1 + .../controllers/orders/helpers/view/view.tpl | 1 + controllers/admin/AdminOrdersController.php | 31 +++++++++++++++++-- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl index 7e5b10b7e..7740fcdce 100755 --- a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl @@ -45,6 +45,7 @@ {/if} {$product['customizationQuantityTotal']} + {if $display_warehouse} {/if} {if ($order->hasBeenPaid())}{$product['customizationQuantityRefunded']}{/if} {if ($order->hasBeenDelivered() || $order->hasProductReturned())}{$product['customizationQuantityReturned']}{/if} {if $stock_management} - {/if} @@ -103,6 +104,7 @@ {/if} + {if $display_warehouse} {/if} {if ($order->hasBeenPaid())}{$customization['quantity_refunded']}{/if} {if ($order->hasBeenDelivered())}{$customization['quantity_returned']}{/if} diff --git a/admin-dev/themes/default/template/controllers/orders/_new_product.tpl b/admin-dev/themes/default/template/controllers/orders/_new_product.tpl index 44027fb81..381be5cdc 100644 --- a/admin-dev/themes/default/template/controllers/orders/_new_product.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_new_product.tpl @@ -40,6 +40,7 @@ {if ($order->hasBeenPaid())} {/if} + {if $display_warehouse} {/if} {if ($order->hasBeenDelivered())} {/if} 0 {displayPrice price=0 currency=$currency->id} diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl index f16827cc4..64b16cc61 100755 --- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl @@ -56,6 +56,7 @@ {/if} + {if $display_warehouse}{$product.warehouse_name|escape:'htmlall':'UTF-8'}{/if} {if ($order->hasBeenPaid())} {$product['product_quantity_refunded']} diff --git a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl index 6c484a558..ef8cc81c5 100755 --- a/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -592,6 +592,7 @@ {l s='Product'} {l s='Unit Price'} * {l s='Qty'} + {if $display_warehouse}{l s='Warehouse'}{/if} {if ($order->hasBeenPaid())}{l s='Refunded'}{/if} {if ($order->hasBeenDelivered() || $order->hasProductReturned())}{l s='Returned'}{/if} {if $stock_management}{l s='Available quantity'}{/if} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9858efccf..0b9557f64 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -1332,6 +1332,13 @@ class AdminOrdersControllerCore extends AdminController // if the current stock requires a warning if ($product['current_stock'] == 0 && $display_out_of_stock_warning) $this->displayWarning($this->l('This product is out of stock: ').' '.$product['product_name']); + if ($product['id_warehouse'] != 0) + { + $warehouse = new Warehouse((int)$product['id_warehouse']); + $product['warehouse_name'] = $warehouse->name; + } + else + $product['warehouse_name'] = '--'; } // Smarty assign @@ -1374,7 +1381,8 @@ class AdminOrdersControllerCore extends AdminController 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, - 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop) + 'invoice_management_active' => Configuration::get('PS_INVOICE', null, null, $order->id_shop), + 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') ); return parent::renderView(); @@ -1737,6 +1745,13 @@ class AdminOrdersControllerCore extends AdminController $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']); + if ($product['id_warehouse'] != 0) + { + $warehouse = new Warehouse((int)$product['id_warehouse']); + $product['warehouse_name'] = $warehouse->name; + } + else + $product['warehouse_name'] = '--'; // Get invoices collection $invoice_collection = $order->getInvoicesCollection(); @@ -1757,7 +1772,8 @@ class AdminOrdersControllerCore extends AdminController 'invoices_collection' => $invoice_collection, 'current_id_lang' => Context::getContext()->language->id, 'link' => Context::getContext()->link, - 'current_index' => self::$currentIndex + 'current_index' => self::$currentIndex, + 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') )); $this->sendChangedNotification($order); @@ -1952,6 +1968,14 @@ class AdminOrdersControllerCore extends AdminController $product['amount_refundable'] = $product['total_price_tax_incl'] - $resume['amount_tax_incl']; $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl']); $product['refund_history'] = OrderSlip::getProductSlipDetail($order_detail->id); + if ($product['id_warehouse'] != 0) + { + $warehouse = new Warehouse((int)$product['id_warehouse']); + $product['warehouse_name'] = $warehouse->name; + } + else + $product['warehouse_name'] = '--'; + // Get invoices collection $invoice_collection = $order->getInvoicesCollection(); @@ -1971,7 +1995,8 @@ class AdminOrdersControllerCore extends AdminController 'invoices_collection' => $invoice_collection, 'current_id_lang' => Context::getContext()->language->id, 'link' => Context::getContext()->link, - 'current_index' => self::$currentIndex + 'current_index' => self::$currentIndex, + 'display_warehouse' => (int)Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') )); if (!$res)