Fix: Mauvaise valeur sauvegardé si montant supérieur à 1000

This commit is contained in:
Laurent Destailleur 2006-02-08 21:09:47 +00:00
parent a12a2ea93d
commit dbabaef6e3
16 changed files with 73 additions and 73 deletions

View File

@ -159,7 +159,7 @@ class BonPrelevement
$sql .= " VALUES (".$this->id; $sql .= " VALUES (".$this->id;
$sql .= ",".$client_id.",'".addslashes($client_nom)."'"; $sql .= ",".$client_id.",'".addslashes($client_nom)."'";
$sql .= ",'".ereg_replace(",",".",$amount)."'"; $sql .= ",'".price2num($amount)."'";
$sql .= ", '$code_banque', '$code_guichet', '$number')"; $sql .= ", '$code_banque', '$code_guichet', '$number')";
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -977,7 +977,7 @@ class BonPrelevement
*/ */
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $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; $sql .= " WHERE rowid = ".$prev_id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -399,10 +399,10 @@ class Livre {
$sql = "UPDATE ".OSC_DB_NAME.".products "; $sql = "UPDATE ".OSC_DB_NAME.".products ";
$sql .= "SET products_model = '".$this->ref."'"; $sql .= "SET products_model = '".$this->ref."'";
$sql .= ", products_image = '".$this->image."'"; $sql .= ", products_image = '".$this->image."'";
$sql .= ", products_price = ".ereg_replace(",",".",$this->price).""; $sql .= ", products_price = ".price2num($this->price)."";
if ($this->frais_de_port) if ($this->frais_de_port)
{ {
$sql .= ", products_weight = ".ereg_replace(",",".",$this->price).""; $sql .= ", products_weight = ".price2num($this->price)."";
} }
else else
{ {
@ -445,7 +445,7 @@ class Livre {
$sql = "UPDATE ".MAIN_DB_PREFIX."livre "; $sql = "UPDATE ".MAIN_DB_PREFIX."livre ";
$sql .= " SET title = '" . trim($this->titre) ."'"; $sql .= " SET title = '" . trim($this->titre) ."'";
$sql .= ", ref = '" . trim($this->ref) ."'"; $sql .= ", ref = '" . trim($this->ref) ."'";
$sql .= ", prix = " . ereg_replace(",",".",$this->price).""; $sql .= ", prix = " . price2num($this->price)."";
$sql .= ", annee = " . $this->annee ; $sql .= ", annee = " . $this->annee ;
$sql .= ", fk_editeur = " . $this->editeurid ; $sql .= ", fk_editeur = " . $this->editeurid ;
$sql .= ", description = '" . trim($this->description) ."'"; $sql .= ", description = '" . trim($this->description) ."'";

View File

@ -64,10 +64,10 @@ class PaiementCharge {
{ {
$facid = $key; $facid = $key;
$value = trim($value); $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; if (is_numeric($amount)) $total += $amount;
} }
$total = ereg_replace(",",".",$total); $total = price2num($total);
if ($total > 0) if ($total > 0)
{ {

View File

@ -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 = '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) ) if ( $this->db->query( $sql) )
{ {

View File

@ -200,7 +200,7 @@ class ComptaExportPoivre extends ComptaExport
$page->write_string($j, 3, stripslashes($this->line_out[$i][2])); $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, 4, stripslashes($this->line_out[$i][3])." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de factur $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, 7, 'D' ); // D pour débit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); $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, 4, stripslashes($this->line_out[$i][3])." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); // Numéro de 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, 7, 'C'); // C pour crédit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); $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, 2, $this->line_out[$i][4]); // Code Comptable
$page->write_string($j, 4, $this->line_out[$i][3]." Facture"); $page->write_string($j, 4, $this->line_out[$i][3]." Facture");
$page->write_string($j, 5, $this->line_out[$i][5]); $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, 7, 'C'); // C pour crédit
$page->write_string($j, 8, strftime("%d%m%y",$this->line_out[$i][0])); $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,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); //
$page->write_string($j,5, $linep[$i][7]); // Numéro de facture $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,7,$debit);
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0])); $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,3, $linep[$i][2]);
$page->write_string($j,4, stripslashes($linep[$i][3])." ".stripslashes($linep[$i][6])); // $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_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,7, $credit);
$page->write_string($j,8, strftime("%d%m%y",$linep[$i][0])); $page->write_string($j,8, strftime("%d%m%y",$linep[$i][0]));

View File

@ -415,7 +415,7 @@ class FactureRec
$qty=1; $qty=1;
} }
$remise = 0; $remise = 0;
$price = round(ereg_replace(",",".",$pu), 2); $price = round(price2num($pu), 2);
$subprice = $price; $subprice = $price;
if (trim(strlen($remise_percent)) > 0) 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 = "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 .= " VALUES ('$facid', '$desc'";
$sql .= ",".ereg_replace(",",".",$price); $sql .= ",".price2num($price);
$sql .= ",".ereg_replace(",",".",$qty); $sql .= ",".price2num($qty);
$sql .= ",".ereg_replace(",",".",$txtva); $sql .= ",".price2num($txtva);
$sql .= ",'$fk_product'"; $sql .= ",'$fk_product'";
$sql .= ",'".ereg_replace(",",".",$remise_percent)."'"; $sql .= ",'".price2num($remise_percent)."'";
$sql .= ",'".ereg_replace(",",".",$subprice)."'"; $sql .= ",'".price2num($subprice)."'";
$sql .= ",'".ereg_replace(",",".",$remise)."') ;"; $sql .= ",'".price2num($remise)."') ;";
if ( $this->db->query( $sql) ) if ( $this->db->query( $sql) )
{ {
@ -458,7 +458,7 @@ class FactureRec
$qty=1; $qty=1;
} }
$remise = 0; $remise = 0;
$price = round(ereg_replace(",",".",$pu), 2); $price = round(price2num($pu), 2);
$subprice = $price; $subprice = $price;
if (trim(strlen($remise_percent)) > 0) if (trim(strlen($remise_percent)) > 0)
{ {
@ -471,11 +471,11 @@ class FactureRec
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc'"; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set description='$desc'";
$sql .= ",price=".ereg_replace(",",".",$price); $sql .= ",price=".price2num($price);
$sql .= ",subprice=".ereg_replace(",",".",$subprice); $sql .= ",subprice=".price2num($subprice);
$sql .= ",remise=".ereg_replace(",",".",$remise); $sql .= ",remise=".price2num($remise);
$sql .= ",remise_percent=".ereg_replace(",",".",$remise_percent); $sql .= ",remise_percent=".price2num($remise_percent);
$sql .= ",qty=".ereg_replace(",",".",$qty); $sql .= ",qty=".price2num($qty);
$sql .= " WHERE rowid = $rowid ;"; $sql .= " WHERE rowid = $rowid ;";
$result = $this->db->query( $sql); $result = $this->db->query( $sql);
@ -536,11 +536,11 @@ class FactureRec
$tvas = $calculs[5]; $tvas = $calculs[5];
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET ";
$sql .= " amount = ".ereg_replace(",",".",$this->amount_ht); $sql .= " amount = ".price2num($this->amount_ht);
$sql .= ", remise=".ereg_replace(",",".",$this->total_remise); $sql .= ", remise=".price2num($this->total_remise);
$sql .= ", total=".ereg_replace(",",".",$this->total_ht); $sql .= ", total=".price2num($this->total_ht);
$sql .= ", tva=".ereg_replace(",",".",$this->total_tva); $sql .= ", tva=".price2num($this->total_tva);
$sql .= ", total_ttc=".ereg_replace(",",".",$this->total_ttc); $sql .= ", total_ttc=".price2num($this->total_ttc);
$sql .= " WHERE rowid = $facid ;"; $sql .= " WHERE rowid = $facid ;";
@ -578,7 +578,7 @@ class FactureRec
$this->remise_percent = $remise ; $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 ;"; $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
if ($this->db->query($sql) ) if ($this->db->query($sql) )

View File

@ -80,7 +80,7 @@ if ($socidp)
} }
if ($_GET["search_montant"]) 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 if ($_GET["orphelins"]) // Option qui ne sert qu'au debogage

View File

@ -78,10 +78,10 @@ if ($_POST["action"] == 'add_paiement')
{ {
$chid = $key; $chid = $key;
$value = trim($value); $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; if (is_numeric($amount)) $total += $amount;
} }
$total = ereg_replace(",",".",$total); $total = price2num($total);
// Insertion dans llx_bank // Insertion dans llx_bank
$label = "Règlement charge"; $label = "Règlement charge";

View File

@ -572,8 +572,8 @@ class Contrat
if ($this->statut == 0) if ($this->statut == 0)
{ {
$qty = ereg_replace(",",".",$qty); $qty = price2num($qty);
$pu = ereg_replace(",",".",$pu); $pu = price2num($pu);
if ($fk_product > 0) if ($fk_product > 0)
{ {
@ -591,7 +591,7 @@ class Contrat
} }
$remise = 0; $remise = 0;
$price = ereg_replace(",",".",round($pu, 2)); $price = price2num(round($pu, 2));
$subprice = $price; $subprice = $price;
if (strlen($remise_percent) > 0) if (strlen($remise_percent) > 0)
{ {
@ -607,7 +607,7 @@ class Contrat
if ($dateend > 0) { $sql.= ",date_fin_validite"; } if ($dateend > 0) { $sql.= ",date_fin_validite"; }
$sql.= ") VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',"; $sql.= ") VALUES ($this->id, '" . addslashes($label) . "','" . addslashes($desc) . "',";
$sql.= ($fk_product>0 ? $fk_product : "null"); $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 ($datestart > 0) { $sql.= ",".$this->db->idate($datestart); }
if ($dateend > 0) { $sql.= ",".$this->db->idate($dateend); } if ($dateend > 0) { $sql.= ",".$this->db->idate($dateend); }
$sql.= ");"; $sql.= ");";
@ -651,8 +651,8 @@ class Contrat
$qty=trim($qty); $qty=trim($qty);
$desc=trim($desc); $desc=trim($desc);
$desc=trim($desc); $desc=trim($desc);
$price = ereg_replace(",",".",$pu); $price = price2num($pu);
$tvatx = ereg_replace(",",".",$tvatx); $tvatx = price2num($tvatx);
$subprice = $price; $subprice = $price;
$remise = 0; $remise = 0;
if (strlen($remise_percent) > 0) if (strlen($remise_percent) > 0)
@ -670,12 +670,12 @@ class Contrat
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".addslashes($desc)."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".addslashes($desc)."'";
$sql .= ",price_ht='" . ereg_replace(",",".",$price)."'"; $sql .= ",price_ht='" . price2num($price)."'";
$sql .= ",subprice='" . ereg_replace(",",".",$subprice)."'"; $sql .= ",subprice='" . price2num($subprice)."'";
$sql .= ",remise='" . ereg_replace(",",".",$remise)."'"; $sql .= ",remise='" . price2num($remise)."'";
$sql .= ",remise_percent='".ereg_replace(",",".",$remise_percent)."'"; $sql .= ",remise_percent='".price2num($remise_percent)."'";
$sql .= ",qty='$qty'"; $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); } if ($datestart > 0) { $sql.= ",date_ouverture_prevue=".$this->db->idate($datestart); }
else { $sql.=",date_ouverture_prevue=null"; } else { $sql.=",date_ouverture_prevue=null"; }

View File

@ -195,7 +195,7 @@ class Don
$sql .= " fk_don_projet,"; $sql .= " fk_don_projet,";
} }
$sql .= " note, fk_user_author, datedon, email)"; $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) if ($this->projetid)
{ {
$sql .= " $this->projetid,"; $sql .= " $this->projetid,";

View File

@ -332,7 +332,7 @@ class Expedition
$p_qty = 1; $p_qty = 1;
} }
$p_price = ereg_replace(",",".",$p_price); $p_price = price2num($p_price);
$price = $p_price; $price = $p_price;
$subprice = $p_price; $subprice = $p_price;

View File

@ -385,7 +385,7 @@ if (! $_GET['action'] && ! $_POST['action'])
} }
if ($_GET["search_montant"]) if ($_GET["search_montant"])
{ {
$sql .=" AND p.amount=".ereg_replace(",",".",$_GET["search_montant"]); $sql .=" AND p.amount=".price2num($_GET["search_montant"]);
} }
*/ */

View File

@ -547,7 +547,7 @@ class CommandeFournisseur
$p_qty = 1; $p_qty = 1;
} }
$p_price = ereg_replace(",",".",$p_price); $p_price = price2num($p_price);
$price = $p_price; $price = $p_price;
$subprice = $p_price; $subprice = $p_price;
@ -645,11 +645,11 @@ class CommandeFournisseur
* *
*/ */
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur set"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur set";
$sql .= " amount_ht ='".ereg_replace(",",".",$totalht)."'"; $sql .= " amount_ht ='".price2num($totalht)."'";
$sql .= ", total_ht ='".ereg_replace(",",".",$totalht)."'"; $sql .= ", total_ht ='".price2num($totalht)."'";
$sql .= ", tva ='".ereg_replace(",",".",$totaltva)."'"; $sql .= ", tva ='".price2num($totaltva)."'";
$sql .= ", total_ttc ='".ereg_replace(",",".",$totalttc)."'"; $sql .= ", total_ttc ='".price2num($totalttc)."'";
$sql .= ", remise ='".ereg_replace(",",".",$total_remise)."'"; $sql .= ", remise ='".price2num($total_remise)."'";
$sql .= " WHERE rowid = $this->id"; $sql .= " WHERE rowid = $this->id";
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {

View File

@ -120,7 +120,7 @@ class Product
if (strlen($this->price)==0) $this->price = 0; if (strlen($this->price)==0) $this->price = 0;
if (strlen($this->envente)==0) $this->envente = 0; // deprecated if (strlen($this->envente)==0) $this->envente = 0; // deprecated
if (strlen($this->status)==0) $this->status = 0; 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); dolibarr_syslog("Product::Create ref=".$this->ref." Categorie : ".$this->catid);
@ -263,13 +263,13 @@ class Product
$sql_multiprix .= "WHERE date_price = now()"; $sql_multiprix .= "WHERE date_price = now()";
$sql_multiprix .= " and fk_product = ".$this->id; $sql_multiprix .= " and fk_product = ".$this->id;
$sql_multiprix .= " and fk_user_author = ".$user->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); $this->db->query($sql_multiprix);
// On ajoute nouveau tarif // 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 = "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 .= ")"; $sql_multiprix .= ")";
if (! $this->db->query($sql_multiprix) ) if (! $this->db->query($sql_multiprix) )
$queryError = true; $queryError = true;
@ -282,7 +282,7 @@ class Product
$sql .= "WHERE date_price = now()"; $sql .= "WHERE date_price = now()";
$sql .= " and fk_product = ".$this->id; $sql .= " and fk_product = ".$this->id;
$sql .= " and fk_user_author = ".$user->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 envente = ".$this->envente;
$sql .= " and tva_tx = ".$this->tva_tx; $sql .= " and tva_tx = ".$this->tva_tx;
@ -290,7 +290,7 @@ class Product
// On ajoute nouveau tarif // On ajoute nouveau tarif
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) "; $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 .= ")"; $sql .= ")";
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
$queryError = true; $queryError = true;
@ -310,7 +310,7 @@ class Product
$sql .= "WHERE date_price = now()"; $sql .= "WHERE date_price = now()";
$sql .= " and fk_product = ".$this->id; $sql .= " and fk_product = ".$this->id;
$sql .= " and fk_user_author = ".$user->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 envente = ".$this->envente;
$sql .= " and tva_tx = ".$this->tva_tx; $sql .= " and tva_tx = ".$this->tva_tx;
@ -318,7 +318,7 @@ class Product
// On ajoute nouveau tarif // On ajoute nouveau tarif
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) "; $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 .= ")"; $sql .= ")";
if ($this->db->query($sql) ) if ($this->db->query($sql) )
@ -404,7 +404,7 @@ class Product
$sql .= " ,fk_product = ".$this->id; $sql .= " ,fk_product = ".$this->id;
$sql .= " ,fk_soc = ".$id_fourn; $sql .= " ,fk_soc = ".$id_fourn;
$sql .= " ,fk_user = ".$user->id; $sql .= " ,fk_user = ".$user->id;
$sql .= " ,price = ".ereg_replace(",",".",$buyprice); $sql .= " ,price = ".price2num($buyprice);
$sql .= " ,quantity = ".$qty; $sql .= " ,quantity = ".$qty;
if (! $this->db->query($sql)) if (! $this->db->query($sql))
@ -419,7 +419,7 @@ class Product
$sql .= " ,fk_product = ".$this->id; $sql .= " ,fk_product = ".$this->id;
$sql .= " ,fk_soc = ".$id_fourn; $sql .= " ,fk_soc = ".$id_fourn;
$sql .= " ,fk_user = ".$user->id; $sql .= " ,fk_user = ".$user->id;
$sql .= " ,price = ".ereg_replace(",",".",$buyprice); $sql .= " ,price = ".price2num($buyprice);
$sql .= " ,quantity = ".$qty; $sql .= " ,quantity = ".$qty;
if (! $this->db->query($sql)) if (! $this->db->query($sql))
@ -463,7 +463,7 @@ class Product
if (strlen(trim($this->price)) > 0 ) if (strlen(trim($this->price)) > 0 )
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."product "; $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET price = " . ereg_replace(",",".",$this->price); $sql .= " SET price = " . price2num($this->price);
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
@ -493,7 +493,7 @@ class Product
if (strlen(trim($this->price)) > 0 ) if (strlen(trim($this->price)) > 0 )
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."product "; $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET price = " . ereg_replace(",",".",$this->price); $sql .= " SET price = " . price2num($this->price);
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )

View File

@ -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 = "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) ) 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 = "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) ) if ($this->db->query($sql) )
{ {
@ -459,10 +459,10 @@ class Propal
// Met a jour en base // Met a jour en base
$sql = "UPDATE ".MAIN_DB_PREFIX."propal SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
$sql .= " price='". ereg_replace(",",".",$this->total_ht)."'"; $sql .= " price='". price2num($this->total_ht)."'";
$sql .= ", tva='". ereg_replace(",",".",$this->total_tva)."'"; $sql .= ", tva='". price2num($this->total_tva)."'";
$sql .= ", total='". ereg_replace(",",".",$this->total_ttc)."'"; $sql .= ", total='". price2num($this->total_ttc)."'";
$sql .= ", remise='".ereg_replace(",",".",$this->remise)."'"; $sql .= ", remise='".price2num($this->remise)."'";
$sql .=" WHERE rowid = $this->id"; $sql .=" WHERE rowid = $this->id";
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )

View File

@ -839,7 +839,7 @@ class Societe {
{ {
if ($this->id) if ($this->id)
{ {
$remise = ereg_replace(",",".",$remise); $remise = price2num($remise);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
$sql .= " WHERE fk_soc = " . $this->id ." AND fk_facture IS NULL;"; $sql .= " WHERE fk_soc = " . $this->id ." AND fk_facture IS NULL;";