2
0
forked from Wavyzz/dolibarr

Fix : use RUM if defined in bank account

This commit is contained in:
Maxime Kohlhaas
2019-07-09 18:13:06 +02:00
parent 8b0b824471
commit 0aa42fefae

View File

@@ -1349,7 +1349,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
@@ -1375,7 +1375,7 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum, $obj->rum);
$this->total = $this->total + $obj->somme;
$i++;
}
@@ -1586,9 +1586,10 @@ class BonPrelevement extends CommonObject
* @param string $row_bic rib.bic AS bic,
* @param string $row_datec rib.datec,
* @param string $row_drum rib.rowid used to generate rum
* @param string $row_rum rib.rum Rum defined on company bank account
* @return string Return string with SEPA part DrctDbtTxInf
*/
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum)
{
// phpcs:enable
global $conf;
@@ -1597,7 +1598,7 @@ class BonPrelevement extends CommonObject
// Define value for RUM
// Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId)
$Rum = $this->buildRumNumber($row_code_client, $row_datec, $row_drum);
$Rum = empty($row_rum) ? $this->buildRumNumber($row_code_client, $row_datec, $row_drum) : $row_rum;
// Define date of RUM signature
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');