From 7c5f1c1b6668bd96fcf6813fbbc5b3b941df4bf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Jan 2008 20:25:44 +0000 Subject: [PATCH] Ajout logs --- htdocs/paiement.class.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index c1d51bc4489..27662e1b9c5 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -16,9 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** @@ -26,7 +23,7 @@ \ingroup facture \brief Fichier de la classe des paiement de factures clients \remarks Cette classe est presque identique à paiementfourn.class.php - \version $Revision$ + \version $Id$ */ @@ -142,10 +139,10 @@ class Paiement if ($this->total <> 0) // On accepte les montants négatifs pour les rejets de prélèvement { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement (datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)'; - $sql .= ' VALUES (now(), '.$this->db->idate($this->datepaye).', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.addslashes($this->note).'\', '.$user->id.')'; + $sql.= ' VALUES (now(), '.$this->db->idate($this->datepaye).', \''.$this->total.'\', '.$this->paiementid.', \''.$this->num_paiement.'\', \''.addslashes($this->note).'\', '.$user->id.')'; $resql = $this->db->query($sql); - dolibarr_syslog("Paiement::Create sql=".$sql); + dolibarr_syslog("Paiement::Create insert paiement sql=".$sql); if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'paiement'); @@ -160,11 +157,12 @@ class Paiement $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiement_facture (fk_facture, fk_paiement, amount)'; $sql .= ' VALUES ('.$facid.','. $this->id.',\''.$amount.'\')'; - dolibarr_syslog("Paiement::Create sql=".$sql); + dolibarr_syslog("Paiement::Create insert paiement_facture sql=".$sql); $resql=$this->db->query($sql); if (! $resql) { - dolibarr_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid); + $this->error=$this->db->error(); + dolibarr_syslog('Paiement::Create insert paiement_facture error='.$this->error, LOG_ERR); $error++; } } @@ -186,21 +184,20 @@ class Paiement } else { - dolibarr_syslog('Paiement::Create Erreur INSERT dans paiement'); + $this->error=$this->db->error(); + dolibarr_syslog('Paiement::Create insert paiement error='.$this->error, LOG_ERR); $error++; } } - if ( $this->total <> 0 && $error == 0 ) // On accepte les montants négatifs + if ($this->total <> 0 && ! $error) // On accepte les montants négatifs { $this->db->commit(); - dolibarr_syslog('Paiement::Create Ok Total = '.$this->total); return $this->id; } else { $this->db->rollback(); - dolibarr_syslog('Paiement::Create Erreur'); return -1; } }