From f8e9a38e5cecddc7ebef63cc66a4cdc731592681 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Feb 2015 19:37:44 +0100 Subject: [PATCH] Fix: Avoid empty table into setup when module are missing. --- htdocs/admin/stock.php | 131 +++++++++++++++++++++------------- htdocs/langs/en_US/admin.lang | 2 + 2 files changed, 82 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 6b2c626da39..87ed5fe64c6 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -136,6 +136,8 @@ print "  \n"; print ''."\n"; $var=true; +$found=0; + if (! empty($conf->facture->enabled)) { $var=!$var; @@ -148,6 +150,7 @@ if (! empty($conf->facture->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->commande->enabled)) @@ -162,6 +165,7 @@ if (! empty($conf->commande->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->expedition->enabled)) @@ -176,7 +180,17 @@ if (! empty($conf->expedition->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); print ''; print "\n\n\n"; + $found++; } + +if (! $found) +{ + $var=!$var; + print ""; + print ''.$langs->trans("NoModueToManageStockDecrease").''; + print "\n"; +} + print ''; print '
'; @@ -189,6 +203,8 @@ print "  \n"; print ''."\n"; $var=true; +$found=0; + if (! empty($conf->fournisseur->enabled)) { $var=!$var; @@ -201,6 +217,7 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->fournisseur->enabled)) @@ -215,6 +232,7 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->fournisseur->enabled)) { @@ -228,65 +246,76 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; +} + +if (! $found) +{ + $var=!$var; + print ""; + print ''.$langs->trans("NoModueToManageStockIncrease").''; + print "\n"; } print ''; // Optio to force stock to be enough before adding a line into document -print '
'; -print ''; -print ''; -print " \n"; -print " \n"; -print ''."\n"; +if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled) +{ + print '
'; + print '
".$langs->trans("RuleForStockAvailability")." 
'; + print ''; + print " \n"; + print " \n"; + print ''."\n"; -if($conf->invoice->enabled) { - $var = !$var; - print ""; - print ''; - print '\n"; - print "\n"; + if($conf->invoice->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + + if($conf->order->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + + if($conf->expedition->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + print '
".$langs->trans("RuleForStockAvailability")." 
'.$langs->trans("StockMustBeEnoughForInvoice").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); - print ''; - print '
'; - print "
'.$langs->trans("StockMustBeEnoughForInvoice").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); + print ''; + print '
'; + print "
'.$langs->trans("StockMustBeEnoughForOrder").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); + print ''; + print '
'; + print "
'.$langs->trans("StockMustBeEnoughForShipment").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); + print ''; + print '
'; + print "
'; } -if($conf->order->enabled) { - $var = !$var; - print ""; - print ''.$langs->trans("StockMustBeEnoughForOrder").''; - print ''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); - print ''; - print '
'; - print "\n"; - print "\n"; -} - -if($conf->expedition->enabled) { - $var = !$var; - print ""; - print ''.$langs->trans("StockMustBeEnoughForShipment").''; - print ''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); - print ''; - print '
'; - print "\n"; - print "\n"; -} -print ''; - - $virtualdiffersfromphysical=0; if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8768983ce73..e39486e242a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1560,3 +1560,5 @@ SortOrder=Sort order Format=Format TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type IncludePath=Include path (defined into variable %s) +NoModueToManageStockDecrease=No module able to manage automatic stock decrease has been activated. Stock decrease will be done on manual input only. +NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only.