Completed
Branch develop (b41ef2)
by
unknown
24:57
created
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')) {
@@ -2394,18 +2394,18 @@  discard block
 block discarded – undo
2394 2394
 				} else {
2395 2395
 					$instrprty = 'NORM';
2396 2396
 				}
2397
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2398
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2399
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2400
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2401
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2402
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2403
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2404
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2397
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2398
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2399
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2400
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2401
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2402
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2403
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2404
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2405 2405
 			}
2406
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2406
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2407 2407
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2408
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2408
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2409 2409
 			/*
2410 2410
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2411 2411
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2416,35 +2416,35 @@  discard block
 block discarded – undo
2416 2416
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2417 2417
 			 */
2418 2418
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2419
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2420
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2421
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2422
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2423
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2424
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2425
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2426
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2427
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2419
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2420
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2421
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2422
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2423
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2424
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2425
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2426
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2427
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2428 2428
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2429
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2429
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2430 2430
 			if (trim($addressline1)) {
2431
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2431
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2432 2432
 			}
2433 2433
 			if (trim($addressline2)) {
2434
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2434
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2435 2435
 			}
2436
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2437
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2438
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2439
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2440
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2441
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2442
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2443
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2436
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2437
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2438
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2439
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2440
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2441
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2442
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2443
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2444 2444
 			// A string with some information on payment - 140 max
2445
-			$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
2446
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2447
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2445
+			$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
2446
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2447
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2448 2448
 			return $XML_CREDITOR;
2449 2449
 		}
2450 2450
 	}
@@ -2477,11 +2477,11 @@  discard block
 block discarded – undo
2477 2477
 
2478 2478
 		// Raison Sociale C2
2479 2479
 
2480
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2480
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2481 2481
 
2482 2482
 		// Ref of thirdparty on 7 characters
2483 2483
 
2484
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2484
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2485 2485
 
2486 2486
 		// Zone Reservee D1-2
2487 2487
 
@@ -2499,7 +2499,7 @@  discard block
 block discarded – undo
2499 2499
 
2500 2500
 		// Numero de compte D4
2501 2501
 
2502
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2502
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2503 2503
 
2504 2504
 		// Zone Reservee E
2505 2505
 
@@ -2561,15 +2561,15 @@  discard block
 block discarded – undo
2561 2561
 			$this->emetteur_iban = $account->iban;
2562 2562
 			$this->emetteur_bic = $account->bic;
2563 2563
 
2564
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2564
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2565 2565
 
2566 2566
 			$this->raison_sociale = $account->owner_name;
2567 2567
 		}
2568 2568
 
2569 2569
 		// Get pending payments
2570 2570
 		$sql = "SELECT rowid, ref";
2571
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2572
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2571
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2572
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2573 2573
 
2574 2574
 		$resql = $this->db->query($sql);
2575 2575
 		if ($resql) {
@@ -2586,45 +2586,45 @@  discard block
 block discarded – undo
2586 2586
 			if ($type != 'bank-transfer') {
2587 2587
 				// SEPA Paiement Information of my company for Direct Debit
2588 2588
 				$XML_SEPA_INFO = '';
2589
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2590
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/DD' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2591
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2592
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2593
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2594
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2595
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2596
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2597
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2598
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2599
-				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2600
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2601
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2602
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2603
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2604
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2605
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2606
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2607
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2589
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2590
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/DD'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2591
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2592
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2593
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2594
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2595
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2596
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2597
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2598
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2599
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2600
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2601
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2602
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2603
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2604
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2605
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2606
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2607
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2608 2608
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2609
-				$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) => ""));
2609
+				$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) => ""));
2610 2610
 				if ($addressline1) {
2611
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2611
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2612 2612
 				}
2613 2613
 				if ($addressline2) {
2614
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2614
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2615 2615
 				}
2616
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2617
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2618
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2619
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2620
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2621
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2622
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2623
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2624
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2625
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2626
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2627
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2616
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2617
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2618
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2619
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2620
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2621
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2622
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2623
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2624
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2625
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2626
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2627
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2628 2628
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2629 2629
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2630 2630
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2633,64 +2633,64 @@  discard block
 block discarded – undo
2633 2633
 				 $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;
2634 2634
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2635 2635
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2636
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2637
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2638
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2639
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2640
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2641
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2642
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2643
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2644
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2645
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2646
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2647
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2648
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2636
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2637
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2638
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2639
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2640
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2641
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2642
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2643
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2644
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2645
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2646
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2647
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2648
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2649 2649
 			} else {
2650 2650
 				// SEPA Paiement Information of my company for Credit Transfer
2651 2651
 				$XML_SEPA_INFO = '';
2652
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2653
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DOL/' . $dateTime_YMD . '/CT' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2654
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2652
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2653
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DOL/'.$dateTime_YMD.'/CT'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2654
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2655 2655
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2656
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2657
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2656
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2657
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2658 2658
 				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.
2659
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2660
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2661
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2662
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2663
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2664
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2665
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2666
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2667
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2659
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2660
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2661
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2662
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2663
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2664
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2665
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2666
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2667
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2668 2668
 				}
2669
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2670
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2671
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2672
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2673
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2669
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2670
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2671
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2672
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2673
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2674 2674
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2675
-				$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) => ""));
2675
+				$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) => ""));
2676 2676
 				if ($addressline1) {
2677
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2677
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2678 2678
 				}
2679 2679
 				if ($addressline2) {
2680
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2680
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2681 2681
 				}
2682
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2683
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2684
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2685
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2686
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2687
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2688
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2689
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2690
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2691
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2692
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2693
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2682
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2683
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2684
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2685
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2686
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2687
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2688
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2689
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2690
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2691
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2692
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2693
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2694 2694
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2695 2695
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2696 2696
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2699,7 +2699,7 @@  discard block
 block discarded – undo
2699 2699
 				 $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;
2700 2700
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2701 2701
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2702
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2702
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2703 2703
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2704 2704
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2705 2705
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2715 2715
 			}
2716 2716
 		} else {
2717
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2717
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2718 2718
 			$XML_SEPA_INFO = '';
2719 2719
 		}
2720 2720
 		return $XML_SEPA_INFO;
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
 
2767 2767
 		$montant = ($total * 100);
2768 2768
 
2769
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2769
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2770 2770
 
2771 2771
 		// Zone Reservee F
2772 2772
 
@@ -2923,18 +2923,18 @@  discard block
 block discarded – undo
2923 2923
 		$return .= img_picto('', $this->picto);
2924 2924
 		$return .= '</span>';
2925 2925
 		$return .= '<div class="info-box-content">';
2926
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2926
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2927 2927
 		if ($selected >= 0) {
2928
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2928
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2929 2929
 		}
2930 2930
 		if (property_exists($this, 'date_echeance')) {
2931
-			$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>';
2931
+			$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>';
2932 2932
 		}
2933 2933
 		if (property_exists($this, 'total')) {
2934
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2934
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2935 2935
 		}
2936 2936
 		if (method_exists($this, 'LibStatut')) {
2937
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2937
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2938 2938
 		}
2939 2939
 		$return .= '</div>';
2940 2940
 		$return .= '</div>';
@@ -2955,9 +2955,9 @@  discard block
 block discarded – undo
2955 2955
 			return 0;
2956 2956
 		}
2957 2957
 		if ($id) {
2958
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2959
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2960
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2958
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2959
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2960
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2961 2961
 			$sql .= " AND fk_user IS NOT NULL";
2962 2962
 
2963 2963
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/core/class/html.formadmin.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			$out .= '>'.$langs->trans("AutoDetectLang").'</option>';
130 130
 		}
131 131
 
132
-		asort($langs_available);	// array('XX' => 'Language (Country)', ...)
132
+		asort($langs_available); // array('XX' => 'Language (Country)', ...)
133 133
 
134 134
 		foreach ($langs_available as $key => $value) {
135 135
 			$valuetoshow = $value;
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 */
512 512
 	public function selectTypeOfFields($htmlname, $type, $typewecanchangeinto = array())
513 513
 	{
514
-		global $type2label;	// TODO Remove this global
514
+		global $type2label; // TODO Remove this global
515 515
 
516 516
 		$out = '';
517 517
 
Please login to merge, or discard this patch.
htdocs/core/tpl/massactions_pre.tpl.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 if ($massaction == 'preclonetasks') {
77 77
 	$selected = '';
78 78
 	foreach (GETPOST('toselect') as $tmpselected) {
79
-		$selected .= '&selected[]=' . $tmpselected;
79
+		$selected .= '&selected[]='.$tmpselected;
80 80
 	}
81 81
 	$formquestion = array(
82 82
 		// TODO If list of project is long and project is not on a thirdparty, the combo may be very long.
83 83
 		// Solution: Allow only sameproject for cloning tasks ?
84
-		array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', null, 1)),
84
+		array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project').': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', null, 1)),
85 85
 	);
86
-	print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590);
86
+	print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.$selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590);
87 87
 }
88 88
 
89 89
 if ($massaction == 'preaffecttag' && isModEnabled('category')) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			$result = $objecttmp->fetch($toselectid);
215 215
 			if ($result > 0) {
216 216
 				$listofselectedid[$toselectid] = $toselectid;
217
-				$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);	// For proposal, order, invoice, conferenceorbooth, ...
217
+				$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); // For proposal, order, invoice, conferenceorbooth, ...
218 218
 				if (in_array($objecttmp->element, array('societe', 'conferenceorboothattendee'))) {
219 219
 					$thirdpartyid = $objecttmp->id;
220 220
 				} elseif ($objecttmp->element == 'contact') {
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
 		$formmail->withfile = 0;
296 296
 		$formmail->withmaindocfile = 0; // Add a checkbox "Attach also main document"
297 297
 	} else {
298
-		$formmail->withfile = 1;    // $formmail->withfile = 2 to allow to upload files is not yet supported in mass action
298
+		$formmail->withfile = 1; // $formmail->withfile = 2 to allow to upload files is not yet supported in mass action
299 299
 		// Add a checkbox "Attach also main document"
300 300
 		if (isset($withmaindocfilemail)) {
301 301
 			$formmail->withmaindocfile = $withmaindocfilemail;
302 302
 		} else {    // Do an automatic definition of $formmail->withmaindocfile
303 303
 			$formmail->withmaindocfile = 1;
304 304
 			if ($objecttmp->element != 'societe') {
305
-				$formmail->withfile = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("OnlyPDFattachmentSupported") . '</span>';
305
+				$formmail->withfile = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("OnlyPDFattachmentSupported").'</span>';
306 306
 				$formmail->withmaindocfile = -1; // Add a checkbox "Attach also main document" but not checked by default
307 307
 			}
308 308
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
 	// Tableau des parameters complementaires du post
334 334
 	$formmail->param['action'] = $action;
335
-	$formmail->param['models'] = $modelmail;	// the filter to know which kind of template emails to show. 'none' means no template suggested.
335
+	$formmail->param['models'] = $modelmail; // the filter to know which kind of template emails to show. 'none' means no template suggested.
336 336
 	$formmail->param['models_id'] = GETPOSTINT('modelmailselected') ? GETPOSTINT('modelmailselected') : '-1';
337 337
 	$formmail->param['id'] = implode(',', $arrayofselected);
338 338
 	// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 
377 377
 		foreach ($extrafields_list as $extraKey => $extraLabel) {
378 378
 			$outputShowOutputFields .= '<div class="mass-action-extrafield" data-extrafield="'.$extraKey.'" style="display:none;" >';
379
-			$outputShowOutputFields .= '<br><span>'. $langs->trans('NewValue').'</span>';
379
+			$outputShowOutputFields .= '<br><span>'.$langs->trans('NewValue').'</span>';
380 380
 			$outputShowOutputFields .= $extrafields->showInputField($extraKey, '', '', $keysuffix, '', 0, $objecttmp, $objecttmp->table_element);
381 381
 			$outputShowOutputFields .= '</div>';
382 382
 		}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 // Allow Pre-Mass-Action hook (eg for confirmation dialog)
439 439
 if (empty($toselect)) {
440
-	$toselect=[];
440
+	$toselect = [];
441 441
 }
442 442
 $parameters = array(
443 443
 	'toselect' => &$toselect,
Please login to merge, or discard this patch.
htdocs/contact/perso.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
 	$result = $object->update_perso($id, $user);
77 77
 	if ($result > 0) {
78
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
78
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
79 79
 
80 80
 		// Logo/Photo save
81 81
 		$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$maxfilesizearray = getMaxFileSizeArray();
209 209
 		$maxmin = $maxfilesizearray['maxmin'];
210 210
 		if ($maxmin > 0) {
211
-			print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
211
+			print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
212 212
 		}
213 213
 		print '<input type="file" class="flat" name="photo" id="photoinput">';
214 214
 		print '</td></tr>';
Please login to merge, or discard this patch.
htdocs/societe/paymentmodes.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 // Check permission on company
98 98
 $result = restrictedArea($user, 'societe', '', '');
99 99
 
100
-$stripe = null;  // Stripe object
100
+$stripe = null; // Stripe object
101 101
 $stripeacc = null; // Stripe Account
102 102
 $stripecu = null; // Remote stripe customer
103 103
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		}
178 178
 
179 179
 		if (!$error) {
180
-			$companybankaccount->oldcopy = dol_clone($companybankaccount, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
180
+			$companybankaccount->oldcopy = dol_clone($companybankaccount, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
181 181
 
182 182
 			$companybankaccount->socid           = $object->id;
183 183
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 		$companypaymentmode->fetch($id);
256 256
 		if (!$error) {
257
-			$companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
257
+			$companypaymentmode->oldcopy = dol_clone($companypaymentmode, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
258 258
 
259 259
 			$companypaymentmode->fk_soc          = $object->id;
260 260
 
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
 			'use_companybankid' => GETPOST('companybankid'),
541 541
 			'force_dir_output' => $conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName((string) $object->id)
542 542
 		);
543
-		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml');	// This is required by core/action_builddoc.inc.php
544
-		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); 		// This is required by core/action_builddoc.inc.php
543
+		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
544
+		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
545 545
 	}
546 546
 
547 547
 	$id = $socid;
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 		}
612 612
 		if ($action == 'syncsepatostripe' && $permissiontoaddupdatepaymentinformation) {
613 613
 			// Create the bank account on current Stripe env
614
-			$companypaymentmode = new CompanyPaymentMode($db);	// Get record in llx_societe_rib
614
+			$companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib
615 615
 			$companypaymentmode->fetch($id);
616 616
 
617 617
 			if ($companypaymentmode->type != 'ban') {
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 		print '<table class="liste centpercent noborder">'."\n";
1217 1217
 		print '<tr class="liste_titre">';
1218 1218
 		print '<td>'.$langs->trans('Label').'</td>';
1219
-		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>';	// external system ID
1219
+		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>'; // external system ID
1220 1220
 		print '<td>'.$langs->trans('Type').'</td>';
1221 1221
 		print '<td>'.$langs->trans('Informations').'</td>';
1222 1222
 		print '<td></td>';
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 
1558 1558
 	// List of bank accounts
1559 1559
 	if ($permissiontoaddupdatepaymentinformation) {
1560
-		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&amp;action=create');
1560
+		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=create');
1561 1561
 	}
1562 1562
 
1563 1563
 	print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank');
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
 
1575 1575
 		print '<tr class="liste_titre">';
1576 1576
 		print_liste_field_titre("Label");
1577
-		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")));		// external system ID
1577
+		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID
1578 1578
 		print_liste_field_titre("Bank");
1579 1579
 		print_liste_field_titre("RIB");
1580 1580
 		print_liste_field_titre("IBAN");
@@ -1755,7 +1755,7 @@  discard block
 block discarded – undo
1755 1755
 				print '<td class="minwidth200 width200">';
1756 1756
 				$useonlinesignature = 1;
1757 1757
 				if ($useonlinesignature) {
1758
-					require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
1758
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
1759 1759
 					print showOnlineSignatureUrl($companybankaccount->element, (string) $rib->id, $rib, 'short');
1760 1760
 				}
1761 1761
 				print '</td>';
Please login to merge, or discard this patch.
htdocs/product/stock/movement_list.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 $object = new MouvementStock($db);
127 127
 $extrafields = new ExtraFields($db);
128 128
 $diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id;
129
-$hookmanager->initHooks(array($contextpage)); 	// Note that conf->hooks_modules contains array of activated contexes
129
+$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes
130 130
 
131 131
 $formfile = new FormFile($db);
132 132
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 }
334 334
 
335 335
 if ($action == 'update_extras' && $permissiontoadd) {
336
-	$tmpwarehouse->oldcopy = dol_clone($tmpwarehouse, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
336
+	$tmpwarehouse->oldcopy = dol_clone($tmpwarehouse, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
337 337
 
338 338
 	// Fill array 'array_options' with data from update form
339 339
 	$ret = $extrafields->setOptionalsFromPost(null, $tmpwarehouse, GETPOST('attribute', 'restricthtml'));
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
 	$sql .= " AND e.rowid = ".((int) $id);
723 723
 }
724 724
 if (!empty($search_date_start)) {
725
-	$sql .= " AND m.datem >= '" . $db->idate($search_date_start) . "'";
725
+	$sql .= " AND m.datem >= '".$db->idate($search_date_start)."'";
726 726
 }
727 727
 if (!empty($search_date_end)) {
728
-	$sql .= " AND m.datem <= '" . $db->idate($search_date_end) . "'";
728
+	$sql .= " AND m.datem <= '".$db->idate($search_date_end)."'";
729 729
 }
730 730
 if ($idproduct > 0) {
731 731
 	$sql .= " AND p.rowid = ".((int) $idproduct);
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 }
1174 1174
 
1175 1175
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1176
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
1176
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1177 1177
 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1178 1178
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1179 1179
 
Please login to merge, or discard this patch.
htdocs/install/upgrade2.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4231,7 +4231,7 @@  discard block
 block discarded – undo
4231 4231
 
4232 4232
 	if (!is_object($user)) {
4233 4233
 		include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
4234
-		$user = new User($db);	// To avoid error during migration
4234
+		$user = new User($db); // To avoid error during migration
4235 4235
 	}
4236 4236
 
4237 4237
 	dolibarr_install_syslog("upgrade2::migrate_reload_modules force=".$force.", listofmodule=".implode(',', array_keys($listofmodule)));
@@ -4403,7 +4403,7 @@  discard block
 block discarded – undo
4403 4403
 
4404 4404
 	if (!is_object($user)) {
4405 4405
 		include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
4406
-		$user = new User($db);	// To avoid error during migration
4406
+		$user = new User($db); // To avoid error during migration
4407 4407
 	}
4408 4408
 
4409 4409
 	print '<tr><td colspan="4">';
@@ -4413,7 +4413,7 @@  discard block
 block discarded – undo
4413 4413
 	$sql = "SELECT rowid , entity, batch, fk_product from ".MAIN_DB_PREFIX."product_lot";
4414 4414
 	$resql = $db->query($sql);
4415 4415
 	if ($resql) {
4416
-		$modulepart="product_batch";
4416
+		$modulepart = "product_batch";
4417 4417
 		while ($obj = $db->fetch_object($resql)) {
4418 4418
 			$entity = (empty($obj->entity) ? 1 : $obj->entity);
4419 4419
 			if ($entity > 1) {
@@ -4427,10 +4427,10 @@  discard block
 block discarded – undo
4427 4427
 
4428 4428
 			if ($dir && $res > 0) {
4429 4429
 				$lot->ref = $obj->batch;
4430
-				$origin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart);
4430
+				$origin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart);
4431 4431
 
4432 4432
 				$lot->fetch($obj->rowid, $obj->fk_product, $obj->batch);
4433
-				$destin = $dir . '/' . get_exdir(0, 0, 0, 1, $lot, $modulepart);
4433
+				$destin = $dir.'/'.get_exdir(0, 0, 0, 1, $lot, $modulepart);
4434 4434
 
4435 4435
 				if (dol_is_dir($origin) && !dol_is_dir($destin)) {
4436 4436
 					dol_move_dir($origin, $destin, 0);
@@ -5113,7 +5113,7 @@  discard block
 block discarded – undo
5113 5113
 				$error++;
5114 5114
 			}
5115 5115
 
5116
-			$current_contract =  $obj->cid;
5116
+			$current_contract = $obj->cid;
5117 5117
 		}
5118 5118
 	} else {
5119 5119
 		$error++;
Please login to merge, or discard this patch.
htdocs/ticket/list.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 $moretitle = '';
348 348
 if ($socid > 0) {
349 349
 	$socstatic->fetch($socid);
350
-	$moretitle = $langs->trans("ThirdParty") . ' - ';
350
+	$moretitle = $langs->trans("ThirdParty").' - ';
351 351
 	if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $socstatic->name) {
352
-		$moretitle = $socstatic->name . ' - ';
352
+		$moretitle = $socstatic->name.' - ';
353 353
 	}
354 354
 }
355 355
 
356
-$title = $moretitle . $langs->trans('Tickets');
356
+$title = $moretitle.$langs->trans('Tickets');
357 357
 $morejs = array();
358 358
 $morecss = array();
359 359
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 }
392 392
 
393 393
 foreach ($search as $key => $val) {
394
-	$tmpkey = 't.' . $key;
394
+	$tmpkey = 't.'.$key;
395 395
 	if ($key == 'fk_statut' && !empty($search['fk_statut'])) {
396 396
 		$newarrayofstatus = array();
397 397
 		foreach ($search['fk_statut'] as $key2 => $val2) {
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
992 992
 		$cssforfield .= ($cssforfield ? ' ' : '').'right';
993 993
 	}
994
-	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
994
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
995 995
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
996 996
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
997 997
 		$totalarray['nbfield']++;
@@ -1160,16 +1160,16 @@  discard block
 block discarded – undo
1160 1160
 					$should_show_warning = (getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE') || getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE'));
1161 1161
 					if ($is_open && $should_show_warning) {
1162 1162
 						$date_last_msg_sent = (int) $object->date_last_msg_sent;
1163
-						$hour_diff = ($now - $date_last_msg_sent) / 3600 ;
1163
+						$hour_diff = ($now - $date_last_msg_sent) / 3600;
1164 1164
 
1165 1165
 						if (getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE') && $date_last_msg_sent == 0) {
1166
-							$creation_date =  $object->datec;
1167
-							$hour_diff_creation = ($now - $creation_date) / 3600 ;
1166
+							$creation_date = $object->datec;
1167
+							$hour_diff_creation = ($now - $creation_date) / 3600;
1168 1168
 							if ($hour_diff_creation > getDolGlobalInt('TICKET_DELAY_BEFORE_FIRST_RESPONSE')) {
1169
-								print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', 0, 0, 0, '', '');
1169
+								print " ".img_picto($langs->trans('Late').' : '.$langs->trans('TicketsDelayForFirstResponseTooLong', getDolGlobalString('TICKET_DELAY_BEFORE_FIRST_RESPONSE')), 'warning', 'style="color: red;"', 0, 0, 0, '', '');
1170 1170
 							}
1171 1171
 						} elseif (getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE') && $hour_diff > getDolGlobalInt('TICKET_DELAY_SINCE_LAST_RESPONSE')) {
1172
-							print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')), 'warning');
1172
+							print " ".img_picto($langs->trans('Late').' : '.$langs->trans('TicketsDelayFromLastResponseTooLong', getDolGlobalString('TICKET_DELAY_SINCE_LAST_RESPONSE')), 'warning');
1173 1173
 						}
1174 1174
 					}
1175 1175
 				} else {	// Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 
1261 1261
 print '</table>'."\n";
1262 1262
 print '</div>'."\n";
1263
-print '</div>'."\n";	// end div-responsive-inside
1263
+print '</div>'."\n"; // end div-responsive-inside
1264 1264
 
1265 1265
 print '</form>'."\n";
1266 1266
 
Please login to merge, or discard this patch.
htdocs/adherents/class/adherent.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 		$sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
798 798
 		$sql .= ", societe = ".($this->company ? "'".$this->db->escape($this->company)."'" : ($this->societe ? "'".$this->db->escape($this->societe)."'" : "null"));
799 799
 		if ($this->socid) {
800
-			$sql .= ", fk_soc = ".($this->socid > 0 ? (int) $this->socid : "null");	 // Must be modified only when creating from a third-party
800
+			$sql .= ", fk_soc = ".($this->socid > 0 ? (int) $this->socid : "null"); // Must be modified only when creating from a third-party
801 801
 		}
802 802
 		$sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null");
803 803
 		$sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null");
@@ -2291,7 +2291,7 @@  discard block
 block discarded – undo
2291 2291
 		$datas['divopen'] = '<div class="centpercent">';
2292 2292
 		$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u> '.$this->getLibStatut(4);
2293 2293
 		if (!empty($this->morphy)) {
2294
-			$datas['picto'] .= '&nbsp;' . $this->getmorphylib('', 1);
2294
+			$datas['picto'] .= '&nbsp;'.$this->getmorphylib('', 1);
2295 2295
 		}
2296 2296
 		if (!empty($this->ref)) {
2297 2297
 			$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
@@ -2311,9 +2311,9 @@  discard block
 block discarded – undo
2311 2311
 		$datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);
2312 2312
 		// show categories for this record only in ajax to not overload lists
2313 2313
 		if (isModEnabled('category') && !$nofetch) {
2314
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2314
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2315 2315
 			$form = new Form($this->db);
2316
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
2316
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
2317 2317
 		}
2318 2318
 		$datas['divclose'] = '</div>';
2319 2319
 
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
 			}
2440 2440
 		}
2441 2441
 		global $action;
2442
-		$hookmanager->initHooks(array($this->element . 'dao'));
2442
+		$hookmanager->initHooks(array($this->element.'dao'));
2443 2443
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
2444 2444
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
2445 2445
 		if ($reshook > 0) {
@@ -2749,13 +2749,13 @@  discard block
 block discarded – undo
2749 2749
 		global $conf;
2750 2750
 		$dn = '';
2751 2751
 		if ($mode == 0) {
2752
-			$dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]."," . getDolGlobalString('LDAP_MEMBER_DN');
2752
+			$dn = getDolGlobalString('LDAP_KEY_MEMBERS')."=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')].",".getDolGlobalString('LDAP_MEMBER_DN');
2753 2753
 		}
2754 2754
 		if ($mode == 1) {
2755 2755
 			$dn = getDolGlobalString('LDAP_MEMBER_DN');
2756 2756
 		}
2757 2757
 		if ($mode == 2) {
2758
-			$dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')];
2758
+			$dn = getDolGlobalString('LDAP_KEY_MEMBERS')."=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')];
2759 2759
 		}
2760 2760
 		return $dn;
2761 2761
 	}
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
 						$listofmembersko[$adherent->id] = $adherent->id;
3107 3107
 					} else {
3108 3108
 						$thirdpartyres = $adherent->fetch_thirdparty();
3109
-						if ($thirdpartyres === -1 ) {
3109
+						if ($thirdpartyres === -1) {
3110 3110
 							$languagecodeformember = $mysoc->default_lang;
3111 3111
 						} else {
3112 3112
 							// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
Please login to merge, or discard this patch.