From 417a1232eff0841e560c65f83df9ca90b40f60aa Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 11 Apr 2014 18:00:58 +0200
Subject: [PATCH] Uniformize usage of function price

---
 htdocs/compta/dons/index.php          |  4 ++--
 htdocs/compta/tva/quadri_detail.php   |  8 ++++----
 htdocs/core/class/html.form.class.php |  8 ++++----
 htdocs/product/stock/fiche.php        |  4 ++--
 htdocs/product/stock/product.php      | 10 +++++-----
 htdocs/product/stock/valo.php         |  4 ++--
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php
index bc258dec541..bc21b31a37c 100644
--- a/htdocs/compta/dons/index.php
+++ b/htdocs/compta/dons/index.php
@@ -181,8 +181,8 @@ if ($resql)
 
             print '<td class="nobordernopadding">';
             print $obj->societe;
-            print ($obj->societe && $obj->nom?' / ':'');
-            print dolGetFirstLastname($obj->nom,$obj->firstname);
+            print ($obj->societe && ($obj->lastname || $obj->firstname)?' / ':'');
+            print dolGetFirstLastname($obj->lastname,$obj->firstname);
             print '</td>';
 
             print '<td align="right" class="nobordernopadding">';
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index b39befd8ad6..82585b191ac 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -425,14 +425,14 @@ else
 				print '<td class="nowrap" align="right">';
 				$temp_ht=$fields['totalht'];
 				if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
-				print price(price2num($temp_ht,'MT'));
+				print price(price2num($temp_ht,'MT'),1);
 				print '</td>';
 
 				// VAT
 				print '<td class="nowrap" align="right">';
 				$temp_vat=$fields['vat'];
 				if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
-				print price(price2num($temp_vat,'MT'));
+				print price(price2num($temp_vat,'MT'),1);
 				//print price($fields['vat']);
 				print '</td>';
 				print '</tr>';
@@ -576,14 +576,14 @@ else
 				print '<td class="nowrap" align="right">';
 				$temp_ht=$fields['totalht'];
 				if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
-				print price(price2num($temp_ht,'MT'));
+				print price(price2num($temp_ht,'MT'),1);
 				print '</td>';
 
 				// VAT
 				print '<td class="nowrap" align="right">';
 				$temp_vat=$fields['vat'];
 				if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
-				print price(price2num($temp_vat,'MT'));
+				print price(price2num($temp_vat,'MT'),1);
 				//print price($fields['vat']);
 				print '</td>';
 				print '</tr>';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4d082960d5d..9f2d7bea180 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1625,13 +1625,13 @@ class Form
 
 				if ($objp->custprice_base_type == 'HT')
 				{
-					$opt.= price($objp->custprice,1).' '.$currencytext.' '.$langs->trans("HT");
-					$outval.= price($objp->custprice,1).' '.$currencytextnoent.' '.$langs->transnoentities("HT");
+					$opt.= price($objp->custprice,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
+					$outval.= price($objp->custprice,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
 				}
 				else
 				{
-					$opt.= price($objp->custprice_ttc,1).' '.$currencytext.' '.$langs->trans("TTC");
-					$outval.= price($objp->custprice_ttc,1).' '.$currencytextnoent.' '.$langs->transnoentities("TTC");
+					$opt.= price($objp->custprice_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
+					$outval.= price($objp->custprice_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
 				}
 
 				$outprice_ht=price($objp->custprice);
diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php
index c87b3a06585..6949d29cf8e 100644
--- a/htdocs/product/stock/fiche.php
+++ b/htdocs/product/stock/fiche.php
@@ -443,11 +443,11 @@ else
                     {
                         $pricemin=$objp->price;
                         print '<td align="right">';
-                        print price(price2num($pricemin,'MU'));
+                        print price(price2num($pricemin,'MU'),1);
                         print '</td>';
                         // Total sell min
                         print '<td align="right">';
-                        print price(price2num($pricemin*$objp->value,'MT'));
+                        print price(price2num($pricemin*$objp->value,'MT'),1);
                         print '</td>';
                     }
                     $totalvaluesell+=price2num($pricemin*$objp->value,'MT');
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 1fd34c65c2d..d8f1418bb29 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -627,11 +627,11 @@ if ($resql)
 		print '<td align="right">'.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').'</td>'; // Ditto : Show PMP from movement or from product
         // Sell price
 		print '<td align="right">';
-        if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'));
+        if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1);
         else print $langs->trans("Variable");
         print '</td>'; // Ditto : Show PMP from movement or from product
         print '<td align="right">';
-        if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT')).'</td>'; // Ditto : Show PMP from movement or from product
+        if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'</td>'; // Ditto : Show PMP from movement or from product
         else print $langs->trans("Variable");
 		print '</tr>'; ;
 		$total += $obj->reel;
@@ -661,14 +661,14 @@ print '<td class="liste_total" align="right">';
 print ($totalwithpmp?price($totalvalue/$totalwithpmp):'&nbsp;');
 print '</td>';
 print '<td class="liste_total" align="right">';
-print price(price2num($totalvalue,'MT'));
+print price(price2num($totalvalue,'MT'),1);
 print '</td>';
 print '<td class="liste_total" align="right">';
-if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total):'&nbsp;');
+if (empty($conf->global->PRODUIT_MULTI_PRICES)) print ($total?price($totalvaluesell/$total,1):'&nbsp;');
 else print $langs->trans("Variable");
 print '</td>';
 print '<td class="liste_total" align="right">';
-if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($totalvaluesell,'MT'));
+if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($totalvaluesell,'MT'),1);
 else print $langs->trans("Variable");
 print '</td>';
 print "</tr>";
diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php
index e7d782ae5e0..e2899e4e465 100644
--- a/htdocs/product/stock/valo.php
+++ b/htdocs/product/stock/valo.php
@@ -108,12 +108,12 @@ if ($result)
             print '<td>'.$objp->lieu.'</td>';
             // PMP value
             print '<td align="right">';
-            if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'));
+            if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1);
             else print '';
             print '</td>';
             // Selling value
             print '<td align="right">';
-            if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue,'MT'));
+            if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue,'MT'),1);
             else print $langs->trans("Variable");
             print '</td>';
             // Status
-- 
GitLab