Fix: Avoid empty table into setup when module are missing.

This commit is contained in:
Laurent Destailleur 2015-02-28 19:37:44 +01:00
parent 7baaf18ad1
commit f8e9a38e5c
2 changed files with 82 additions and 51 deletions

View File

@ -136,6 +136,8 @@ print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;
$found=0;
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
$var=!$var; $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 $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->commande->enabled)) 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 $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->expedition->enabled)) 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 $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! $found)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockDecrease").'</td>';
print "</tr>\n";
}
print '</table>'; print '</table>';
print '<br>'; print '<br>';
@ -189,6 +203,8 @@ print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n"; print '</tr>'."\n";
$var=true; $var=true;
$found=0;
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
$var=!$var; $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 $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->fournisseur->enabled)) 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 $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
} }
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
@ -228,11 +246,22 @@ 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 $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
print "</form>\n</td>\n</tr>\n"; print "</form>\n</td>\n</tr>\n";
$found++;
}
if (! $found)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td colspan="2">'.$langs->trans("NoModueToManageStockIncrease").'</td>';
print "</tr>\n";
} }
print '</table>'; print '</table>';
// Optio to force stock to be enough before adding a line into document // Optio to force stock to be enough before adding a line into document
if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled)
{
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -285,7 +314,7 @@ if($conf->expedition->enabled) {
print "</tr>\n"; print "</tr>\n";
} }
print '</table>'; print '</table>';
}
$virtualdiffersfromphysical=0; $virtualdiffersfromphysical=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)

View File

@ -1560,3 +1560,5 @@ SortOrder=Sort order
Format=Format Format=Format
TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type
IncludePath=Include path (defined into variable %s) 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.