Qual: Uniformize code and fix a regression

This commit is contained in:
Laurent Destailleur 2012-11-26 11:36:45 +01:00
parent 6c8b00b82f
commit b4ebd7e852

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -42,17 +42,16 @@
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td> <td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php <?php
$colspan = 4; $colspan = 4;
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled))
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
?> ?>
<td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td> <td align="right"><?php echo $langs->trans('BuyingPrice'); ?></td>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
$colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES))
$colspan++;
} }
?> ?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr> </tr>
<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST"> <form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
@ -63,7 +62,7 @@ if (! empty($conf->margin->enabled)) {
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery('#idprod').change(function() { jQuery('#idprod').change(function() {
jQuery('#np_desc').focus(); if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
}); });
}); });
</script> </script>
@ -97,17 +96,16 @@ jQuery(document).ready(function() {
<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td> <td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>">%</td>
<?php <?php
$colspan = 4; $colspan = 4;
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled))
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
?> ?>
<td align="right"> <td align="right">
<select id="fournprice" name="fournprice" style="display: none;"></select> <select id="fournprice" name="fournprice" style="display: none;"></select>
<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>"> <input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
</td> </td>
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
$colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES))
$colspan++;
} }
?> ?>
<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"> <td align="center" valign="middle" colspan="<?php echo $colspan; ?>">
@ -115,18 +113,17 @@ if (! empty($conf->margin->enabled)) {
</td> </td>
</tr> </tr>
<?php if (! empty($conf->service->enabled) && $dateSelector) { <?php
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->service->enabled) && $dateSelector)
$colspan = 10; {
else if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
$colspan = 9; else $colspan = 9;
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled))
$colspan++; // For the buying price {
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; // For the buying price
$colspan++; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
$colspan++; }
}
?> ?>
<tr <?php echo $bcnd[$var]; ?>> <tr <?php echo $bcnd[$var]; ?>>
<td colspan="<?php echo $colspan; ?>"> <td colspan="<?php echo $colspan; ?>">
@ -138,11 +135,15 @@ if (! empty($conf->margin->enabled)) {
?> ?>
</td> </td>
</tr> </tr>
<?php } ?> <?php
}
?>
</form> </form>
<?php <?php
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled))
{
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$("#idprod").change(function() { $("#idprod").change(function() {
@ -177,5 +178,7 @@ $("#idprod").change(function() {
'json'); 'json');
}); });
</script> </script>
<?php } ?> <?php
}
?>
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php --> <!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->