Ajout logs
This commit is contained in:
parent
15fdea2460
commit
7c5f1c1b66
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user