diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index c646f9980f307c02f347a3170a03d465094b7912..6e039b688cbc5cab4a07af430fcee00866b70796 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -41,17 +41,17 @@
 
 class Form
 {
-  var $db;
-  var $error;
+	var $db;
+	var $error;
     
-  var $cache_types_paiements_code=array();
-  var $cache_types_paiements_libelle=array();
-  var $cache_conditions_paiements_code=array();
-  var $cache_conditions_paiements_libelle=array();
+	// Cache arrays
+	var $cache_types_paiements=array();
+	var $cache_conditions_paiements=array();
 
-  var $tva_taux_value;
-  var $tva_taux_libelle;
-  
+	var $tva_taux_value;
+	var $tva_taux_libelle;
+
+	
   /**
      \brief     Constructeur
      \param     DB      handler d'acc�s base de donn�e
@@ -1285,7 +1285,7 @@ class Form
     {
         global $langs;
 
-        if (sizeof($this->cache_conditions_paiements_code)) return 0;    // Cache d�ja charg�
+        if (sizeof($this->cache_conditions_paiements)) return 0;    // Cache d�ja charg�
 
         dolibarr_syslog('Form::load_cache_conditions_paiements',LOG_DEBUG);
 
@@ -1296,7 +1296,7 @@ class Form
         $resql = $this->db->query($sql);
         if ($resql)
         {
-            $num = $this->db->num_rows($result);
+            $num = $this->db->num_rows($resql);
             $i = 0;
             while ($i < $num)
             {
@@ -1304,8 +1304,8 @@ class Form
 
                 // Si traduction existe, on l'utilise, sinon on prend le libell� par d�faut
                 $libelle=($langs->trans("PaymentConditionShort".$obj->code)!=("PaymentConditionShort".$obj->code)?$langs->trans("PaymentConditionShort".$obj->code):($obj->libelle!='-'?$obj->libelle:''));
-                $this->cache_conditions_paiements_code[$obj->rowid]=$obj->code;
-                $this->cache_conditions_paiements_libelle[$obj->rowid]=$libelle;
+                $this->cache_conditions_paiements[$obj->rowid]['code'] =$obj->code;
+                $this->cache_conditions_paiements[$obj->rowid]['label']=$libelle;
                 $i++;
             }
             return 1;
@@ -1324,7 +1324,7 @@ class Form
     {
         global $langs;
 
-        if (sizeof($this->cache_types_paiements_code)) return 0;    // Cache d�ja charg�
+        if (sizeof($this->cache_types_paiements)) return 0;    // Cache d�ja charg�
 
         dolibarr_syslog('Form::load_cache_types_paiements',LOG_DEBUG);
 
@@ -1335,7 +1335,7 @@ class Form
         $resql = $this->db->query($sql);
         if ($resql)
         {
-            $num = $this->db->num_rows($result);
+            $num = $this->db->num_rows($resql);
             $i = 0;
             while ($i < $num)
             {
@@ -1343,9 +1343,9 @@ class Form
 
                 // Si traduction existe, on l'utilise, sinon on prend le libell� par d�faut
                 $libelle=($langs->trans("PaymentTypeShort".$obj->code)!=("PaymentTypeShort".$obj->code)?$langs->trans("PaymentTypeShort".$obj->code):($obj->libelle!='-'?$obj->libelle:''));
-                $this->cache_types_paiements_code[$obj->id]=$obj->code;
-                $this->cache_types_paiements_libelle[$obj->id]=$libelle;
-                $this->cache_types_paiements_type[$obj->id]=$obj->type;
+                $this->cache_types_paiements[$obj->id]['code'] =$obj->code;
+                $this->cache_types_paiements[$obj->id]['label']=$libelle;
+                $this->cache_types_paiements[$obj->id]['type'] =$obj->type;
                 $i++;
             }
             return $num;
@@ -1373,7 +1373,7 @@ class Form
  
         print '<select class="flat" name="'.$htmlname.'">';
 		if ($addempty) print '<option value="0">&nbsp;</option>';
-        foreach($this->cache_conditions_paiements_code as $id => $code)
+        foreach($this->cache_conditions_paiements as $id => $arrayconditions)
         {
             if ($selected == $id)
             {
@@ -1383,40 +1383,13 @@ class Form
             {
                 print '<option value="'.$id.'">';
             }
-            print $this->cache_conditions_paiements_libelle[$id];
-            print '</option>';
-        }
-        print '</select>';
-    }
-    
-    /**
-     *      \brief      Selection HT ou TTC
-     *      \param      selected        Id pr�-s�lectionn�
-     *      \param      htmlname        Nom de la zone select
-     */
-    function select_PriceBaseType($selected='',$htmlname='price_base_type')
-    {
-        global $langs;
-        print '<select class="flat" name="'.$htmlname.'">';
-		$options = array(
-					'HT'=>$langs->trans("HT"),
-					'TTC'=>$langs->trans("TTC")
-					);
-        foreach($options as $id => $value)
-        {
-            if ($selected == $id)
-            {
-                print '<option value="'.$id.'" selected="true">'.$value;
-            }
-            else
-            {
-                print '<option value="'.$id.'">'.$value;
-            }
+            print $arrayconditions['label'];
             print '</option>';
         }
         print '</select>';
     }
     
+
     /**
      *      \brief      Retourne la liste des modes de paiements possibles
      *      \param      selected        Id du mode de paiement pr�-s�lectionn�
@@ -1440,26 +1413,55 @@ class Form
 
         print '<select class="flat" name="'.$htmlname.'">';
 		if ($empty) print '<option value="">&nbsp;</option>';
-        foreach($this->cache_types_paiements_code as $id => $code)
+        foreach($this->cache_types_paiements as $id => $arraytypes)
         {
             // On passe si on a demand� de filtrer sur des modes de paiments particuliers
-            if (sizeof($filterarray) && ! in_array($this->cache_types_paiements_type[$id],$filterarray)) continue;
+            if (sizeof($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue;
 
             if ($format == 0) print '<option value="'.$id.'"';
-            if ($format == 1) print '<option value="'.$code.'"';
-            if ($format == 2) print '<option value="'.$code.'"';
+            if ($format == 1) print '<option value="'.$arraytypes['code'].'"';
+            if ($format == 2) print '<option value="'.$arraytypes['code'].'"';
             // Si selected est text, on compare avec code, sinon avec id
-            if (eregi('[a-z]', $selected) && $selected == $code) print ' selected="true"';
+            if (eregi('[a-z]', $selected) && $selected == $arraytypes['code']) print ' selected="true"';
             elseif ($selected == $id) print ' selected="true"';
             print '>';
-            if ($format == 0) $value=$this->cache_types_paiements_libelle[$id];
-            if ($format == 1) $value=$code;
-            if ($format == 2) $value=$this->cache_types_paiements_libelle[$id];
+            if ($format == 0) $value=$arraytypes['label'];
+            if ($format == 1) $value=$arraytypes['code'];
+            if ($format == 2) $value=$arraytypes['label'];
             print $value?$value:'&nbsp;';
             print '</option>';
         }
         print '</select>';
     }
+
+    /**
+     *      \brief      Selection HT ou TTC
+     *      \param      selected        Id pr�-s�lectionn�
+     *      \param      htmlname        Nom de la zone select
+     */
+    function select_PriceBaseType($selected='',$htmlname='price_base_type')
+    {
+        global $langs;
+        print '<select class="flat" name="'.$htmlname.'">';
+		$options = array(
+					'HT'=>$langs->trans("HT"),
+					'TTC'=>$langs->trans("TTC")
+					);
+        foreach($options as $id => $value)
+        {
+            if ($selected == $id)
+            {
+                print '<option value="'.$id.'" selected="true">'.$value;
+            }
+            else
+            {
+                print '<option value="'.$id.'">'.$value;
+            }
+            print '</option>';
+        }
+        print '</select>';
+    }
+    
     /**
      *    \brief      Retourne la liste d�roulante des diff�rents �tats d'une propal.
      *                Les valeurs de la liste sont les id de la table c_propalst
@@ -1904,7 +1906,7 @@ class Form
             if ($selected)
             {
                 $this->load_cache_conditions_paiements();
-                print $this->cache_conditions_paiements_libelle[$selected];
+                print $this->cache_conditions_paiements[$selected]['label'];
             } else {
                 print "&nbsp;";
             }
@@ -1969,7 +1971,7 @@ class Form
             if ($selected)
             {
                 $this->load_cache_types_paiements();
-                print $this->cache_types_paiements_libelle[$selected];
+                print $this->cache_types_paiements[$selected]['label'];
             } else {
                 print "&nbsp;";
             }
@@ -2150,7 +2152,7 @@ class Form
     
         $sql = "SELECT code_iso, label, active FROM ".MAIN_DB_PREFIX."c_currencies";
         $sql .= " WHERE active = 1";
-        $sql .= " ORDER BY code_iso ASC;";
+        $sql .= " ORDER BY code_iso ASC";
     
         if ($this->db->query($sql))
         {