Withdrawals: Add bank transaction for refused withdrawals
This commit is contained in:
parent
e1e6629043
commit
5d1a032cd1
@ -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,25 +140,26 @@ 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
|
||||||
|
if ($pai->valide() < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
dol_syslog("RejetPrelevement::Create Erreur validation du paiement");
|
||||||
|
}
|
||||||
|
|
||||||
// Payment validation
|
//Tag invoice as unpaid
|
||||||
if ($pai->valide() < 0)
|
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
|
||||||
{
|
$fac->set_unpaid($fac->id, $user);
|
||||||
$error++;
|
|
||||||
dol_syslog("RejetPrelevement::Create Erreur validation du paiement");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tag invoice as unpaid
|
// Send email to sender of the standing order request
|
||||||
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
|
$this->_send_email($fac);
|
||||||
$fac->set_unpaid($fac->id, $user);
|
|
||||||
|
|
||||||
// Send email to sender of the standing order request
|
|
||||||
$this->_send_email($fac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user