diff --git a/htdocs/bon-prelevement.class.php b/htdocs/bon-prelevement.class.php index 1ada712cb1a6d1c63ae6e97c68aa4e6bce6f5693..7866035e903fc478927162f7d41898a1e2d6f4d6 100644 --- a/htdocs/bon-prelevement.class.php +++ b/htdocs/bon-prelevement.class.php @@ -159,7 +159,7 @@ class BonPrelevement $sql .= " VALUES (".$this->id; $sql .= ",".$client_id.",'".addslashes($client_nom)."'"; - $sql .= ",'".ereg_replace(",",".",$amount)."'"; + $sql .= ",'".price2num($amount)."'"; $sql .= ", '$code_banque', '$code_guichet', '$number')"; if ($this->db->query($sql)) @@ -977,7 +977,7 @@ class BonPrelevement */ $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; - $sql .= " SET amount = ".ereg_replace(",",".",$bonprev->total); + $sql .= " SET amount = ".price2num($bonprev->total); $sql .= " WHERE rowid = ".$prev_id; $resql=$this->db->query($sql); diff --git a/htdocs/boutique/livre/livre.class.php b/htdocs/boutique/livre/livre.class.php index 99e066122838f2bc49acb828766bf435741d3be8..eb1a8bb8ddb9b34b558dd49518091ea394194f5f 100644 --- a/htdocs/boutique/livre/livre.class.php +++ b/htdocs/boutique/livre/livre.class.php @@ -399,10 +399,10 @@ class Livre { $sql = "UPDATE ".OSC_DB_NAME.".products "; $sql .= "SET products_model = '".$this->ref."'"; $sql .= ", products_image = '".$this->image."'"; - $sql .= ", products_price = ".ereg_replace(",",".",$this->price).""; + $sql .= ", products_price = ".price2num($this->price).""; if ($this->frais_de_port) { - $sql .= ", products_weight = ".ereg_replace(",",".",$this->price).""; + $sql .= ", products_weight = ".price2num($this->price).""; } else { @@ -445,7 +445,7 @@ class Livre { $sql = "UPDATE ".MAIN_DB_PREFIX."livre "; $sql .= " SET title = '" . trim($this->titre) ."'"; $sql .= ", ref = '" . trim($this->ref) ."'"; - $sql .= ", prix = " . ereg_replace(",",".",$this->price).""; + $sql .= ", prix = " . price2num($this->price).""; $sql .= ", annee = " . $this->annee ; $sql .= ", fk_editeur = " . $this->editeurid ; $sql .= ", description = '" . trim($this->description) ."'"; diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index 480b67ecfcfec594b32a75b6d76fdd16aafdd3b9..9f6226c72cf8b18773d62478d6299f8f055feddf 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -64,10 +64,10 @@ class PaiementCharge { { $facid = $key; $value = trim($value); - $amount = round(ereg_replace(",",".",$value), 2); // Un round est ok si nb avec '.' + $amount = round(price2num($value), 2); // Un round est ok si nb avec '.' if (is_numeric($amount)) $total += $amount; } - $total = ereg_replace(",",".",$total); + $total = price2num($total); if ($total > 0) { diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 57649e0215465aee2d7676a59103d032819bc384..b0d942d78cae0b56a9c4b8b46e86b80c4b2a9abb 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -402,7 +402,7 @@ class Commande } $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet (fk_commande,label,description,fk_product, price,qty,tva_tx, remise_percent, subprice, remise)'; - $sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."') ;"; + $sql .= " VALUES ($this->id, '" . addslashes($desc) . "','" . addslashes($desc) . "',$fk_product,".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."') ;"; if ( $this->db->query( $sql) ) { diff --git a/htdocs/compta/export/modules/compta.export.poivre.class.php b/htdocs/compta/export/modules/compta.export.poivre.class.php index fd8659249a383dd13441f10bc78ef5eeaa4bb128..3d135b3d2550147627c331a491f43f608e91d6b1 100644 --- a/htdocs/compta/export/modules/compta.export.poivre.class.php +++ b/htdocs/compta/export/modules/compta.export.poivre.class.php @@ -200,7 +200,7 @@ class ComptaExportPoivre extends ComptaExport $page->write_string($j, 3, stripslashes($this->line_out[$i][2])); $page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture"); $page->write_string($j, 5, $this->line_out[$i][5]); // Num�ro de factur - $page->write($j, 6, ereg_replace(",",".",$this->line_out[$i][7])); + $page->write($j, 6, price2num($this->line_out[$i][7])); $page->write_string($j, 7, 'D' ); // D pour d�bit $page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); @@ -213,7 +213,7 @@ class ComptaExportPoivre extends ComptaExport $page->write_string($j, 4, stripslashes($this->line_out[$i][3])." Facture"); $page->write_string($j, 5, $this->line_out[$i][5]); // Num�ro de facture - $page->write($j, 6, ereg_replace(",",".",$this->line_out[$i][6])); // Montant de TVA + $page->write($j, 6, price2num($this->line_out[$i][6])); // Montant de TVA $page->write_string($j, 7, 'C'); // C pour cr�dit $page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); @@ -227,7 +227,7 @@ class ComptaExportPoivre extends ComptaExport $page->write_string($j, 2, $this->line_out[$i][4]); // Code Comptable $page->write_string($j, 4, $this->line_out[$i][3]." Facture"); $page->write_string($j, 5, $this->line_out[$i][5]); - $page->write($j, 6, ereg_replace(",",".",round($this->line_out[$i][8], 2))); + $page->write($j, 6, price2num(round($this->line_out[$i][8], 2))); $page->write_string($j, 7, 'C'); // C pour cr�dit $page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); @@ -304,7 +304,7 @@ class ComptaExportPoivre extends ComptaExport $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); // $page->write_string($j,5, $linep[$i][7]); // Num�ro de facture - $page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne + $page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne $page->write_string($j,7,$debit); $page->write_string($j,8, strftime("%d%m%y",$linep[$i][0])); @@ -318,7 +318,7 @@ class ComptaExportPoivre extends ComptaExport $page->write_string($j,3, $linep[$i][2]); $page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); // $page->write_string($j,5, $linep[$i][7]); // Num�ro de facture - $page->write($j,6, ereg_replace(",",".",round(abs($linep[$i][5]), 2))); // Montant de la ligne + $page->write($j,6, price2num(round(abs($linep[$i][5]), 2))); // Montant de la ligne $page->write_string($j,7, $credit); $page->write_string($j,8, strftime("%d%m%y",$linep[$i][0])); diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index 84b033105bdaea40a730a71fa29268ab076b8210..0af3ef63413ed3f730e5ad8e817eccf099158d29 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -415,7 +415,7 @@ class FactureRec $qty=1; } $remise = 0; - $price = round(ereg_replace(",",".",$pu), 2); + $price = round(price2num($pu), 2); $subprice = $price; if (trim(strlen($remise_percent)) > 0) { @@ -425,13 +425,13 @@ class FactureRec $sql = "INSERT INTO ".MAIN_DB_PREFIX."facturedet_rec (fk_facture,description,price,qty,tva_taux, fk_product, remise_percent, subprice, remise)"; $sql .= " VALUES ('$facid', '$desc'"; - $sql .= ",".ereg_replace(",",".",$price); - $sql .= ",".ereg_replace(",",".",$qty); - $sql .= ",".ereg_replace(",",".",$txtva); + $sql .= ",".price2num($price); + $sql .= ",".price2num($qty); + $sql .= ",".price2num($txtva); $sql .= ",'$fk_product'"; - $sql .= ",'".ereg_replace(",",".",$remise_percent)."'"; - $sql .= ",'".ereg_replace(",",".",$subprice)."'"; - $sql .= ",'".ereg_replace(",",".",$remise)."') ;"; + $sql .= ",'".price2num($remise_percent)."'"; + $sql .= ",'".price2num($subprice)."'"; + $sql .= ",'".price2num($remise)."') ;"; if ( $this->db->query( $sql) ) { @@ -458,7 +458,7 @@ class FactureRec $qty=1; } $remise = 0; - $price = round(ereg_replace(",",".",$pu), 2); + $price = round(price2num($pu), 2); $subprice = $price; if (trim(strlen($remise_percent)) > 0) { @@ -471,11 +471,11 @@ class FactureRec } $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc'"; - $sql .= ",price=".ereg_replace(",",".",$price); - $sql .= ",subprice=".ereg_replace(",",".",$subprice); - $sql .= ",remise=".ereg_replace(",",".",$remise); - $sql .= ",remise_percent=".ereg_replace(",",".",$remise_percent); - $sql .= ",qty=".ereg_replace(",",".",$qty); + $sql .= ",price=".price2num($price); + $sql .= ",subprice=".price2num($subprice); + $sql .= ",remise=".price2num($remise); + $sql .= ",remise_percent=".price2num($remise_percent); + $sql .= ",qty=".price2num($qty); $sql .= " WHERE rowid = $rowid ;"; $result = $this->db->query( $sql); @@ -536,11 +536,11 @@ class FactureRec $tvas = $calculs[5]; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET "; - $sql .= " amount = ".ereg_replace(",",".",$this->amount_ht); - $sql .= ", remise=".ereg_replace(",",".",$this->total_remise); - $sql .= ", total=".ereg_replace(",",".",$this->total_ht); - $sql .= ", tva=".ereg_replace(",",".",$this->total_tva); - $sql .= ", total_ttc=".ereg_replace(",",".",$this->total_ttc); + $sql .= " amount = ".price2num($this->amount_ht); + $sql .= ", remise=".price2num($this->total_remise); + $sql .= ", total=".price2num($this->total_ht); + $sql .= ", tva=".price2num($this->total_tva); + $sql .= ", total_ttc=".price2num($this->total_ttc); $sql .= " WHERE rowid = $facid ;"; @@ -578,7 +578,7 @@ class FactureRec $this->remise_percent = $remise ; - $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET remise_percent = ".ereg_replace(",",".",$remise); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET remise_percent = ".price2num($remise); $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; if ($this->db->query($sql) ) diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 5311b4a7d5b174c88b30b404f97671dadccdc14a..ae647646f6bf2a9f8059121bb8ff0ac96830a068 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -80,7 +80,7 @@ if ($socidp) } if ($_GET["search_montant"]) { - $sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]); + $sql .=" AND p.amount=".price2num($_GET["search_montant"]); } if ($_GET["orphelins"]) // Option qui ne sert qu'au debogage diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 93ba2d39a38353d04faef2cce4faeb5ee8f45473..f9d875cd835d7876a4dc288b5f4bac6158ca9f87 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -78,10 +78,10 @@ if ($_POST["action"] == 'add_paiement') { $chid = $key; $value = trim($value); - $amount = round(ereg_replace(",",".",$value), 2); // Un round est ok si nb avec '.' + $amount = round(price2num($value), 2); // Un round est ok si nb avec '.' if (is_numeric($amount)) $total += $amount; } - $total = ereg_replace(",",".",$total); + $total = price2num($total); // Insertion dans llx_bank $label = "R�glement charge"; diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index a4e636417ee01831543f802058af40f2c6d2ac27..0481a5d1e1aa8b1cbac6c574b09cb9b962acd7a8 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -572,8 +572,8 @@ class Contrat if ($this->statut == 0) { - $qty = ereg_replace(",",".",$qty); - $pu = ereg_replace(",",".",$pu); + $qty = price2num($qty); + $pu = price2num($pu); if ($fk_product > 0) { @@ -591,7 +591,7 @@ class Contrat } $remise = 0; - $price = ereg_replace(",",".",round($pu, 2)); + $price = price2num(round($pu, 2)); $subprice = $price; if (strlen($remise_percent) > 0) { @@ -607,7 +607,7 @@ class Contrat if ($dateend > 0) { $sql.= ",date_fin_validite"; } $sql.= ") VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',"; $sql.= ($fk_product>0 ? $fk_product : "null"); - $sql.= ",".ereg_replace(",",".",$price).", '$qty', $txtva, $remise_percent,'".ereg_replace(",",".",$subprice)."','".ereg_replace(",",".", $remise)."'"; + $sql.= ",".price2num($price).", '$qty', $txtva, $remise_percent,'".price2num($subprice)."','".price2num( $remise)."'"; if ($datestart > 0) { $sql.= ",".$this->db->idate($datestart); } if ($dateend > 0) { $sql.= ",".$this->db->idate($dateend); } $sql.= ");"; @@ -651,8 +651,8 @@ class Contrat $qty=trim($qty); $desc=trim($desc); $desc=trim($desc); - $price = ereg_replace(",",".",$pu); - $tvatx = ereg_replace(",",".",$tvatx); + $price = price2num($pu); + $tvatx = price2num($tvatx); $subprice = $price; $remise = 0; if (strlen($remise_percent) > 0) @@ -670,12 +670,12 @@ class Contrat $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".addslashes($desc)."'"; - $sql .= ",price_ht='" . ereg_replace(",",".",$price)."'"; - $sql .= ",subprice='" . ereg_replace(",",".",$subprice)."'"; - $sql .= ",remise='" . ereg_replace(",",".",$remise)."'"; - $sql .= ",remise_percent='".ereg_replace(",",".",$remise_percent)."'"; + $sql .= ",price_ht='" . price2num($price)."'"; + $sql .= ",subprice='" . price2num($subprice)."'"; + $sql .= ",remise='" . price2num($remise)."'"; + $sql .= ",remise_percent='".price2num($remise_percent)."'"; $sql .= ",qty='$qty'"; - $sql .= ",tva_tx='". ereg_replace(",",".",$tvatx)."'"; + $sql .= ",tva_tx='". price2num($tvatx)."'"; if ($datestart > 0) { $sql.= ",date_ouverture_prevue=".$this->db->idate($datestart); } else { $sql.=",date_ouverture_prevue=null"; } diff --git a/htdocs/don.class.php b/htdocs/don.class.php index b197aee1b22da99ed1ebbf972f3a7d88c9d76615..37e68a95a02d6eabf4ba2cb77781606508eef147 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -195,7 +195,7 @@ class Don $sql .= " fk_don_projet,"; } $sql .= " note, fk_user_author, datedon, email)"; - $sql .= " VALUES (now(),".ereg_replace(",",".", $this->amount).", $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, "; + $sql .= " VALUES (now(),".price2num($this->amount).", $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, "; if ($this->projetid) { $sql .= " $this->projetid,"; diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index ae65bbc973b07ff1b946ea64b05ea0e450f3ec16..439f7ba6cec70ebae78f6623e6bf6e2114207bd9 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -332,7 +332,7 @@ class Expedition $p_qty = 1; } - $p_price = ereg_replace(",",".",$p_price); + $p_price = price2num($p_price); $price = $p_price; $subprice = $p_price; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 3e116afa59662d8607e7ddb4039baaf8b10f71cc..0594196a66d43481169a3f0d3c86a18221351865 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -385,7 +385,7 @@ if (! $_GET['action'] && ! $_POST['action']) } if ($_GET["search_montant"]) { - $sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]); + $sql .=" AND p.amount=".price2num($_GET["search_montant"]); } */ diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 73511da60ba26922822677ec0c112157319c0c6c..0d21e445ef66213c230fc345b6d94c06662a8219 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -547,7 +547,7 @@ class CommandeFournisseur $p_qty = 1; } - $p_price = ereg_replace(",",".",$p_price); + $p_price = price2num($p_price); $price = $p_price; $subprice = $p_price; @@ -645,11 +645,11 @@ class CommandeFournisseur * */ $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur set"; - $sql .= " amount_ht ='".ereg_replace(",",".",$totalht)."'"; - $sql .= ", total_ht ='".ereg_replace(",",".",$totalht)."'"; - $sql .= ", tva ='".ereg_replace(",",".",$totaltva)."'"; - $sql .= ", total_ttc ='".ereg_replace(",",".",$totalttc)."'"; - $sql .= ", remise ='".ereg_replace(",",".",$total_remise)."'"; + $sql .= " amount_ht ='".price2num($totalht)."'"; + $sql .= ", total_ht ='".price2num($totalht)."'"; + $sql .= ", tva ='".price2num($totaltva)."'"; + $sql .= ", total_ttc ='".price2num($totalttc)."'"; + $sql .= ", remise ='".price2num($total_remise)."'"; $sql .= " WHERE rowid = $this->id"; if ( $this->db->query($sql) ) { diff --git a/htdocs/product.class.php b/htdocs/product.class.php index dc6a7ac22da7b799509d752361e3dfbc9f8babb9..6b860ac37d477d5cebed96dc29d74da5eee34ae4 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -120,7 +120,7 @@ class Product if (strlen($this->price)==0) $this->price = 0; if (strlen($this->envente)==0) $this->envente = 0; // deprecated if (strlen($this->status)==0) $this->status = 0; - $this->price = ereg_replace(",",".",$this->price); + $this->price = price2num($this->price); dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid); @@ -263,13 +263,13 @@ class Product $sql_multiprix .= "WHERE date_price = now()"; $sql_multiprix .= " and fk_product = ".$this->id; $sql_multiprix .= " and fk_user_author = ".$user->id; - $sql_multiprix .= " and price = ".ereg_replace(",",".",$this->multiprices["$i"]); + $sql_multiprix .= " and price = ".price2num($this->multiprices["$i"]); $this->db->query($sql_multiprix); // On ajoute nouveau tarif $sql_multiprix = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price_level,price) "; - $sql_multiprix .= " VALUES(now(),".$this->id.",".$user->id.",".$i.",".ereg_replace(",",".",$this->multiprices["$i"]); + $sql_multiprix .= " VALUES(now(),".$this->id.",".$user->id.",".$i.",".price2num($this->multiprices["$i"]); $sql_multiprix .= ")"; if (! $this->db->query($sql_multiprix) ) $queryError = true; @@ -282,7 +282,7 @@ class Product $sql .= "WHERE date_price = now()"; $sql .= " and fk_product = ".$this->id; $sql .= " and fk_user_author = ".$user->id; - $sql .= " and price = ".ereg_replace(",",".",$this->price); + $sql .= " and price = ".price2num($this->price); $sql .= " and envente = ".$this->envente; $sql .= " and tva_tx = ".$this->tva_tx; @@ -290,7 +290,7 @@ class Product // On ajoute nouveau tarif $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) "; - $sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx; + $sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($this->price).",".$this->envente.",".$this->tva_tx; $sql .= ")"; if (! $this->db->query($sql) ) $queryError = true; @@ -310,7 +310,7 @@ class Product $sql .= "WHERE date_price = now()"; $sql .= " and fk_product = ".$this->id; $sql .= " and fk_user_author = ".$user->id; - $sql .= " and price = ".ereg_replace(",",".",$this->price); + $sql .= " and price = ".price2num($this->price); $sql .= " and envente = ".$this->envente; $sql .= " and tva_tx = ".$this->tva_tx; @@ -318,7 +318,7 @@ class Product // On ajoute nouveau tarif $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) "; - $sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx; + $sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($this->price).",".$this->envente.",".$this->tva_tx; $sql .= ")"; if ($this->db->query($sql) ) @@ -404,7 +404,7 @@ class Product $sql .= " ,fk_product = ".$this->id; $sql .= " ,fk_soc = ".$id_fourn; $sql .= " ,fk_user = ".$user->id; - $sql .= " ,price = ".ereg_replace(",",".",$buyprice); + $sql .= " ,price = ".price2num($buyprice); $sql .= " ,quantity = ".$qty; if (! $this->db->query($sql)) @@ -419,7 +419,7 @@ class Product $sql .= " ,fk_product = ".$this->id; $sql .= " ,fk_soc = ".$id_fourn; $sql .= " ,fk_user = ".$user->id; - $sql .= " ,price = ".ereg_replace(",",".",$buyprice); + $sql .= " ,price = ".price2num($buyprice); $sql .= " ,quantity = ".$qty; if (! $this->db->query($sql)) @@ -463,7 +463,7 @@ class Product if (strlen(trim($this->price)) > 0 ) { $sql = "UPDATE ".MAIN_DB_PREFIX."product "; - $sql .= " SET price = " . ereg_replace(",",".",$this->price); + $sql .= " SET price = " . price2num($this->price); $sql .= " WHERE rowid = " . $id; if ( $this->db->query($sql) ) @@ -493,7 +493,7 @@ class Product if (strlen(trim($this->price)) > 0 ) { $sql = "UPDATE ".MAIN_DB_PREFIX."product "; - $sql .= " SET price = " . ereg_replace(",",".",$this->price); + $sql .= " SET price = " . price2num($this->price); $sql .= " WHERE rowid = " . $id; if ( $this->db->query($sql) ) diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 17e6f264445ea42a8cff46435bd84458f4701d42..e84a8c1079241e73eecc73ed8f0abceab47d4ec9 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -172,7 +172,7 @@ class Propal } $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES "; - $sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".ereg_replace(",",".",$remise_percent)."','".ereg_replace(",",".",$subprice)."')"; + $sql .= " (".$this->id.",". $idproduct.",'". $qty."','". $price."','".$txtva."','".addslashes($p_desc?$p_desc:$prod->label)."','".price2num($remise_percent)."','".price2num($subprice)."')"; if ($this->db->query($sql) ) { @@ -230,7 +230,7 @@ class Propal } $sql = "INSERT INTO ".MAIN_DB_PREFIX."propaldet (fk_propal, fk_product, qty, price, tva_tx, description, remise_percent, subprice) VALUES "; - $sql .= " (".$this->id.", 0,'". $p_qty."','". ereg_replace(",",".",$price)."','".$p_tva_tx."','".addslashes($p_desc)."','$remise_percent', '".ereg_replace(",",".",$subprice)."') ; "; + $sql .= " (".$this->id.", 0,'". $p_qty."','". price2num($price)."','".$p_tva_tx."','".addslashes($p_desc)."','$remise_percent', '".price2num($subprice)."') ; "; if ($this->db->query($sql) ) { @@ -459,10 +459,10 @@ class Propal // Met a jour en base $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET"; - $sql .= " price='". ereg_replace(",",".",$this->total_ht)."'"; - $sql .= ", tva='". ereg_replace(",",".",$this->total_tva)."'"; - $sql .= ", total='". ereg_replace(",",".",$this->total_ttc)."'"; - $sql .= ", remise='".ereg_replace(",",".",$this->remise)."'"; + $sql .= " price='". price2num($this->total_ht)."'"; + $sql .= ", tva='". price2num($this->total_tva)."'"; + $sql .= ", total='". price2num($this->total_ttc)."'"; + $sql .= ", remise='".price2num($this->remise)."'"; $sql .=" WHERE rowid = $this->id"; if ( $this->db->query($sql) ) diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index f3df034c1a687aef794390ceaeb0764348e96e8a..7030498d0ae43871c4723adffabfcbd359e70e61 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -839,7 +839,7 @@ class Societe { { if ($this->id) { - $remise = ereg_replace(",",".",$remise); + $remise = price2num($remise); $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except "; $sql .= " WHERE fk_soc = " . $this->id ." AND fk_facture IS NULL;";