From fd18aa8717920b4e657fe6f2da630c7309586139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 20 Feb 2015 10:17:02 +0100 Subject: [PATCH 1/3] Better fix for Bug #1825 --- htdocs/core/lib/agenda.lib.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index c9773372e93..5bd0bc5ee95 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -140,26 +140,28 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh { if (count($showextcals) > 0) { - print ' ' . $langs->trans("LocalAgenda") . ''; + print ''; + //jQuery Learning "How do I select an element by an ID that has characters used in CSS notation?" + //http://learn.jquery.com/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation/ + print ''; + print ' ' . $langs->trans("LocalAgenda") . ''; foreach ($showextcals as $val) { $htmlname = dol_string_nospecial($val['name']); print ''; - print '' . "\n"; print ' ' . $val ['name']; print ''; } From bfe9bf7a478c4eefe66af7c10d1e5c63c79183c3 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 27 Feb 2015 17:55:15 +0100 Subject: [PATCH 2/3] Fix: Bad SEPA xml file creation --- ChangeLog | 1 + .../class/bonprelevement.class.php | 41 +++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index c50c42acb21..927ed0e7a24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1830 ] Salaries payment only allows checking accounts - Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work - Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key +- Fix: Bad SEPA xml file creation ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7f0b693391e..0a9884bbcd3 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1326,12 +1326,26 @@ class BonPrelevement extends CommonObject $dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S'); $fileDebiteurSection = ''; $fileEmetteurSection = ''; - $i = 0; + $i = $j = 0; $this->total = 0; /* * section Debiteur (sepa Debiteurs bloc lines) */ + + $sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_pays as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1"; + $resql=$this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + while ($j < $num) + { + $objfac = $this->db->fetch_object($resql); + $ListOfFactures = $ListOfFactures . $objfac->fac . ","; + $j++; + } + } + $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, soc.datec, p.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.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; @@ -1357,7 +1371,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->facnumber, $obj->idfac, $obj->iban, $obj->bic, $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, $ListOfFactures , $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); $this->total = $this->total + $obj->somme; $i++; } @@ -1394,13 +1408,14 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$this->total.''.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$this->raison_sociale.''.$CrLf); -/* fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' 0533883248'.$CrLf); - fputs($this->file, ' KBO-BCE'.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$conf->global->PRELEVEMENT_ICS.''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); -*/ fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); // SEPA File Emetteur if ($result != -2) @@ -1583,6 +1598,7 @@ class BonPrelevement extends CommonObject $CrLf = "\n"; $Rowing = sprintf("%06d", $row_idfac); $Date_Rum = strtotime($row_datec); + $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); $pre = ($date_Rum > 1359673200) ? 'Rum' : '++R'; $Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum); $XML_DEBITOR =''; @@ -1590,11 +1606,11 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.('AS-'.$row_facnumber.'-'.$Rowing).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.round($row_somme, 2).''.$CrLf; + $XML_DEBITOR .=' '.round($row_somme, 2).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$Rum.''.$CrLf; - $XML_DEBITOR .=' '.$row_datec.''.$CrLf; + $XML_DEBITOR .=' '.$DtOfSgntr.''.$CrLf; $XML_DEBITOR .=' false'.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1607,17 +1623,18 @@ class BonPrelevement extends CommonObject $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 .=' '.strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")).''.$CrLf; $XML_DEBITOR .=' '.dol_string_unaccent($row_zip.' '.$row_town).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.$row_iban.''.$CrLf; + $XML_DEBITOR .=' '.preg_replace('/\s/', '', $row_iban).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.($row_facnumber.'/'.$Rowing.'/'.$Rum).''.$CrLf; + // $XML_DEBITOR .=' '.($row_facnumber.'/'.$Rowing.'/'.$Rum).''.$CrLf; + $XML_DEBITOR .=' '.$row_facnumber.''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; return $XML_DEBITOR; From 7ca8fdb20cd833d11ed1b693cadd36ffe521bca3 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 27 Feb 2015 17:58:19 +0100 Subject: [PATCH 3/3] PHP norms --- htdocs/compta/prelevement/class/bonprelevement.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0a9884bbcd3..b90b0dc6c25 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1326,7 +1326,8 @@ class BonPrelevement extends CommonObject $dateTime_ECMA = dol_print_date($date_actu, '%Y-%m-%dT%H:%M:%S'); $fileDebiteurSection = ''; $fileEmetteurSection = ''; - $i = $j = 0; + $i = 0; + $j = 0; $this->total = 0; /*