Withdrawals: Add bank transaction for refused withdrawals

This commit is contained in:
Juanjo Menent 2011-01-31 21:39:23 +00:00
parent e1e6629043
commit 5d1a032cd1

View File

@ -77,7 +77,7 @@ class RejetPrelevement
$this->bon_id = $bonid; $this->bon_id = $bonid;
dol_syslog("RejetPrelevement::Create id $id"); dol_syslog("RejetPrelevement::Create id $id");
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
$facs = $this->_get_list_factures(); $facs = $this->_get_list_factures();
$this->db->begin(); $this->db->begin();
@ -140,11 +140,12 @@ class RejetPrelevement
$pai->paiementid = 3; // type of payment: withdrawal $pai->paiementid = 3; // type of payment: withdrawal
$pai->num_paiement = $langs->trans("StatusRefused"); $pai->num_paiement = $langs->trans("StatusRefused");
if ($pai->create($this->user, 1) == -1) // we call with no_commit if ($pai->create($this->user) == -1) // we call with no_commit
{ {
$error++; $error++;
dol_syslog("RejetPrelevement::Create Erreur creation paiement facture ".$facs[$i]); dol_syslog("RejetPrelevement::Create Erreur creation paiement facture ".$facs[$i]);
} }
$result=$pai->addPaymentToBank($user,'payment','(WithdrawalRefused)',$bankaccount);
// Payment validation // Payment validation
if ($pai->valide() < 0) if ($pai->valide() < 0)