From 577aa781bc9c33d3dc9e5ade0451d01710231b5a Mon Sep 17 00:00:00 2001 From: dSevere Date: Wed, 30 Nov 2011 16:28:06 +0000 Subject: [PATCH] // Stock Available : Add shared management for group of shops git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10812 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/group_shop/form.tpl | 30 +- .../themes/template/products/quantities.tpl | 172 ++++++----- classes/ObjectModel.php | 2 +- classes/Product.php | 16 +- classes/shop/GroupShop.php | 5 +- classes/stock/StockAvailable.php | 289 ++++++++++++++---- .../admin/AdminGroupShopController.php | 24 +- controllers/admin/AdminProductsController.php | 90 ++++-- install-dev/sql/db.sql | 2 + 9 files changed, 442 insertions(+), 188 deletions(-) diff --git a/admin-dev/themes/template/group_shop/form.tpl b/admin-dev/themes/template/group_shop/form.tpl index 3b1a56f87..7a60bb77f 100644 --- a/admin-dev/themes/template/group_shop/form.tpl +++ b/admin-dev/themes/template/group_shop/form.tpl @@ -27,14 +27,34 @@ {block name=script} + function toggleShareOrders() { + + var disabled_customer = ($('#share_customer_on').attr('checked')) ? false : true; + var disabled_stock = ($('#share_stock_on').attr('checked')) ? false : true; + + if (disabled_customer || disabled_stock) + { + $("input[name=share_order]").each(function(i) { + $(this).attr('disabled', 'disabled'); + }); + + $('#share_order_off').attr('checked', true); + } + else + { + $('input[name=share_order]').attr('disabled', ''); + } + } + $(document).ready(function() { - $('input[name=share_order]').attr('disabled', true); + toggleShareOrders(); $('input[name=share_customer]').click(function() { - var disabled = ($('input[name=share_customer]').attr('checked')) ? false : true; - $('input[name=share_order]').attr('disabled', disabled); - if (disabled) - $('#share_order_off').attr('checked', true); + toggleShareOrders(); + }); + $('input[name=share_stock]').click(function() + { + toggleShareOrders(); }); $('#useImportData').click(function() { diff --git a/admin-dev/themes/template/products/quantities.tpl b/admin-dev/themes/template/products/quantities.tpl index 37dd72454..86dd0bb6c 100644 --- a/admin-dev/themes/template/products/quantities.tpl +++ b/admin-dev/themes/template/products/quantities.tpl @@ -2,90 +2,102 @@

{l s='This interface allows you to manage the available quantities for sale of the current product and its combinations on the current shop.'}

{l s='You can manually specify the quantities for the product / each product combinations, or choose to automatically determine these quantities based on your stock.'}

-

{l s='In this case, the quantities correspond to the quantitites of the real stock in the warehouses associated to the current shop.'}

+

{l s='In this case, the quantities correspond to the quantitites of the real stock in the warehouses associated to the current shop or current group of shops.'}


-

{l s='Available quantities for sale'}

+

{l s='Available quantities for sale'}

- - - - - - - - - - - - - - - - - - -
- depends_on_stock == 1 && $stock_management_active == 1}checked="checked" {/if} {if $stock_management_active == 0}disabled="disabled" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> - -

-
- depends_on_stock == 0 || $stock_management_active == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> - -

-
- - - - - - - - - - - - - {foreach from=$attributes item=attribute} - - - - - {/foreach} - -
{l s='Quantity'}{l s='Designation'}
- {$available_quantity[$attribute['id_product_attribute']]} - - {$product_designation[$attribute['id_product_attribute']]}
-
- - - - - - - -
- out_of_stock == 0}checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock"> - -
- out_of_stock == 1} 'checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock"> - -
- out_of_stock == 2} 'checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock"> - -
-
+ {if $show_quantities == true} + + + + + + + + + + + + + + + + + + + +
+ depends_on_stock == 1 && $stock_management_active == 1}checked="checked" {/if} {if $stock_management_active == 0}disabled="disabled" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> + +

+
+ depends_on_stock == 0 || $stock_management_active == 0}checked="checked" {/if} type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> + +

+
+ + + + + + + + + + + + + {foreach from=$attributes item=attribute} + + + + + {/foreach} + +
{l s='Quantity'}{l s='Designation'}
+ {$available_quantity[$attribute['id_product_attribute']]} + + {$product_designation[$attribute['id_product_attribute']]}
+
+ + + + + + + +
+ out_of_stock == 0}checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock"> + +
+ out_of_stock == 1} 'checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock"> + +
+ out_of_stock == 2} 'checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock"> + +
+
+ {else} +
+

{l s='It is not possible to manage quantities when : '}

+ +
+ {/if}