From da8a1cb47507cfcb2fea6888b8166c71df5fdf0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 15:38:20 +0200 Subject: [PATCH] Fix: Iban was used instead of Bic into SEPA file. Fix: Must unaccent strings into SEPA file. --- ChangeLog | 2 ++ .../class/bonprelevement.class.php | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e060f84ad15..f8193c0ce1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ For users: - Fix: Trigger on create category call failed because user is not passed on card - Fix: list event view lost type event filter - Fix: Save also code event +- Fix: Iban was used instead of Bic into SEPA file. +- Fix: Must unaccent strings into SEPA file. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 417f4362000..5c21c3c5fbf 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1219,11 +1219,11 @@ class BonPrelevement extends CommonObject /** - * Generate a withdrawal file. Generation Formats: - * France: CFONB - * Spain: AEB19 (if external module EsAEB is enabled) - * Others: Warning message - * File is generated with name this->filename + * Generate a withdrawal file. + * Generation Formats: + * - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled) + * - Others countries: Warning message + * File is generated with name this->filename * * @return int 0 if OK, <0 if KO */ @@ -1410,7 +1410,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - + $sql = "SELECT pl.amount"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; @@ -1419,14 +1419,14 @@ class BonPrelevement extends CommonObject $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; $sql.= " AND pf.fk_facture = f.rowid"; - + //Lines $i = 0; $resql=$this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1574,7 +1574,7 @@ class BonPrelevement extends CommonObject * @param string $row_bic rib.bic AS bic, * @param string $row_datec soc.datec, * @param string $row_drum soc.rowid AS drum - * @return void + * @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) { @@ -1598,15 +1598,15 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.$row_iban.''.$CrLf; + $XML_DEBITOR .=' '.$row_bic.''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.strtoupper($row_nom).''.$CrLf; + $XML_DEBITOR .=' '.strtoupper(dol_string_unaccent($row_nom)).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$row_country_code.''.$CrLf; $XML_DEBITOR .=' '.strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")).''.$CrLf; - $XML_DEBITOR .=' '.$row_zip.' '.$row_town.''.$CrLf; + $XML_DEBITOR .=' '.dol_string_unaccent($row_zip.' '.$row_town).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1689,7 +1689,8 @@ class BonPrelevement extends CommonObject } /** - * Write sender of request (me) + * Write sender of request (me). + * Note: The tag PmtInf is opened here but closed into caller * * @param string $configuration conf * @param date $ladate Date