forked from Wavyzz/dolibarr
Merge pull request #11775 from atm-ph/fix_9.0_withdraw_trigger_create_missing
NEW Add trigger DIRECT_DEBIT_ORDER_CREATE on widthdraw is missing
This commit is contained in:
@@ -772,17 +772,18 @@ class BonPrelevement extends CommonObject
|
||||
* Create a withdraw
|
||||
* TODO delete params banque and agence when not necesary
|
||||
*
|
||||
* @param int $banque dolibarr mysoc bank
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param int $banque dolibarr mysoc bank
|
||||
* @param int $agence dolibarr mysoc bank office (guichet)
|
||||
* @param string $mode real=do action, simu=test only
|
||||
* @param string $format FRST, RCUR or ALL
|
||||
* @param string $executiondate Date to execute the transfer
|
||||
* @param string $executiondate Date to execute the transfer
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, nbre of invoice withdrawed if OK
|
||||
*/
|
||||
public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '')
|
||||
public function Create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs, $user;
|
||||
|
||||
dol_syslog(__METHOD__."::Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
|
||||
|
||||
@@ -1091,6 +1092,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
$this->factures = $factures_prev_id;
|
||||
$this->context['factures_prev'] = $factures_prev;
|
||||
|
||||
// Generation of SEPA file $this->filename
|
||||
$this->generate($format, $executiondate);
|
||||
@@ -1114,6 +1116,14 @@ class BonPrelevement extends CommonObject
|
||||
dol_syslog(__METHOD__."::Error update total: ".$this->db->error(), LOG_ERR);
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
Reference in New Issue
Block a user