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 61cf4e531..a7bd55c58 100755
--- a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl
+++ b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl
@@ -45,8 +45,8 @@
{$product['customizationQuantityTotal']}
{if ($order->hasBeenPaid())}{$product['customizationQuantityRefunded']} {/if}
- {if ($order->hasBeenDelivered())}{$product['customizationQuantityReturned']} {/if}
- -
+ {if ($order->hasBeenDelivered() || $order->hasProductReturned())}{$product['customizationQuantityReturned']} {/if}
+ {if $stock_management} - {/if}
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
{displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) 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 c22b4b15f..a5fd8cac3 100755
--- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl
+++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl
@@ -88,7 +88,7 @@
{/if}
{/if}
- {$product['current_stock']}
+ {if $stock_management}{$product['current_stock']} {/if}
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
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 c844c492a..949367e56 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
@@ -39,6 +39,7 @@
var priceDisplayPrecision = 2;
var use_taxes = {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC}true{else}false{/if};
var token = "{$smarty.get.token|escape:'htmlall':'UTF-8'}";
+ var stock_management = {$stock_management|intval};
var txt_add_product_stock_issue = "{l s='You want to add more product than are available in stock, are you sure you want to add this quantity?' js=1}";
var txt_add_product_new_invoice = "{l s='Are you sure you want to create a new invoice?' js=1}";
@@ -594,7 +595,7 @@
{l s='Qty'}
{if ($order->hasBeenPaid())}{l s='Refunded'} {/if}
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}{l s='Returned'} {/if}
- {l s='Available quantity'}
+ {if $stock_management}{l s='Available quantity'} {/if}
{l s='Total'} *
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index c91102bb6..86fd2c9cc 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -1122,8 +1122,11 @@ class AdminControllerCore extends Controller
}
public function display()
{
- $this->context->smarty->assign('display_header', $this->display_header);
- $this->context->smarty->assign('display_footer', $this->display_footer);
+ $this->context->smarty->assign(array(
+ 'display_header' => $this->display_header,
+ 'display_footer' => $this->display_footer,
+ )
+ );
// Use page title from meta_title if it has been set else from the breadcrumbs array
if (!$this->meta_title)
@@ -1702,6 +1705,7 @@ class AdminControllerCore extends Controller
'table' => $this->table,
'current' => self::$currentIndex,
'token' => $this->token,
+ 'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT')
));
if ($this->display_header)
diff --git a/js/admin_order.js b/js/admin_order.js
index 8229689b5..cf6077eed 100644
--- a/js/admin_order.js
+++ b/js/admin_order.js
@@ -284,7 +284,8 @@ function closeAddProduct()
$('#add_product_product_quantity').val('1');
$('#add_product_product_attribute_id option').remove();
$('#add_product_product_attribute_area').hide();
- $('#add_product_product_stock').html('0');
+ if (stock_management)
+ $('#add_product_product_stock').html('0');
current_product = null;
}
@@ -356,7 +357,8 @@ function init()
$('#add_product_product_price_tax_incl').val(data.price_tax_incl);
$('#add_product_product_price_tax_excl').val(data.price_tax_excl);
addProductRefreshTotal();
- $('#add_product_product_stock').html(data.stock[0]);
+ if (stock_management)
+ $('#add_product_product_stock').html(data.stock[0]);
if (current_product.combinations.length !== 0)
{
@@ -367,7 +369,8 @@ function init()
$('select#add_product_product_attribute_id').append(''+this.attributes+' ');
if (this.default_on == 1)
{
- $('#add_product_product_stock').html(this.qty_in_stock);
+ if (stock_management)
+ $('#add_product_product_stock').html(this.qty_in_stock);
defaultAttribute = this.id_product_attribute;
}
});
@@ -396,24 +399,26 @@ function init()
populateWarehouseList(current_product.warehouse_list[$(this).val()]);
addProductRefreshTotal();
-
- $('#add_product_product_stock').html(current_product.combinations[$(this).val()].qty_in_stock);
+ if (stock_management)
+ $('#add_product_product_stock').html(current_product.combinations[$(this).val()].qty_in_stock);
});
$('input#add_product_product_quantity').unbind('keyup');
$('input#add_product_product_quantity').keyup(function() {
- var quantity = parseInt($(this).val());
- if (quantity < 1 || isNaN(quantity))
- quantity = 1;
- var stock_available = parseInt($('#add_product_product_stock').html());
+ if (stock_management)
+ {
+ var quantity = parseInt($(this).val());
+ if (quantity < 1 || isNaN(quantity))
+ quantity = 1;
+ var stock_available = parseInt($('#add_product_product_stock').html());
+ // stock status update
+ if (quantity > stock_available)
+ $('#add_product_product_stock').css('font-weight', 'bold').css('color', 'red').css('font-size', '1.2em');
+ else
+ $('#add_product_product_stock').css('font-weight', 'normal').css('color', 'black').css('font-size', '1em');
+ }
// total update
addProductRefreshTotal();
-
- // stock status update
- if (quantity > stock_available)
- $('#add_product_product_stock').css('font-weight', 'bold').css('color', 'red').css('font-size', '1.2em');
- else
- $('#add_product_product_stock').css('font-weight', 'normal').css('color', 'black').css('font-size', '1em');
});
$('#submitAddProduct').unbind('click');