Fix: En modif un prix est affich tel quel et jamais tronqu.

This commit is contained in:
Laurent Destailleur
2007-04-11 01:33:25 +00:00
parent 07dc449578
commit 9e34dca725
4 changed files with 11 additions and 10 deletions

View File

@@ -1278,7 +1278,7 @@ if ($_GET['propalid'] > 0)
else else
print $html->select_tva("tva_tx",$objp->tva_tx,$mysoc,$societe); print $html->select_tva("tva_tx",$objp->tva_tx,$mysoc,$societe);
print '</td>'; print '</td>';
print '<td align="right"><input size="6" type="text" class="flat" name="subprice" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="6" type="text" class="flat" name="subprice" value="'.price($objp->subprice,0,'',0).'"></td>';
print '<td align="right">'; print '<td align="right">';
if (($objp->info_bits & 2) != 2) if (($objp->info_bits & 2) != 2)
{ {

View File

@@ -1441,7 +1441,7 @@ else
else else
print $html->select_tva('tva_tx',$objp->tva_tx,$mysoc,$soc); print $html->select_tva('tva_tx',$objp->tva_tx,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input size="5" type="text" class="flat" name="pu" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="5" type="text" class="flat" name="pu" value="'.price($objp->subprice,0,'',0).'"></td>';
print '<td align="right">'; print '<td align="right">';
if (($objp->info_bits & 2) != 2) if (($objp->info_bits & 2) != 2)
{ {

View File

@@ -2389,7 +2389,7 @@ else
else else
print $html->select_tva('tva_tx',$objp->tva_taux,$mysoc,$soc); print $html->select_tva('tva_tx',$objp->tva_taux,$mysoc,$soc);
print '</td>'; print '</td>';
print '<td align="right"><input size="6" type="text" class="flat" name="price" value="'.price($objp->subprice).'"></td>'; print '<td align="right"><input size="6" type="text" class="flat" name="price" value="'.price($objp->subprice,0,'',0).'"></td>';
print '<td align="right">'; print '<td align="right">';
if (($objp->info_bits & 2) != 2) if (($objp->info_bits & 2) != 2)
{ {

View File

@@ -1824,10 +1824,11 @@ function print_fleche_navigation($page,$file,$options='',$nextpage)
* \param amount Montant a formater * \param amount Montant a formater
* \param html Formatage html ou pas (0 par defaut) * \param html Formatage html ou pas (0 par defaut)
* \param outlangs Objet langs pour formatage * \param outlangs Objet langs pour formatage
* \param trunc 1=Tronque affichage si trop de d<>cimales
* \return string Chaine avec montant format<61> * \return string Chaine avec montant format<61>
* \seealso price2num Fonction inverse de price * \seealso price2num Fonction inverse de price
*/ */
function price($amount, $html=0, $outlangs='') function price($amount, $html=0, $outlangs='', $trunc=1)
{ {
global $langs,$conf; global $langs,$conf;
@@ -1849,25 +1850,25 @@ function price($amount, $html=0, $outlangs='')
//print $datas[1]."<br>"; //print $datas[1]."<br>";
// On pose par defaut 2 decimales // On pose par defaut 2 decimales
$decimal = 2; $nbdecimal = 2;
$end=''; $end='';
// On augmente au besoin si il y a plus de 2 d<>cimales // On augmente au besoin si il y a plus de 2 d<>cimales
if (strlen($decpart) > $decimal) $decimal=strlen($decpart); if (strlen($decpart) > $nbdecimal) $nbdecimal=strlen($decpart);
// Si on depasse max // Si on depasse max
if ($decimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN) if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN)
{ {
$decimal=$conf->global->MAIN_MAX_DECIMALS_SHOWN; $nbdecimal=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
$end='...'; $end='...';
} }
// Formate nombre // Formate nombre
if ($html) if ($html)
{ {
$output=ereg_replace(' ','&nbsp;',number_format($amount, $decimal, $dec, $thousand)); $output=ereg_replace(' ','&nbsp;',number_format($amount, $nbdecimal, $dec, $thousand));
} }
else else
{ {
$output=number_format($amount, $decimal, $dec, $thousand); $output=number_format($amount, $nbdecimal, $dec, $thousand);
} }
$output.=$end; $output.=$end;