mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
creation of prelevement_bon only for 1 demande
This commit is contained in:
parent
646c1b1502
commit
be2ee21462
|
|
@ -747,9 +747,10 @@ class BonPrelevement extends CommonObject
|
|||
* @param string $executiondate Date to execute the transfer
|
||||
* @param int $notrigger Disable triggers
|
||||
* @param string $type 'direct-debit' or 'bank-transfer'
|
||||
* @param int $did ID of payment request
|
||||
* @return int <0 if KO, No of invoice included into file if OK
|
||||
*/
|
||||
public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit')
|
||||
public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit', $did = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
|
|
@ -811,7 +812,9 @@ class BonPrelevement extends CommonObject
|
|||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND f.total_ttc > 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
|
||||
if ($did > 0) {
|
||||
$sql .= " AND pfd.rowid = '".$this->db->escape($did)."'";
|
||||
}
|
||||
dol_syslog(__METHOD__."::Read invoices,", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
|
|||
|
|
@ -1442,8 +1442,8 @@ abstract class CommonInvoice extends CommonObject
|
|||
}
|
||||
|
||||
// TODO Create a prelevement_bon and set its status to sent instead of this
|
||||
$bon = new BonPrelevement($db);
|
||||
$nbinvoices = $bon->create();
|
||||
$bon = new BonPrelevement($this->db);
|
||||
$nbinvoices = $bon->create(0, 0, 'real', 'ALL', '', 0, 'direct-debit', $did);
|
||||
if ($nbinvoices <= 0) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
|
|
@ -1451,12 +1451,14 @@ abstract class CommonInvoice extends CommonObject
|
|||
$this->errors[] = "Error on BonPrelevement creation";
|
||||
}
|
||||
|
||||
$result = $bon->set_infotrans($user, $now, 'internet');
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog("Error on BonPrelevement creation", LOG_ERR);
|
||||
$this->errors[] = "Error on BonPrelevement creation";
|
||||
if (!$errorforinvoice) {
|
||||
$result = $bon->set_infotrans($user, $now, 'internet');
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errorforinvoice++;
|
||||
dol_syslog("Error on BonPrelevement creation", LOG_ERR);
|
||||
$this->errors[] = "Error on BonPrelevement creation";
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errorforinvoice) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user