Completed
Branch develop (0403f4)
by
unknown
23:52
created
htdocs/compta/tva/payments.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 
32 32
 // Load Dolibarr environment
33 33
 require '../../main.inc.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/paymentvat.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40 40
 
41 41
 /**
42 42
  * @var Conf $conf
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
 
101 101
 $param = '';
102 102
 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
103
-	$param .= '&contextpage=' . $contextpage;
103
+	$param .= '&contextpage='.$contextpage;
104 104
 }
105 105
 if ($limit > 0 && $limit != $conf->liste_limit) {
106
-	$param .= '&limit=' . $limit;
106
+	$param .= '&limit='.$limit;
107 107
 }
108 108
 if ($sortfield) {
109
-	$param .= '&sortfield=' . $sortfield;
109
+	$param .= '&sortfield='.$sortfield;
110 110
 }
111 111
 if ($sortorder) {
112
-	$param .= '&sortorder=' . $sortorder;
112
+	$param .= '&sortorder='.$sortorder;
113 113
 }
114 114
 
115 115
 $center = '';
116 116
 
117 117
 if ($year) {
118
-	$param .= '&year=' . $year;
118
+	$param .= '&year='.$year;
119 119
 }
120 120
 
121 121
 $sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 $sql .= ", tva.amount as total,";
124 124
 $sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
125 125
 $sql .= " pct.code as payment_code";
126
-$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva,";
127
-$sql .= " " . MAIN_DB_PREFIX . "payment_vat as ptva";
128
-$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON (b.rowid = ptva.fk_bank)";
129
-$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as bank ON (bank.rowid = b.fk_account)";
130
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as pct ON ptva.fk_typepaiement = pct.id";
126
+$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
127
+$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
128
+$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON (b.rowid = ptva.fk_bank)";
129
+$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank_account as bank ON (bank.rowid = b.fk_account)";
130
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
131 131
 $sql .= " WHERE ptva.fk_tva = tva.rowid";
132
-$sql .= " AND tva.entity = " . $conf->entity;
132
+$sql .= " AND tva.entity = ".$conf->entity;
133 133
 if ($year > 0) {
134 134
 	$sql .= " AND (";
135 135
 	// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
136 136
 	// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
137
-	$sql .= "   (tva.datev IS NOT NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
138
-	$sql .= " OR (tva.datev IS NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
137
+	$sql .= "   (tva.datev IS NOT NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
138
+	$sql .= " OR (tva.datev IS NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
139 139
 	$sql .= ")";
140 140
 }
141 141
 if (preg_match('/^cs\./', $sortfield)
@@ -160,16 +160,16 @@  discard block
 block discarded – undo
160 160
 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $num, 'title_accountancy', 0, '', '', $limit);
161 161
 
162 162
 if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
163
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
163
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
164 164
 	if ($optioncss != '') {
165
-		print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
165
+		print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
166 166
 	}
167
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
167
+	print '<input type="hidden" name="token" value="'.newToken().'">';
168 168
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
169
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
170
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
171
-	print '<input type="hidden" name="page" value="' . $page . '">';
172
-	print '<input type="hidden" name="mode" value="' . $mode . '">';
169
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
170
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
171
+	print '<input type="hidden" name="page" value="'.$page.'">';
172
+	print '<input type="hidden" name="mode" value="'.$mode.'">';
173 173
 
174 174
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
175 175
 	print '<table class="noborder centpercent">';
@@ -195,19 +195,19 @@  discard block
 block discarded – undo
195 195
 	$sql .= ", tva.amount as total,";
196 196
 	$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
197 197
 	$sql .= " pct.code as payment_code";
198
-	$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva,";
199
-	$sql .= " " . MAIN_DB_PREFIX . "payment_vat as ptva";
200
-	$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON (b.rowid = ptva.fk_bank)";
201
-	$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as bank ON (bank.rowid = b.fk_account)";
202
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as pct ON ptva.fk_typepaiement = pct.id";
198
+	$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
199
+	$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
200
+	$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON (b.rowid = ptva.fk_bank)";
201
+	$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank_account as bank ON (bank.rowid = b.fk_account)";
202
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
203 203
 	$sql .= " WHERE ptva.fk_tva = tva.rowid";
204
-	$sql .= " AND tva.entity = " . $conf->entity;
204
+	$sql .= " AND tva.entity = ".$conf->entity;
205 205
 	if ($year > 0) {
206 206
 		$sql .= " AND (";
207 207
 		// We'll use the specified period as the date filter, unless it's missing, in which case we'll use the due date.
208 208
 		// This is to handle situations where the period was optional.
209
-		$sql .= "   (tva.datev IS NOT NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
210
-		$sql .= " OR (tva.datev IS NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
209
+		$sql .= "   (tva.datev IS NOT NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
210
+		$sql .= " OR (tva.datev IS NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
211 211
 		$sql .= ")";
212 212
 	}
213 213
 	if ($sortfield !== null
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 			print '<tr class="oddeven">';
237 237
 
238 238
 			// Ref payment
239
-			print '<td>' . $payment_vat_static->getNomUrl(1) . "</td>\n";
239
+			print '<td>'.$payment_vat_static->getNomUrl(1)."</td>\n";
240 240
 
241 241
 			// VAT
242 242
 			print '<td>';
@@ -244,28 +244,28 @@  discard block
 block discarded – undo
244 244
 			print '</td>';
245 245
 
246 246
 			// Label
247
-			print '<td class="tdoverflowmax150" title="' . dol_escape_htmltag($obj->label) . '">' . dol_escape_htmltag($obj->label) . '</td>';
247
+			print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
248 248
 
249 249
 			// Date
250 250
 			$date = $db->jdate($obj->datev);
251
-			print '<td class="center nowraponall">' . dol_print_date($date, 'day') . '</td>';
251
+			print '<td class="center nowraponall">'.dol_print_date($date, 'day').'</td>';
252 252
 
253 253
 			// Date payment
254 254
 			$datep = $db->jdate($obj->datep);
255
-			print '<td class="center nowraponall">' . dol_print_date($datep, 'day') . '</td>';
255
+			print '<td class="center nowraponall">'.dol_print_date($datep, 'day').'</td>';
256 256
 
257 257
 			// Type payment
258 258
 			$labelpaymenttype = '';
259 259
 			if ($obj->payment_code) {
260
-				$labelpaymenttype = $langs->trans("PaymentTypeShort" . $obj->payment_code) . ' ';
260
+				$labelpaymenttype = $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
261 261
 			}
262 262
 
263
-			print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag($labelpaymenttype) . '">';
263
+			print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelpaymenttype).'">';
264 264
 			print dol_escape_htmltag($labelpaymenttype);
265 265
 			print '</td>';
266 266
 
267 267
 			// Chq number
268
-			print '<td>' . dol_escape_htmltag($obj->num_payment) . '</td>';
268
+			print '<td>'.dol_escape_htmltag($obj->num_payment).'</td>';
269 269
 
270 270
 			if (isModEnabled("bank")) {
271 271
 				// Bank transaction
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 
285 285
 			// Expected to pay
286
-			print '<td class="right"><span class="amount">' . price($obj->total) . '</span></td>';
286
+			print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
287 287
 
288 288
 			// Paid
289 289
 			print '<td class="right"><span class="amount">';
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		}
300 300
 
301 301
 		// Total
302
-		print '<tr class="liste_total"><td colspan="3" class="liste_total">' . $langs->trans("Total") . '</td>';
302
+		print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
303 303
 		print '<td class="liste_total right"></td>'; // A total here has no sense
304 304
 		print '<td class="center liste_total">&nbsp;</td>';
305 305
 		print '<td class="center liste_total">&nbsp;</td>';
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		}
310 310
 		print '<td class="center liste_total">&nbsp;</td>';
311 311
 		print '<td class="center liste_total">&nbsp;</td>';
312
-		print '<td class="liste_total right">' . price($totalpaid) . "</td>";
312
+		print '<td class="liste_total right">'.price($totalpaid)."</td>";
313 313
 		print "</tr>";
314 314
 	}
315 315
 	print '</table>';
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +452 added lines, -452 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * \brief      File of withdrawal receipts class
30 30
  */
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
43 43
 
44 44
 
45 45
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
 	const STATUS_DRAFT = 0;
151 151
 	const STATUS_TRANSFERED = 1;
152
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
152
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
154 154
 
155 155
 
156 156
 	/**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 		if ($result == 0) {
341 341
 			if ($line_id > 0) {
342
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
342
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
343 343
 				if ($type != 'bank-transfer') {
344 344
 					$sql .= "fk_facture";
345 345
 				} else {
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 				$sql .= ",fk_prelevement_lignes";
353 353
 				$sql .= ") VALUES (";
354 354
 				$sql .= ((int) $invoice_id);
355
-				$sql .= ", " . ((int) $line_id);
355
+				$sql .= ", ".((int) $line_id);
356 356
 				$sql .= ")";
357 357
 
358 358
 				if ($this->db->query($sql)) {
359 359
 					$result = 0;
360 360
 				} else {
361 361
 					$result = -1;
362
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
363
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
362
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
363
+					dol_syslog(get_class($this)."::AddFacture Error $result");
364 364
 				}
365 365
 			} else {
366 366
 				$result = -2;
367
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
368
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
367
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
368
+				dol_syslog(get_class($this)."::AddFacture Error $result");
369 369
 			}
370 370
 		} else {
371 371
 			$result = -3;
372
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
372
+			dol_syslog(get_class($this)."::AddFacture Error $result");
373 373
 		}
374 374
 
375 375
 		return $result;
@@ -392,23 +392,23 @@  discard block
 block discarded – undo
392 392
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
393 393
 	{
394 394
 		$result = -1;
395
-		$concat = 0;	// ??? what is this for. Seems not used.
395
+		$concat = 0; // ??? what is this for. Seems not used.
396 396
 
397 397
 		if ($concat == 1) {
398 398
 			/*
399 399
 			 * We aggregate the lines
400 400
 			 */
401 401
 			$sql = "SELECT rowid";
402
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
403
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
402
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
403
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
404 404
 			if ($sourcetype == 'salary') {
405
-				$sql .= " AND fk_soc = " . ((int) $client_id);
405
+				$sql .= " AND fk_soc = ".((int) $client_id);
406 406
 			} else {
407
-				$sql .= " AND fk_user = " . ((int) $client_id);
407
+				$sql .= " AND fk_user = ".((int) $client_id);
408 408
 			}
409
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
410
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
411
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
409
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
410
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
411
+			$sql .= " AND number = '".$this->db->escape($number)."'";
412 412
 
413 413
 			$resql = $this->db->query($sql);
414 414
 			if ($resql) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 			/*
421 421
 			 * No aggregate
422 422
 			 */
423
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
423
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
424 424
 			$sql .= "fk_prelevement_bons";
425 425
 			$sql .= ", fk_soc";
426 426
 			$sql .= ", client_nom";
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
433 433
 			$sql .= ") VALUES (";
434 434
 			$sql .= $this->id;
435
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
436
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
437
-			$sql .= ", " . ((float) price2num($amount));
438
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
439
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
440
-			$sql .= ", '" . $this->db->escape($number) . "'";
441
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
442
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
435
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
436
+			$sql .= ", '".$this->db->escape($client_nom)."'";
437
+			$sql .= ", ".((float) price2num($amount));
438
+			$sql .= ", '".$this->db->escape($code_banque)."'";
439
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
440
+			$sql .= ", '".$this->db->escape($number)."'";
441
+			$sql .= ", '".$this->db->escape($number_key)."'";
442
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
443 443
 			$sql .= ")";
444 444
 			if ($this->db->query($sql)) {
445
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
445
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
446 446
 				$result = 0;
447 447
 			} else {
448
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
449
-				dol_syslog(get_class($this) . "::addline Error -2");
448
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
449
+				dol_syslog(get_class($this)."::addline Error -2");
450 450
 				$result = -2;
451 451
 			}
452 452
 		}
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 		$sql .= ", p.type";
490 490
 		$sql .= ", p.fk_bank_account";
491 491
 		$sql .= ", p.statut as status";
492
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
493
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
492
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
493
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
494 494
 		if ($rowid > 0) {
495
-			$sql .= " AND p.rowid = " . ((int) $rowid);
495
+			$sql .= " AND p.rowid = ".((int) $rowid);
496 496
 		} else {
497
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
497
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
498 498
 		}
499 499
 
500
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
500
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
501 501
 		$result = $this->db->query($sql);
502 502
 		if ($result) {
503 503
 			if ($this->db->num_rows($result)) {
@@ -523,13 +523,13 @@  discard block
 block discarded – undo
523 523
 				if (empty($this->status)) {		// Value is sometimes null in database
524 524
 					$this->status = 0;
525 525
 				}
526
-				$this->statut         = $this->status; // For backward compatibility
526
+				$this->statut = $this->status; // For backward compatibility
527 527
 
528 528
 				$this->fetched = 1;
529 529
 
530 530
 				return 1;
531 531
 			} else {
532
-				dol_syslog(get_class($this) . "::Fetch no record found");
532
+				dol_syslog(get_class($this)."::Fetch no record found");
533 533
 				return 0;
534 534
 			}
535 535
 		} else {
@@ -570,19 +570,19 @@  discard block
 block discarded – undo
570 570
 			if ($date < $this->date_trans) {
571 571
 				$langs->load("errors");
572 572
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
573
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
573
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
574 574
 				return -1027;
575 575
 			}
576 576
 
577 577
 			$this->db->begin();
578 578
 
579
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
580
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
581
-			$sql .= ", statut = " . self::STATUS_CREDITED;
582
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
583
-			$sql .= " WHERE rowid = " . ((int) $this->id);
584
-			$sql .= " AND entity = " . ((int) $conf->entity);
585
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
579
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
580
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
581
+			$sql .= ", statut = ".self::STATUS_CREDITED;
582
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
583
+			$sql .= " WHERE rowid = ".((int) $this->id);
584
+			$sql .= " AND entity = ".((int) $conf->entity);
585
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
586 586
 
587 587
 			$resql = $this->db->query($sql);
588 588
 			if ($resql) {
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 						$error++;
697 697
 						$this->error = $paiement->error;
698 698
 						$this->errors = $paiement->errors;
699
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
699
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
700 700
 					} else {
701 701
 						if ($this->type == 'bank-transfer') {
702 702
 							if ($type == 'salary') {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						} else {
712 712
 							$modeforaddpayment = 'payment';
713 713
 							$labelforaddpayment = '(CustomerInvoicePayment)';
714
-							$addbankurl = 'direct-debit';	// = 'directdebit'
714
+							$addbankurl = 'direct-debit'; // = 'directdebit'
715 715
 						}
716 716
 
717 717
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 							$error++;
727 727
 							$this->error = $paiement->error;
728 728
 							$this->errors = $paiement->errors;
729
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
729
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
730 730
 						}
731 731
 					}
732 732
 				}
@@ -734,24 +734,24 @@  discard block
 block discarded – undo
734 734
 				// Update withdrawal line
735 735
 				// TODO: Translate to ligneprelevement.class.php
736 736
 				if (!$error) {
737
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
737
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
738 738
 					$sql .= " SET statut = 2";
739
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
739
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
740 740
 
741 741
 					if (!$this->db->query($sql)) {
742
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
742
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
743 743
 						$error++;
744 744
 					}
745 745
 				}
746 746
 			} else {
747 747
 				$this->error = $this->db->lasterror();
748
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
748
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
749 749
 				$error++;
750 750
 			}
751 751
 
752 752
 			// End of procedure
753 753
 			if ($error == 0) {
754
-				$this->date_credit = $date;		// date credit or debit
754
+				$this->date_credit = $date; // date credit or debit
755 755
 				$this->statut = self::STATUS_CREDITED;
756 756
 				$this->status = self::STATUS_CREDITED;
757 757
 
@@ -782,17 +782,17 @@  discard block
 block discarded – undo
782 782
 
783 783
 		$error = 0;
784 784
 
785
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
785
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
786 786
 
787 787
 		if ($this->db->begin()) {
788
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
789
-			$sql .= " SET fk_user_trans = " . $user->id;
790
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
791
-			$sql .= " , method_trans = " . ((int) $method);
792
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
793
-			$sql .= " WHERE rowid = " . ((int) $this->id);
794
-			$sql .= " AND entity = " . ((int) $conf->entity);
795
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
788
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
789
+			$sql .= " SET fk_user_trans = ".$user->id;
790
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
791
+			$sql .= " , method_trans = ".((int) $method);
792
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
793
+			$sql .= " WHERE rowid = ".((int) $this->id);
794
+			$sql .= " AND entity = ".((int) $conf->entity);
795
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
796 796
 
797 797
 			if ($this->db->query($sql)) {
798 798
 				$this->method_trans = $method;
@@ -817,12 +817,12 @@  discard block
 block discarded – undo
817 817
 				return 0;
818 818
 			} else {
819 819
 				$this->db->rollback();
820
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
820
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
821 821
 
822 822
 				return -1;
823 823
 			}
824 824
 		} else {
825
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
825
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
826 826
 			return -2;
827 827
 		}
828 828
 	}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 		$arr = array();
843 843
 
844
-		dol_syslog(get_class($this) . "::getListInvoices");
844
+		dol_syslog(get_class($this)."::getListInvoices");
845 845
 
846 846
 		// Returns all invoices presented within same order
847 847
 		$sql = "SELECT ";
@@ -857,13 +857,13 @@  discard block
 block discarded – undo
857 857
 		if ($amounts) {
858 858
 			$sql .= ", SUM(pl.amount)";
859 859
 		}
860
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
861
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
862
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
860
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
861
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
862
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
863 863
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
864 864
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
865
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
866
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
865
+		$sql .= " AND pb.rowid = ".((int) $this->id);
866
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
867 867
 		if ($amounts) {
868 868
 			if ($this->type == 'bank-transfer') {
869 869
 				if ($type == 'salary') {
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 		$sql = "SELECT sum(pd.amount) as nb";
918 918
 		if ($type !== 'salary') {
919 919
 			if ($mode != 'bank-transfer') {
920
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
920
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
921 921
 			} else {
922
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
922
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
923 923
 			}
924 924
 		} else {
925
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
925
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
926 926
 		}
927
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
928
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
927
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
928
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
929 929
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
930
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
930
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
931 931
 		}
932 932
 		if ($type !== 'salary') {
933 933
 			if ($mode != 'bank-transfer') {
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 			return $obj->nb;
953 953
 		} else {
954 954
 			$error = 1;
955
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
955
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
956 956
 			dol_syslog($this->db->error());
957 957
 
958 958
 			return -1;
@@ -988,26 +988,26 @@  discard block
 block discarded – undo
988 988
 		// phpcs:enable
989 989
 		if ($forsalary == 1) {
990 990
 			$sql = "SELECT count(s.rowid) as nb";
991
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
991
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
992 992
 		} else {
993 993
 			$sql = "SELECT count(f.rowid) as nb";
994 994
 
995 995
 			if ($type == 'bank-transfer') {
996
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
996
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
997 997
 			} else {
998
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
998
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
999 999
 			}
1000 1000
 		}
1001
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
1001
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
1002 1002
 		if ($forsalary == 1) {
1003
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
1003
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
1004 1004
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1005 1005
 				$sql .= " AND s.paye = 0";
1006 1006
 			}
1007 1007
 		} else {
1008
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
1008
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
1009 1009
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1010
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
1010
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1011 1011
 			}
1012 1012
 		}
1013 1013
 		if ($forsalary == 1) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			$sql .= " AND s.paye = 0";
1028 1028
 		}
1029 1029
 
1030
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
1030
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
1031 1031
 		$resql = $this->db->query($sql);
1032 1032
 
1033 1033
 		if ($resql) {
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 			return $obj->nb;
1038 1038
 		} else {
1039
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
1039
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
1040 1040
 			return -1;
1041 1041
 		}
1042 1042
 	}
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 		// phpcs:enable
1069 1069
 		global $conf, $langs, $user;
1070 1070
 
1071
-		dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
1071
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
1072 1072
 
1073
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
1074
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
1073
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
1074
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
1075 1075
 
1076 1076
 		// Check params
1077 1077
 		if ($type != 'bank-transfer') {
@@ -1106,14 +1106,14 @@  discard block
 block discarded – undo
1106 1106
 		// Check if there is an iban associated to the bank transfer request or if we take the default
1107 1107
 		if ($did > 0) {
1108 1108
 			$sql = "SELECT pd.fk_societe_rib";
1109
-			$sql .= " FROM " . $this->db->prefix() . "prelevement_demande as pd";
1109
+			$sql .= " FROM ".$this->db->prefix()."prelevement_demande as pd";
1110 1110
 			$sql .= " WHERE pd.rowid = ".((int) $did);
1111 1111
 
1112 1112
 			$resql = $this->db->query($sql);
1113 1113
 
1114 1114
 			if (!$resql) {
1115 1115
 				$this->error = $this->db->lasterror();
1116
-				dol_syslog(__METHOD__ . " Read fk_societe_rib error " . $this->db->lasterror(), LOG_ERR);
1116
+				dol_syslog(__METHOD__." Read fk_societe_rib error ".$this->db->lasterror(), LOG_ERR);
1117 1117
 				return -1;
1118 1118
 			}
1119 1119
 
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 			if ($obj) {
1122 1122
 				$thirdpartyBANId = $obj->fk_societe_rib;
1123 1123
 
1124
-				dol_syslog(__METHOD__ . " Found an BAN ID to use: ".$thirdpartyBANId);
1124
+				dol_syslog(__METHOD__." Found an BAN ID to use: ".$thirdpartyBANId);
1125 1125
 			}
1126 1126
 
1127 1127
 			$this->db->free($resql);
@@ -1147,10 +1147,10 @@  discard block
 block discarded – undo
1147 1147
 		$factures_errors = array();
1148 1148
 
1149 1149
 		if (!$error) {
1150
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1150
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1151 1151
 
1152 1152
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1153
-			$sql .= ", f.".$this->db->sanitize($socOrUser);		// fk_soc or fk_user
1153
+			$sql .= ", f.".$this->db->sanitize($socOrUser); // fk_soc or fk_user
1154 1154
 			$sql .= ", pd.code_banque, pd.code_guichet, pd.number, pd.cle_rib";
1155 1155
 			$sql .= ", pd.amount";
1156 1156
 			if ($sourcetype != 'salary') {
@@ -1160,13 +1160,13 @@  discard block
 block discarded – undo
1160 1160
 				$sql .= ", CONCAT(s.firstname,' ',s.lastname) as name";
1161 1161
 				$sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur";
1162 1162
 			}
1163
-			$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f";
1164
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
1165
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
1166
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);
1163
+			$sql .= " FROM ".$this->db->prefix().$sqlTable." as f";
1164
+			$sql .= " LEFT JOIN ".$this->db->prefix()."prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
1165
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
1166
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);
1167 1167
 			if ($sourcetype != 'salary') {
1168 1168
 				if (!empty($thirdpartyBANId)) {
1169
-					$sql .= " AND sr.rowid = " . ((int) $thirdpartyBANId);
1169
+					$sql .= " AND sr.rowid = ".((int) $thirdpartyBANId);
1170 1170
 				} else {
1171 1171
 					$sql .= " AND sr.default_rib = 1";
1172 1172
 				}
@@ -1186,10 +1186,10 @@  discard block
 block discarded – undo
1186 1186
 			$sql .= " AND pd.traite = 0";
1187 1187
 			$sql .= " AND pd.ext_payment_id IS NULL";
1188 1188
 			if ($sourcetype != 'salary') {
1189
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1189
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1190 1190
 			}
1191 1191
 			if ($did > 0) {
1192
-				$sql .= " AND pd.rowid = " . ((int) $did);
1192
+				$sql .= " AND pd.rowid = ".((int) $did);
1193 1193
 			}
1194 1194
 
1195 1195
 			$resql = $this->db->query($sql);
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 				$i = 0;
1199 1199
 
1200 1200
 				while ($i < $num) {
1201
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1201
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1202 1202
 					'@phan-var-force array<int<0,12>,string> $row';
1203 1203
 
1204 1204
 					// All fields: 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur
@@ -1209,35 +1209,35 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 					if ($row[7] == 0) {
1211 1211
 						$error++;
1212
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1213
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1212
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1213
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1214 1214
 						break;
1215 1215
 					}
1216 1216
 					$i++;
1217 1217
 				}
1218 1218
 
1219 1219
 				$this->db->free($resql);
1220
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1220
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1221 1221
 			} else {
1222 1222
 				$this->error = $this->db->lasterror();
1223
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1223
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1224 1224
 				return -1;
1225 1225
 			}
1226 1226
 		}
1227 1227
 
1228 1228
 		if (!$error) {
1229 1229
 			// Make some checks
1230
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1231
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1232
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1233
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1230
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1231
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1232
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1233
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1234 1234
 
1235 1235
 			$tmpsoc = new Societe($this->db);
1236 1236
 			$tmpuser = new User($this->db);
1237 1237
 
1238 1238
 			// Check BAN
1239 1239
 			$i = 0;
1240
-			dol_syslog(__METHOD__ . " Check BAN for each invoices or salary", LOG_DEBUG);
1240
+			dol_syslog(__METHOD__." Check BAN for each invoices or salary", LOG_DEBUG);
1241 1241
 
1242 1242
 			if (count($factures) > 0) {
1243 1243
 				foreach ($factures as $key => $fac) {
@@ -1268,31 +1268,31 @@  discard block
 block discarded – undo
1268 1268
 							if ($type != 'bank-transfer') {
1269 1269
 								$tmpsoc->id = (int) $fac[2];
1270 1270
 								$tmpsoc->name = $fac[8];
1271
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1272
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1273
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1271
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1272
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1273
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1274 1274
 								$error++;
1275 1275
 							}
1276 1276
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1277 1277
 								$tmpsoc->id = (int) $fac[2];
1278 1278
 								$tmpsoc->name = $fac[8];
1279
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1280
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1281
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1279
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1280
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1281
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1282 1282
 								$error++;
1283 1283
 							}
1284 1284
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1285 1285
 								$tmpuser->id = (int) $fac[2];
1286 1286
 								$tmpuser->firstname = $fac[8];
1287
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1288
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1289
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1287
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1288
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1289
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1290 1290
 								$error++;
1291 1291
 							}
1292
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1292
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1293 1293
 						}
1294 1294
 					} else {
1295
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1295
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1296 1296
 					}
1297 1297
 					/*
1298 1298
 					} else {
@@ -1301,14 +1301,14 @@  discard block
 block discarded – undo
1301 1301
 					*/
1302 1302
 				}
1303 1303
 			} else {
1304
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1304
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1305 1305
 			}
1306 1306
 		}
1307 1307
 
1308 1308
 		$ok = 0;
1309 1309
 
1310 1310
 		// Withdraw invoices in factures_prev array
1311
-		$out = count($factures_prev) . " invoices or salaries will be included.";
1311
+		$out = count($factures_prev)." invoices or salaries will be included.";
1312 1312
 		//print $out."\n";
1313 1313
 		dol_syslog($out);
1314 1314
 
@@ -1342,32 +1342,32 @@  discard block
 block discarded – undo
1342 1342
 			 * Process order generation
1343 1343
 			 */
1344 1344
 			if (!$error) {
1345
-				$ref = substr($year, -2) . $month;
1345
+				$ref = substr($year, -2).$month;
1346 1346
 
1347 1347
 				// Get next free number for the ref of bon prelevement
1348
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1349
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1350
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1351
-				$sql .= " AND entity = " . ((int) $conf->entity);
1348
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1349
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1350
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1351
+				$sql .= " AND entity = ".((int) $conf->entity);
1352 1352
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1353 1353
 
1354
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1354
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1355 1355
 				$resql = $this->db->query($sql);
1356 1356
 
1357 1357
 				if ($resql) {
1358 1358
 					$row = $this->db->fetch_row($resql);
1359 1359
 
1360 1360
 					// Build the new ref
1361
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1361
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1362 1362
 
1363 1363
 					// $conf->abc->dir_output may be:
1364 1364
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1365 1365
 					// or
1366 1366
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1367 1367
 					if ($type != 'bank-transfer') {
1368
-						$dir = $conf->prelevement->dir_output . '/receipts';
1368
+						$dir = $conf->prelevement->dir_output.'/receipts';
1369 1369
 					} else {
1370
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1370
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1371 1371
 					}
1372 1372
 					if (!is_dir($dir)) {
1373 1373
 						dol_mkdir($dir);
@@ -1375,41 +1375,41 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 					if (isModEnabled('multicompany')) {
1377 1377
 						$labelentity = $conf->entity;
1378
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1378
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1379 1379
 					} else {
1380
-						$this->filename = $dir . '/' . $ref . '.xml';
1380
+						$this->filename = $dir.'/'.$ref.'.xml';
1381 1381
 					}
1382 1382
 
1383 1383
 					// Create withdraw order in database
1384
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1384
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1385 1385
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1386 1386
 					$sql .= ") VALUES (";
1387
-					$sql .= "'" . $this->db->escape($ref) . "'";
1388
-					$sql .= ", " . ((int) $conf->entity);
1389
-					$sql .= ", '" . $this->db->idate($now) . "'";
1390
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1391
-					$sql .= ", " . ((int) $fk_bank_account);
1387
+					$sql .= "'".$this->db->escape($ref)."'";
1388
+					$sql .= ", ".((int) $conf->entity);
1389
+					$sql .= ", '".$this->db->idate($now)."'";
1390
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1391
+					$sql .= ", ".((int) $fk_bank_account);
1392 1392
 					$sql .= ")";
1393 1393
 
1394 1394
 					$resql = $this->db->query($sql);
1395 1395
 
1396 1396
 
1397 1397
 					if ($resql) {
1398
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1398
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1399 1399
 						$this->id = $prev_id;
1400 1400
 						$this->ref = $ref;
1401 1401
 					} else {
1402 1402
 						$error++;
1403
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1403
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1404 1404
 					}
1405 1405
 				} else {
1406 1406
 					$error++;
1407
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1407
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1408 1408
 				}
1409 1409
 			}
1410 1410
 
1411 1411
 			if (!$error) {
1412
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1412
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1413 1413
 
1414 1414
 				// Add lines for the bon
1415 1415
 				if (count($factures_prev) > 0) {
@@ -1438,17 +1438,17 @@  discard block
 block discarded – undo
1438 1438
 						}
1439 1439
 
1440 1440
 						// Update invoice requests as done
1441
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1441
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1442 1442
 						$sql .= " SET traite = 1";
1443
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1444
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1445
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1443
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1444
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1445
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1446 1446
 
1447 1447
 						$resql = $this->db->query($sql);
1448 1448
 						if (!$resql) {
1449 1449
 							$error++;
1450 1450
 							$this->errors[] = $this->db->lasterror();
1451
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1451
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1452 1452
 						}
1453 1453
 					}
1454 1454
 				}
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1460 1460
 				 */
1461 1461
 
1462
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1462
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1463 1463
 
1464 1464
 				if (count($factures_prev) > 0) {
1465 1465
 					$this->date_echeance = $datetimeprev;
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 						$this->emetteur_iban               = $account->iban;
1476 1476
 						$this->emetteur_bic                = $account->bic;
1477 1477
 
1478
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1478
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1479 1479
 
1480 1480
 						$this->raison_sociale = $account->owner_name;
1481 1481
 					}
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 						$error++;
1495 1495
 					}
1496 1496
 				}
1497
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1497
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1498 1498
 			}
1499 1499
 
1500 1500
 
@@ -1502,15 +1502,15 @@  discard block
 block discarded – undo
1502 1502
 			 * Update total defined after generation of file
1503 1503
 			 */
1504 1504
 			if (!$error) {
1505
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1506
-				$sql .= " SET amount = " . price2num($this->total);
1507
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1508
-				$sql .= " AND entity = " . ((int) $conf->entity);
1505
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1506
+				$sql .= " SET amount = ".price2num($this->total);
1507
+				$sql .= " WHERE rowid = ".((int) $this->id);
1508
+				$sql .= " AND entity = ".((int) $conf->entity);
1509 1509
 				$resql = $this->db->query($sql);
1510 1510
 
1511 1511
 				if (!$resql) {
1512 1512
 					$error++;
1513
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1513
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1514 1514
 				}
1515 1515
 			}
1516 1516
 
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 
1531 1531
 			if (!$error) {
1532 1532
 				$this->db->commit();
1533
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1533
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1534 1534
 			} else {
1535 1535
 				$this->db->rollback();
1536 1536
 				return -1;
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
 		}
1570 1570
 
1571 1571
 		if (!$error) {
1572
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")";
1572
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
1573 1573
 			$resql1 = $this->db->query($sql);
1574 1574
 			if (!$resql1) {
1575 1575
 				dol_print_error($this->db);
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
 		}
1578 1578
 
1579 1579
 		if (!$error) {
1580
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1580
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1581 1581
 			$resql2 = $this->db->query($sql);
1582 1582
 			if (!$resql2) {
1583 1583
 				dol_print_error($this->db);
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 		}
1586 1586
 
1587 1587
 		if (!$error) {
1588
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1588
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1589 1589
 			$resql3 = $this->db->query($sql);
1590 1590
 			if (!$resql3) {
1591 1591
 				dol_print_error($this->db);
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 		}
1594 1594
 
1595 1595
 		if (!$error) {
1596
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1596
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1597 1597
 			$resql4 = $this->db->query($sql);
1598 1598
 			if (!$resql4) {
1599 1599
 				dol_print_error($this->db);
@@ -1635,22 +1635,22 @@  discard block
 block discarded – undo
1635 1635
 			$labeltoshow = 'PaymentByBankTransfer';
1636 1636
 		}
1637 1637
 
1638
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1638
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1639 1639
 		$label .= '<br>';
1640
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1640
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1641 1641
 		if (isset($this->amount)) {
1642
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1642
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1643 1643
 		}
1644 1644
 		if (isset($this->date_trans)) {
1645
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1645
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1646 1646
 		}
1647 1647
 		/*if (isset($this->date_credit)) {
1648 1648
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1649 1649
 		}*/
1650 1650
 
1651
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1651
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1652 1652
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1653
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1653
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1654 1654
 		}
1655 1655
 
1656 1656
 		if ($option != 'nolink') {
@@ -1668,21 +1668,21 @@  discard block
 block discarded – undo
1668 1668
 		if (empty($notooltip)) {
1669 1669
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1670 1670
 				$label = $langs->trans("ShowMyObject");
1671
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1671
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1672 1672
 			}
1673
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1674
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1673
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1674
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1675 1675
 		} else {
1676
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1676
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1677 1677
 		}
1678 1678
 
1679
-		$linkstart = '<a href="' . $url . '"';
1680
-		$linkstart .= $linkclose . '>';
1679
+		$linkstart = '<a href="'.$url.'"';
1680
+		$linkstart .= $linkclose.'>';
1681 1681
 		$linkend = '</a>';
1682 1682
 
1683 1683
 		$result .= $linkstart;
1684 1684
 		if ($withpicto) {
1685
-			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1685
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1686 1686
 		}
1687 1687
 		if ($withpicto != 2) {
1688 1688
 			$result .= $this->ref;
@@ -1711,8 +1711,8 @@  discard block
 block discarded – undo
1711 1711
 	 */
1712 1712
 	public function deleteNotificationById($rowid)
1713 1713
 	{
1714
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1715
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1714
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1715
+		$sql .= " WHERE rowid = ".((int) $rowid);
1716 1716
 
1717 1717
 		if ($this->db->query($sql)) {
1718 1718
 			return 0;
@@ -1736,8 +1736,8 @@  discard block
 block discarded – undo
1736 1736
 			$userid = $user;
1737 1737
 		}
1738 1738
 
1739
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1740
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1739
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1740
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1741 1741
 
1742 1742
 		if ($this->db->query($sql)) {
1743 1743
 			return 0;
@@ -1769,15 +1769,15 @@  discard block
 block discarded – undo
1769 1769
 		if ($this->deleteNotification($user, $action) == 0) {
1770 1770
 			$now = dol_now();
1771 1771
 
1772
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1773
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1772
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1773
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1774 1774
 
1775
-			dol_syslog("adnotiff: " . $sql);
1775
+			dol_syslog("adnotiff: ".$sql);
1776 1776
 			if ($this->db->query($sql)) {
1777 1777
 				$result = 0;
1778 1778
 			} else {
1779 1779
 				$result = -1;
1780
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1780
+				dol_syslog(get_class($this)."::addNotification Error $result");
1781 1781
 			}
1782 1782
 		}
1783 1783
 
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
 
1814 1814
 		$result = 0;
1815 1815
 
1816
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1816
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1817 1817
 
1818 1818
 		$this->file = fopen($this->filename, "w");
1819 1819
 		if ($this->file == false) {
@@ -1859,20 +1859,20 @@  discard block
 block discarded – undo
1859 1859
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1860 1860
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1861 1861
 				$sql .= " FROM";
1862
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1863
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1864
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1865
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1866
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1867
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1868
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1862
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1863
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1864
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1865
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1866
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1867
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1868
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1869 1869
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1870 1870
 				$sql .= " AND p.fk_facture = f.rowid";
1871 1871
 				$sql .= " AND f.fk_soc = soc.rowid";
1872 1872
 				$sql .= " AND soc.fk_pays = c.rowid";
1873 1873
 				$sql .= " AND rib.fk_soc = f.fk_soc";
1874 1874
 				if (!empty($thirdpartyBANId)) {
1875
-					$sql .= " AND rib.rowid = " . ((int) $thirdpartyBANId);
1875
+					$sql .= " AND rib.rowid = ".((int) $thirdpartyBANId);
1876 1876
 				} else {
1877 1877
 					$sql .= " AND rib.default_rib = 1";
1878 1878
 				}
@@ -1907,7 +1907,7 @@  discard block
 block discarded – undo
1907 1907
 					$nbtotalDrctDbtTxInf = $i;
1908 1908
 				} else {
1909 1909
 					$this->error = $this->db->lasterror();
1910
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1910
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1911 1911
 					$result = -2;
1912 1912
 				}
1913 1913
 
@@ -1924,26 +1924,26 @@  discard block
 block discarded – undo
1924 1924
 				 * SECTION CREATION SEPA FILE - ISO200022
1925 1925
 				 */
1926 1926
 				// SEPA File Header
1927
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1928
-				fwrite($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);
1929
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1927
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1928
+				fwrite($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);
1929
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1930 1930
 				// SEPA Group header
1931
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1932
-				fwrite($this->file, '			<MsgId>' . ('DOL/' . $dateTime_YMD . '/DD' . $this->id) . '</MsgId>' . $CrLf);
1933
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1934
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1935
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1936
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1937
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1938
-				fwrite($this->file, '				<Id>' . $CrLf);
1939
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1940
-				fwrite($this->file, '					<Othr>' . $CrLf);
1941
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1942
-				fwrite($this->file, '					</Othr>' . $CrLf);
1943
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1944
-				fwrite($this->file, '				</Id>' . $CrLf);
1945
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1946
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1931
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1932
+				fwrite($this->file, '			<MsgId>'.('DOL/'.$dateTime_YMD.'/DD'.$this->id).'</MsgId>'.$CrLf);
1933
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1934
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1935
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1936
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1937
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1938
+				fwrite($this->file, '				<Id>'.$CrLf);
1939
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1940
+				fwrite($this->file, '					<Othr>'.$CrLf);
1941
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1942
+				fwrite($this->file, '					</Othr>'.$CrLf);
1943
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1944
+				fwrite($this->file, '				</Id>'.$CrLf);
1945
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1946
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1947 1947
 				// SEPA File Emetteur
1948 1948
 				if ($result != -2) {
1949 1949
 					fwrite($this->file, $fileEmetteurSection);
@@ -1953,9 +1953,9 @@  discard block
 block discarded – undo
1953 1953
 					fwrite($this->file, $fileDebiteurSection);
1954 1954
 				}
1955 1955
 				// SEPA FILE FOOTER
1956
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1957
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1958
-				fwrite($this->file, '</Document>' . $CrLf);
1956
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1957
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1958
+				fwrite($this->file, '</Document>'.$CrLf);
1959 1959
 			} else {
1960 1960
 				/**
1961 1961
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1987,13 +1987,13 @@  discard block
 block discarded – undo
1987 1987
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1988 1988
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1989 1989
 					$sql .= " FROM";
1990
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1991
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1992
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1993
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1994
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1995
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1996
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1990
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1991
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1992
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1993
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1994
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1995
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1996
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1997 1997
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1998 1998
 					$sql .= " AND p.fk_salary = s.rowid";
1999 1999
 					$sql .= " AND s.fk_user = u.rowid";
@@ -2004,19 +2004,19 @@  discard block
 block discarded – undo
2004 2004
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
2005 2005
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
2006 2006
 					$sql .= " FROM";
2007
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2008
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2009
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
2010
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
2011
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
2012
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
2013
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2007
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2008
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2009
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
2010
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
2011
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
2012
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
2013
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2014 2014
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2015 2015
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
2016 2016
 					$sql .= " AND f.fk_soc = soc.rowid";
2017 2017
 					$sql .= " AND rib.fk_soc = f.fk_soc";
2018 2018
 					if (!empty($thirdpartyBANId)) {
2019
-						$sql .= " AND rib.rowid = " . ((int) $thirdpartyBANId);
2019
+						$sql .= " AND rib.rowid = ".((int) $thirdpartyBANId);
2020 2020
 					} else {
2021 2021
 						$sql .= " AND rib.default_rib = 1";
2022 2022
 					}
@@ -2044,7 +2044,7 @@  discard block
 block discarded – undo
2044 2044
 						$iban = dolDecrypt($obj->iban);
2045 2045
 						$refobj = $obj->reffac;
2046 2046
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
2047
-							$refobj = "SAL" . $obj->idfac;
2047
+							$refobj = "SAL".$obj->idfac;
2048 2048
 						}
2049 2049
 
2050 2050
 						$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 					$nbtotalDrctDbtTxInf = $i;
2056 2056
 				} else {
2057 2057
 					$this->error = $this->db->lasterror();
2058
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
2058
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
2059 2059
 					$result = -2;
2060 2060
 				}
2061 2061
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -2071,26 +2071,26 @@  discard block
 block discarded – undo
2071 2071
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
2072 2072
 				 */
2073 2073
 				// SEPA File Header
2074
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
2075
-				fwrite($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);
2076
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
2074
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
2075
+				fwrite($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);
2076
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
2077 2077
 				// SEPA Group header
2078
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
2079
-				fwrite($this->file, '			<MsgId>' . ('DOL/' . $dateTime_YMD . '/CT' . $this->id) . '</MsgId>' . $CrLf);
2080
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
2081
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
2082
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
2083
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
2084
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
2085
-				fwrite($this->file, '				<Id>' . $CrLf);
2086
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
2087
-				fwrite($this->file, '					<Othr>' . $CrLf);
2088
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
2089
-				fwrite($this->file, '					</Othr>' . $CrLf);
2090
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
2091
-				fwrite($this->file, '				</Id>' . $CrLf);
2092
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
2093
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
2078
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
2079
+				fwrite($this->file, '			<MsgId>'.('DOL/'.$dateTime_YMD.'/CT'.$this->id).'</MsgId>'.$CrLf);
2080
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
2081
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
2082
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
2083
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
2084
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
2085
+				fwrite($this->file, '				<Id>'.$CrLf);
2086
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
2087
+				fwrite($this->file, '					<Othr>'.$CrLf);
2088
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
2089
+				fwrite($this->file, '					</Othr>'.$CrLf);
2090
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
2091
+				fwrite($this->file, '				</Id>'.$CrLf);
2092
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
2093
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
2094 2094
 				// SEPA File Emetteur (mycompany)
2095 2095
 				if ($result != -2) {
2096 2096
 					fwrite($this->file, $fileEmetteurSection);
@@ -2100,9 +2100,9 @@  discard block
 block discarded – undo
2100 2100
 					fwrite($this->file, $fileCrediteurSection);
2101 2101
 				}
2102 2102
 				// SEPA FILE FOOTER
2103
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
2104
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
2105
-				fwrite($this->file, '</Document>' . $CrLf);
2103
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
2104
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
2105
+				fwrite($this->file, '</Document>'.$CrLf);
2106 2106
 			}
2107 2107
 		}
2108 2108
 
@@ -2111,10 +2111,10 @@  discard block
 block discarded – undo
2111 2111
 			if ($type != 'bank-transfer') {
2112 2112
 				$sql = "SELECT pl.amount";
2113 2113
 				$sql .= " FROM";
2114
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2115
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
2116
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2117
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2114
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2115
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
2116
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2117
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2118 2118
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2119 2119
 				$sql .= " AND p.fk_facture = f.rowid";
2120 2120
 
@@ -2137,10 +2137,10 @@  discard block
 block discarded – undo
2137 2137
 			} else {
2138 2138
 				$sql = "SELECT pl.amount";
2139 2139
 				$sql .= " FROM";
2140
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2141
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2142
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2143
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2140
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2141
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2142
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2143
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2144 2144
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2145 2145
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2146 2146
 				// Lines
@@ -2189,7 +2189,7 @@  discard block
 block discarded – undo
2189 2189
 		$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)
2190 2190
 
2191 2191
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2192
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2192
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2193 2193
 	}
2194 2194
 
2195 2195
 
@@ -2228,11 +2228,11 @@  discard block
 block discarded – undo
2228 2228
 
2229 2229
 		// Raison Sociale Destinataire C2
2230 2230
 
2231
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2231
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2232 2232
 
2233 2233
 		// Address optional D1
2234 2234
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2235
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2235
+		fwrite($this->file, substr($address."                         ", 0, 24));
2236 2236
 
2237 2237
 		// Zone Reservee D2
2238 2238
 
@@ -2244,17 +2244,17 @@  discard block
 block discarded – undo
2244 2244
 
2245 2245
 		// Numero de compte D4
2246 2246
 
2247
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2247
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2248 2248
 
2249 2249
 		// Zone E Montant
2250 2250
 
2251 2251
 		$montant = (round($amount, 2) * 100);
2252 2252
 
2253
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2253
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2254 2254
 
2255 2255
 		// Label F
2256 2256
 
2257
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2257
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2258 2258
 
2259 2259
 		// Code etablissement G1
2260 2260
 
@@ -2305,7 +2305,7 @@  discard block
 block discarded – undo
2305 2305
 			$row_somme = round((float) $row_somme, 2);
2306 2306
 		}
2307 2307
 
2308
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2308
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2309 2309
 
2310 2310
 		$CrLf = "\n";
2311 2311
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2320,46 +2320,46 @@  discard block
 block discarded – undo
2320 2320
 		if ($type != 'bank-transfer') {
2321 2321
 			// SEPA Paiement Information of buyer for Direct Debit
2322 2322
 			$XML_DEBITOR = '';
2323
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2324
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2323
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2324
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2325 2325
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2326
-			$XML_DEBITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2327
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2328
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2329
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2330
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2331
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2332
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2333
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2334
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2335
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2336
-			$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2337
-			$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2326
+			$XML_DEBITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2327
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2328
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2329
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2330
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2331
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2332
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2333
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2334
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2335
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2336
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2337
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2338 2338
 			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) {
2339
-				$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2339
+				$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2340 2340
 			}
2341
-			$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2342
-			$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2343
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2344
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2345
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2346
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2341
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2342
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2343
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2344
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2345
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2346
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2347 2347
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2348
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2348
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2349 2349
 			if (trim($addressline1)) {
2350
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2350
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2351 2351
 			}
2352 2352
 			if (trim($addressline2)) {
2353
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2353
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2354 2354
 			}
2355
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2356
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2357
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2358
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2359
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2360
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2361
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2362
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2355
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2356
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2357
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2358
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2359
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2360
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2361
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2362
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2363 2363
 
2364 2364
 			// Structured data for Belgium
2365 2365
 			if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION') && $mysoc->country_code == 'BE') {
@@ -2369,24 +2369,24 @@  discard block
 block discarded – undo
2369 2369
 				$invoicestatic->fetch($row_idfac);
2370 2370
 
2371 2371
 				$invoicePaymentKey = dolBECalculateStructuredCommunication($invoicestatic->ref, $invoicestatic->type);
2372
-				$XML_DEBITOR .= '					<strd>' . $invoicePaymentKey . '</strd>' . $CrLf;
2372
+				$XML_DEBITOR .= '					<strd>'.$invoicePaymentKey.'</strd>'.$CrLf;
2373 2373
 			} else {
2374 2374
 				// A string with some information on payment - 140 max
2375
-				$XML_DEBITOR .= '					<Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max
2375
+				$XML_DEBITOR .= '					<Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
2376 2376
 			}
2377
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2378
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2377
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2378
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2379 2379
 			return $XML_DEBITOR;
2380 2380
 		} else {
2381 2381
 			// SEPA Payment Information of seller for Credit Transfer
2382 2382
 			$XML_CREDITOR = '';
2383
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2384
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2383
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2384
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2385 2385
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2386
-			$XML_CREDITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2387
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2386
+			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2387
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2388 2388
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2389
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2389
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2390 2390
 
2391 2391
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2392 2392
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2398,18 +2398,18 @@  discard block
 block discarded – undo
2398 2398
 				// Set $categoryPurpose: CORE, TREA, SUPP, ...
2399 2399
 				$categoryPurpose = getDolGlobalString('PAYMENTBYBANKTRANSFER_CUSTOM_CATEGORY_PURPOSE', 'CORE');
2400 2400
 
2401
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2402
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2403
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2404
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2405
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2406
-				$XML_CREDITOR .= '						<Cd>' . $categoryPurpose . '</Cd>' . $CrLf;
2407
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2408
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2401
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2402
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2403
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2404
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2405
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2406
+				$XML_CREDITOR .= '						<Cd>'.$categoryPurpose.'</Cd>'.$CrLf;
2407
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2408
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2409 2409
 			}
2410
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2410
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2411 2411
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2412
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2412
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2413 2413
 			/*
2414 2414
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2415 2415
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2420,35 +2420,35 @@  discard block
 block discarded – undo
2420 2420
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2421 2421
 			 */
2422 2422
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2423
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2424
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2425
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2426
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2427
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2428
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2429
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2430
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2431
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2423
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2424
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2425
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2426
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2427
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2428
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2429
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2430
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2431
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2432 2432
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2433
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2433
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2434 2434
 			if (trim($addressline1)) {
2435
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2435
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2436 2436
 			}
2437 2437
 			if (trim($addressline2)) {
2438
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2438
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2439 2439
 			}
2440
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2441
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2442
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2443
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2444
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2445
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2446
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2447
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2440
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2441
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2442
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2443
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2444
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2445
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2446
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2447
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2448 2448
 			// A string with some information on payment - 140 max
2449
-			$XML_CREDITOR .= '					<Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
2450
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2451
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2449
+			$XML_CREDITOR .= '					<Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
2450
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2451
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2452 2452
 			return $XML_CREDITOR;
2453 2453
 		}
2454 2454
 	}
@@ -2481,11 +2481,11 @@  discard block
 block discarded – undo
2481 2481
 
2482 2482
 		// Raison Sociale C2
2483 2483
 
2484
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2484
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2485 2485
 
2486 2486
 		// Ref of thirdparty on 7 characters
2487 2487
 
2488
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2488
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2489 2489
 
2490 2490
 		// Zone Reservee D1-2
2491 2491
 
@@ -2503,7 +2503,7 @@  discard block
 block discarded – undo
2503 2503
 
2504 2504
 		// Numero de compte D4
2505 2505
 
2506
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2506
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2507 2507
 
2508 2508
 		// Zone Reservee E
2509 2509
 
@@ -2565,15 +2565,15 @@  discard block
 block discarded – undo
2565 2565
 			$this->emetteur_iban = $account->iban;
2566 2566
 			$this->emetteur_bic = $account->bic;
2567 2567
 
2568
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2568
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2569 2569
 
2570 2570
 			$this->raison_sociale = $account->owner_name;
2571 2571
 		}
2572 2572
 
2573 2573
 		// Get pending payments
2574 2574
 		$sql = "SELECT rowid, ref";
2575
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2576
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2575
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2576
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2577 2577
 
2578 2578
 		$resql = $this->db->query($sql);
2579 2579
 		if ($resql) {
@@ -2591,45 +2591,45 @@  discard block
 block discarded – undo
2591 2591
 			if ($type != 'bank-transfer') {
2592 2592
 				// SEPA Paiement Information of my company for Direct Debit
2593 2593
 				$XML_SEPA_INFO = '';
2594
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2595
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/DD' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2596
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2597
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2598
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2599
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2600
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2601
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2602
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2603
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2604
-				$XML_SEPA_INFO .= '					<Cd>' . $localInstrument . '</Cd>' . $CrLf;
2605
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2606
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2607
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2608
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2609
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2610
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2611
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2612
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2594
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2595
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/DD'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2596
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2597
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2598
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2599
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2600
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2601
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2602
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2603
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2604
+				$XML_SEPA_INFO .= '					<Cd>'.$localInstrument.'</Cd>'.$CrLf;
2605
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2606
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2607
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2608
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2609
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2610
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2611
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2612
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2613 2613
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2614
-				$addressline2 = 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) => ""));
2614
+				$addressline2 = 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) => ""));
2615 2615
 				if ($addressline1) {
2616
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2616
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2617 2617
 				}
2618 2618
 				if ($addressline2) {
2619
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2619
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2620 2620
 				}
2621
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2622
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2623
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2624
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2625
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2626
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2627
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2628
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2629
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2630
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2631
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2632
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2621
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2622
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2623
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2624
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2625
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2626
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2627
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2628
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2629
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2630
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2631
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2632
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2633 2633
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2634 2634
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2635 2635
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2638,64 +2638,64 @@  discard block
 block discarded – undo
2638 2638
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2639 2639
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2640 2640
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2641
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2642
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2643
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2644
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2645
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2646
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2647
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2648
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2649
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2650
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2651
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2652
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2653
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2641
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2642
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2643
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2644
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2645
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2646
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2647
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2648
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2649
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2650
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2651
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2652
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2653
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2654 2654
 			} else {
2655 2655
 				// SEPA Paiement Information of my company for Credit Transfer
2656 2656
 				$XML_SEPA_INFO = '';
2657
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2658
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/CT' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2659
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2657
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2658
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/CT'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2659
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2660 2660
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2661
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2662
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2661
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2662
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2663 2663
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2664
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2665
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2666
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2667
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2668
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2669
-					$XML_SEPA_INFO .= '					<Cd>' . $localInstrument . '</Cd>' . $CrLf;
2670
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2671
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2672
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2664
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2665
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2666
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2667
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2668
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2669
+					$XML_SEPA_INFO .= '					<Cd>'.$localInstrument.'</Cd>'.$CrLf;
2670
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2671
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2672
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2673 2673
 				}
2674
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2675
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2676
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2677
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2678
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2674
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2675
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2676
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2677
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2678
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2679 2679
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2680
-				$addressline2 = 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) => ""));
2680
+				$addressline2 = 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) => ""));
2681 2681
 				if ($addressline1) {
2682
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2682
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2683 2683
 				}
2684 2684
 				if ($addressline2) {
2685
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2685
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2686 2686
 				}
2687
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2688
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2689
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2690
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2691
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2692
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2693
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2694
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2695
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2696
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2697
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2698
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2687
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2688
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2689
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2690
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2691
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2692
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2693
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2694
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2695
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2696
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2697
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2698
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2699 2699
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2700 2700
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2701 2701
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2704,7 +2704,7 @@  discard block
 block discarded – undo
2704 2704
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2705 2705
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2706 2706
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2707
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2707
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2708 2708
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2709 2709
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2710 2710
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2719,7 +2719,7 @@  discard block
 block discarded – undo
2719 2719
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2720 2720
 			}
2721 2721
 		} else {
2722
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2722
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2723 2723
 			$XML_SEPA_INFO = '';
2724 2724
 		}
2725 2725
 		return $XML_SEPA_INFO;
@@ -2771,7 +2771,7 @@  discard block
 block discarded – undo
2771 2771
 
2772 2772
 		$montant = ($total * 100);
2773 2773
 
2774
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2774
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2775 2775
 
2776 2776
 		// Zone Reservee F
2777 2777
 
@@ -2928,18 +2928,18 @@  discard block
 block discarded – undo
2928 2928
 		$return .= img_picto('', $this->picto);
2929 2929
 		$return .= '</span>';
2930 2930
 		$return .= '<div class="info-box-content">';
2931
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2931
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2932 2932
 		if ($selected >= 0) {
2933
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2933
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2934 2934
 		}
2935 2935
 		if (property_exists($this, 'date_echeance')) {
2936
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>';
2936
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
2937 2937
 		}
2938 2938
 		if (property_exists($this, 'total')) {
2939
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2939
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2940 2940
 		}
2941 2941
 		if (method_exists($this, 'LibStatut')) {
2942
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2942
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2943 2943
 		}
2944 2944
 		$return .= '</div>';
2945 2945
 		$return .= '</div>';
@@ -2960,9 +2960,9 @@  discard block
 block discarded – undo
2960 2960
 			return 0;
2961 2961
 		}
2962 2962
 		if ($id) {
2963
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2964
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2965
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2963
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2964
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2965
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2966 2966
 			$sql .= " AND fk_user IS NOT NULL";
2967 2967
 
2968 2968
 			$num = 0;
Please login to merge, or discard this patch.