Browse Source

Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/admin/system/database-tables.php
	htdocs/compta/prelevement/class/bonprelevement.class.php
	htdocs/core/class/commonobject.class.php
	htdocs/langs/fr_FR/withdrawals.lang
	htdocs/societe/class/societe.class.php
Laurent Destailleur 5 years ago
parent
commit
fb811a1656

+ 6 - 0
dev/resources/sepa/text.txt

@@ -1,2 +1,8 @@
+Spec for credit transfer: 
+https://docs.oracle.com/cd/E39124_01/doc.91/e60210/fields_sepa_pay_file_appx.htm#EOAEL00515
+
+To validate a SEPA file:
+xmllint --schema pain.001.001.03.xsd T200801.xml --noout
+
 To test a SEPA file: 
 https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa 

+ 1 - 1
htdocs/admin/modulehelp.php

@@ -262,7 +262,7 @@ print '<div class="centpercent">';
 
 $picto = 'object_'.$objMod->picto;
 
-print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto);
+print load_fiche_titre(($modulename ? $modulename : $moduledesc), $moreinfo, $picto, 0, '', 'titlemodulehelp');
 print '<br>';
 
 dol_fiche_head($head, $mode, '', -1);

+ 25 - 16
htdocs/admin/system/database-tables.php

@@ -28,21 +28,27 @@ require '../../main.inc.php';
 
 $langs->load("admin");
 
-if (!$user->admin)
+if (!$user->admin) {
 	accessforbidden();
+}
 
 $action = GETPOST('action', 'alpha');
 
 
 if ($action == 'convert')
 {
-    $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
+	$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ENGINE=INNODB";
 	$db->query($sql);
 }
 if ($action == 'convertutf8')
 {
-    $sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
-    $db->query($sql);
+	$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." CHARACTER SET utf8 COLLATE utf8_unicode_ci";
+	$db->query($sql);
+}
+if ($action == 'convertdynamic')
+{
+	$sql = "ALTER TABLE ".$db->escape(GETPOST("table", "aZ09"))." ROW_FORMAT=DYNAMIC;";
+	$db->query($sql);
 }
 
 
@@ -82,8 +88,8 @@ if (!$base)
 } else {
 	if ($base == 1)
 	{
-        print '<div class="div-table-responsive-no-min">';
-	    print '<table class="noborder">';
+		print '<div class="div-table-responsive-no-min">';
+		print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td colspan="2">'.$langs->trans("Type").'</td>';
@@ -112,13 +118,17 @@ if (!$base)
 
 				print '<td><a href="dbtable.php?table='.$obj->Name.'">'.$obj->Name.'</a></td>';
 				print '<td>'.$obj->Engine.'</td>';
-				if (isset($obj->Engine) && $obj->Engine == "MyISAM")
-				{
+				if (isset($obj->Engine) && $obj->Engine == "MyISAM") {
 				    print '<td><a class="reposition" href="database-tables.php?action=convert&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDb</a></td>';
 				} else {
 					print '<td>&nbsp;</td>';
 				}
-				print '<td>'.$obj->Row_format.'</td>';
+				print '<td>';
+				print $obj->Row_format;
+				if (isset($obj->Row_format) && (in_array($obj->Row_format, array("Compact")))) {
+					print '<br><a class="reposition" href="database-tables.php?action=convertdynamic&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' Dynamic</a>';
+				}
+				print '</td>';
 				print '<td align="right">'.$obj->Rows.'</td>';
 				print '<td align="right">'.$obj->Avg_row_length.'</td>';
 				print '<td align="right">'.$obj->Data_length.'</td>';
@@ -127,9 +137,8 @@ if (!$base)
 				print '<td align="right">'.$obj->Auto_increment.'</td>';
 				print '<td align="right">'.$obj->Check_time.'</td>';
 				print '<td align="right">'.$obj->Collation;
-				if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci"))))
-				{
-				    print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
+				if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci")))) {
+					print '<br><a class="reposition" href="database-tables.php?action=convertutf8&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' UTF8</a>';
 				}
 				print '</td>';
 				print '</tr>';
@@ -142,8 +151,8 @@ if (!$base)
 
 	if ($base == 2)
 	{
-        print '<div class="div-table-responsive-no-min">';
-	    print '<table class="noborder">';
+		print '<div class="div-table-responsive-no-min">';
+		print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td>Nb of tuples</td>';
@@ -182,8 +191,8 @@ if (!$base)
 	if ($base == 4)
 	{
 		// Sqlite by PDO or by Sqlite3
-        print '<div class="div-table-responsive-no-min">';
-	    print '<table class="noborder">';
+		print '<div class="div-table-responsive-no-min">';
+		print '<table class="noborder">';
 		print '<tr class="liste_titre">';
 		print '<td>'.$langs->trans("TableName").'</td>';
 		print '<td>'.$langs->trans("NbOfRecord").'</td>';

+ 292 - 168
htdocs/compta/prelevement/class/bonprelevement.class.php

@@ -1081,7 +1081,7 @@ class BonPrelevement extends CommonObject
 			if (!$error)
 			{
 				/*
-				 * Create file of direct debit order or credit transfer into a XML file
+				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
 				 */
 
 				dol_syslog(__METHOD__."::Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
@@ -1399,7 +1399,7 @@ class BonPrelevement extends CommonObject
 	 *
 	 * @param	string	$format				FRST, RCUR or ALL
 	 * @param 	string 	$executiondate		Date to execute transfer
-	 * @param	string	$type				'direct-debit' or 'credit-transfer'
+	 * @param	string	$type				'direct-debit' or 'bank-transfer'
 	 * @return	int							>=0 if OK, <0 if KO
 	 */
 	public function generate($format = 'ALL', $executiondate = '', $type = 'direct-debit')
@@ -1427,9 +1427,9 @@ class BonPrelevement extends CommonObject
 		{
 			$found++;
 
-			if ($type == 'bank-transfer') {
+			if ($type != 'bank-transfer') {
 				/**
-				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
+				 * SECTION CREATION FICHIER SEPA - DIRECT DEBIT
 				 */
 				// SEPA Initialisation
 				$CrLf = "\n";
@@ -1443,12 +1443,12 @@ class BonPrelevement extends CommonObject
 
 				$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
 				$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
-				$fileCrediteurSection = '';
+				$fileDebiteurSection = '';
 				$fileEmetteurSection = '';
 				$i = 0;
 
 				/*
-				 * Section Creditor (sepa Crediteurs bloc lines)
+				 * Section Debitor (sepa Debiteurs bloc lines)
 				 */
 
 				$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
@@ -1456,14 +1456,14 @@ class BonPrelevement extends CommonObject
 				$sql .= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
 				$sql .= " FROM";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
-				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
 				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
 				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
 				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
 				$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
 				$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
-				$sql .= " AND pf.fk_facture_fourn = f.rowid";
+				$sql .= " AND pf.fk_facture = f.rowid";
 				$sql .= " AND soc.fk_pays = c.rowid";
 				$sql .= " AND soc.rowid = f.fk_soc";
 				$sql .= " AND rib.fk_soc = f.fk_soc";
@@ -1471,7 +1471,7 @@ class BonPrelevement extends CommonObject
 				$sql .= " AND rib.type = 'ban'";
 				//print $sql;
 
-				// Define $fileCrediteurSection. One section DrctDbtTxInf per invoice.
+				// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
 				$resql = $this->db->query($sql);
 				if ($resql)
 				{
@@ -1480,32 +1480,32 @@ class BonPrelevement extends CommonObject
 					{
 						$obj = $this->db->fetch_object($resql);
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
-						$fileCrediteurSection .= $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, $daterum, $obj->drum, $obj->rum);
+						$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, $daterum, $obj->drum, $obj->rum, $type);
 						$this->total = $this->total + $obj->somme;
 						$i++;
 					}
 					$nbtotalDrctDbtTxInf = $i;
 				} else {
-					fputs($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
+					fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
 					$result = -2;
 				}
 
 				// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf
 				if ($result != -2)
 				{
-					$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format);
+					$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format, $type);
 				}
 
 				/**
-				 * SECTION CREATION SEPA FILE - CREDTI TRANSFER - ISO200022
+				 * SECTION CREATION SEPA FILE - ISO200022
 				 */
 				// SEPA File Header
 				fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
-				fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
-				fputs($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
+				fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
+				fputs($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
 				// SEPA Group header
 				fputs($this->file, '		<GrpHdr>'.$CrLf);
-				fputs($this->file, '			<MsgId>'.('CREDTRANS'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
+				fputs($this->file, '			<MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
 				fputs($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
 				fputs($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
 				fputs($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
@@ -1520,19 +1520,19 @@ class BonPrelevement extends CommonObject
 				fputs($this->file, '				</Id>'.$CrLf);
 				fputs($this->file, '			</InitgPty>'.$CrLf);
 				fputs($this->file, '		</GrpHdr>'.$CrLf);
-				// SEPA File Emetteur (mycompany)
+				// SEPA File Emetteur
 				if ($result != -2)
 				{	fputs($this-> file, $fileEmetteurSection); }
-				// SEPA File Creditors
+				// SEPA File Debiteurs
 				if ($result != -2)
-				{	fputs($this-> file, $fileCrediteurSection); }
+				{	fputs($this-> file, $fileDebiteurSection); }
 				// SEPA FILE FOOTER
 				fputs($this->file, '		</PmtInf>'.$CrLf);
-				fputs($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
+				fputs($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
 				fputs($this->file, '</Document>'.$CrLf);
 			} else {
 				/**
-				 * SECTION CREATION FICHIER SEPA
+				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
 				 */
 				// SEPA Initialisation
 				$CrLf = "\n";
@@ -1546,27 +1546,27 @@ class BonPrelevement extends CommonObject
 
 				$dateTime_YMD = dol_print_date($date_actu, '%Y%m%d');
 				$dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S');
-				$fileDebiteurSection = '';
+				$fileCrediteurSection = '';
 				$fileEmetteurSection = '';
 				$i = 0;
 
 				/*
-				 * Section Debitor (sepa Debiteurs bloc lines)
+				 * Section Creditor (sepa Crediteurs bloc lines)
 				 */
 
 				$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.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
+				$sql .= " f.ref as fac, pf.fk_facture_fourn as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
 				$sql .= " FROM";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
-				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,";
 				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
 				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
 				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
 				$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
 				$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
-				$sql .= " AND pf.fk_facture = f.rowid";
+				$sql .= " AND pf.fk_facture_fourn = f.rowid";
 				$sql .= " AND soc.fk_pays = c.rowid";
 				$sql .= " AND soc.rowid = f.fk_soc";
 				$sql .= " AND rib.fk_soc = f.fk_soc";
@@ -1574,7 +1574,7 @@ class BonPrelevement extends CommonObject
 				$sql .= " AND rib.type = 'ban'";
 				//print $sql;
 
-				// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
+				// Define $fileCrediteurSection. One section DrctDbtTxInf per invoice.
 				$resql = $this->db->query($sql);
 				if ($resql)
 				{
@@ -1583,32 +1583,34 @@ class BonPrelevement extends CommonObject
 					{
 						$obj = $this->db->fetch_object($resql);
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
-						$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, $daterum, $obj->drum, $obj->rum);
+						$fileCrediteurSection .= $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, $daterum, $obj->drum, $obj->rum, $type);
 						$this->total = $this->total + $obj->somme;
 						$i++;
 					}
 					$nbtotalDrctDbtTxInf = $i;
-				} else {
-					fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
+				}
+				else
+				{
+					fputs($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
 					$result = -2;
 				}
 
 				// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all $nbtotalDrctDbtTxInf
 				if ($result != -2)
 				{
-					$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format);
+					$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format, $type);
 				}
 
 				/**
-				 * SECTION CREATION SEPA FILE - ISO200022
+				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
 				 */
 				// SEPA File Header
 				fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
-				fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
-				fputs($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
+				fputs($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
+				fputs($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
 				// SEPA Group header
 				fputs($this->file, '		<GrpHdr>'.$CrLf);
-				fputs($this->file, '			<MsgId>'.('PREL'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
+				fputs($this->file, '			<MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
 				fputs($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
 				fputs($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
 				fputs($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
@@ -1623,15 +1625,15 @@ class BonPrelevement extends CommonObject
 				fputs($this->file, '				</Id>'.$CrLf);
 				fputs($this->file, '			</InitgPty>'.$CrLf);
 				fputs($this->file, '		</GrpHdr>'.$CrLf);
-				// SEPA File Emetteur
+				// SEPA File Emetteur (mycompany)
 				if ($result != -2)
 				{	fputs($this-> file, $fileEmetteurSection); }
-				// SEPA File Debiteurs
+				// SEPA File Creditors
 				if ($result != -2)
-				{	fputs($this-> file, $fileDebiteurSection); }
+				{	fputs($this-> file, $fileCrediteurSection); }
 				// SEPA FILE FOOTER
 				fputs($this->file, '		</PmtInf>'.$CrLf);
-				fputs($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
+				fputs($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
 				fputs($this->file, '</Document>'.$CrLf);
 			}
 		}
@@ -1639,15 +1641,15 @@ class BonPrelevement extends CommonObject
 		// Build file for Other Countries with unknow format
 		if (!$found)
 		{
-			if ($type == 'bank-transfer') {
+			if ($type != 'bank-transfer') {
 				$sql = "SELECT pl.amount";
 				$sql .= " FROM";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
-				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
 				$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
 				$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
-				$sql .= " AND pf.fk_facture_fourn = f.rowid";
+				$sql .= " AND pf.fk_facture = f.rowid";
 
 				// Lines
 				$i = 0;
@@ -1671,11 +1673,11 @@ class BonPrelevement extends CommonObject
 				$sql = "SELECT pl.amount";
 				$sql .= " FROM";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
-				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
 				$sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf";
 				$sql .= " WHERE pl.fk_prelevement_bons = ".$this->id;
 				$sql .= " AND pl.rowid = pf.fk_prelevement_lignes";
-				$sql .= " AND pf.fk_facture = f.rowid";
+				$sql .= " AND pf.fk_facture_fourn = f.rowid";
 
 				// Lines
 				$i = 0;
@@ -1712,6 +1714,22 @@ class BonPrelevement extends CommonObject
 	}
 
 
+	/**
+	 * Generate dynamically a RUM number for a customer bank account
+	 *
+	 * @param	string		$row_code_client	Customer code (soc.code_client)
+	 * @param	int			$row_datec			Creation date of bank account (rib.datec)
+	 * @param	string		$row_drum			Id of customer bank account (rib.rowid)
+	 * @return 	string		RUM number
+	 */
+	public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
+	{
+		global $langs;
+		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
+		return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
+	}
+
+
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Write recipient of request (customer)
@@ -1725,9 +1743,11 @@ class BonPrelevement extends CommonObject
 	 *	@param	string	$ref		ref of invoice
 	 *	@param	int		$facid			id of invoice
 	 *  @param	string	$rib_dom		rib domiciliation
+	 *  @param	string	$type			'direct-debit' or 'bank-transfer'
 	 *	@return	void
+	 *  @see EnregDestinataireSEPA()
 	 */
-	public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '')
+	public function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '', $type = 'direct-debit')
 	{
 		// phpcs:enable
 		fputs($this->file, "06");
@@ -1784,22 +1804,6 @@ class BonPrelevement extends CommonObject
 		fputs($this->file, "\n");
 	}
 
-
-	/**
-	 * Build RUM number for a customer bank account
-	 *
-	 * @param	string		$row_code_client	Customer code (soc.code_client)
-	 * @param	int			$row_datec			Creation date of bank account (rib.datec)
-	 * @param	string		$row_drum			Id of customer bank account (rib.rowid)
-	 * @return 	string		RUM number
-	 */
-	public static function buildRumNumber($row_code_client, $row_datec, $row_drum)
-	{
-		global $langs;
-		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
-		return $pre.'-'.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
-	}
-
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
 	 *	Write recipient of request (customer)
@@ -1821,9 +1825,11 @@ class BonPrelevement extends CommonObject
 	 *	@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
+	 *  @param	string		$type				'direct-debit' or 'bank-transfer'
 	 *	@return	string							Return string with SEPA part DrctDbtTxInf
+	 *  @see EnregDestinataire()
 	 */
-	public 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_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum)
+	public 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_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum, $row_rum, $type = 'direct-debit')
 	{
 		// phpcs:enable
 		global $conf;
@@ -1831,7 +1837,7 @@ class BonPrelevement extends CommonObject
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 
 		$CrLf = "\n";
-		$Rowing = sprintf("%06d", $row_idfac);
+		$Rowing = sprintf("%010d", $row_idfac);
 
 		// Define value for RUM
 		// Example:  RUMCustomerCode-CustomerBankAccountId-01424448606	(note: Date is date of creation of CustomerBankAccountId)
@@ -1840,57 +1846,108 @@ class BonPrelevement extends CommonObject
 		// Define date of RUM signature
 		$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
 
-		$XML_DEBITOR = '';
-		$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
-		$XML_DEBITOR .= '				<PmtId>'.$CrLf;
-		// $XML_DEBITOR .='					<EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf;          // ISO20022 states that EndToEndId has a MaxLength of 35 characters
-		$XML_DEBITOR .= '					<EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
-		$XML_DEBITOR .= '				</PmtId>'.$CrLf;
-		$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
-		$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
-		$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
-		$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
-		$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
-		$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
-		$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
-		$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
-		$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
-		$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
-		$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
-		$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
-		$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
-		$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
-		$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
-		$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
-		$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
-		$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
-		$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
-		if (trim($addressline1)) 	$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
-		if (trim($addressline2))	$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
-		$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
-		$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
-		$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
-		$XML_DEBITOR .= '					<Id>'.$CrLf;
-		$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
-		$XML_DEBITOR .= '					</Id>'.$CrLf;
-		$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
-		$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
-		// $XML_DEBITOR .='					<Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
-		// $XML_DEBITOR .='					<Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf;        // 140 max
-		$XML_DEBITOR .= '					<Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
-		$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
-		$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
-		return $XML_DEBITOR;
+		if ($type != 'bank-transfer') {
+			// SEPA Paiement Information of buyer for Direct debit
+			$XML_DEBITOR = '';
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
+			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
+			$XML_DEBITOR .= '					<EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
+			$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
+			$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
+			$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
+			if (trim($addressline1)) 	$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
+			if (trim($addressline2))	$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
+			// A string with some information on payment - 140 max
+			$XML_DEBITOR .= '					<Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
+			return $XML_DEBITOR;
+		} else {
+			// SEPA Paiement Information of seller for Credit Transfer
+			$XML_CREDITOR = '';
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
+			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
+			$XML_CREDITOR .= '					<EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
+			$XML_CREDITOR .= '					<InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
+			/*
+			$XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
+			$XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
+			$XML_CREDITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
+			$XML_CREDITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
+			$XML_CREDITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
+			$XML_CREDITOR .= '					</MndtRltdInf>'.$CrLf;
+			$XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
+			*/
+			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
+			$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
+			$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town) ? ' ' : ''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
+			if (trim($addressline1)) 	$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline1, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
+			if (trim($addressline2))	$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc($addressline2, 70, 'right', 'UTF-8', true)).'</AdrLine>'.$CrLf;
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
+			// A string with some information on payment - 140 max
+			$XML_CREDITOR .= '					<Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135)).'</Ustrd>'.$CrLf; // 140 max
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
+			return $XML_CREDITOR;
+		}
 	}
 
 
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
 	/**
-	 *	Write sender of request (me)
+	 *	Write sender of request (me).
 	 *
+	 *  @param	string		$type				'direct-debit' or 'bank-transfer'
 	 *	@return	void
+	 *  @see EnregEmetteurSEPA()
 	 */
-	public function EnregEmetteur()
+	public function EnregEmetteur($type = 'direct-debit')
 	{
 		// phpcs:enable
 		fputs($this->file, "03");
@@ -1962,9 +2019,11 @@ class BonPrelevement extends CommonObject
 	 *	@param	float	$total			Total
 	 *	@param	string	$CrLf			End of line character
 	 *  @param	string	$format			FRST or RCUR or ALL
+	 *  @param	string	$type			'direct-debit' or 'bank-transfer'
 	 *	@return	string					String with SEPA Sender
+	 *  @see EnregEmetteur()
 	 */
-	public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST')
+	public function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST', $type = 'direct-debit')
 	{
 		// phpcs:enable
 		// SEPA INITIALISATION
@@ -1991,7 +2050,7 @@ class BonPrelevement extends CommonObject
 			$this->raison_sociale = $account->proprio;
 		}
 
-		// Récupération info demandeur
+		// Get pending payments
 		$sql = "SELECT rowid, ref";
 		$sql .= " FROM";
 		$sql .= " ".MAIN_DB_PREFIX."prelevement_bons as pb";
@@ -2002,70 +2061,135 @@ class BonPrelevement extends CommonObject
 		{
 			$obj = $this->db->fetch_object($resql);
 
-			// DONNEES BRUTES : par la suite Rows['XXX'] de la requete au dessus
 			$country = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY);
 			$IdBon  = sprintf("%05d", $obj->rowid);
 			$RefBon = $obj->ref;
 
-			// SEPA Paiement Information
-			$XML_SEPA_INFO = '';
-			$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
-			$XML_SEPA_INFO .= '			<PmtInfId>'.('PREL'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
-			$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
-			$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
-			$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
-			$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
-			$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
-			$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
-			$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
-			$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
-			$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
-			$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
-			$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
-			$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
-			$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
-			$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
-			$XML_SEPA_INFO .= '				<Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
-			$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
-			$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
-			$addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")));
-			$addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")));
-			if ($addressline1)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline1.'</AdrLine>'.$CrLf;
-			if ($addressline2)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline2.'</AdrLine>'.$CrLf;
-			$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
-			$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
-			$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
-			$XML_SEPA_INFO .= '				<Id>'.$CrLf;
-			$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
-			$XML_SEPA_INFO .= '				</Id>'.$CrLf;
-			$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
-			$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
-			$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
-			$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
-			$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
-			$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
-			/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
-			 $XML_SEPA_INFO .= '				<Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
-			 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
-			 $XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
-			 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
-			 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
-			 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
-			 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
-			$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf;
-			$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
-			$XML_SEPA_INFO .= '				<Id>'.$CrLf;
-			$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
-			$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
-			$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
-			$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
-			$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
-			$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
-			$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
-			$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
-			$XML_SEPA_INFO .= '				</Id>'.$CrLf;
-			$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
-		} else {
+			if ($type != 'bank-transfer') {
+				// SEPA Paiement Information of my company for Direct debit
+				$XML_SEPA_INFO = '';
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
+				$addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")));
+				$addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")));
+				if ($addressline1)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline1.'</AdrLine>'.$CrLf;
+				if ($addressline2)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline2.'</AdrLine>'.$CrLf;
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
+				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
+				 $XML_SEPA_INFO .= '				<Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
+				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
+				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
+				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf;		// Field "Responsible of fees". Must be SLEV
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
+			} else {
+				// SEPA Paiement Information of my company for Credit Transfer
+				$XML_SEPA_INFO = '';
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
+				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
+				/*
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Cd>TRF</Cd>'.$CrLf;
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
+				$XML_SEPA_INFO .= '				<CtgyPurp><Cd>SECU</Cd></CtgyPurp>'.$CrLf;
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
+				*/
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
+				$addressline1 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(CHR(13) => ", ", CHR(10) => "")));
+				$addressline2 = dol_string_unaccent(strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(CHR(13) => ", ", CHR(10) => "")));
+				if ($addressline1)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline1.'</AdrLine>'.$CrLf;
+				if ($addressline2)		$XML_SEPA_INFO .= '					<AdrLine>'.$addressline2.'</AdrLine>'.$CrLf;
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
+				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
+				 $XML_SEPA_INFO .= '				<Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
+				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
+				 $XML_SEPA_INFO .= '					<AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
+				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
+				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf;		// Field "Responsible of fees". Must be SLEV
+				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
+			}
+		}
+		else
+		{
 			fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
 			$result = -2;
 		}

+ 9 - 4
htdocs/compta/prelevement/create.php

@@ -370,10 +370,15 @@ if ($resql)
 
 			// RUM
 			print '<td>';
-			print $thirdpartystatic->display_rib('rum');
-			$format = $thirdpartystatic->display_rib('format');
-			if ($type != 'bank-transfer') {
-				if ($format) print ' ('.$format.')';
+			$rumtoshow = $thirdpartystatic->display_rib('rum');
+			if ($rumtoshow) {
+				print $rumtoshow;
+				$format = $thirdpartystatic->display_rib('format');
+				if ($type != 'bank-transfer') {
+					if ($format) print ' ('.$format.')';
+				}
+			} else {
+				print img_warning($langs->trans("NoBankAccount"));
 			}
 			print '</td>';
 			// Amount

+ 8 - 9
htdocs/core/class/commonobject.class.php

@@ -5311,11 +5311,12 @@ abstract class CommonObject
 			   				$new_array_options[$key] = null;
 			   			}
 			 			break;
-					case 'double':
+			   		case 'price':
+			   		case 'double':
 						$value = price2num($value);
 						if (!is_numeric($value) && $value != '')
 						{
-							dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
+							dol_syslog($langs->trans("ExtraFieldHasWrongValue")." for ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG);
 							$this->errors[] = $langs->trans("ExtraFieldHasWrongValue", $attributeLabel);
 							return -1;
 						} elseif ($value == '')
@@ -5363,9 +5364,6 @@ abstract class CommonObject
 			   				$new_array_options[$key] = $this->array_options[$key];
 			   			}
 			   			break;
-			   		case 'price':
-						$new_array_options[$key] = price2num($this->array_options[$key]);
-						break;
 					case 'date':
 					case 'datetime':
 						// If data is a string instead of a timestamp, we convert it
@@ -5457,7 +5455,7 @@ abstract class CommonObject
     			{
     			    if (!isset($extrafields->attributes[$this->table_element]['type'][$tmpkey]))    // If field not already added previously
     			    {
-                        if (in_array($tmpval, array('int', 'double'))) $sql .= ", 0";
+                        if (in_array($tmpval, array('int', 'double', 'price'))) $sql .= ", 0";
                         else $sql .= ", ''";
     			    }
     			}
@@ -6733,7 +6731,7 @@ abstract class CommonObject
 			if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0)
 			{
 				$out .= "\n";
-				$out .= '<!-- showOptionalsInput --> ';
+				$out .= '<!-- showOptionals --> ';
 				$out .= "\n";
 
 	            $extrafields_collapse_num = '';
@@ -6867,7 +6865,7 @@ abstract class CommonObject
 						// HTML, select, integer and text add default value
 						if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('html', 'text', 'select', 'int')))
 						{
-							if ($action == 'create') $value = $extrafields->attributes[$this->table_element]['default'][$key];
+							if ($action == 'create') $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix) ? GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none', 3) : $extrafields->attributes[$this->table_element]['default'][$key];
 							else $value = $this->array_options['options_'.$key];
 						}
 
@@ -6953,7 +6951,7 @@ abstract class CommonObject
 					</script>'."\n";
 				}
 
-				$out .= '<!-- /showOptionalsInput --> '."\n";
+				$out .= '<!-- /showOptionals --> '."\n";
 			}
 		}
 
@@ -7613,6 +7611,7 @@ abstract class CommonObject
 		$now = dol_now();
 
 		$fieldvalues = $this->setSaveQuery();
+
 		if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
 		if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
 		unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.

+ 4 - 1
htdocs/core/class/translate.class.php

@@ -539,7 +539,10 @@ class Translate
     {
 		global $conf, $db;
 
-		if (!is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
+		if (!is_string($key)) {
+			//xdebug_print_function_stack('ErrorBadValueForParamNotAString');
+			return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
+		}
 
 		$newstr = $key;
 	    if (preg_match('/^Civility([0-9A-Z]+)$/i', $key, $reg))

+ 3 - 3
htdocs/langs/en_US/admin.lang

@@ -546,9 +546,9 @@ Module54Desc=Management of contracts (services or recurring subscriptions)
 Module55Name=Barcodes
 Module55Desc=Barcode management
 Module56Name=Payment by credit transfer
-Module56Desc=Management of payment of suppliers by credit transfer orders. It includes generation of SEPA file for European countries.
-Module57Name=Bank Direct Debit payments
-Module57Desc=Management of Direct Debit payment orders. It includes generation of SEPA file for European countries.
+Module56Desc=Management of payment of suppliers by Credit Transfer orders. It includes generation of SEPA file for European countries.
+Module57Name=Payments by Direct Debit
+Module57Desc=Management of Direct Debit orders. It includes generation of SEPA file for European countries.
 Module58Name=ClickToDial
 Module58Desc=Integration of a ClickToDial system (Asterisk, ...)
 Module59Name=Bookmark4u

+ 1 - 1
htdocs/langs/fr_FR/withdrawals.lang

@@ -77,7 +77,7 @@ StatusMotif8=Autre motif
 CreateForSepaFRST=Créer fichier de prélèvement (SEPA FRST)
 CreateForSepaRCUR=Créer fichier de prélèvement (SEPA RCUR)
 CreateAll=Créer le fichier de prélèvement (tout)
-CreateFileForPaymentByBankTransfer=Créer fichier pour les virements (tous)
+CreateFileForPaymentByBankTransfer=Créer un fichier de virement
 CreateSepaFileForPaymentByBankTransfer=Créer un fichier de virement (SEPA)
 CreateGuichet=Seulement guichet
 CreateBanque=Seulement banque

+ 2 - 2
htdocs/projet/card.php

@@ -178,12 +178,12 @@ if (empty($reshook))
 				if ($result < 0)
 				{
 					$langs->load("errors");
-					setEventMessages($langs->trans($object->error), null, 'errors');
+					setEventMessages($object->error, $object->errors, 'errors');
 					$error++;
 				}
 			} else {
 				$langs->load("errors");
-				setEventMessages($langs->trans($object->error), null, 'errors');
+				setEventMessages($object->error, $object->errors, 'errors');
 				$error++;
 			}
 			if (!$error && !empty($object->id) > 0)

+ 18 - 18
htdocs/societe/class/societe.class.php

@@ -2742,7 +2742,7 @@ class Societe extends CommonObject
 	 *  Return bank number property of thirdparty (label or rum)
 	 *
 	 *	@param	string	$mode	'label' or 'rum' or 'format'
-	 *  @return	string			Bank number
+	 *  @return	string			Bank label or RUM or '' if no bank account found
 	 */
     public function display_rib($mode = 'label')
 	{
@@ -2752,25 +2752,25 @@ class Societe extends CommonObject
 		$bac = new CompanyBankAccount($this->db);
 		$bac->fetch(0, $this->id);
 
-		if ($mode == 'label')
-		{
-			return $bac->getRibLabel(true);
-		} elseif ($mode == 'rum')
-		{
-			if (empty($bac->rum))
-			{
-				require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
-				$prelevement = new BonPrelevement($this->db);
-				$bac->fetch_thirdparty();
-				$bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
+		if ($bac->id > 0) {		// If a bank account has been found for company $this->id
+			if ($mode == 'label') {
+				return $bac->getRibLabel(true);
+			} elseif ($mode == 'rum') {
+				if (empty($bac->rum)) {
+					require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
+					$prelevement = new BonPrelevement($this->db);
+					$bac->fetch_thirdparty();
+					$bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id);
+				}
+				return $bac->rum;
+			} elseif ($mode == 'format') {
+				return $bac->frstrecur;
+			} else {
+				return 'BadParameterToFunctionDisplayRib';
 			}
-			return $bac->rum;
-		} elseif ($mode == 'format')
-		{
-			return $bac->frstrecur;
+		} else {
+			return '';
 		}
-
-		return 'BadParameterToFunctionDisplayRib';
 	}
 
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

+ 2 - 1
htdocs/theme/eldy/global.inc.php

@@ -3987,7 +3987,8 @@ div.boximport {
 .fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor); }
 
 td.widthpictotitle { width: 26px; text-align: <?php echo $left; ?>; }
-span.widthpictotitle { font-size: 1.7em; };
+span.widthpictotitle { font-size: 1.7em; }
+table.titlemodulehelp tr td img.widthpictotitle { width: 80px; }
 
 .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; }
 .dolgraphtitlecssboxes { /* margin: 0px; */ }

+ 1 - 0
htdocs/theme/md/style.css.php

@@ -3862,6 +3862,7 @@ div.boximport {
 .fieldrequired { font-weight: bold; color: #000055; }
 
 .widthpictotitle { width: 40px; font-size: 1.4em; text-align: <?php echo $left; ?>; }
+table.titlemodulehelp tr td img.widthpictotitle { width: 80px; }
 
 .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; }
 .dolgraphtitlecssboxes { /* margin: 0px; */ }