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
/* 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>
*
* 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>
<?php
$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>
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
$colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES))
$colspan++;
}
?>
<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
<?php
}
?>
</tr>
<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">
jQuery(document).ready(function() {
jQuery('#idprod').change(function() {
jQuery('#np_desc').focus();
if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
});
});
</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>
<?php
$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">
<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"]:''); ?>">
</td>
<?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; ?>">
@ -115,18 +113,17 @@ if (! empty($conf->margin->enabled)) {
</td>
</tr>
<?php if (! empty($conf->service->enabled) && $dateSelector) {
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
$colspan = 10;
else
$colspan = 9;
if (! empty($conf->margin->enabled)) {
$colspan++; // For the buying price
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
$colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES))
$colspan++;
}
<?php
if (! empty($conf->service->enabled) && $dateSelector)
{
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
else $colspan = 9;
if (! empty($conf->margin->enabled))
{
$colspan++; // For the buying price
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
}
?>
<tr <?php echo $bcnd[$var]; ?>>
<td colspan="<?php echo $colspan; ?>">
@ -138,11 +135,15 @@ if (! empty($conf->margin->enabled)) {
?>
</td>
</tr>
<?php } ?>
<?php
}
?>
</form>
<?php
if (! empty($conf->margin->enabled)) {
if (! empty($conf->margin->enabled))
{
?>
<script type="text/javascript">
$("#idprod").change(function() {
@ -177,5 +178,7 @@ $("#idprod").change(function() {
'json');
});
</script>
<?php } ?>
<?php
}
?>
<!-- END PHP TEMPLATE predefinedproductline_create.tpl.php -->