2
0
forked from Wavyzz/dolibarr

Correction bug sur nombre a virgule dans la saisie des paiements.

This commit is contained in:
Laurent Destailleur
2004-07-24 19:13:11 +00:00
parent 9c986def2f
commit 0c8150ddbd
2 changed files with 19 additions and 2 deletions

View File

@@ -273,7 +273,10 @@ class DoliDb {
{ {
$query = trim($query); $query = trim($query);
//print "<p>$query</p>\n"; //print "<p>$query</p>\n";
$this->lastquery=$query;
$this->results = mysql_query($query, $this->db); $this->results = mysql_query($query, $this->db);
return $this->results; return $this->results;
} }
@@ -407,6 +410,16 @@ class DoliDb {
return mysql_num_fields($this->results); return mysql_num_fields($this->results);
} }
/*!
\brief renvoie la derniere requete soumise par la methode query()
\return error_text
*/
function lastquery()
{
return $this->lastquery;
}
/*! /*!
\brief renvoie le texte de l'erreur mysql de l'operation precedente. \brief renvoie le texte de l'erreur mysql de l'operation precedente.
\return error_text \return error_text

View File

@@ -100,18 +100,19 @@ class Paiement
{ {
$facid = $key; $facid = $key;
$value = trim($value); $value = trim($value);
$amount = round(ereg_replace(",",".",$value), 2); $amount = ereg_replace(",",".",round($value, 2));
if (is_numeric($amount)) if (is_numeric($amount))
{ {
$total += $amount; $total += $amount;
} }
} }
$total = ereg_replace(",",".",$total);
if ($total > 0) if ($total > 0)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)";
$sql .= " VALUES (now(), $this->datepaye, $total, $this->paiementid, '$this->num_paiement', '$this->note', $user->id)"; $sql .= " VALUES (now(), $this->datepaye, '$total', $this->paiementid, '$this->num_paiement', '$this->note', $user->id)";
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{ {
@@ -130,13 +131,16 @@ class Paiement
$sql .= " VALUES ('".$facid."','". $this->id."','". $amount."')"; $sql .= " VALUES ('".$facid."','". $this->id."','". $amount."')";
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
print dolibarr_print_error($this->db);
$sql_err++; $sql_err++;
} }
} }
} }
} }
else else
{ {
print dolibarr_print_error($this->db);
$sql_err++; $sql_err++;
} }
} }