diff --git a/htdocs/lib/mysql.lib.php b/htdocs/lib/mysql.lib.php index 527bb6e75fa..b3809a807f4 100644 --- a/htdocs/lib/mysql.lib.php +++ b/htdocs/lib/mysql.lib.php @@ -273,7 +273,10 @@ class DoliDb { { $query = trim($query); //print "

$query

\n"; + $this->lastquery=$query; + $this->results = mysql_query($query, $this->db); + return $this->results; } @@ -407,6 +410,16 @@ class DoliDb { 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. \return error_text diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index 2ba63d4d260..76a7c1b36d4 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -100,18 +100,19 @@ class Paiement { $facid = $key; $value = trim($value); - $amount = round(ereg_replace(",",".",$value), 2); + $amount = ereg_replace(",",".",round($value, 2)); if (is_numeric($amount)) { $total += $amount; } } + $total = ereg_replace(",",".",$total); if ($total > 0) { $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) ) { @@ -130,13 +131,16 @@ class Paiement $sql .= " VALUES ('".$facid."','". $this->id."','". $amount."')"; if (! $this->db->query($sql) ) { + print dolibarr_print_error($this->db); $sql_err++; } } } + } else { + print dolibarr_print_error($this->db); $sql_err++; } }