Qual: Replace ereg_replace(",","." by price2num

This commit is contained in:
Laurent Destailleur 2008-12-09 21:02:58 +00:00
parent 6abe23f15c
commit d3283a798a
7 changed files with 564 additions and 571 deletions

View File

@ -110,11 +110,11 @@ else if ($_POST["action"] == 'confirmDeleteProdLineInForm')
}
else if ($_POST["action"] == 'ProductCanvasAbility')
{
dolibarr_set_const($db, "PRODUCT_CANVAS_ABILITY", $_POST["ProductCanvasAbility"]);
dolibarr_set_const($db, "MAIN_NEED_SMARTY", $_POST["ProductCanvasAbility"]);
// Create temp directory for smarty
if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile);
if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache);
dolibarr_set_const($db, "MAIN_NEED_SMARTY", $_POST["ProductCanvasAbility"]);
}
else if ($_POST["action"] == 'usesearchtoselectproduct')
{
@ -122,6 +122,10 @@ else if ($_POST["action"] == 'usesearchtoselectproduct')
}
else if ($_GET["action"] == 'set')
{
// Create temp directory for smarty
if (! empty($dolibarr_smarty_compile)) create_exdir($dolibarr_smarty_compile);
if (! empty($dolibarr_smarty_cache)) create_exdir($dolibarr_smarty_cache);
$const = "PRODUIT_SPECIAL_".strtoupper($_GET["spe"]);
if ($_GET["value"]) dolibarr_set_const($db, $const, $_GET["value"]);
else dolibarr_del_const($db, $const);
@ -277,8 +281,8 @@ print '</tr>';
print '</form>';
// Only rodolphe and auguria menu manage canvas menu (auguria not correctly yet)
if (eregi('^rodolphe',$conf->left_menu) || eregi('^auguria',$conf->left_menu))
// Old canvas feature
if ($conf->global->PRODUCT_CANVAS_ABILITY)
{
// Propose utilisation de canvas.
// Ces derniers ne sont geres que par le menu default
@ -289,17 +293,6 @@ if (eregi('^rodolphe',$conf->left_menu) || eregi('^auguria',$conf->left_menu))
print " <td align=\"right\" width=\"60\">".$langs->trans("Value")."</td>\n";
print " <td width=\"80\">&nbsp;</td></tr>\n";
print '<form method="post" action="produit.php">';
print '<input type="hidden" name="action" value="ProductCanvasAbility">';
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("ProductCanvasAbility").'</td>';
print '<td width="60" align="right">';
print $html->selectyesno("ProductCanvasAbility",$conf->global->PRODUCT_CANVAS_ABILITY,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td>";
print '</tr></form>';
require_once(DOL_DOCUMENT_ROOT . "/product.class.php");
$dir = DOL_DOCUMENT_ROOT . "/product/canvas/";

View File

@ -118,7 +118,7 @@ class RejetPrelevement
// certaines install de PHP renvoie uniquement la partie
// entiere negative
$pai->amounts[$facs[$i]] = ereg_replace(",",".",($fac->total_ttc * -1));
$pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1);
$pai->datepaye = $this->db->idate($date_rejet);
$pai->paiementid = 3; // prélèvement
$pai->num_paiement = "Rejet";

View File

@ -504,9 +504,6 @@ else // Si utilisateur externe
$conf->left_menu=$conf->global->MAIN_MENUFRONT_BARRELEFT;
}
// Only rodolphe and auguria menu manage canvas menu (auguria not correctly yet)
if (! eregi('^rodolphe',$conf->left_menu) && ! eregi('^auguria',$conf->left_menu)) $conf->global->PRODUCT_CANVAS_ABILITY=0;
// For modules using Smarty
if ($conf->global->MAIN_NEED_SMARTY)

View File

@ -370,8 +370,9 @@ class Product extends CommonObject
$this->weight_units = trim($this->weight_units);
$this->volume = price2num($this->volume);
$this->volume_units = trim($this->volume_units);
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->finished)) $this->finished = 0;
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->finished)) $this->finished = 0;
if (empty($this->seuil_stock_alerte)) $this->seuil_stock_alerte = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
$sql .= " SET label = '" . addslashes($this->libelle) ."'";
@ -383,7 +384,7 @@ class Product extends CommonObject
$sql .= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
$sql .= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
$sql .= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
$sql .= ",seuil_stock_alerte = '" . $this->seuil_stock_alerte."'";
$sql .= ",seuil_stock_alerte = " . ($this->seuil_stock_alerte!='' ? $this->seuil_stock_alerte : "null");
$sql .= ",description = '" . addslashes($this->description) ."'";
$sql .= ",stock_loc = '" . addslashes($this->stock_loc) ."'";
$sql .= ",note = '" . addslashes($this->note) ."'";

File diff suppressed because it is too large Load Diff

View File

@ -283,7 +283,7 @@ class MouvementStock
if ( strftime('%Y%m%d',$entrepot_value_date) == strftime('%Y%m%d',$now) )
{
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot_valorisation";
$sql.= " SET valo_pmp='".ereg_replace(",",".",$new_value)."'";
$sql.= " SET valo_pmp='".price2num($new_value)."'";
$sql.= " WHERE fk_entrepot = $entrepot_id ";
$sql.= " AND ".$this->db->pdate("date_calcul")."='".$entrepot_value_date."';";
}
@ -292,7 +292,7 @@ class MouvementStock
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot_valorisation";
$sql.= " (date_calcul, fk_entrepot, valo_pmp)";
$sql.= " VALUES (".$this->db->idate(mktime()).", ".$entrepot_id;
$sql.= ",'".ereg_replace(",",".",$new_value)."');";
$sql.= ",'".price2num($new_value)."')";
}
if ($this->db->query($sql))
@ -309,7 +309,7 @@ class MouvementStock
if ($error === 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot";
$sql.= " SET valo_pmp='".ereg_replace(",",".",$new_value)."'";
$sql.= " SET valo_pmp='".price2num($new_value)."'";
$sql.= " WHERE rowid = $entrepot_id ";
if ($this->db->query($sql))

View File

@ -352,7 +352,7 @@ if (sizeof($factures_prev) > 0)
*/
$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;
if (!$db->query($sql))