Completed
Branch develop (456163)
by
unknown
23:40
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.form.class.php 1 patch
Spacing   +1255 added lines, -1255 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
124 124
 			if (!empty($perm)) {
125 125
 				$tmp = explode(':', $typeofdata);
126
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
126
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
127 127
 				if ($fieldrequired) {
128 128
 					$ret .= '<span class="fieldrequired">';
129 129
 				}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				if ($fieldrequired) {
136 136
 					$ret .= '</span>';
137 137
 				}
138
-				$ret .= '</div>' . "\n";
138
+				$ret .= '</div>'."\n";
139 139
 			} else {
140 140
 				if ($fieldrequired) {
141 141
 					$ret .= '<span class="fieldrequired">';
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 			if (empty($notabletag) && $perm) {
174 174
 				$ret .= '<td class="right">';
175 175
 			}
176
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
177
-				$ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>';
176
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
177
+				$ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>';
178 178
 			}
179 179
 			if (!empty($notabletag) && $notabletag == 1) {
180 180
 				if ($text) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			} elseif ($reg[1] == 'int') {
242 242
 				$typeofdata = 'numeric';
243 243
 			} else {
244
-				return 'ErrorBadParameter ' . $typeofdata;
244
+				return 'ErrorBadParameter '.$typeofdata;
245 245
 			}
246 246
 		}
247 247
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 			if ($editaction == '') {
253 253
 				$editaction = GETPOST('action', 'aZ09');
254 254
 			}
255
-			$editmode = ($editaction == 'edit' . $htmlname);
255
+			$editmode = ($editaction == 'edit'.$htmlname);
256 256
 			if ($editmode) {	// edit mode
257 257
 				$ret .= "<!-- formeditfieldval -->\n";
258
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
259
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
260
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
261
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
258
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
259
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
260
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
261
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
262 262
 				if (empty($notabletag)) {
263 263
 					$ret .= '<table class="nobordernopadding centpercent">';
264 264
 				}
@@ -267,28 +267,28 @@  discard block
 block discarded – undo
267 267
 				}
268 268
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
269 269
 					$tmp = explode(':', $typeofdata);
270
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
270
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
271 271
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
272 272
 					$tmp = explode(':', $typeofdata);
273 273
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
274
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
274
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
275 275
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
276 276
 					$tmp = explode(':', $typeofdata);
277 277
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
278
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
278
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
279 279
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
280 280
 					$tmp = explode(':', $typeofdata);
281
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
281
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
282 282
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
283 283
 					$tmp = explode(':', $typeofdata);
284 284
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
285 285
 					$morealt = '';
286 286
 					if (preg_match('/%/', $cols)) {
287
-						$morealt = ' style="width: ' . $cols . '"';
287
+						$morealt = ' style="width: '.$cols.'"';
288 288
 						$cols = '';
289 289
 					}
290 290
 					$valuetoshow = ($editvalue ? $editvalue : $value);
291
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
291
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
292 292
 					// textarea convert automatically entities chars into simple chars.
293 293
 					// So we convert & into &amp; so a string like 'a &lt; <b>b</b><br>é<br>&lt;script&gt;alert('X');&lt;script&gt;' stay a correct html and is not converted by textarea component when wysiwyg is off.
294 294
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
299 299
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
300 300
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
301
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
302 302
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
303 303
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
304 304
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
305 305
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
306
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
307 307
 				} elseif (preg_match('/^select;/', $typeofdata)) {
308 308
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
309 309
 					$arraylist = array();
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 					// TODO Not yet implemented. See code for extrafields
318 318
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
319 319
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
320
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
320
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
321 321
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? false : (bool) $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
322 322
 					$ret .= $doleditor->Create(1);
323 323
 				} elseif ($typeofdata == 'asis') {
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 					$ret .= '<td>';
333 333
 				}
334 334
 				//else $ret.='<div class="clearboth"></div>';
335
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
335
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
336 336
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
337
-					$ret .= '<br>' . "\n";
337
+					$ret .= '<br>'."\n";
338 338
 				}
339
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
339
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
340 340
 				if (empty($notabletag)) {
341 341
 					$ret .= '</td>';
342 342
 				}
343 343
 
344 344
 				if (empty($notabletag)) {
345
-					$ret .= '</tr></table>' . "\n";
345
+					$ret .= '</tr></table>'."\n";
346 346
 				}
347
-				$ret .= '</form>' . "\n";
347
+				$ret .= '</form>'."\n";
348 348
 			} else {		// view mode
349 349
 				if (preg_match('/^email/', $typeofdata)) {
350 350
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
357 357
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
358 358
 					$tmp = explode(':', $typeofdata);
359
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
359
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
360 360
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
361 361
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
362 362
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
363 363
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
364 364
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
365
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
365
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
366 366
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
367
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
367
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
368 368
 				} elseif (preg_match('/^select;/', $typeofdata)) {
369 369
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
370 370
 					$arraylist = array();
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 					$ret .= $arraylist[$value];
376 376
 					if ($htmlname == 'fk_product_type') {
377 377
 						if ($value == 0) {
378
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
378
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
379 379
 						} else {
380
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
380
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
381 381
 						}
382 382
 					}
383 383
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
386 386
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
387 387
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
388
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
389 389
 					}
390 390
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
391 391
 					// clean data from some dangerous html
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
395 395
 						$ret .= dol_escape_htmltag($value);
396 396
 					} else {
397
-						$ret .= $value;        // $value must be already html escaped.
397
+						$ret .= $value; // $value must be already html escaped.
398 398
 					}
399 399
 				}
400 400
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
434 434
 			if (!is_object($extralanguages)) {
435
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
435
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
436 436
 				$extralanguages = new ExtraLanguages($this->db);
437 437
 			}
438 438
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 				return ''; // No extralang field to show
442 442
 			}
443 443
 
444
-			$result .= '<!-- Widget for translation -->' . "\n";
445
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
444
+			$result .= '<!-- Widget for translation -->'."\n";
445
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
446 446
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang');
447 447
 			$result .= $s;
448 448
 			$result .= '</div>';
449 449
 
450
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
450
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
451 451
 
452 452
 			$resultforextrlang = '';
453 453
 			foreach ($arrayoflangcode as $langcode) {
454
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
454
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
455 455
 				if (empty($valuetoshow)) {
456 456
 					$object->fetchValuesForExtraLanguages();
457 457
 					//var_dump($object->array_languages);
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 
464 464
 				// TODO Use the showInputField() method of ExtraLanguages object
465 465
 				if ($typeofdata == 'textarea') {
466
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
466
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
467 467
 					$resultforextrlang .= $valuetoshow;
468 468
 					$resultforextrlang .= '</textarea>';
469 469
 				} else {
470
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
470
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
471 471
 				}
472 472
 			}
473 473
 			$result .= $resultforextrlang;
474 474
 
475 475
 			$result .= '</div>';
476
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
476
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
477 477
 		}
478 478
 
479 479
 		return $result;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 				if (!empty($tmp[2])) {
537 537
 					$savemethod = $tmp[2];
538 538
 				}
539
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
539
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
540 540
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
541 541
 				$tmp = explode(':', $inputType);
542 542
 				$inputType = $tmp[0];
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 					$savemethod = $tmp[2];
548 548
 				}
549 549
 
550
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
550
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
551 551
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
552 552
 				$tmp = explode(':', $inputType);
553 553
 				$inputType = $tmp[0];
@@ -578,40 +578,40 @@  discard block
 block discarded – undo
578 578
 				}
579 579
 
580 580
 				if (isModEnabled('fckeditor')) {
581
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
581
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
582 582
 				} else {
583 583
 					$inputType = 'textarea';
584 584
 				}
585 585
 			}
586 586
 
587
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
590
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
587
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
590
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
591 591
 			if (!empty($savemethod)) {
592
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
592
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
593 593
 			}
594 594
 			if (!empty($ext_element)) {
595
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
595
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
596 596
 			}
597 597
 			if (!empty($custommsg)) {
598 598
 				if (is_array($custommsg)) {
599 599
 					if (!empty($custommsg['success'])) {
600
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
600
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
601 601
 					}
602 602
 					if (!empty($custommsg['error'])) {
603
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
603
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
604 604
 					}
605 605
 				} else {
606
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
606
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
607 607
 				}
608 608
 			}
609 609
 			if ($inputType == 'textarea') {
610
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
611
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
611
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
612 612
 			}
613
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
614
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
613
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
614
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
615 615
 		} else {
616 616
 			$out = $value;
617 617
 		}
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
641 641
 	{
642 642
 		if ($incbefore) {
643
-			$text = $incbefore . $text;
643
+			$text = $incbefore.$text;
644 644
 		}
645 645
 		if (!$htmltext) {
646 646
 			return $text;
647 647
 		}
648
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
648
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
649 649
 
650 650
 		$tag = 'td';
651 651
 		if ($notabs == 2) {
@@ -659,11 +659,11 @@  discard block
 block discarded – undo
659 659
 
660 660
 		$extrastyle = '';
661 661
 		if ($direction < 0) {
662
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
662
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
663 663
 			$extrastyle = 'padding: 0px; padding-left: 2px;';
664 664
 		}
665 665
 		if ($direction > 0) {
666
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
666
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
667 667
 			$extrastyle = 'padding: 0px; padding-right: 2px;';
668 668
 		}
669 669
 
@@ -676,53 +676,53 @@  discard block
 block discarded – undo
676 676
 			$htmltext = str_replace('"', '&quot;', $htmltext);
677 677
 		} else {
678 678
 			$classfortooltip = 'classfortooltiponclick';
679
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
679
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
680 680
 		}
681 681
 		if ($tooltipon == 2 || $tooltipon == 3) {
682
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
682
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
683 683
 			if ($tooltiptrigger == '') {
684
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
684
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
685 685
 			} else {
686
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
686
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
687 687
 			}
688 688
 		} else {
689
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
689
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
690 690
 		}
691 691
 		if ($tooltipon == 1 || $tooltipon == 3) {
692
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
692
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
693 693
 			if ($tooltiptrigger == '') {
694
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
694
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
695 695
 			} else {
696
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
696
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
697 697
 			}
698 698
 		} else {
699
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
699
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
700 700
 		}
701 701
 		if (empty($notabs)) {
702 702
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
703 703
 		} elseif ($notabs == 2) {
704
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
704
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
705 705
 		}
706 706
 		// Define value if value is before
707 707
 		if ($direction < 0) {
708
-			$s .= '<' . $tag . $paramfortooltipimg;
708
+			$s .= '<'.$tag.$paramfortooltipimg;
709 709
 			if ($tag == 'td') {
710 710
 				$s .= ' class="valigntop" width="14"';
711 711
 			}
712
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
712
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
713 713
 		}
714 714
 		// Use another method to help avoid having a space in value in order to use this value with jquery
715 715
 		// Define label
716 716
 		if ((string) $text != '') {
717
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
717
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
718 718
 		}
719 719
 		// Define value if value is after
720 720
 		if ($direction > 0) {
721
-			$s .= '<' . $tag . $paramfortooltipimg;
721
+			$s .= '<'.$tag.$paramfortooltipimg;
722 722
 			if ($tag == 'td') {
723 723
 				$s .= ' class="valignmiddle" width="14"';
724 724
 			}
725
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
725
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
726 726
 		}
727 727
 		if (empty($notabs)) {
728 728
 			$s .= '</tr></table>';
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
 		$disabled = 0;
831 831
 		$ret = '<div class="centpercent center">';
832
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
832
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
833 833
 
834 834
 		// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
835 835
 		$parameters = array();
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 			return;
841 841
 		}
842 842
 		if (empty($reshook)) {
843
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
843
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
844 844
 			if (is_array($arrayofaction)) {
845 845
 				foreach ($arrayofaction as $code => $label) {
846
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
846
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
847 847
 				}
848 848
 			}
849 849
 		}
@@ -852,17 +852,17 @@  discard block
 block discarded – undo
852 852
 		$ret .= '</select>';
853 853
 
854 854
 		if (empty($conf->dol_optimize_smallscreen)) {
855
-			$ret .= ajax_combobox('.' . $name . 'select');
855
+			$ret .= ajax_combobox('.'.$name.'select');
856 856
 		}
857 857
 
858 858
 		// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
859 859
 		$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
860
-		$ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">';
860
+		$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
861 861
 		$ret .= '</div>';
862 862
 
863 863
 		if (!empty($conf->use_javascript_ajax)) {
864 864
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
865
-    		<script nonce="' . getNonce() . '">
865
+    		<script nonce="' . getNonce().'">
866 866
                         function initCheckForSelect(mode, name, cssclass)	/* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */
867 867
         		{
868 868
         			atleastoneselected=0;
@@ -873,11 +873,11 @@  discard block
 block discarded – undo
873 873
 
874 874
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
875 875
 
876
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
876
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
877 877
     	  			{
878 878
                                     jQuery("."+name).show();
879
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
880
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
879
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
880
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
881 881
     	  			}
882 882
     	  			else
883 883
     	  			{
@@ -887,26 +887,26 @@  discard block
 block discarded – undo
887 887
         		}
888 888
 
889 889
         	jQuery(document).ready(function () {
890
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
891
-                    jQuery(".' . $cssclass . '").click(function() {
892
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
890
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
891
+                    jQuery(".' . $cssclass.'").click(function() {
892
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
893 893
                     });
894
-                    jQuery(".' . $name . 'select").change(function() {
894
+                    jQuery(".' . $name.'select").change(function() {
895 895
         				var massaction = $( this ).val();
896 896
         				var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
897 897
         				if (massaction == "builddoc") {
898 898
                         	urlform = urlform + "#show_files";
899 899
     	            	}
900 900
         				$( this ).closest("form").attr("action", urlform);
901
-                    	console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform);
901
+                    	console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform);
902 902
         	        	/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */
903 903
         				if ($(this).val() != \'0\') {
904
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
905
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
906
-                                        jQuery(".' . $name . '"+massaction).show();
904
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
905
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
906
+                                        jQuery(".' . $name.'"+massaction).show();
907 907
     	  				} else {
908
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
909
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
908
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
909
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
910 910
     	  				}
911 911
     	        });
912 912
         	});
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 		$atleastonefavorite = 0;
950 950
 
951 951
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
952
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
952
+		$sql .= " FROM ".$this->db->prefix()."c_country";
953 953
 		$sql .= " WHERE active > 0";
954 954
 		//$sql.= " ORDER BY code ASC";
955 955
 
956
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
956
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
957 957
 		$resql = $this->db->query($sql);
958 958
 		if ($resql) {
959
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
959
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
960 960
 			$num = $this->db->num_rows($resql);
961 961
 			$i = 0;
962 962
 			if ($num) {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 					$countryArray[$i]['rowid'] = $obj->rowid;
967 967
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
968 968
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
969
-					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
969
+					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
970 970
 					$countryArray[$i]['favorite'] = $obj->favorite;
971 971
 					$countryArray[$i]['eec'] = $obj->eec;
972 972
 					$favorite[$i] = $obj->favorite;
@@ -984,20 +984,20 @@  discard block
 block discarded – undo
984 984
 
985 985
 				if ($showempty) {
986 986
 					if (is_numeric($showempty)) {
987
-						$out .= '<option value="">&nbsp;</option>' . "\n";
987
+						$out .= '<option value="">&nbsp;</option>'."\n";
988 988
 					} else {
989
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
989
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
990 990
 					}
991 991
 				}
992 992
 
993 993
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
994 994
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
995
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
996
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
995
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
996
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
997 997
 					if ($mysoc->isInEEC()) {
998
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
998
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
999 999
 					}
1000
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
1000
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
1001 1001
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
1002 1002
 				}
1003 1003
 
@@ -1025,20 +1025,20 @@  discard block
 block discarded – undo
1025 1025
 						$labeltoshow .= '&nbsp;';
1026 1026
 					}
1027 1027
 					if ($row['code_iso']) {
1028
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1028
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1029 1029
 						if (empty($hideflags)) {
1030 1030
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1031
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1031
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1032 1032
 						}
1033 1033
 					}
1034 1034
 
1035 1035
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1036
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1036
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1037 1037
 					} else {
1038
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1038
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1039 1039
 					}
1040 1040
 					$out .= $labeltoshow;
1041
-					$out .= '</option>' . "\n";
1041
+					$out .= '</option>'."\n";
1042 1042
 				}
1043 1043
 			}
1044 1044
 			$out .= '</select>';
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 		}
1048 1048
 
1049 1049
 		// Make select dynamic
1050
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1051
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1050
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1051
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1052 1052
 
1053 1053
 		return $out;
1054 1054
 	}
@@ -1080,25 +1080,25 @@  discard block
 block discarded – undo
1080 1080
 		$incotermArray = array();
1081 1081
 
1082 1082
 		$sql = "SELECT rowid, code";
1083
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1083
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1084 1084
 		$sql .= " WHERE active > 0";
1085 1085
 		$sql .= " ORDER BY code ASC";
1086 1086
 
1087
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1087
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1088 1088
 		$resql = $this->db->query($sql);
1089 1089
 		if ($resql) {
1090 1090
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1091
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1091
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1092 1092
 				$out .= ajax_combobox($htmlname, $events);
1093 1093
 			}
1094 1094
 
1095 1095
 			if (!empty($page)) {
1096
-				$out .= '<form method="post" action="' . $page . '">';
1096
+				$out .= '<form method="post" action="'.$page.'">';
1097 1097
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1098
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1098
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1099 1099
 			}
1100 1100
 
1101
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1101
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1102 1102
 			$out .= '<option value="0">&nbsp;</option>';
1103 1103
 			$num = $this->db->num_rows($resql);
1104 1104
 			$i = 0;
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 				foreach ($incotermArray as $row) {
1114 1114
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1115
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1115
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1116 1116
 					} else {
1117
-						$out .= '<option value="' . $row['rowid'] . '">';
1117
+						$out .= '<option value="'.$row['rowid'].'">';
1118 1118
 					}
1119 1119
 
1120 1120
 					if ($row['code']) {
@@ -1128,13 +1128,13 @@  discard block
 block discarded – undo
1128 1128
 			$out .= ajax_combobox($htmlname);
1129 1129
 
1130 1130
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1131
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1131
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1132 1132
 				$moreattrib .= ' autocomplete="off"';
1133 1133
 			}
1134
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1134
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1135 1135
 
1136 1136
 			if (!empty($page)) {
1137
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1137
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1138 1138
 			}
1139 1139
 		} else {
1140 1140
 			dol_print_error($this->db);
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1167 1167
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1168 1168
 			if (empty($hidetext)) {
1169
-				print $langs->trans("Type") . ': ';
1169
+				print $langs->trans("Type").': ';
1170 1170
 			}
1171
-			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1171
+			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1172 1172
 			if ($showempty) {
1173 1173
 				print '<option value="-1"';
1174 1174
 				if ($selected == -1) {
@@ -1187,28 +1187,28 @@  discard block
 block discarded – undo
1187 1187
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1188 1188
 				print ' selected';
1189 1189
 			}
1190
-			print '>' . $langs->trans("Product");
1190
+			print '>'.$langs->trans("Product");
1191 1191
 
1192 1192
 			print '<option value="1"';
1193 1193
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1194 1194
 				print ' selected';
1195 1195
 			}
1196
-			print '>' . $langs->trans("Service");
1196
+			print '>'.$langs->trans("Service");
1197 1197
 
1198 1198
 			print '</select>';
1199
-			print ajax_combobox('select_' . $htmlname);
1199
+			print ajax_combobox('select_'.$htmlname);
1200 1200
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1201 1201
 		}
1202 1202
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1203 1203
 			print $langs->trans("Service");
1204
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1204
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1205 1205
 		}
1206 1206
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1207 1207
 			print $langs->trans("Product");
1208
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1208
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1209 1209
 		}
1210 1210
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1211
-			print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1211
+			print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1212 1212
 		}
1213 1213
 	}
1214 1214
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 		$langs->load("trips");
1235 1235
 
1236 1236
 		$sql = "SELECT c.code, c.label";
1237
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1237
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1238 1238
 		$sql .= " WHERE active > 0";
1239 1239
 
1240 1240
 		$resql = $this->db->query($sql);
@@ -1275,11 +1275,11 @@  discard block
 block discarded – undo
1275 1275
 		// phpcs:enable
1276 1276
 		global $user, $langs;
1277 1277
 
1278
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1278
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1279 1279
 
1280 1280
 		$this->load_cache_types_fees();
1281 1281
 
1282
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1282
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1283 1283
 		if ($showempty) {
1284 1284
 			print '<option value="-1"';
1285 1285
 			if ($selected == -1) {
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 		}
1290 1290
 
1291 1291
 		foreach ($this->cache_types_fees as $key => $value) {
1292
-			print '<option value="' . $key . '"';
1292
+			print '<option value="'.$key.'"';
1293 1293
 			if ($key == $selected) {
1294 1294
 				print ' selected';
1295 1295
 			}
@@ -1341,12 +1341,12 @@  discard block
 block discarded – undo
1341 1341
 				$ajaxoptions = array();
1342 1342
 			}
1343 1343
 
1344
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1344
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1345 1345
 
1346 1346
 			// No immediate load of all database
1347 1347
 			$placeholder = '';
1348 1348
 			if ($selected && empty($selected_input_value)) {
1349
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1349
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1350 1350
 				$societetmp = new Societe($this->db);
1351 1351
 				$societetmp->fetch($selected);
1352 1352
 				$selected_input_value = $societetmp->name;
@@ -1354,11 +1354,11 @@  discard block
 block discarded – undo
1354 1354
 			}
1355 1355
 
1356 1356
 			// mode 1
1357
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : '');
1357
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : '');
1358 1358
 
1359 1359
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1360 1360
 			if (empty($hidelabel)) {
1361
-				$out .= $langs->trans("RefOrLabel") . ' : ';
1361
+				$out .= $langs->trans("RefOrLabel").' : ';
1362 1362
 			} elseif ($hidelabel == 1 && !is_numeric($showempty)) {
1363 1363
 				$placeholder = $langs->trans($showempty);
1364 1364
 			} elseif ($hidelabel > 1) {
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 					$out .= img_picto($langs->trans("Search"), 'search');
1368 1368
 				}
1369 1369
 			}
1370
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1370
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1371 1371
 			if ($hidelabel == 3) {
1372 1372
 				$out .= img_picto($langs->trans("Search"), 'search');
1373 1373
 			}
@@ -1429,12 +1429,12 @@  discard block
 block discarded – undo
1429 1429
 				$events = array();
1430 1430
 			}
1431 1431
 
1432
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1432
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1433 1433
 
1434 1434
 			// No immediate load of all database
1435 1435
 			$placeholder = '';
1436 1436
 			if ($selected && empty($selected_input_value)) {
1437
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1437
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1438 1438
 				$contacttmp = new Contact($this->db);
1439 1439
 				$contacttmp->fetch($selected);
1440 1440
 				$selected_input_value = $contacttmp->getFullName($langs);
@@ -1445,11 +1445,11 @@  discard block
 block discarded – undo
1445 1445
 			}
1446 1446
 
1447 1447
 			// mode 1
1448
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : '');
1448
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : '');
1449 1449
 
1450 1450
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1451 1451
 
1452
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1452
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1453 1453
 
1454 1454
 			$out .= ajax_event($htmlname, $events);
1455 1455
 
@@ -1546,30 +1546,30 @@  discard block
 block discarded – undo
1546 1546
 			$sql .= ", s.address, s.zip, s.town";
1547 1547
 			$sql .= ", dictp.code as country_code";
1548 1548
 		}
1549
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1549
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1550 1550
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1551
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1551
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1552 1552
 		}
1553 1553
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1554
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1554
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1555 1555
 		}
1556
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1556
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1557 1557
 		if (!empty($user->socid)) {
1558
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1558
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1559 1559
 		}
1560 1560
 		if ($filter) {
1561 1561
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1562 1562
 			// if not, by testSqlAndScriptInject() only.
1563
-			$sql .= " AND (" . $filter . ")";
1563
+			$sql .= " AND (".$filter.")";
1564 1564
 		}
1565 1565
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1566
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1566
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1567 1567
 		}
1568 1568
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1569 1569
 			$sql .= " AND s.status <> 0";
1570 1570
 		}
1571 1571
 		if (!empty($excludeids)) {
1572
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1572
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1573 1573
 		}
1574 1574
 		// Add where from hooks
1575 1575
 		$parameters = array();
@@ -1589,17 +1589,17 @@  discard block
 block discarded – undo
1589 1589
 				if ($i > 0) {
1590 1590
 					$sql .= " AND ";
1591 1591
 				}
1592
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1592
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1593 1593
 				$i++;
1594 1594
 			}
1595 1595
 			if (count($search_crit) > 1) {
1596 1596
 				$sql .= ")";
1597 1597
 			}
1598 1598
 			if (isModEnabled('barcode')) {
1599
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1599
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1600 1600
 			}
1601
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1602
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1601
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1602
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1603 1603
 			$sql .= ")";
1604 1604
 		}
1605 1605
 		$sql .= $this->db->order("nom", "ASC");
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		$resql = $this->db->query($sql);
1611 1611
 		if ($resql) {
1612 1612
 			// Construct $out and $outarray
1613
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1613
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1614 1614
 
1615 1615
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1616 1616
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 				}
1624 1624
 			}
1625 1625
 			if ($showempty) {
1626
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1626
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1627 1627
 			}
1628 1628
 
1629 1629
 			$companytemp = new Societe($this->db);
@@ -1636,18 +1636,18 @@  discard block
 block discarded – undo
1636 1636
 					$label = '';
1637 1637
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1638 1638
 						if (($obj->client) && (!empty($obj->code_client))) {
1639
-							$label = $obj->code_client . ' - ';
1639
+							$label = $obj->code_client.' - ';
1640 1640
 						}
1641 1641
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1642
-							$label .= $obj->code_fournisseur . ' - ';
1642
+							$label .= $obj->code_fournisseur.' - ';
1643 1643
 						}
1644
-						$label .= ' ' . $obj->name;
1644
+						$label .= ' '.$obj->name;
1645 1645
 					} else {
1646 1646
 						$label = $obj->name;
1647 1647
 					}
1648 1648
 
1649 1649
 					if (!empty($obj->name_alias)) {
1650
-						$label .= ' (' . $obj->name_alias . ')';
1650
+						$label .= ' ('.$obj->name_alias.')';
1651 1651
 					}
1652 1652
 
1653 1653
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 						$companytemp->fournisseur = $obj->fournisseur;
1663 1663
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1664 1664
 						if ($tmptype) {
1665
-							$labelhtml .= ' ' . $tmptype;
1665
+							$labelhtml .= ' '.$tmptype;
1666 1666
 						}
1667 1667
 
1668 1668
 						if ($obj->client || $obj->fournisseur) {
@@ -1672,10 +1672,10 @@  discard block
 block discarded – undo
1672 1672
 							$label .= $langs->trans("Customer");
1673 1673
 						}
1674 1674
 						if ($obj->client == 2 || $obj->client == 3) {
1675
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1675
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1676 1676
 						}
1677 1677
 						if ($obj->fournisseur) {
1678
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1678
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1679 1679
 						}
1680 1680
 						if ($obj->client || $obj->fournisseur) {
1681 1681
 							$label .= ')';
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 					}
1684 1684
 
1685 1685
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1686
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1686
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1687 1687
 						if (!empty($obj->country_code)) {
1688
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1688
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1689 1689
 						}
1690 1690
 						$label .= $s;
1691 1691
 						$labelhtml .= $s;
@@ -1693,9 +1693,9 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 					if (empty($outputmode)) {
1695 1695
 						if (in_array($obj->rowid, $selected)) {
1696
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1696
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1697 1697
 						} else {
1698
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1698
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1699 1699
 						}
1700 1700
 					} else {
1701 1701
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1707,9 +1707,9 @@  discard block
 block discarded – undo
1707 1707
 					}
1708 1708
 				}
1709 1709
 			}
1710
-			$out .= '</select>' . "\n";
1710
+			$out .= '</select>'."\n";
1711 1711
 			if (!$forcecombo) {
1712
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1712
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1713 1713
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT"));
1714 1714
 			}
1715 1715
 		} else {
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		}
1799 1799
 
1800 1800
 		if (!is_object($hookmanager)) {
1801
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1801
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1802 1802
 			$hookmanager = new HookManager($this->db);
1803 1803
 		}
1804 1804
 
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1808 1808
 			$sql .= ", s.nom as company, s.town AS company_town";
1809 1809
 		}
1810
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1810
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1811 1811
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1812
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1812
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1813 1813
 		}
1814
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1814
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1815 1815
 		$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
1816 1816
 		if ($socid > 0 || $socid == -1) {
1817
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1817
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1818 1818
 		}
1819 1819
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1820 1820
 			$sql .= " AND sp.statut <> 0";
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		if ($filter) {
1823 1823
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1824 1824
 			// if not, by testSqlAndScriptInject() only.
1825
-			$sql .= " AND (" . $filter . ")";
1825
+			$sql .= " AND (".$filter.")";
1826 1826
 		}
1827 1827
 		// Add where from hooks
1828 1828
 		$parameters = array();
@@ -1830,30 +1830,30 @@  discard block
 block discarded – undo
1830 1830
 		$sql .= $hookmanager->resPrint;
1831 1831
 		$sql .= " ORDER BY sp.lastname ASC";
1832 1832
 
1833
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1833
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1834 1834
 		$resql = $this->db->query($sql);
1835 1835
 		if ($resql) {
1836 1836
 			$num = $this->db->num_rows($resql);
1837 1837
 
1838 1838
 			if ($htmlname != 'none' && !$options_only) {
1839
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1839
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1840 1840
 			}
1841 1841
 
1842 1842
 			if ($showempty && !is_numeric($showempty)) {
1843 1843
 				$textforempty = $showempty;
1844
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1844
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1845 1845
 			} else {
1846 1846
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1847
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1847
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1848 1848
 				}
1849 1849
 				if ($showempty == 2) {
1850
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1850
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1851 1851
 				}
1852 1852
 			}
1853 1853
 
1854 1854
 			$i = 0;
1855 1855
 			if ($num) {
1856
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1856
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1857 1857
 				$contactstatic = new Contact($this->db);
1858 1858
 
1859 1859
 				while ($i < $num) {
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 						}
1890 1890
 						$extendedInfos = implode(' - ', $extendedInfos);
1891 1891
 						if (!empty($extendedInfos)) {
1892
-							$extendedInfos = ' - ' . $extendedInfos;
1892
+							$extendedInfos = ' - '.$extendedInfos;
1893 1893
 						}
1894 1894
 					}
1895 1895
 
@@ -1907,35 +1907,35 @@  discard block
 block discarded – undo
1907 1907
 								$disabled = 1;
1908 1908
 							}
1909 1909
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1910
-								$out .= '<option value="' . $obj->rowid . '"';
1910
+								$out .= '<option value="'.$obj->rowid.'"';
1911 1911
 								if ($disabled) {
1912 1912
 									$out .= ' disabled';
1913 1913
 								}
1914 1914
 								$out .= ' selected>';
1915 1915
 
1916
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1916
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1917 1917
 								if ($showfunction && $obj->poste) {
1918
-									$tmplabel .= ' (' . $obj->poste . ')';
1918
+									$tmplabel .= ' ('.$obj->poste.')';
1919 1919
 								}
1920 1920
 								if (($showsoc > 0) && $obj->company) {
1921
-									$tmplabel .= ' - (' . $obj->company . ')';
1921
+									$tmplabel .= ' - ('.$obj->company.')';
1922 1922
 								}
1923 1923
 
1924 1924
 								$out .= $tmplabel;
1925 1925
 								$out .= '</option>';
1926 1926
 							} else {
1927
-								$out .= '<option value="' . $obj->rowid . '"';
1927
+								$out .= '<option value="'.$obj->rowid.'"';
1928 1928
 								if ($disabled) {
1929 1929
 									$out .= ' disabled';
1930 1930
 								}
1931 1931
 								$out .= '>';
1932 1932
 
1933
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1933
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1934 1934
 								if ($showfunction && $obj->poste) {
1935
-									$tmplabel .= ' (' . $obj->poste . ')';
1935
+									$tmplabel .= ' ('.$obj->poste.')';
1936 1936
 								}
1937 1937
 								if (($showsoc > 0) && $obj->company) {
1938
-									$tmplabel .= ' - (' . $obj->company . ')';
1938
+									$tmplabel .= ' - ('.$obj->company.')';
1939 1939
 								}
1940 1940
 
1941 1941
 								$out .= $tmplabel;
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
 							}
1944 1944
 						} else {
1945 1945
 							if (in_array($obj->rowid, $selected)) {
1946
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1946
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1947 1947
 								if ($showfunction && $obj->poste) {
1948
-									$tmplabel .= ' (' . $obj->poste . ')';
1948
+									$tmplabel .= ' ('.$obj->poste.')';
1949 1949
 								}
1950 1950
 								if (($showsoc > 0) && $obj->company) {
1951
-									$tmplabel .= ' - (' . $obj->company . ')';
1951
+									$tmplabel .= ' - ('.$obj->company.')';
1952 1952
 								}
1953 1953
 
1954 1954
 								$out .= $tmplabel;
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 				}
1964 1964
 			} else {
1965 1965
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1966
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1966
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1967 1967
 				$out .= $labeltoshow;
1968 1968
 				$out .= '</option>';
1969 1969
 			}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 			}
1985 1985
 
1986 1986
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1987
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1987
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1988 1988
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT"));
1989 1989
 			}
1990 1990
 
@@ -2023,18 +2023,18 @@  discard block
 block discarded – undo
2023 2023
 		// On recherche les remises
2024 2024
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
2025 2025
 		$sql .= " re.description, re.fk_facture_source";
2026
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
2027
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
2028
-		$sql .= " AND re.entity = " . $conf->entity;
2026
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
2027
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
2028
+		$sql .= " AND re.entity = ".$conf->entity;
2029 2029
 		if ($filter) {
2030
-			$sql .= " AND " . $filter;
2030
+			$sql .= " AND ".$filter;
2031 2031
 		}
2032 2032
 		$sql .= " ORDER BY re.description ASC";
2033 2033
 
2034
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
2034
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
2035 2035
 		$resql = $this->db->query($sql);
2036 2036
 		if ($resql) {
2037
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
2037
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
2038 2038
 			$num = $this->db->num_rows($resql);
2039 2039
 
2040 2040
 			$qualifiedlines = $num;
@@ -2072,16 +2072,16 @@  discard block
 block discarded – undo
2072 2072
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
2073 2073
 						$tmpfac = new Facture($this->db);
2074 2074
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
2075
-							$desc = $desc . ' - ' . $tmpfac->ref;
2075
+							$desc = $desc.' - '.$tmpfac->ref;
2076 2076
 						}
2077 2077
 					}
2078 2078
 
2079
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
2079
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
2080 2080
 					$i++;
2081 2081
 				}
2082 2082
 			}
2083 2083
 			print '</select>';
2084
-			print ajax_combobox('select_' . $htmlname);
2084
+			print ajax_combobox('select_'.$htmlname);
2085 2085
 
2086 2086
 			return $qualifiedlines;
2087 2087
 		} else {
@@ -2190,14 +2190,14 @@  discard block
 block discarded – undo
2190 2190
 		if ($showlabelofentity) {
2191 2191
 			$sql .= ", e.label";
2192 2192
 		}
2193
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2193
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2194 2194
 		if ($showlabelofentity) {
2195
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2195
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2196 2196
 		}
2197 2197
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2198 2198
 		if ($userissuperadminentityone && $force_entity != 'default') {
2199 2199
 			if (!empty($force_entity)) {
2200
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2200
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2201 2201
 			} else {
2202 2202
 				$sql .= " WHERE u.entity IS NOT NULL";
2203 2203
 			}
@@ -2205,18 +2205,18 @@  discard block
 block discarded – undo
2205 2205
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2206 2206
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2207 2207
 			} else {
2208
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2208
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2209 2209
 			}
2210 2210
 		}
2211 2211
 
2212 2212
 		if (!empty($user->socid)) {
2213
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2213
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2214 2214
 		}
2215 2215
 		if (is_array($exclude) && $excludeUsers) {
2216
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2216
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2217 2217
 		}
2218 2218
 		if ($includeUsers) {
2219
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2219
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2220 2220
 		}
2221 2221
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2222 2222
 			$sql .= " AND u.statut <> 0";
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
 			$sql .= " AND u.fk_soc IS NULL";
2229 2229
 		}
2230 2230
 		if (!empty($morefilter)) {
2231
-			$sql .= " " . $morefilter;
2231
+			$sql .= " ".$morefilter;
2232 2232
 		}
2233 2233
 
2234 2234
 		//Add hook to filter on user (for example on usergroup define in custom modules)
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2244 2244
 		}
2245 2245
 
2246
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2246
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2247 2247
 
2248 2248
 		$resql = $this->db->query($sql);
2249 2249
 		if ($resql) {
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 			$i = 0;
2252 2252
 			if ($num) {
2253 2253
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2254
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2254
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2255 2255
 				if ($show_empty && !$multiple) {
2256 2256
 					$textforempty = ' ';
2257 2257
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 					if (!is_numeric($show_empty)) {
2261 2261
 						$textforempty = $show_empty;
2262 2262
 					}
2263
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2263
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2264 2264
 
2265 2265
 					$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty;
2266 2266
 					$outarray2[($show_empty < 0 ? $show_empty : -1)] = array(
@@ -2272,13 +2272,13 @@  discard block
 block discarded – undo
2272 2272
 					);
2273 2273
 				}
2274 2274
 				if ($show_every) {
2275
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2275
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2276 2276
 
2277
-					$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --';
2277
+					$outarray[-2] = '-- '.$langs->trans("Everybody").' --';
2278 2278
 					$outarray2[-2] = array(
2279 2279
 						'id' => -2,
2280
-						'label' => '-- ' . $langs->trans("Everybody") . ' --',
2281
-						'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --',
2280
+						'label' => '-- '.$langs->trans("Everybody").' --',
2281
+						'labelhtml' => '-- '.$langs->trans("Everybody").' --',
2282 2282
 						'color' => '',
2283 2283
 						'picto' => ''
2284 2284
 					);
@@ -2329,21 +2329,21 @@  discard block
 block discarded – undo
2329 2329
 					}
2330 2330
 					if ($showstatus >= 0) {
2331 2331
 						if ($obj->status == 1 && $showstatus == 1) {
2332
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2333
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2332
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2333
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2334 2334
 						}
2335 2335
 						if ($obj->status == 0 && $showstatus == 1) {
2336
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2337
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2336
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2337
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2338 2338
 						}
2339 2339
 					}
2340 2340
 					if ($showlabelofentity) {
2341 2341
 						if (empty($obj->entity)) {
2342
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2343
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2342
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2343
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2344 2344
 						} else {
2345 2345
 							if ($obj->entity != $conf->entity) {
2346
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2346
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2347 2347
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2348 2348
 							}
2349 2349
 						}
@@ -2352,13 +2352,13 @@  discard block
 block discarded – undo
2352 2352
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2353 2353
 					if (!empty($disableline) && $disableline != '1') {
2354 2354
 						// Add text from $enableonlytext parameter
2355
-						$moreinfo .= ' - ' . $disableline;
2356
-						$moreinfohtml .= ' - ' . $disableline;
2355
+						$moreinfo .= ' - '.$disableline;
2356
+						$moreinfohtml .= ' - '.$disableline;
2357 2357
 					}
2358 2358
 					$labeltoshow .= $moreinfo;
2359 2359
 					$labeltoshowhtml .= $moreinfohtml;
2360 2360
 
2361
-					$out .= '<option value="' . $obj->rowid . '"';
2361
+					$out .= '<option value="'.$obj->rowid.'"';
2362 2362
 					if (!empty($disableline)) {
2363 2363
 						$out .= ' disabled';
2364 2364
 					}
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 					}
2368 2368
 					$out .= ' data-html="';
2369 2369
 
2370
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2370
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2371 2371
 					if ($showstatus >= 0 && $obj->status == 0) {
2372 2372
 						$outhtml .= '<strike class="opacitymediumxxx">';
2373 2373
 					}
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 					$out .= $labeltoshow;
2383 2383
 					$out .= '</option>';
2384 2384
 
2385
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2385
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2386 2386
 					$outarray2[$userstatic->id] = array(
2387 2387
 						'id' => $userstatic->id,
2388 2388
 						'label' => $labeltoshow,
@@ -2394,14 +2394,14 @@  discard block
 block discarded – undo
2394 2394
 					$i++;
2395 2395
 				}
2396 2396
 			} else {
2397
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2398
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2397
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2398
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2399 2399
 			}
2400 2400
 			$out .= '</select>';
2401 2401
 
2402 2402
 			if ($num && !$forcecombo) {
2403 2403
 				// Enhance with select2
2404
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2404
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2405 2405
 				$out .= ajax_combobox($htmlname);
2406 2406
 			}
2407 2407
 		} else {
@@ -2477,16 +2477,16 @@  discard block
 block discarded – undo
2477 2477
 			$out .= $userstatic->getNomUrl(-1);
2478 2478
 			if ($i == 0) {
2479 2479
 				$ownerid = $value['id'];
2480
-				$out .= ' (' . $langs->trans("Owner") . ')';
2480
+				$out .= ' ('.$langs->trans("Owner").')';
2481 2481
 			}
2482 2482
 			if ($nbassignetouser > 1 && $action != 'view') {
2483
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
2483
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
2484 2484
 			}
2485 2485
 			// Show my availability
2486 2486
 			if ($showproperties) {
2487 2487
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2488 2488
 					$out .= '<div class="myavailability inline-block">';
2489
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2489
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2490 2490
 					$out .= '</div>';
2491 2491
 				}
2492 2492
 			}
@@ -2503,15 +2503,15 @@  discard block
 block discarded – undo
2503 2503
 		// Method with no ajax
2504 2504
 		if ($action != 'view') {
2505 2505
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2506
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2506
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2507 2507
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2508 2508
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2509
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2510
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2509
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2510
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2511 2511
 			$out .= '});';
2512 2512
 			$out .= '})</script>';
2513 2513
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2514
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2514
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2515 2515
 			$out .= '<br>';
2516 2516
 		}
2517 2517
 
@@ -2570,13 +2570,13 @@  discard block
 block discarded – undo
2570 2570
 			$resourcestatic->fetch($value['id']);
2571 2571
 			$out .= $resourcestatic->getNomUrl(-1);
2572 2572
 			if ($nbassignetoresource >= 1 && $action != 'view') {
2573
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassignedresource reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2573
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassignedresource reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2574 2574
 			}
2575 2575
 			// Show my availability
2576 2576
 			if ($showproperties) {
2577 2577
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2578 2578
 					$out .= '<div class="myavailability inline-block">';
2579
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2579
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2580 2580
 					$out .= '</div>';
2581 2581
 				}
2582 2582
 			}
@@ -2593,11 +2593,11 @@  discard block
 block discarded – undo
2593 2593
 		// Method with no ajax
2594 2594
 		if ($action != 'view') {
2595 2595
 			$out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">';
2596
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2596
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2597 2597
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2598 2598
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2599
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2600
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2599
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2600
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2601 2601
 			$out .= '});';
2602 2602
 			$out .= '})</script>';
2603 2603
 
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2606 2606
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2607 2607
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2608
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2608
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2609 2609
 			$out .= '<br>';
2610 2610
 		}
2611 2611
 
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 			$placeholder = '';
2670 2670
 
2671 2671
 			if ($selected && empty($selected_input_value)) {
2672
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2672
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2673 2673
 				$producttmpselect = new Product($this->db);
2674 2674
 				$producttmpselect->fetch($selected);
2675 2675
 				$selected_input_value = $producttmpselect->ref;
@@ -2684,20 +2684,20 @@  discard block
 block discarded – undo
2684 2684
 				}
2685 2685
 			}
2686 2686
 			// mode=1 means customers products
2687
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&status_purchase=' . $status_purchase . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus;
2687
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
2688 2688
 			if ((int) $warehouseId > 0) {
2689
-				$urloption .= '&warehouseid=' . (int) $warehouseId;
2689
+				$urloption .= '&warehouseid='.(int) $warehouseId;
2690 2690
 			}
2691
-			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2691
+			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2692 2692
 
2693 2693
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2694 2694
 				// Code to automatically insert with javascript the select of attributes under the select of product
2695 2695
 				// when a parent of variant has been selected.
2696 2696
 				$out .= '
2697 2697
 				<!-- script to auto show attributes select tags if a variant was selected -->
2698
-				<script nonce="' . getNonce() . '">
2698
+				<script nonce="' . getNonce().'">
2699 2699
 					// auto show attributes fields
2700
-					selected = ' . json_encode($selected_combinations) . ';
2700
+					selected = ' . json_encode($selected_combinations).';
2701 2701
 					combvalues = {};
2702 2702
 
2703 2703
 					jQuery(document).ready(function () {
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 							}
2709 2709
 						});
2710 2710
 
2711
-						jQuery("input#' . $htmlname . '").change(function () {
2711
+						jQuery("input#' . $htmlname.'").change(function () {
2712 2712
 
2713 2713
 							if (!jQuery(this).val()) {
2714 2714
 								jQuery(\'div#attributes_box\').empty();
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 
2718 2718
 							console.log("A change has started. We get variants fields to inject html select");
2719 2719
 
2720
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2720
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2721 2721
 								id: jQuery(this).val()
2722 2722
 							}, function (data) {
2723 2723
 								jQuery(\'div#attributes_box\').empty();
@@ -2760,21 +2760,21 @@  discard block
 block discarded – undo
2760 2760
 							})
2761 2761
 						});
2762 2762
 
2763
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2763
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2764 2764
 					});
2765 2765
 				</script>
2766 2766
                 ';
2767 2767
 			}
2768 2768
 
2769 2769
 			if (empty($hidelabel)) {
2770
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2770
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2771 2771
 			} elseif ($hidelabel > 1) {
2772
-				$placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"';
2772
+				$placeholder = ' placeholder="'.dolPrintHTMLForAttribute($langs->trans("RefOrLabel")).'"';
2773 2773
 				if ($hidelabel == 2) {
2774 2774
 					$out .= img_picto($langs->trans("Search"), 'search');
2775 2775
 				}
2776 2776
 			}
2777
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2777
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2778 2778
 			if ($hidelabel == 3) {
2779 2779
 				$out .= img_picto($langs->trans("Search"), 'search');
2780 2780
 			}
@@ -2811,33 +2811,33 @@  discard block
 block discarded – undo
2811 2811
 		// phpcs:enable
2812 2812
 		global $db;
2813 2813
 
2814
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2814
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2815 2815
 
2816 2816
 		$error = 0;
2817 2817
 		$out = '';
2818 2818
 
2819 2819
 		if (!$forcecombo) {
2820
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2820
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2821 2821
 			$events = array();
2822 2822
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2823 2823
 		}
2824 2824
 
2825
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2825
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2826 2826
 
2827 2827
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2828
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2829
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2828
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2829
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2830 2830
 		if (!empty($status)) {
2831
-			$sql .= ' AND status = ' . (int) $status;
2831
+			$sql .= ' AND status = '.(int) $status;
2832 2832
 		}
2833 2833
 		if (!empty($type)) {
2834
-			$sql .= ' AND bomtype = ' . (int) $type;
2834
+			$sql .= ' AND bomtype = '.(int) $type;
2835 2835
 		}
2836 2836
 		if (!empty($TProducts)) {
2837
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2837
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2838 2838
 		}
2839 2839
 		if (!empty($limit)) {
2840
-			$sql .= ' LIMIT ' . (int) $limit;
2840
+			$sql .= ' LIMIT '.(int) $limit;
2841 2841
 		}
2842 2842
 		$resql = $db->query($sql);
2843 2843
 		if ($resql) {
@@ -2851,11 +2851,11 @@  discard block
 block discarded – undo
2851 2851
 			while ($obj = $db->fetch_object($resql)) {
2852 2852
 				$product = new Product($db);
2853 2853
 				$res = $product->fetch($obj->fk_product);
2854
-				$out .= '<option value="' . $obj->rowid . '"';
2854
+				$out .= '<option value="'.$obj->rowid.'"';
2855 2855
 				if ($obj->rowid == $selected) {
2856 2856
 					$out .= 'selected';
2857 2857
 				}
2858
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2858
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2859 2859
 			}
2860 2860
 		} else {
2861 2861
 			$error++;
@@ -2913,7 +2913,7 @@  discard block
 block discarded – undo
2913 2913
 
2914 2914
 		$warehouseStatusArray = array();
2915 2915
 		if (!empty($warehouseStatus)) {
2916
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2916
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2917 2917
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2918 2918
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2919 2919
 			}
@@ -2927,9 +2927,9 @@  discard block
 block discarded – undo
2927 2927
 
2928 2928
 		$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression";
2929 2929
 		if (count($warehouseStatusArray)) {
2930
-			$selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock
2930
+			$selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock
2931 2931
 		} else {
2932
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2932
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2933 2933
 		}
2934 2934
 
2935 2935
 		$sql = "SELECT ";
@@ -2945,9 +2945,9 @@  discard block
 block discarded – undo
2945 2945
 
2946 2946
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2947 2947
 			//Product category
2948
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2949
-						FROM " . $this->db->prefix() . "categorie_product
2950
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2948
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2949
+						FROM " . $this->db->prefix()."categorie_product
2950
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2951 2951
 						LIMIT 1
2952 2952
 				) AS categorie_product_id ";
2953 2953
 		}
@@ -2973,15 +2973,15 @@  discard block
 block discarded – undo
2973 2973
 		}
2974 2974
 		// Price by quantity
2975 2975
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2976
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2976
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2977 2977
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2978
-				$sql .= " AND price_level = " . ((int) $price_level);
2978
+				$sql .= " AND price_level = ".((int) $price_level);
2979 2979
 			}
2980 2980
 			$sql .= " ORDER BY date_price";
2981 2981
 			$sql .= " DESC LIMIT 1) as price_rowid";
2982
-			$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2982
+			$sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2983 2983
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2984
-				$sql .= " AND price_level = " . ((int) $price_level);
2984
+				$sql .= " AND price_level = ".((int) $price_level);
2985 2985
 			}
2986 2986
 			$sql .= " ORDER BY date_price";
2987 2987
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2992 2992
 
2993 2993
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
2994
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
2994
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
2995 2995
 		}
2996 2996
 
2997 2997
 		// Add from (left join) from hooks
@@ -3000,53 +3000,53 @@  discard block
 block discarded – undo
3000 3000
 		$sql .= $hookmanager->resPrint;
3001 3001
 
3002 3002
 		if (count($warehouseStatusArray)) {
3003
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
3004
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
3005
-			$sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
3003
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
3004
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
3005
+			$sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
3006 3006
 		}
3007 3007
 
3008 3008
 		// include search in supplier ref
3009 3009
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3010
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3010
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3011 3011
 		}
3012 3012
 
3013 3013
 		//Price by customer
3014 3014
 		if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3015
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
3015
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
3016 3016
 		}
3017 3017
 		// Units
3018 3018
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3019
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3019
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3020 3020
 		}
3021 3021
 		// Multilang : we add translation
3022 3022
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
3023
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
3023
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3024 3024
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3025
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3025
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3026 3026
 				$soc = new Societe($this->db);
3027 3027
 				$result = $soc->fetch($socid);
3028 3028
 				if ($result > 0 && !empty($soc->default_lang)) {
3029
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3029
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3030 3030
 				} else {
3031
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3031
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3032 3032
 				}
3033 3033
 			} else {
3034
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3034
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3035 3035
 			}
3036 3036
 		}
3037 3037
 
3038 3038
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3039
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3039
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3040 3040
 		}
3041 3041
 
3042
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3042
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3043 3043
 
3044 3044
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3045 3045
 			$sql .= " AND pac.rowid IS NULL";
3046 3046
 		}
3047 3047
 
3048 3048
 		if ($finished == 0) {
3049
-			$sql .= " AND p.finished = " . ((int) $finished);
3049
+			$sql .= " AND p.finished = ".((int) $finished);
3050 3050
 		} elseif ($finished == 1) {
3051 3051
 			$sql .= " AND p.finished = ".((int) $finished);
3052 3052
 		}
@@ -3054,11 +3054,11 @@  discard block
 block discarded – undo
3054 3054
 			$sql .= " AND p.tosell = ".((int) $status);
3055 3055
 		}
3056 3056
 		if ($status_purchase >= 0) {
3057
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3057
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3058 3058
 		}
3059 3059
 		// Filter by product type
3060 3060
 		if (strval($filtertype) != '') {
3061
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3061
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3062 3062
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3063 3063
 			$sql .= " AND p.fk_product_type = 1";
3064 3064
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
 		}
3067 3067
 
3068 3068
 		if ((int) $warehouseId > 0) {
3069
-			$sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3069
+			$sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3070 3070
 		}
3071 3071
 
3072 3072
 		// Add where from hooks
@@ -3087,21 +3087,21 @@  discard block
 block discarded – undo
3087 3087
 				if ($i > 0) {
3088 3088
 					$sql .= " AND ";
3089 3089
 				}
3090
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3090
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3091 3091
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3092
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3092
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3093 3093
 				}
3094 3094
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3095
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3095
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3096 3096
 				}
3097 3097
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3098
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3098
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3099 3099
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3100
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3100
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3101 3101
 					}
3102 3102
 				}
3103 3103
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3104
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3104
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3105 3105
 				}
3106 3106
 				$sql .= ")";
3107 3107
 				$i++;
@@ -3110,12 +3110,12 @@  discard block
 block discarded – undo
3110 3110
 				$sql .= ")";
3111 3111
 			}
3112 3112
 			if (isModEnabled('barcode')) {
3113
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3113
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3114 3114
 			}
3115 3115
 			$sql .= ')';
3116 3116
 		}
3117 3117
 		if (count($warehouseStatusArray)) {
3118
-			$sql .= " GROUP BY " . $selectFields;
3118
+			$sql .= " GROUP BY ".$selectFields;
3119 3119
 		}
3120 3120
 
3121 3121
 		//Sort by category
@@ -3130,23 +3130,23 @@  discard block
 block discarded – undo
3130 3130
 		$sql .= $this->db->plimit($limit, 0);
3131 3131
 
3132 3132
 		// Build output string
3133
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3133
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3134 3134
 		$result = $this->db->query($sql);
3135 3135
 		if ($result) {
3136
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3137
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3138
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3136
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3137
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3138
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3139 3139
 
3140 3140
 			$num = $this->db->num_rows($result);
3141 3141
 
3142 3142
 			$events = array();
3143 3143
 
3144 3144
 			if (!$forcecombo) {
3145
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3145
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3146 3146
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3147 3147
 			}
3148 3148
 
3149
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3149
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3150 3150
 
3151 3151
 			$textifempty = '';
3152 3152
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
 				}
3164 3164
 			}
3165 3165
 			if ($showempty) {
3166
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3166
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3167 3167
 			}
3168 3168
 
3169 3169
 			$i = 0;
@@ -3174,11 +3174,11 @@  discard block
 block discarded – undo
3174 3174
 
3175 3175
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
3176 3176
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3177
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3178
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3177
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3178
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3179 3179
 					$sql .= " ORDER BY quantity ASC";
3180 3180
 
3181
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3181
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3182 3182
 					$result2 = $this->db->query($sql);
3183 3183
 					if ($result2) {
3184 3184
 						$nb_prices = $this->db->num_rows($result2);
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
 						$price_product = new Product($this->db);
3217 3217
 						$price_product->fetch($objp->rowid, '', '', 1);
3218 3218
 
3219
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3219
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3220 3220
 						$priceparser = new PriceParser($this->db);
3221 3221
 						$price_result = $priceparser->parseProduct($price_product);
3222 3222
 						if ($price_result >= 0) {
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
 			$label = $objp->label_translated;
3303 3303
 		}
3304 3304
 		if (!empty($filterkey) && $filterkey != '') {
3305
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3305
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3306 3306
 		}
3307 3307
 
3308 3308
 		$outkey = $objp->rowid;
@@ -3323,32 +3323,32 @@  discard block
 block discarded – undo
3323 3323
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3324 3324
 
3325 3325
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3326
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3326
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3327 3327
 		}
3328 3328
 
3329 3329
 		// Units
3330 3330
 		$outvalUnits = '';
3331 3331
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3332 3332
 			if (!empty($objp->unit_short)) {
3333
-				$outvalUnits .= ' - ' . $objp->unit_short;
3333
+				$outvalUnits .= ' - '.$objp->unit_short;
3334 3334
 			}
3335 3335
 		}
3336 3336
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3337 3337
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3338 3338
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3339
-				$outvalUnits .= ' - ' . $unitToShow;
3339
+				$outvalUnits .= ' - '.$unitToShow;
3340 3340
 			}
3341 3341
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3342
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3343
-				$outvalUnits .= ' - ' . $unitToShow;
3342
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3343
+				$outvalUnits .= ' - '.$unitToShow;
3344 3344
 			}
3345 3345
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3346 3346
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3347
-				$outvalUnits .= ' - ' . $unitToShow;
3347
+				$outvalUnits .= ' - '.$unitToShow;
3348 3348
 			}
3349 3349
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3350 3350
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3351
-				$outvalUnits .= ' - ' . $unitToShow;
3351
+				$outvalUnits .= ' - '.$unitToShow;
3352 3352
 			}
3353 3353
 		}
3354 3354
 		if ($outdurationvalue && $outdurationunit) {
@@ -3360,7 +3360,7 @@  discard block
 block discarded – undo
3360 3360
 				'y' => $langs->trans('Year')
3361 3361
 			);
3362 3362
 			if (isset($da[$outdurationunit])) {
3363
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3363
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3364 3364
 			}
3365 3365
 		}
3366 3366
 
@@ -3380,31 +3380,31 @@  discard block
 block discarded – undo
3380 3380
 		$labeltoshow = '';
3381 3381
 		$labeltoshow .= $objp->ref;
3382 3382
 		if (!empty($objp->custref)) {
3383
-			$labeltoshow .= ' (' . $objp->custref . ')';
3383
+			$labeltoshow .= ' ('.$objp->custref.')';
3384 3384
 		}
3385 3385
 		if ($outbarcode) {
3386
-			$labeltoshow .= ' (' . $outbarcode . ')';
3386
+			$labeltoshow .= ' ('.$outbarcode.')';
3387 3387
 		}
3388
-		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);
3388
+		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);
3389 3389
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3390
-			$labeltoshow .= ' (' . getCountry($outorigin, '1') . ')';
3390
+			$labeltoshow .= ' ('.getCountry($outorigin, '1').')';
3391 3391
 		}
3392 3392
 
3393 3393
 		// Set $labltoshowhtml
3394 3394
 		$labeltoshowhtml = '';
3395 3395
 		$labeltoshowhtml .= $objp->ref;
3396 3396
 		if (!empty($objp->custref)) {
3397
-			$labeltoshowhtml .= ' (' . $objp->custref . ')';
3397
+			$labeltoshowhtml .= ' ('.$objp->custref.')';
3398 3398
 		}
3399 3399
 		if (!empty($filterkey) && $filterkey != '') {
3400
-			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3400
+			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3401 3401
 		}
3402 3402
 		if ($outbarcode) {
3403
-			$labeltoshowhtml .= ' (' . $outbarcode . ')';
3403
+			$labeltoshowhtml .= ' ('.$outbarcode.')';
3404 3404
 		}
3405
-		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);
3405
+		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);
3406 3406
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3407
-			$labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')';
3407
+			$labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')';
3408 3408
 		}
3409 3409
 
3410 3410
 		// Stock
@@ -3412,14 +3412,14 @@  discard block
 block discarded – undo
3412 3412
 		$labeltoshowhtmlstock = '';
3413 3413
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3414 3414
 			if ($user->hasRight('stock', 'lire')) {
3415
-				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3415
+				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3416 3416
 
3417 3417
 				if ($objp->stock > 0) {
3418 3418
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
3419 3419
 				} elseif ($objp->stock <= 0) {
3420 3420
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
3421 3421
 				}
3422
-				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3422
+				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3423 3423
 				$labeltoshowhtmlstock .= '</span>';
3424 3424
 
3425 3425
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
@@ -3430,9 +3430,9 @@  discard block
 block discarded – undo
3430 3430
 					$tmpproduct->load_virtual_stock();
3431 3431
 					$virtualstock = $tmpproduct->stock_theorique;
3432 3432
 
3433
-					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3433
+					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3434 3434
 
3435
-					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3435
+					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':';
3436 3436
 					if ($virtualstock > 0) {
3437 3437
 						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';
3438 3438
 					} elseif ($virtualstock <= 0) {
@@ -3453,35 +3453,35 @@  discard block
 block discarded – undo
3453 3453
 		// If we need a particular price level (from 1 to n)
3454 3454
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) {
3455 3455
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3456
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3457
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3458
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3459
-			$sql .= " AND price_level = " . ((int) $price_level);
3456
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3457
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3458
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3459
+			$sql .= " AND price_level = ".((int) $price_level);
3460 3460
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3461 3461
 			$sql .= " LIMIT 1";
3462 3462
 
3463
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3463
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3464 3464
 			$result2 = $this->db->query($sql);
3465 3465
 			if ($result2) {
3466 3466
 				$objp2 = $this->db->fetch_object($result2);
3467 3467
 				if ($objp2) {
3468 3468
 					$found = 1;
3469 3469
 					if ($objp2->price_base_type == 'HT') {
3470
-						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3471
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3470
+						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3471
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3472 3472
 					} else {
3473
-						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3474
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3473
+						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3474
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3475 3475
 					}
3476 3476
 					$outprice_ht = price($objp2->price);
3477 3477
 					$outprice_ttc = price($objp2->price_ttc);
3478 3478
 					$outpricebasetype = $objp2->price_base_type;
3479 3479
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3480
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3481
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3480
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3481
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3482 3482
 					} else {
3483
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3484
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3483
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3484
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3485 3485
 					}
3486 3486
 				}
3487 3487
 			} else {
@@ -3495,13 +3495,13 @@  discard block
 block discarded – undo
3495 3495
 			$outqty = $objp->quantity;
3496 3496
 			$outdiscount = $objp->remise_percent;
3497 3497
 			if ($objp->quantity == 1) {
3498
-				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3499
-				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3498
+				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3499
+				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3500 3500
 				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3501 3501
 				$labeltoshowhtmlprice .= $langs->transnoentities("Unit");
3502 3502
 			} else {
3503
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3504
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3503
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3504
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3505 3505
 				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3506 3506
 				$labeltoshowhtmlprice .= $langs->transnoentities("Units");
3507 3507
 			}
@@ -3509,16 +3509,16 @@  discard block
 block discarded – undo
3509 3509
 			$outprice_ht = price($objp->unitprice);
3510 3510
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3511 3511
 			$outpricebasetype = $objp->price_base_type;
3512
-			$outtva_tx = $objp->tva_tx;                            // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3513
-			$outdefault_vat_code = $objp->default_vat_code;        // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3512
+			$outtva_tx = $objp->tva_tx; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3513
+			$outdefault_vat_code = $objp->default_vat_code; // This value is the value on product when constructProductListOption is called by select_produits_list even if other field $objp-> are from table price_by_qty
3514 3514
 		}
3515 3515
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3516
-			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3517
-			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3516
+			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3517
+			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3518 3518
 		}
3519 3519
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3520
-			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3521
-			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3520
+			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3521
+			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3522 3522
 		}
3523 3523
 
3524 3524
 		// Price by customer
@@ -3527,11 +3527,11 @@  discard block
 block discarded – undo
3527 3527
 				$found = 1;
3528 3528
 
3529 3529
 				if ($objp->custprice_base_type == 'HT') {
3530
-					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3531
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3530
+					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3531
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3532 3532
 				} else {
3533
-					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3534
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3533
+					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3534
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3535 3535
 				}
3536 3536
 
3537 3537
 				$outprice_ht = price($objp->custprice);
@@ -3545,11 +3545,11 @@  discard block
 block discarded – undo
3545 3545
 		// If level no defined or multiprice not found, we used the default price
3546 3546
 		if (empty($hidepriceinlabel) && !$found) {
3547 3547
 			if ($objp->price_base_type == 'HT') {
3548
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3549
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3548
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3549
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3550 3550
 			} else {
3551
-				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3552
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3551
+				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3552
+				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3553 3553
 			}
3554 3554
 			$outprice_ht = price($objp->price);
3555 3555
 			$outprice_ttc = price($objp->price_ttc);
@@ -3559,14 +3559,14 @@  discard block
 block discarded – undo
3559 3559
 		}
3560 3560
 
3561 3561
 		// Build options
3562
-		$opt = '<option value="' . $objp->rowid . '"';
3562
+		$opt = '<option value="'.$objp->rowid.'"';
3563 3563
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3564 3564
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3565
-			$opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
3565
+			$opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"';
3566 3566
 		}
3567 3567
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3568
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3569
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3568
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3569
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3570 3570
 		}
3571 3571
 
3572 3572
 		if ($stocktag == 1) {
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
 		$selected_input_value = '';
3662 3662
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3663 3663
 			if ($selected > 0) {
3664
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3664
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3665 3665
 				$producttmpselect = new Product($this->db);
3666 3666
 				$producttmpselect->fetch($selected);
3667 3667
 				$selected_input_value = $producttmpselect->ref;
@@ -3669,10 +3669,10 @@  discard block
 block discarded – undo
3669 3669
 			}
3670 3670
 
3671 3671
 			// mode=2 means suppliers products
3672
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3673
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3672
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3673
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3674 3674
 
3675
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3675
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3676 3676
 		} else {
3677 3677
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3678 3678
 		}
@@ -3730,25 +3730,25 @@  discard block
 block discarded – undo
3730 3730
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3731 3731
 			$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
3732 3732
 		}
3733
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3734
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3733
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3734
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3735 3735
 		if ($socid > 0) {
3736
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3736
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3737 3737
 		}
3738
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3738
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3739 3739
 		// Units
3740 3740
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3741
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3741
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3742 3742
 		}
3743
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3743
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3744 3744
 		if ($statut != -1) {
3745
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3745
+			$sql .= " AND p.tobuy = ".((int) $statut);
3746 3746
 		}
3747 3747
 		if (strval($filtertype) != '') {
3748
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3748
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3749 3749
 		}
3750 3750
 		if (!empty($filtre)) {
3751
-			$sql .= " " . $filtre;
3751
+			$sql .= " ".$filtre;
3752 3752
 		}
3753 3753
 		// Add where from hooks
3754 3754
 		$parameters = array();
@@ -3768,9 +3768,9 @@  discard block
 block discarded – undo
3768 3768
 				if ($i > 0) {
3769 3769
 					$sql .= " AND ";
3770 3770
 				}
3771
-				$sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3771
+				$sql .= "(pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%' OR p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3772 3772
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3773
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3773
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3774 3774
 				}
3775 3775
 				$sql .= ")";
3776 3776
 				$i++;
@@ -3779,8 +3779,8 @@  discard block
 block discarded – undo
3779 3779
 				$sql .= ")";
3780 3780
 			}
3781 3781
 			if (isModEnabled('barcode')) {
3782
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3783
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3782
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3783
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3784 3784
 			}
3785 3785
 			$sql .= ')';
3786 3786
 		}
@@ -3789,20 +3789,20 @@  discard block
 block discarded – undo
3789 3789
 
3790 3790
 		// Build output string
3791 3791
 
3792
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3792
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3793 3793
 		$result = $this->db->query($sql);
3794 3794
 		if ($result) {
3795
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3796
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3795
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3796
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3797 3797
 
3798 3798
 			$num = $this->db->num_rows($result);
3799 3799
 
3800 3800
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3801
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3801
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3802 3802
 			if (!$selected) {
3803
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3803
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3804 3804
 			} else {
3805
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3805
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3806 3806
 			}
3807 3807
 
3808 3808
 			$i = 0;
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
 
3818 3818
 				$outkey = $objp->idprodfournprice; // id in table of price
3819 3819
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3820
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3820
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3821 3821
 				}
3822 3822
 
3823 3823
 				$outref = $objp->ref;
@@ -3832,23 +3832,23 @@  discard block
 block discarded – undo
3832 3832
 				$outvalUnits = '';
3833 3833
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3834 3834
 					if (!empty($objp->unit_short)) {
3835
-						$outvalUnits .= ' - ' . $objp->unit_short;
3835
+						$outvalUnits .= ' - '.$objp->unit_short;
3836 3836
 					}
3837 3837
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3838 3838
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3839
-						$outvalUnits .= ' - ' . $unitToShow;
3839
+						$outvalUnits .= ' - '.$unitToShow;
3840 3840
 					}
3841 3841
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3842
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3843
-						$outvalUnits .= ' - ' . $unitToShow;
3842
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3843
+						$outvalUnits .= ' - '.$unitToShow;
3844 3844
 					}
3845 3845
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3846 3846
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3847
-						$outvalUnits .= ' - ' . $unitToShow;
3847
+						$outvalUnits .= ' - '.$unitToShow;
3848 3848
 					}
3849 3849
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3850 3850
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3851
-						$outvalUnits .= ' - ' . $unitToShow;
3851
+						$outvalUnits .= ' - '.$unitToShow;
3852 3852
 					}
3853 3853
 					if ($outdurationvalue && $outdurationunit) {
3854 3854
 						$da = array(
@@ -3859,22 +3859,22 @@  discard block
 block discarded – undo
3859 3859
 							'y' => $langs->trans('Year')
3860 3860
 						);
3861 3861
 						if (isset($da[$outdurationunit])) {
3862
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3862
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3863 3863
 						}
3864 3864
 					}
3865 3865
 				}
3866 3866
 
3867 3867
 				$objRef = $objp->ref;
3868 3868
 				if ($filterkey && $filterkey != '') {
3869
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3869
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3870 3870
 				}
3871 3871
 				$objRefFourn = $objp->ref_fourn;
3872 3872
 				if ($filterkey && $filterkey != '') {
3873
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3873
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3874 3874
 				}
3875 3875
 				$label = $objp->label;
3876 3876
 				if ($filterkey && $filterkey != '') {
3877
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3877
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3878 3878
 				}
3879 3879
 
3880 3880
 				switch ($objp->fk_product_type) {
@@ -3897,21 +3897,21 @@  discard block
 block discarded – undo
3897 3897
 
3898 3898
 				$optlabel .= $objp->ref;
3899 3899
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3900
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3900
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3901 3901
 				}
3902 3902
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3903
-					$optlabel .= ' (' . $outbarcode . ')';
3903
+					$optlabel .= ' ('.$outbarcode.')';
3904 3904
 				}
3905
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3905
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3906 3906
 
3907 3907
 				$outvallabel = $objRef;
3908 3908
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3909
-					$outvallabel .= ' (' . $objRefFourn . ')';
3909
+					$outvallabel .= ' ('.$objRefFourn.')';
3910 3910
 				}
3911 3911
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3912
-					$outvallabel .= ' (' . $outbarcode . ')';
3912
+					$outvallabel .= ' ('.$outbarcode.')';
3913 3913
 				}
3914
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3914
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3915 3915
 
3916 3916
 				// Units
3917 3917
 				$optlabel .= $outvalUnits;
@@ -3928,7 +3928,7 @@  discard block
 block discarded – undo
3928 3928
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3929 3929
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3930 3930
 
3931
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3931
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3932 3932
 						$priceparser = new PriceParser($this->db);
3933 3933
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3934 3934
 						if ($price_result >= 0) {
@@ -3939,57 +3939,57 @@  discard block
 block discarded – undo
3939 3939
 						}
3940 3940
 					}
3941 3941
 					if ($objp->quantity == 1) {
3942
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3943
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3942
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3943
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3944 3944
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3945 3945
 						$outvallabel .= $langs->transnoentities("Unit");
3946 3946
 					} else {
3947
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3948
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3949
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3950
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3947
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3948
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3949
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3950
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3951 3951
 					}
3952 3952
 
3953 3953
 					if ($objp->quantity > 1) {
3954
-						$optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3955
-						$outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3954
+						$optlabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3955
+						$outvallabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3956 3956
 					}
3957 3957
 					if ($objp->remise_percent >= 1) {
3958
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3959
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3958
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3959
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3960 3960
 					}
3961 3961
 					if ($objp->duration) {
3962
-						$optlabel .= " - " . $objp->duration;
3963
-						$outvallabel .= " - " . $objp->duration;
3962
+						$optlabel .= " - ".$objp->duration;
3963
+						$outvallabel .= " - ".$objp->duration;
3964 3964
 					}
3965 3965
 					if (!$socid) {
3966
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3967
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3966
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3967
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3968 3968
 					}
3969 3969
 					if ($objp->supplier_reputation) {
3970 3970
 						//TODO dictionary
3971 3971
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3972 3972
 
3973
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3974
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3973
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3974
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3975 3975
 					}
3976 3976
 				} else {
3977
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3978
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3977
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3978
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3979 3979
 				}
3980 3980
 
3981 3981
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3982 3982
 					$novirtualstock = ($showstockinlist == 2);
3983 3983
 
3984 3984
 					if ($user->hasRight('stock', 'lire')) {
3985
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3985
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3986 3986
 
3987 3987
 						if ($objp->stock > 0) {
3988 3988
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3989 3989
 						} elseif ($objp->stock <= 0) {
3990 3990
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3991 3991
 						}
3992
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3992
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3993 3993
 						$optlabel .= '</span>';
3994 3994
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3995 3995
 							$langs->load("stocks");
@@ -3999,9 +3999,9 @@  discard block
 block discarded – undo
3999 3999
 							$tmpproduct->load_virtual_stock();
4000 4000
 							$virtualstock = $tmpproduct->stock_theorique;
4001 4001
 
4002
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
4002
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
4003 4003
 
4004
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
4004
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
4005 4005
 							if ($virtualstock > 0) {
4006 4006
 								$optlabel .= '<span class="product_line_stock_ok">';
4007 4007
 							} elseif ($virtualstock <= 0) {
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
 					}
4016 4016
 				}
4017 4017
 
4018
-				$optstart = '<option value="' . $outkey . '"';
4018
+				$optstart = '<option value="'.$outkey.'"';
4019 4019
 				if ($selected && $selected == $objp->idprodfournprice) {
4020 4020
 					$optstart .= ' selected';
4021 4021
 				}
@@ -4024,22 +4024,22 @@  discard block
 block discarded – undo
4024 4024
 				}
4025 4025
 
4026 4026
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
4027
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
4028
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
4029
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
4030
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
4031
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
4032
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
4033
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
4034
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
4035
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
4036
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
4027
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
4028
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
4029
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
4030
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
4031
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
4032
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
4033
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
4034
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
4035
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
4036
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
4037 4037
 					if (isModEnabled('multicurrency')) {
4038
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
4039
-						$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
4038
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
4039
+						$optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
4040 4040
 					}
4041 4041
 				}
4042
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
4042
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
4043 4043
 
4044 4044
 				// set $parameters to call hook
4045 4045
 				$outarrayentry = array(
@@ -4048,9 +4048,9 @@  discard block
 block discarded – undo
4048 4048
 					'label' => $outvallabel,
4049 4049
 					'labelhtml' => $optlabel,
4050 4050
 					'qty' => $outqty,
4051
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
4052
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4053
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4051
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4052
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4053
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4054 4054
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
4055 4055
 					'tva_tx' => price2num($objp->tva_tx),
4056 4056
 					'default_vat_code' => $objp->default_vat_code,
@@ -4080,18 +4080,18 @@  discard block
 block discarded – undo
4080 4080
 				// Add new entry
4081 4081
 				// "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
4082 4082
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4083
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4083
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4084 4084
 				$outarraypush = array(
4085 4085
 					'key' => $outkey,
4086 4086
 					'value' => $outref,
4087 4087
 					'label' => $outvallabel,
4088 4088
 					'labelhtml' => $optlabel,
4089 4089
 					'qty' => $outqty,
4090
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4090
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4091 4091
 					'price_qty_ht_locale' => price($objp->fprice),
4092
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4092
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4093 4093
 					'price_unit_ht_locale' => price($objp->unitprice),
4094
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4094
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4095 4095
 					'tva_tx_formated' => price($objp->tva_tx),
4096 4096
 					'tva_tx' => price2num($objp->tva_tx),
4097 4097
 					'default_vat_code' => $objp->default_vat_code,
@@ -4124,7 +4124,7 @@  discard block
 block discarded – undo
4124 4124
 
4125 4125
 			$this->db->free($result);
4126 4126
 
4127
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4127
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4128 4128
 			$out .= ajax_combobox($htmlname);
4129 4129
 		} else {
4130 4130
 			dol_print_error($this->db);
@@ -4156,43 +4156,43 @@  discard block
 block discarded – undo
4156 4156
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4157 4157
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4158 4158
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4159
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4160
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4161
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4162
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4159
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4160
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4161
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4162
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4163 4163
 		$sql .= " AND p.tobuy = 1";
4164 4164
 		$sql .= " AND s.fournisseur = 1";
4165
-		$sql .= " AND p.rowid = " . ((int) $productid);
4165
+		$sql .= " AND p.rowid = ".((int) $productid);
4166 4166
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4167 4167
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4168 4168
 		} else {
4169 4169
 			$sql .= " ORDER BY pfp.unitprice ASC";
4170 4170
 		}
4171 4171
 
4172
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4172
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4173 4173
 		$result = $this->db->query($sql);
4174 4174
 
4175 4175
 		if ($result) {
4176 4176
 			$num = $this->db->num_rows($result);
4177 4177
 
4178
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4178
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4179 4179
 
4180 4180
 			if (!$num) {
4181
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4181
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4182 4182
 			} else {
4183
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4183
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4184 4184
 				$form .= '<option value="0">&nbsp;</option>';
4185 4185
 
4186 4186
 				$i = 0;
4187 4187
 				while ($i < $num) {
4188 4188
 					$objp = $this->db->fetch_object($result);
4189 4189
 
4190
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4190
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4191 4191
 					//if there is only one supplier, preselect it
4192 4192
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4193 4193
 						$opt .= ' selected';
4194 4194
 					}
4195
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4195
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4196 4196
 
4197 4197
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4198 4198
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4202,7 +4202,7 @@  discard block
 block discarded – undo
4202 4202
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4203 4203
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4204 4204
 
4205
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4205
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4206 4206
 						$priceparser = new PriceParser($this->db);
4207 4207
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4208 4208
 						if ($price_result >= 0) {
@@ -4213,10 +4213,10 @@  discard block
 block discarded – undo
4213 4213
 						}
4214 4214
 					}
4215 4215
 					if ($objp->quantity == 1) {
4216
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4216
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4217 4217
 					}
4218 4218
 
4219
-					$opt .= $objp->quantity . ' ';
4219
+					$opt .= $objp->quantity.' ';
4220 4220
 
4221 4221
 					if ($objp->quantity == 1) {
4222 4222
 						$opt .= $langs->trans("Unit");
@@ -4225,10 +4225,10 @@  discard block
 block discarded – undo
4225 4225
 					}
4226 4226
 					if ($objp->quantity > 1) {
4227 4227
 						$opt .= " - ";
4228
-						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
4228
+						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
4229 4229
 					}
4230 4230
 					if ($objp->duration) {
4231
-						$opt .= " - " . $objp->duration;
4231
+						$opt .= " - ".$objp->duration;
4232 4232
 					}
4233 4233
 					$opt .= "</option>\n";
4234 4234
 
@@ -4266,8 +4266,8 @@  discard block
 block discarded – undo
4266 4266
 		dol_syslog(__METHOD__, LOG_DEBUG);
4267 4267
 
4268 4268
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4269
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4270
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4269
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4270
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4271 4271
 		$sql .= " AND active > 0";
4272 4272
 		$sql .= " ORDER BY sortorder";
4273 4273
 
@@ -4279,7 +4279,7 @@  discard block
 block discarded – undo
4279 4279
 				$obj = $this->db->fetch_object($resql);
4280 4280
 
4281 4281
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4282
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4282
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4283 4283
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4284 4284
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4285 4285
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4307,7 +4307,7 @@  discard block
 block discarded – undo
4307 4307
 		// phpcs:enable
4308 4308
 		global $langs;
4309 4309
 
4310
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4310
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4311 4311
 		if ($num > 0) {
4312 4312
 			return 0; // Cache already loaded
4313 4313
 		}
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
 		$langs->load('propal');
4318 4318
 
4319 4319
 		$sql = "SELECT rowid, code, label, position";
4320
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4320
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4321 4321
 		$sql .= " WHERE active > 0";
4322 4322
 
4323 4323
 		$resql = $this->db->query($sql);
@@ -4328,7 +4328,7 @@  discard block
 block discarded – undo
4328 4328
 				$obj = $this->db->fetch_object($resql);
4329 4329
 
4330 4330
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4331
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4331
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4332 4332
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4333 4333
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4334 4334
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4360,17 +4360,17 @@  discard block
 block discarded – undo
4360 4360
 
4361 4361
 		$this->load_cache_availability();
4362 4362
 
4363
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4363
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4364 4364
 
4365
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4365
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4366 4366
 		if ($addempty) {
4367 4367
 			print '<option value="0">&nbsp;</option>';
4368 4368
 		}
4369 4369
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4370 4370
 			if ($selected == $id) {
4371
-				print '<option value="' . $id . '" selected>';
4371
+				print '<option value="'.$id.'" selected>';
4372 4372
 			} else {
4373
-				print '<option value="' . $id . '">';
4373
+				print '<option value="'.$id.'">';
4374 4374
 			}
4375 4375
 			print dol_escape_htmltag($arrayavailability['label']);
4376 4376
 			print '</option>';
@@ -4391,13 +4391,13 @@  discard block
 block discarded – undo
4391 4391
 	{
4392 4392
 		global $langs;
4393 4393
 
4394
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4394
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4395 4395
 		if ($num > 0) {
4396 4396
 			return 0; // Cache already loaded
4397 4397
 		}
4398 4398
 
4399 4399
 		$sql = "SELECT rowid, code, label";
4400
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4400
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4401 4401
 		$sql .= " WHERE active > 0";
4402 4402
 
4403 4403
 		$resql = $this->db->query($sql);
@@ -4410,8 +4410,8 @@  discard block
 block discarded – undo
4410 4410
 
4411 4411
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4412 4412
 				$label = ($obj->label != '-' ? $obj->label : '');
4413
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4414
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4413
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4414
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4415 4415
 				}
4416 4416
 				if ($langs->trans($obj->code) != $obj->code) {
4417 4417
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4451,9 +4451,9 @@  discard block
 block discarded – undo
4451 4451
 
4452 4452
 		$this->loadCacheInputReason();
4453 4453
 
4454
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4454
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4455 4455
 		if ($addempty) {
4456
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4456
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4457 4457
 		}
4458 4458
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4459 4459
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4461,9 +4461,9 @@  discard block
 block discarded – undo
4461 4461
 			}
4462 4462
 
4463 4463
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4464
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4464
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4465 4465
 			} else {
4466
-				print '<option value="' . $arraydemandreason['id'] . '">';
4466
+				print '<option value="'.$arraydemandreason['id'].'">';
4467 4467
 			}
4468 4468
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4469 4469
 			print $langs->trans($label);
@@ -4473,7 +4473,7 @@  discard block
 block discarded – undo
4473 4473
 		if ($user->admin && empty($notooltip)) {
4474 4474
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4475 4475
 		}
4476
-		print ajax_combobox('select_' . $htmlname);
4476
+		print ajax_combobox('select_'.$htmlname);
4477 4477
 	}
4478 4478
 
4479 4479
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4488,7 +4488,7 @@  discard block
 block discarded – undo
4488 4488
 		// phpcs:enable
4489 4489
 		global $langs;
4490 4490
 
4491
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4491
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4492 4492
 		if ($num > 0) {
4493 4493
 			return $num; // Cache already loaded
4494 4494
 		}
@@ -4498,8 +4498,8 @@  discard block
 block discarded – undo
4498 4498
 		$this->cache_types_paiements = array();
4499 4499
 
4500 4500
 		$sql = "SELECT id, code, libelle as label, type, active";
4501
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4502
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4501
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4502
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4503 4503
 
4504 4504
 		$resql = $this->db->query($sql);
4505 4505
 		if ($resql) {
@@ -4509,7 +4509,7 @@  discard block
 block discarded – undo
4509 4509
 				$obj = $this->db->fetch_object($resql);
4510 4510
 
4511 4511
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4512
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4512
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4513 4513
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4514 4514
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4515 4515
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4581,17 +4581,17 @@  discard block
 block discarded – undo
4581 4581
 		global $langs, $user, $conf;
4582 4582
 
4583 4583
 		$out = '';
4584
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4584
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4585 4585
 
4586 4586
 		$this->load_cache_conditions_paiements();
4587 4587
 
4588 4588
 		// Set default value if not already set by caller
4589 4589
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4590
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4590
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4591 4591
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4592 4592
 		}
4593 4593
 
4594
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4594
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4595 4595
 		if ($addempty) {
4596 4596
 			$out .= '<option value="0">&nbsp;</option>';
4597 4597
 		}
@@ -4605,9 +4605,9 @@  discard block
 block discarded – undo
4605 4605
 
4606 4606
 			if ($selected == $id) {
4607 4607
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4608
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4608
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4609 4609
 			} else {
4610
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4610
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4611 4611
 			}
4612 4612
 			$label = $arrayconditions['label'];
4613 4613
 
@@ -4625,21 +4625,21 @@  discard block
 block discarded – undo
4625 4625
 		$out .= ajax_combobox($htmlname);
4626 4626
 
4627 4627
 		if ($deposit_percent >= 0) {
4628
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4629
-			$out .= $langs->trans('DepositPercent') . ' : ';
4630
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4628
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4629
+			$out .= $langs->trans('DepositPercent').' : ';
4630
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4631 4631
 			$out .= '</span>';
4632 4632
 			$out .= '
4633
-				<script nonce="' . getNonce() . '">
4633
+				<script nonce="' . getNonce().'">
4634 4634
 					$(document).ready(function () {
4635
-						$("#' . $htmlname . '").change(function () {
4635
+						$("#' . $htmlname.'").change(function () {
4636 4636
 							let $selected = $(this).find("option:selected");
4637 4637
 							let depositPercent = $selected.attr("data-deposit_percent");
4638 4638
 
4639 4639
 							if (depositPercent.length > 0) {
4640
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4640
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4641 4641
 							} else {
4642
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4642
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4643 4643
 							}
4644 4644
 
4645 4645
 							return true;
@@ -4677,7 +4677,7 @@  discard block
 block discarded – undo
4677 4677
 
4678 4678
 		$out = '';
4679 4679
 
4680
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4680
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4681 4681
 
4682 4682
 		$filterarray = array();
4683 4683
 		if ($filtertype == 'CRDT') {
@@ -4692,11 +4692,11 @@  discard block
 block discarded – undo
4692 4692
 
4693 4693
 		// Set default value if not already set by caller
4694 4694
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4695
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4695
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4696 4696
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4697 4697
 		}
4698 4698
 
4699
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4699
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4700 4700
 		if ($empty) {
4701 4701
 			$out .= '<option value="">&nbsp;</option>';
4702 4702
 		}
@@ -4717,13 +4717,13 @@  discard block
 block discarded – undo
4717 4717
 			}
4718 4718
 
4719 4719
 			if ($format == 0) {
4720
-				$out .= '<option value="' . $id . '" data-code="'.$arraytypes['code'].'"';
4720
+				$out .= '<option value="'.$id.'" data-code="'.$arraytypes['code'].'"';
4721 4721
 			} elseif ($format == 1) {
4722
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4722
+				$out .= '<option value="'.$arraytypes['code'].'"';
4723 4723
 			} elseif ($format == 2) {
4724
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4724
+				$out .= '<option value="'.$arraytypes['code'].'"';
4725 4725
 			} elseif ($format == 3) {
4726
-				$out .= '<option value="' . $id . '"';
4726
+				$out .= '<option value="'.$id.'"';
4727 4727
 			}
4728 4728
 			// Print attribute selected or not
4729 4729
 			if ($format == 1 || $format == 2) {
@@ -4753,7 +4753,7 @@  discard block
 block discarded – undo
4753 4753
 		if ($user->admin && !$noadmininfo) {
4754 4754
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4755 4755
 		}
4756
-		$out .= ajax_combobox('select' . $htmlname);
4756
+		$out .= ajax_combobox('select'.$htmlname);
4757 4757
 
4758 4758
 		if (empty($nooutput)) {
4759 4759
 			print $out;
@@ -4775,22 +4775,22 @@  discard block
 block discarded – undo
4775 4775
 	{
4776 4776
 		global $langs;
4777 4777
 
4778
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4778
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4779 4779
 		$options = array(
4780 4780
 			'HT' => $langs->trans("HT"),
4781 4781
 			'TTC' => $langs->trans("TTC")
4782 4782
 		);
4783 4783
 		foreach ($options as $id => $value) {
4784 4784
 			if ($selected == $id) {
4785
-				$return .= '<option value="' . $id . '" selected>' . $value;
4785
+				$return .= '<option value="'.$id.'" selected>'.$value;
4786 4786
 			} else {
4787
-				$return .= '<option value="' . $id . '">' . $value;
4787
+				$return .= '<option value="'.$id.'">'.$value;
4788 4788
 			}
4789 4789
 			$return .= '</option>';
4790 4790
 		}
4791 4791
 		$return .= '</select>';
4792 4792
 		if ($addjscombo) {
4793
-			$return .= ajax_combobox('select_' . $htmlname);
4793
+			$return .= ajax_combobox('select_'.$htmlname);
4794 4794
 		}
4795 4795
 
4796 4796
 		return $return;
@@ -4808,7 +4808,7 @@  discard block
 block discarded – undo
4808 4808
 		// phpcs:enable
4809 4809
 		global $langs;
4810 4810
 
4811
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4811
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4812 4812
 		if ($num > 0) {
4813 4813
 			return $num; // Cache already loaded
4814 4814
 		}
@@ -4818,8 +4818,8 @@  discard block
 block discarded – undo
4818 4818
 		$this->cache_transport_mode = array();
4819 4819
 
4820 4820
 		$sql = "SELECT rowid, code, label, active";
4821
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4822
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4821
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4822
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4823 4823
 
4824 4824
 		$resql = $this->db->query($sql);
4825 4825
 		if ($resql) {
@@ -4829,7 +4829,7 @@  discard block
 block discarded – undo
4829 4829
 				$obj = $this->db->fetch_object($resql);
4830 4830
 
4831 4831
 				// If traduction exist, we use it else we take the default label
4832
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4832
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4833 4833
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4834 4834
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4835 4835
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4863,11 +4863,11 @@  discard block
 block discarded – undo
4863 4863
 	{
4864 4864
 		global $langs, $user;
4865 4865
 
4866
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4866
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4867 4867
 
4868 4868
 		$this->load_cache_transport_mode();
4869 4869
 
4870
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4870
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4871 4871
 		if ($empty) {
4872 4872
 			print '<option value="">&nbsp;</option>';
4873 4873
 		}
@@ -4883,13 +4883,13 @@  discard block
 block discarded – undo
4883 4883
 			}
4884 4884
 
4885 4885
 			if ($format == 0) {
4886
-				print '<option value="' . $id . '"';
4886
+				print '<option value="'.$id.'"';
4887 4887
 			} elseif ($format == 1) {
4888
-				print '<option value="' . $arraytypes['code'] . '"';
4888
+				print '<option value="'.$arraytypes['code'].'"';
4889 4889
 			} elseif ($format == 2) {
4890
-				print '<option value="' . $arraytypes['code'] . '"';
4890
+				print '<option value="'.$arraytypes['code'].'"';
4891 4891
 			} elseif ($format == 3) {
4892
-				print '<option value="' . $id . '"';
4892
+				print '<option value="'.$id.'"';
4893 4893
 			}
4894 4894
 			// If text is selected, we compare with code, else with id
4895 4895
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4940,31 +4940,31 @@  discard block
 block discarded – undo
4940 4940
 		$langs->load("deliveries");
4941 4941
 
4942 4942
 		$sql = "SELECT rowid, code, libelle as label";
4943
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4943
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4944 4944
 		$sql .= " WHERE active > 0";
4945 4945
 		if ($filtre) {
4946
-			$sql .= " AND " . $filtre;
4946
+			$sql .= " AND ".$filtre;
4947 4947
 		}
4948 4948
 		$sql .= " ORDER BY libelle ASC";
4949 4949
 
4950
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4950
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4951 4951
 		$result = $this->db->query($sql);
4952 4952
 		if ($result) {
4953 4953
 			$num = $this->db->num_rows($result);
4954 4954
 			$i = 0;
4955 4955
 			if ($num) {
4956
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4956
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4957 4957
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4958 4958
 					print '<option value="-1">&nbsp;</option>';
4959 4959
 				}
4960 4960
 				while ($i < $num) {
4961 4961
 					$obj = $this->db->fetch_object($result);
4962 4962
 					if ($selected == $obj->rowid) {
4963
-						print '<option value="' . $obj->rowid . '" selected>';
4963
+						print '<option value="'.$obj->rowid.'" selected>';
4964 4964
 					} else {
4965
-						print '<option value="' . $obj->rowid . '">';
4965
+						print '<option value="'.$obj->rowid.'">';
4966 4966
 					}
4967
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
4967
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
4968 4968
 					print '</option>';
4969 4969
 					$i++;
4970 4970
 				}
@@ -4973,7 +4973,7 @@  discard block
 block discarded – undo
4973 4973
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4974 4974
 				}
4975 4975
 
4976
-				print ajax_combobox('select' . $htmlname);
4976
+				print ajax_combobox('select'.$htmlname);
4977 4977
 			} else {
4978 4978
 				print $langs->trans("NoShippingMethodDefined");
4979 4979
 			}
@@ -4998,16 +4998,16 @@  discard block
 block discarded – undo
4998 4998
 		$langs->load("deliveries");
4999 4999
 
5000 5000
 		if ($htmlname != "none") {
5001
-			print '<form method="POST" action="' . $page . '">';
5001
+			print '<form method="POST" action="'.$page.'">';
5002 5002
 			print '<input type="hidden" name="action" value="setshippingmethod">';
5003
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5003
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5004 5004
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
5005
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
5005
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
5006 5006
 			print '</form>';
5007 5007
 		} else {
5008 5008
 			if ($selected) {
5009 5009
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
5010
-				print $langs->trans("SendingMethod" . strtoupper($code));
5010
+				print $langs->trans("SendingMethod".strtoupper($code));
5011 5011
 			} else {
5012 5012
 				print "&nbsp;";
5013 5013
 			}
@@ -5030,10 +5030,10 @@  discard block
 block discarded – undo
5030 5030
 
5031 5031
 		$opt = '<option value="" selected></option>';
5032 5032
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
5033
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
5034
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
5033
+		$sql .= ' FROM '.$this->db->prefix().'facture';
5034
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
5035 5035
 		$sql .= ' AND situation_counter >= 1';
5036
-		$sql .= ' AND fk_soc = ' . (int) $socid;
5036
+		$sql .= ' AND fk_soc = '.(int) $socid;
5037 5037
 		$sql .= ' AND type <> 2';
5038 5038
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
5039 5039
 		$resql = $this->db->query($sql);
@@ -5051,19 +5051,19 @@  discard block
 block discarded – undo
5051 5051
 						//Not prov?
5052 5052
 						if (substr($obj->ref, 1, 4) != 'PROV') {
5053 5053
 							if ($selected == $obj->rowid) {
5054
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
5054
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
5055 5055
 							} else {
5056
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
5056
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
5057 5057
 							}
5058 5058
 						}
5059 5059
 					}
5060 5060
 				}
5061 5061
 			}
5062 5062
 		} else {
5063
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
5063
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
5064 5064
 		}
5065 5065
 		if ($opt == '<option value ="" selected></option>') {
5066
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
5066
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
5067 5067
 		}
5068 5068
 		return $opt;
5069 5069
 	}
@@ -5083,12 +5083,12 @@  discard block
 block discarded – undo
5083 5083
 
5084 5084
 		$langs->load('products');
5085 5085
 
5086
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5086
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5087 5087
 
5088
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5088
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5089 5089
 		$sql .= ' WHERE active > 0';
5090 5090
 		if (!empty($unit_type)) {
5091
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5091
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5092 5092
 		}
5093 5093
 		$sql .= " ORDER BY sortorder";
5094 5094
 
@@ -5100,14 +5100,14 @@  discard block
 block discarded – undo
5100 5100
 
5101 5101
 			while ($res = $this->db->fetch_object($resql)) {
5102 5102
 				$unitLabel = $res->label;
5103
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5104
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5103
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5104
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5105 5105
 				}
5106 5106
 
5107 5107
 				if ($selected == $res->rowid) {
5108
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5108
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5109 5109
 				} else {
5110
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5110
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5111 5111
 				}
5112 5112
 			}
5113 5113
 			$return .= '</select>';
@@ -5142,29 +5142,29 @@  discard block
 block discarded – undo
5142 5142
 		$num = 0;
5143 5143
 
5144 5144
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5145
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5146
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5145
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5146
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5147 5147
 		if ($status != 2) {
5148
-			$sql .= " AND clos = " . (int) $status;
5148
+			$sql .= " AND clos = ".(int) $status;
5149 5149
 		}
5150 5150
 		if ($filtre) {	// TODO Support USF
5151
-			$sql .= " AND " . $filtre;
5151
+			$sql .= " AND ".$filtre;
5152 5152
 		}
5153 5153
 		$sql .= " ORDER BY label";
5154 5154
 
5155
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5155
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5156 5156
 		$result = $this->db->query($sql);
5157 5157
 		if ($result) {
5158 5158
 			$num = $this->db->num_rows($result);
5159 5159
 			$i = 0;
5160 5160
 
5161
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5161
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5162 5162
 
5163 5163
 			if ($num == 0) {
5164 5164
 				if ($status == 0) {
5165
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5165
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5166 5166
 				} else {
5167
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountFound") . '</span>';
5167
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountFound").'</span>';
5168 5168
 				}
5169 5169
 			} else {
5170 5170
 				if (!empty($useempty) && !is_numeric($useempty)) {
@@ -5180,25 +5180,25 @@  discard block
 block discarded – undo
5180 5180
 				$labeltoshow = trim($obj->label);
5181 5181
 				$labeltoshowhtml = trim($obj->label);
5182 5182
 				if ($showcurrency) {
5183
-					$labeltoshow .= ' (' . $obj->currency_code . ')';
5184
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>';
5183
+					$labeltoshow .= ' ('.$obj->currency_code.')';
5184
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>';
5185 5185
 				}
5186 5186
 				if ($status == 2 && $obj->status == 1) {
5187
-					$labeltoshow .= ' (' . $langs->trans("Closed") . ')';
5188
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>';
5187
+					$labeltoshow .= ' ('.$langs->trans("Closed").')';
5188
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
5189 5189
 				}
5190 5190
 
5191 5191
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5192
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5192
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5193 5193
 				} else {
5194
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5194
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5195 5195
 				}
5196 5196
 				$out .= $labeltoshow;
5197 5197
 				$out .= '</option>';
5198 5198
 				$i++;
5199 5199
 			}
5200 5200
 			$out .= "</select>";
5201
-			$out .= ajax_combobox('select' . $htmlname);
5201
+			$out .= ajax_combobox('select'.$htmlname);
5202 5202
 		} else {
5203 5203
 			dol_print_error($this->db);
5204 5204
 		}
@@ -5237,22 +5237,22 @@  discard block
 block discarded – undo
5237 5237
 		$num = 0;
5238 5238
 
5239 5239
 		$sql = "SELECT rowid, label, bank, status, iban_prefix, bic";
5240
-		$sql .= " FROM " . $this->db->prefix() . "societe_rib";
5241
-		$sql.=  " WHERE 1=1";
5240
+		$sql .= " FROM ".$this->db->prefix()."societe_rib";
5241
+		$sql .= " WHERE 1=1";
5242 5242
 		if ($filtre) {	// TODO Support USF
5243
-			$sql .= " AND " . $filtre;
5243
+			$sql .= " AND ".$filtre;
5244 5244
 		}
5245 5245
 		$sql .= " ORDER BY label";
5246
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5246
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5247 5247
 		$result = $this->db->query($sql);
5248 5248
 		if ($result) {
5249 5249
 			$num = $this->db->num_rows($result);
5250 5250
 			$i = 0;
5251 5251
 
5252
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5252
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5253 5253
 
5254 5254
 			if ($num == 0) {
5255
-				$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountFound") . '</span>';
5255
+				$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountFound").'</span>';
5256 5256
 			} else {
5257 5257
 				if (!empty($useempty) && !is_numeric($useempty)) {
5258 5258
 					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';
@@ -5265,19 +5265,19 @@  discard block
 block discarded – undo
5265 5265
 				$obj = $this->db->fetch_object($result);
5266 5266
 				$iban = dolDecrypt($obj->iban_prefix);
5267 5267
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5268
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>';
5268
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'" selected>';
5269 5269
 				} else {
5270
-					$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">';
5270
+					$out .= '<option value="'.$obj->rowid.'" data-iban-prefix="'.$iban.' data-bic="'.$obj->bic.'">';
5271 5271
 				}
5272 5272
 				$out .= trim($obj->label);
5273 5273
 				if ($showibanbic) {
5274
-					$out .= ' (' . $iban . '/' .$obj->bic. ')';
5274
+					$out .= ' ('.$iban.'/'.$obj->bic.')';
5275 5275
 				}
5276 5276
 				$out .= '</option>';
5277 5277
 				$i++;
5278 5278
 			}
5279 5279
 			$out .= "</select>";
5280
-			$out .= ajax_combobox('select' . $htmlname);
5280
+			$out .= ajax_combobox('select'.$htmlname);
5281 5281
 		} else {
5282 5282
 			dol_print_error($this->db);
5283 5283
 		}
@@ -5311,23 +5311,23 @@  discard block
 block discarded – undo
5311 5311
 		$num = 0;
5312 5312
 
5313 5313
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5314
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5314
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5315 5315
 		$sql .= " WHERE 1=1";
5316 5316
 		if ($status != 2) {
5317
-			$sql .= " AND status = " . (int) $status;
5317
+			$sql .= " AND status = ".(int) $status;
5318 5318
 		}
5319 5319
 		if ($filtre) {	// TODO Support USF
5320
-			$sql .= " AND " . $filtre;
5320
+			$sql .= " AND ".$filtre;
5321 5321
 		}
5322 5322
 		$sql .= " ORDER BY name";
5323 5323
 
5324
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5324
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5325 5325
 		$result = $this->db->query($sql);
5326 5326
 		if ($result) {
5327 5327
 			$num = $this->db->num_rows($result);
5328 5328
 			$i = 0;
5329 5329
 			if ($num) {
5330
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5330
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5331 5331
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5332 5332
 					print '<option value="-1">&nbsp;</option>';
5333 5333
 				}
@@ -5335,13 +5335,13 @@  discard block
 block discarded – undo
5335 5335
 				while ($i < $num) {
5336 5336
 					$obj = $this->db->fetch_object($result);
5337 5337
 					if ($selected == $obj->rowid) {
5338
-						print '<option value="' . $obj->rowid . '" selected>';
5338
+						print '<option value="'.$obj->rowid.'" selected>';
5339 5339
 					} else {
5340
-						print '<option value="' . $obj->rowid . '">';
5340
+						print '<option value="'.$obj->rowid.'">';
5341 5341
 					}
5342 5342
 					print trim($obj->name);
5343 5343
 					if ($status == 2 && $obj->status == 1) {
5344
-						print ' (' . $langs->trans("Closed") . ')';
5344
+						print ' ('.$langs->trans("Closed").')';
5345 5345
 					}
5346 5346
 					print '</option>';
5347 5347
 					$i++;
@@ -5349,9 +5349,9 @@  discard block
 block discarded – undo
5349 5349
 				print "</select>";
5350 5350
 			} else {
5351 5351
 				if ($status == 0) {
5352
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5352
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5353 5353
 				} else {
5354
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5354
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5355 5355
 				}
5356 5356
 			}
5357 5357
 
@@ -5375,20 +5375,20 @@  discard block
 block discarded – undo
5375 5375
 	{
5376 5376
 		global $langs;
5377 5377
 		if ($htmlname != "none") {
5378
-			print '<form method="POST" action="' . $page . '">';
5378
+			print '<form method="POST" action="'.$page.'">';
5379 5379
 			print '<input type="hidden" name="action" value="setbankaccount">';
5380
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5380
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5381 5381
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5382 5382
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5383 5383
 			if ($nbaccountfound > 0) {
5384
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5384
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5385 5385
 			}
5386 5386
 			print '</form>';
5387 5387
 		} else {
5388 5388
 			$langs->load('banks');
5389 5389
 
5390 5390
 			if ($selected) {
5391
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5391
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5392 5392
 				$bankstatic = new Account($this->db);
5393 5393
 				$result = $bankstatic->fetch($selected);
5394 5394
 				if ($result) {
@@ -5415,24 +5415,24 @@  discard block
 block discarded – undo
5415 5415
 	{
5416 5416
 		global $langs;
5417 5417
 		if ($htmlname != "none") {
5418
-			print '<form method="POST" action="' . $page . '">';
5418
+			print '<form method="POST" action="'.$page.'">';
5419 5419
 			print '<input type="hidden" name="action" value="setbankaccountcustomer">';
5420
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5420
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5421 5421
 			$nbaccountfound = $this->selectRib($selected, $htmlname, $filtre, $addempty, '', $showibanbic);
5422 5422
 			if ($nbaccountfound > 0) {
5423
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5423
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5424 5424
 			}
5425 5425
 			print '</form>';
5426 5426
 		} else {
5427 5427
 			$langs->load('banks');
5428 5428
 
5429 5429
 			if ($selected) {
5430
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
5430
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
5431 5431
 				$bankstatic = new CompanyBankAccount($this->db);
5432 5432
 				$result = $bankstatic->fetch($selected);
5433 5433
 				if ($result) {
5434 5434
 					print $bankstatic->label;
5435
-					if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')';
5435
+					if ($showibanbic) print ' ('.$bankstatic->iban.'/'.$bankstatic->bic.')';
5436 5436
 				}
5437 5437
 			} else {
5438 5438
 				print "&nbsp;";
@@ -5467,11 +5467,11 @@  discard block
 block discarded – undo
5467 5467
 		global $conf, $langs;
5468 5468
 		$langs->load("categories");
5469 5469
 
5470
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5470
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5471 5471
 
5472 5472
 		// For backward compatibility
5473 5473
 		if (is_numeric($type)) {
5474
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5474
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5475 5475
 		}
5476 5476
 
5477 5477
 		if ($type === Categorie::TYPE_BANK_LINE) {
@@ -5479,8 +5479,8 @@  discard block
 block discarded – undo
5479 5479
 			$cat = new Categorie($this->db);
5480 5480
 			$cate_arbo = array();
5481 5481
 			$sql = "SELECT c.label, c.rowid";
5482
-			$sql .= " FROM " . $this->db->prefix() . "categorie as c";
5483
-			$sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]);
5482
+			$sql .= " FROM ".$this->db->prefix()."categorie as c";
5483
+			$sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]);
5484 5484
 			$sql .= " ORDER BY c.label";
5485 5485
 			$result = $this->db->query($sql);
5486 5486
 			if ($result) {
@@ -5506,12 +5506,12 @@  discard block
 block discarded – undo
5506 5506
 		$outarrayrichhtml = array();
5507 5507
 
5508 5508
 
5509
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5509
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5510 5510
 		if (is_array($cate_arbo)) {
5511 5511
 			$num = count($cate_arbo);
5512 5512
 
5513 5513
 			if (!$num) {
5514
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5514
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5515 5515
 			} else {
5516 5516
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5517 5517
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5523,15 +5523,15 @@  discard block
 block discarded – undo
5523 5523
 						$add = '';
5524 5524
 					}
5525 5525
 
5526
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5526
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5527 5527
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5528 5528
 
5529 5529
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5530 5530
 
5531 5531
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5532 5532
 
5533
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5534
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5533
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5534
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5535 5535
 					$output .= '>';
5536 5536
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5537 5537
 					$output .= '</option>';
@@ -5577,7 +5577,7 @@  discard block
 block discarded – undo
5577 5577
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5578 5578
 	{
5579 5579
 		// phpcs:enable
5580
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5580
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5581 5581
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5582 5582
 	}
5583 5583
 
@@ -5612,7 +5612,7 @@  discard block
 block discarded – undo
5612 5612
 	{
5613 5613
 		global $langs, $conf;
5614 5614
 
5615
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5615
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5616 5616
 		$formconfirm = '';
5617 5617
 		$inputok = array();
5618 5618
 		$inputko = array();
@@ -5636,27 +5636,27 @@  discard block
 block discarded – undo
5636 5636
 			foreach ($formquestion as $key => $input) {
5637 5637
 				if (is_array($input) && !empty($input)) {
5638 5638
 					if ($input['type'] == 'hidden') {
5639
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5640
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5639
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5640
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5641 5641
 
5642
-						$more .= '<input type="hidden" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . dol_escape_htmltag($input['value']) . '" class="' . $morecss . '"' . $moreattr . '>' . "\n";
5642
+						$more .= '<input type="hidden" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'" value="'.dol_escape_htmltag($input['value']).'" class="'.$morecss.'"'.$moreattr.'>'."\n";
5643 5643
 					}
5644 5644
 				}
5645 5645
 			}
5646 5646
 
5647 5647
 			// Now add questions
5648 5648
 			$moreonecolumn = '';
5649
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5649
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5650 5650
 			foreach ($formquestion as $key => $input) {
5651 5651
 				if (is_array($input) && !empty($input)) {
5652
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5653
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5654
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5652
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5653
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5654
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5655 5655
 
5656 5656
 					if ($input['type'] == 'text') {
5657
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="text" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n";
5657
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="text" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5658 5658
 					} elseif ($input['type'] == 'password') {
5659
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div><div class="tagtd"><input type="password" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $size . ' value="' . (empty($input['value']) ? '' : $input['value']) . '"' . $moreattr . ' /></div></div>' . "\n";
5659
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd"><input type="password" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$size.' value="'.(empty($input['value']) ? '' : $input['value']).'"'.$moreattr.' /></div></div>'."\n";
5660 5660
 					} elseif ($input['type'] == 'textarea') {
5661 5661
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5662 5662
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5664,8 +5664,8 @@  discard block
 block discarded – undo
5664 5664
 						$more .= '</textarea>';
5665 5665
 						$more .= '</div></div>'."\n";*/
5666 5666
 						$moreonecolumn .= '<div class="margintoponly">';
5667
-						$moreonecolumn .= $input['label'] . '<br>';
5668
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5667
+						$moreonecolumn .= $input['label'].'<br>';
5668
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5669 5669
 						$moreonecolumn .= $input['value'];
5670 5670
 						$moreonecolumn .= '</textarea>';
5671 5671
 						$moreonecolumn .= '</div>';
@@ -5682,20 +5682,20 @@  discard block
 block discarded – undo
5682 5682
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5683 5683
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5684 5684
 
5685
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5685
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5686 5686
 						if (!empty($input['label'])) {
5687
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5687
+							$more .= $input['label'].'</div><div class="tagtd left">';
5688 5688
 						}
5689 5689
 						if ($input['type'] == 'select') {
5690 5690
 							$more .= $this->selectarray($input['name'], $input['values'], isset($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
5691 5691
 						} else {
5692 5692
 							$more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr);
5693 5693
 						}
5694
-						$more .= '</div></div>' . "\n";
5694
+						$more .= '</div></div>'."\n";
5695 5695
 					} elseif ($input['type'] == 'checkbox') {
5696 5696
 						$more .= '<div class="tagtr">';
5697
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5698
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5697
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5698
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5699 5699
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5700 5700
 							$more .= ' checked';
5701 5701
 						}
@@ -5706,19 +5706,19 @@  discard block
 block discarded – undo
5706 5706
 							$more .= ' disabled';
5707 5707
 						}
5708 5708
 						$more .= ' /></div>';
5709
-						$more .= '</div>' . "\n";
5709
+						$more .= '</div>'."\n";
5710 5710
 					} elseif ($input['type'] == 'radio') {
5711 5711
 						$i = 0;
5712 5712
 						foreach ($input['values'] as $selkey => $selval) {
5713 5713
 							$more .= '<div class="tagtr">';
5714 5714
 							if (isset($input['label'])) {
5715 5715
 								if ($i == 0) {
5716
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5716
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5717 5717
 								} else {
5718
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5718
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5719 5719
 								}
5720 5720
 							}
5721
-							$more .= '<div class="tagtd' . ($i == 0 ? ' tdtop' : '') . '"><input type="radio" class="flat' . $morecss . '" id="' . dol_escape_htmltag($input['name'] . $selkey) . '" name="' . dol_escape_htmltag($input['name']) . '" value="' . $selkey . '"' . $moreattr;
5721
+							$more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.dol_escape_htmltag($input['name'].$selkey).'" name="'.dol_escape_htmltag($input['name']).'" value="'.$selkey.'"'.$moreattr;
5722 5722
 							if (!empty($input['disabled'])) {
5723 5723
 								$more .= ' disabled';
5724 5724
 							}
@@ -5726,12 +5726,12 @@  discard block
 block discarded – undo
5726 5726
 								$more .= ' checked="checked"';
5727 5727
 							}
5728 5728
 							$more .= ' /> ';
5729
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5730
-							$more .= '</div></div>' . "\n";
5729
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5730
+							$more .= '</div></div>'."\n";
5731 5731
 							$i++;
5732 5732
 						}
5733 5733
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5734
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5734
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5735 5735
 						$more .= '<div class="tagtd">';
5736 5736
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5737 5737
 						$h = $m = 0;
@@ -5749,24 +5749,24 @@  discard block
 block discarded – undo
5749 5749
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5750 5750
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5751 5751
 						if (!empty($input['label'])) {
5752
-							$more .= $input['label'] . '</div><div class="tagtd">';
5752
+							$more .= $input['label'].'</div><div class="tagtd">';
5753 5753
 						}
5754 5754
 						$more .= $input['value'];
5755
-						$more .= '</div></div>' . "\n";
5755
+						$more .= '</div></div>'."\n";
5756 5756
 					} elseif ($input['type'] == 'onecolumn') {
5757 5757
 						$moreonecolumn .= '<div class="margintoponly">';
5758 5758
 						$moreonecolumn .= $input['value'];
5759
-						$moreonecolumn .= '</div>' . "\n";
5759
+						$moreonecolumn .= '</div>'."\n";
5760 5760
 					} elseif ($input['type'] == 'hidden') {
5761 5761
 						// Do nothing more, already added by a previous loop
5762 5762
 					} elseif ($input['type'] == 'separator') {
5763 5763
 						$more .= '<br>';
5764 5764
 					} else {
5765
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5765
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5766 5766
 					}
5767 5767
 				}
5768 5768
 			}
5769
-			$more .= '</div>' . "\n";
5769
+			$more .= '</div>'."\n";
5770 5770
 			$more .= $moreonecolumn;
5771 5771
 		}
5772 5772
 
@@ -5788,10 +5788,10 @@  discard block
 block discarded – undo
5788 5788
 				$button = $useajax;
5789 5789
 				$useajax = 1;
5790 5790
 				$autoOpen = false;
5791
-				$dialogconfirm .= '-' . $button;
5791
+				$dialogconfirm .= '-'.$button;
5792 5792
 			}
5793
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5794
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5793
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5794
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5795 5795
 
5796 5796
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5797 5797
 			if (is_array($formquestion)) {
@@ -5814,24 +5814,24 @@  discard block
 block discarded – undo
5814 5814
 			}
5815 5815
 
5816 5816
 			// Show JQuery confirm box.
5817
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5817
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5818 5818
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5819
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5819
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5820 5820
 			}
5821 5821
 			if (!empty($more)) {
5822
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5822
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5823 5823
 			}
5824
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5825
-			$formconfirm .= '</div>' . "\n";
5824
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5825
+			$formconfirm .= '</div>'."\n";
5826 5826
 
5827
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5828
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5827
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5828
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5829 5829
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5830 5830
 			$formconfirm .= 'jQuery(document).ready(function() {
5831 5831
             $(function() {
5832
-            	$( "#' . $dialogconfirm . '" ).dialog(
5832
+            	$( "#' . $dialogconfirm.'" ).dialog(
5833 5833
             	{
5834
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5834
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5835 5835
 			if ($newselectedchoice == 'no') {
5836 5836
 				$formconfirm .= '
5837 5837
 						open: function() {
@@ -5841,24 +5841,24 @@  discard block
 block discarded – undo
5841 5841
 
5842 5842
 			$jsforcursor = '';
5843 5843
 			if ($useajax == 1) {
5844
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5845
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5844
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5845
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5846 5846
 			}
5847 5847
 
5848 5848
 			$postconfirmas = 'GET';
5849 5849
 
5850 5850
 			$formconfirm .= '
5851 5851
                     resizable: false,
5852
-                    height: "' . $height . '",
5853
-                    width: "' . $width . '",
5852
+                    height: "' . $height.'",
5853
+                    width: "' . $width.'",
5854 5854
                     modal: true,
5855 5855
                     closeOnEscape: false,
5856 5856
                     buttons: {
5857
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5858
-							var options = "token=' . urlencode(newToken()) . '";
5859
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5860
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5861
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5857
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5858
+							var options = "token=' . urlencode(newToken()).'";
5859
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5860
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5861
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5862 5862
 
5863 5863
                          	if (inputok.length > 0) {
5864 5864
                          		$.each(inputok, function(i, inputname) {
@@ -5892,11 +5892,11 @@  discard block
 block discarded – undo
5892 5892
 							}
5893 5893
 	                        $(this).dialog("close");
5894 5894
                         },
5895
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5896
-                        	var options = "token=' . urlencode(newToken()) . '";
5897
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5898
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5899
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5895
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5896
+                        	var options = "token=' . urlencode(newToken()).'";
5897
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5898
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5899
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5900 5900
                          	if (inputko.length > 0) {
5901 5901
                          		$.each(inputko, function(i, inputname) {
5902 5902
                          			var more = "";
@@ -5928,10 +5928,10 @@  discard block
 block discarded – undo
5928 5928
                 }
5929 5929
                 );
5930 5930
 
5931
-            	var button = "' . $button . '";
5931
+            	var button = "' . $button.'";
5932 5932
             	if (button.length > 0) {
5933 5933
                 	$( "#" + button ).click(function() {
5934
-                		$("#' . $dialogconfirm . '").dialog("open");
5934
+                		$("#' . $dialogconfirm.'").dialog("open");
5935 5935
         			});
5936 5936
                 }
5937 5937
             });
@@ -5939,44 +5939,44 @@  discard block
 block discarded – undo
5939 5939
             </script>';
5940 5940
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5941 5941
 		} else {
5942
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5942
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5943 5943
 
5944 5944
 			if (empty($disableformtag)) {
5945
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n";
5945
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n";
5946 5946
 			}
5947 5947
 
5948
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5949
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5948
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5949
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5950 5950
 
5951
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5951
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5952 5952
 
5953 5953
 			// Line title
5954 5954
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5955
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5956
-			$formconfirm .= '</td></tr>' . "\n";
5955
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5956
+			$formconfirm .= '</td></tr>'."\n";
5957 5957
 
5958 5958
 			// Line text
5959 5959
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5960
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5960
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5961 5961
 			}
5962 5962
 
5963 5963
 			// Line form fields
5964 5964
 			if ($more) {
5965
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5965
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5966 5966
 				$formconfirm .= $more;
5967
-				$formconfirm .= '</td></tr>' . "\n";
5967
+				$formconfirm .= '</td></tr>'."\n";
5968 5968
 			}
5969 5969
 
5970 5970
 			// Line with question
5971 5971
 			$formconfirm .= '<tr class="valid">';
5972
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5972
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5973 5973
 			$formconfirm .= '<td class="valid center">';
5974 5974
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5975
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5975
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5976 5976
 			$formconfirm .= '</td>';
5977
-			$formconfirm .= '</tr>' . "\n";
5977
+			$formconfirm .= '</tr>'."\n";
5978 5978
 
5979
-			$formconfirm .= '</table>' . "\n";
5979
+			$formconfirm .= '</table>'."\n";
5980 5980
 
5981 5981
 			if (empty($disableformtag)) {
5982 5982
 				$formconfirm .= "</form>\n";
@@ -5985,7 +5985,7 @@  discard block
 block discarded – undo
5985 5985
 
5986 5986
 			if (!empty($conf->use_javascript_ajax)) {
5987 5987
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5988
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5988
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5989 5989
 				$formconfirm .= '
5990 5990
 				$(document).ready(function () {
5991 5991
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5997,7 +5997,7 @@  discard block
 block discarded – undo
5997 5997
 					});
5998 5998
 				});
5999 5999
 				';
6000
-				$formconfirm .= '</script>' . "\n";
6000
+				$formconfirm .= '</script>'."\n";
6001 6001
 			}
6002 6002
 
6003 6003
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -6029,8 +6029,8 @@  discard block
 block discarded – undo
6029 6029
 		// phpcs:enable
6030 6030
 		global $langs;
6031 6031
 
6032
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
6033
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
6032
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
6033
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
6034 6034
 
6035 6035
 		$out = '';
6036 6036
 
@@ -6038,11 +6038,11 @@  discard block
 block discarded – undo
6038 6038
 
6039 6039
 		$langs->load("project");
6040 6040
 		if ($htmlname != "none") {
6041
-			$out .= '<form method="post" action="' . $page . '">';
6041
+			$out .= '<form method="post" action="'.$page.'">';
6042 6042
 			$out .= '<input type="hidden" name="action" value="classin">';
6043
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6043
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6044 6044
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
6045
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6045
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6046 6046
 			$out .= '</form>';
6047 6047
 		} else {
6048 6048
 			$out .= '<span class="project_head_block">';
@@ -6051,7 +6051,7 @@  discard block
 block discarded – undo
6051 6051
 				$projet->fetch($selected);
6052 6052
 				$out .= $projet->getNomUrl(0, '', 1);
6053 6053
 			} else {
6054
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
6054
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
6055 6055
 			}
6056 6056
 			$out .= '</span>';
6057 6057
 		}
@@ -6088,14 +6088,14 @@  discard block
 block discarded – undo
6088 6088
 		$out = '';
6089 6089
 
6090 6090
 		if ($htmlname != "none") {
6091
-			$out .= '<form method="POST" action="' . $page . '">';
6091
+			$out .= '<form method="POST" action="'.$page.'">';
6092 6092
 			$out .= '<input type="hidden" name="action" value="setconditions">';
6093
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6093
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6094 6094
 			if ($type) {
6095
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6095
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6096 6096
 			}
6097 6097
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
6098
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6098
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
6099 6099
 			$out .= '</form>';
6100 6100
 		} else {
6101 6101
 			if ($selected) {
@@ -6140,12 +6140,12 @@  discard block
 block discarded – undo
6140 6140
 		// phpcs:enable
6141 6141
 		global $langs;
6142 6142
 		if ($htmlname != "none") {
6143
-			print '<form method="post" action="' . $page . '">';
6143
+			print '<form method="post" action="'.$page.'">';
6144 6144
 			print '<input type="hidden" name="action" value="setavailability">';
6145
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6145
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6146 6146
 			$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty);
6147
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6148
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
6147
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6148
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
6149 6149
 			print '</form>';
6150 6150
 		} else {
6151 6151
 			if ($selected) {
@@ -6171,11 +6171,11 @@  discard block
 block discarded – undo
6171 6171
 	{
6172 6172
 		global $langs;
6173 6173
 		if ($htmlname != "none") {
6174
-			print '<form method="post" action="' . $page . '">';
6174
+			print '<form method="post" action="'.$page.'">';
6175 6175
 			print '<input type="hidden" name="action" value="setdemandreason">';
6176
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6176
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6177 6177
 			$this->selectInputReason($selected, $htmlname, '-1', $addempty);
6178
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6178
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6179 6179
 			print '</form>';
6180 6180
 		} else {
6181 6181
 			if ($selected) {
@@ -6215,17 +6215,17 @@  discard block
 block discarded – undo
6215 6215
 		$ret = '';
6216 6216
 
6217 6217
 		if ($htmlname != "none") {
6218
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6219
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6220
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6218
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6219
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6220
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6221 6221
 			if ($type) {
6222
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6222
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6223 6223
 			}
6224 6224
 			$ret .= '<table class="nobordernopadding">';
6225 6225
 			$ret .= '<tr><td>';
6226
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6226
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6227 6227
 			$ret .= '</td>';
6228
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6228
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6229 6229
 			$ret .= '</tr></table></form>';
6230 6230
 		} else {
6231 6231
 			if ($displayhour) {
@@ -6260,15 +6260,15 @@  discard block
 block discarded – undo
6260 6260
 		global $langs;
6261 6261
 
6262 6262
 		if ($htmlname != "none") {
6263
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6264
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6265
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6263
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6264
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6265
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6266 6266
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6267
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6267
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6268 6268
 			print '</form>';
6269 6269
 		} else {
6270 6270
 			if ($selected) {
6271
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6271
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6272 6272
 				$theuser = new User($this->db);
6273 6273
 				$theuser->fetch($selected);
6274 6274
 				print $theuser->getNomUrl(1);
@@ -6301,14 +6301,14 @@  discard block
 block discarded – undo
6301 6301
 
6302 6302
 		$out = '';
6303 6303
 		if ($htmlname != "none") {
6304
-			$out .= '<form method="POST" action="' . $page . '">';
6304
+			$out .= '<form method="POST" action="'.$page.'">';
6305 6305
 			$out .= '<input type="hidden" name="action" value="setmode">';
6306
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6306
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6307 6307
 			if ($type) {
6308
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6308
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6309 6309
 			}
6310 6310
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6311
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6311
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6312 6312
 			$out .= '</form>';
6313 6313
 		} else {
6314 6314
 			if ($selected) {
@@ -6341,11 +6341,11 @@  discard block
 block discarded – undo
6341 6341
 	{
6342 6342
 		global $langs;
6343 6343
 		if ($htmlname != "none") {
6344
-			print '<form method="POST" action="' . $page . '">';
6344
+			print '<form method="POST" action="'.$page.'">';
6345 6345
 			print '<input type="hidden" name="action" value="settransportmode">';
6346
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6346
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6347 6347
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6348
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6348
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6349 6349
 			print '</form>';
6350 6350
 		} else {
6351 6351
 			if ($selected) {
@@ -6372,14 +6372,14 @@  discard block
 block discarded – undo
6372 6372
 		// phpcs:enable
6373 6373
 		global $langs;
6374 6374
 		if ($htmlname != "none") {
6375
-			print '<form method="POST" action="' . $page . '">';
6375
+			print '<form method="POST" action="'.$page.'">';
6376 6376
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6377
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6377
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6378 6378
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6379
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6379
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6380 6380
 			print '</form>';
6381 6381
 		} else {
6382
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6382
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6383 6383
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6384 6384
 		}
6385 6385
 	}
@@ -6401,22 +6401,22 @@  discard block
 block discarded – undo
6401 6401
 		global $langs, $mysoc, $conf;
6402 6402
 
6403 6403
 		if ($htmlname != "none") {
6404
-			print '<form method="POST" action="' . $page . '">';
6404
+			print '<form method="POST" action="'.$page.'">';
6405 6405
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6406
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6407
-			print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6406
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6407
+			print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6408 6408
 			print '<select name="calculation_mode" id="calculation_mode">';
6409
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6410
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6409
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6410
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6411 6411
 			print '</select> ';
6412 6412
 			print ajax_combobox("calculation_mode");
6413
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6413
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6414 6414
 			print '</form>';
6415 6415
 		} else {
6416 6416
 			if (!empty($rate)) {
6417 6417
 				print price($rate, 1, $langs, 0, 0);
6418 6418
 				if ($currency && $rate != 1) {
6419
-					print ' &nbsp; <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>';
6419
+					print ' &nbsp; <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>';
6420 6420
 				}
6421 6421
 			} else {
6422 6422
 				print 1;
@@ -6446,9 +6446,9 @@  discard block
 block discarded – undo
6446 6446
 		// phpcs:enable
6447 6447
 		global $conf, $langs;
6448 6448
 		if ($htmlname != "none") {
6449
-			print '<form method="post" action="' . $page . '">';
6449
+			print '<form method="post" action="'.$page.'">';
6450 6450
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6451
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6451
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6452 6452
 			print '<div class="inline-block">';
6453 6453
 			if (!empty($discount_type)) {
6454 6454
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6486,24 +6486,24 @@  discard block
 block discarded – undo
6486 6486
 			print '</div>';
6487 6487
 			if (empty($hidelist)) {
6488 6488
 				print '<div class="inline-block" style="padding-right: 10px">';
6489
-				$newfilter = 'discount_type=' . intval($discount_type);
6489
+				$newfilter = 'discount_type='.intval($discount_type);
6490 6490
 				if (!empty($discount_type)) {
6491 6491
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6492 6492
 				} else {
6493 6493
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6494 6494
 				}
6495 6495
 				if ($filter) {
6496
-					$newfilter .= ' AND (' . $filter . ')';
6496
+					$newfilter .= ' AND ('.$filter.')';
6497 6497
 				}
6498 6498
 				// output the combo of discounts
6499 6499
 				$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue);
6500 6500
 				if ($nbqualifiedlines > 0) {
6501
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6501
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6502 6502
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6503
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6503
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6504 6504
 					}
6505 6505
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6506
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6506
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6507 6507
 					}
6508 6508
 
6509 6509
 					print '>';
@@ -6543,23 +6543,23 @@  discard block
 block discarded – undo
6543 6543
 		global $langs;
6544 6544
 
6545 6545
 		if ($htmlname != "none") {
6546
-			print '<form method="post" action="' . $page . '">';
6546
+			print '<form method="post" action="'.$page.'">';
6547 6547
 			print '<input type="hidden" name="action" value="set_contact">';
6548
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6548
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6549 6549
 			print '<table class="nobordernopadding">';
6550 6550
 			print '<tr><td>';
6551 6551
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6552 6552
 			$num = $this->num;
6553 6553
 			if ($num == 0) {
6554 6554
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6555
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6555
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6556 6556
 			}
6557 6557
 			print '</td>';
6558
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6558
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6559 6559
 			print '</tr></table></form>';
6560 6560
 		} else {
6561 6561
 			if ($selected) {
6562
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6562
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6563 6563
 				$contact = new Contact($this->db);
6564 6564
 				$contact->fetch($selected);
6565 6565
 				print $contact->getFullName($langs);
@@ -6594,20 +6594,20 @@  discard block
 block discarded – undo
6594 6594
 
6595 6595
 		$out = '';
6596 6596
 		if ($htmlname != "none") {
6597
-			$out .= '<form method="post" action="' . $page . '">';
6597
+			$out .= '<form method="post" action="'.$page.'">';
6598 6598
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6599
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6599
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6600 6600
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6601
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6601
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6602 6602
 			$out .= '</form>';
6603 6603
 		} else {
6604 6604
 			if ($selected) {
6605
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6605
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6606 6606
 				$soc = new Societe($this->db);
6607 6607
 				$soc->fetch($selected);
6608 6608
 				$out .= $soc->getNomUrl(0, '');
6609 6609
 			} else {
6610
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6610
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6611 6611
 			}
6612 6612
 		}
6613 6613
 
@@ -6657,22 +6657,22 @@  discard block
 block discarded – undo
6657 6657
 			$selected = 'EUR'; // Pour compatibilite
6658 6658
 		}
6659 6659
 
6660
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6660
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6661 6661
 		if ($useempty) {
6662 6662
 			$out .= '<option value="-1" selected></option>';
6663 6663
 		}
6664 6664
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6665 6665
 			$labeltoshow = $currency['label'];
6666 6666
 			if ($mode == 1) {
6667
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6667
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6668 6668
 			} else {
6669
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6669
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6670 6670
 			}
6671 6671
 
6672 6672
 			if ($selected && $selected == $code_iso) {
6673
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6673
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6674 6674
 			} else {
6675
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6675
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6676 6676
 			}
6677 6677
 			$out .= $labeltoshow;
6678 6678
 			$out .= '</option>';
@@ -6683,7 +6683,7 @@  discard block
 block discarded – undo
6683 6683
 		}
6684 6684
 
6685 6685
 		// Make select dynamic
6686
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6686
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6687 6687
 		$out .= ajax_combobox($htmlname);
6688 6688
 
6689 6689
 		return $out;
@@ -6709,10 +6709,10 @@  discard block
 block discarded – undo
6709 6709
 
6710 6710
 		$TCurrency = array();
6711 6711
 
6712
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6713
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6712
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6713
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6714 6714
 		if ($filter) {
6715
-			$sql .= " AND " . $filter;
6715
+			$sql .= " AND ".$filter;
6716 6716
 		}
6717 6717
 		$resql = $this->db->query($sql);
6718 6718
 		if ($resql) {
@@ -6722,7 +6722,7 @@  discard block
 block discarded – undo
6722 6722
 		}
6723 6723
 
6724 6724
 		$out = '';
6725
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6725
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6726 6726
 		if ($useempty) {
6727 6727
 			$out .= '<option value="">&nbsp;</option>';
6728 6728
 		}
@@ -6734,13 +6734,13 @@  discard block
 block discarded – undo
6734 6734
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6735 6735
 				if (isset($TCurrency[$code_iso])) {
6736 6736
 					if (!empty($selected) && $selected == $code_iso) {
6737
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6737
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6738 6738
 					} else {
6739
-						$out .= '<option value="' . $code_iso . '">';
6739
+						$out .= '<option value="'.$code_iso.'">';
6740 6740
 					}
6741 6741
 
6742 6742
 					$out .= $currency['label'];
6743
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6743
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6744 6744
 					$out .= '</option>';
6745 6745
 				}
6746 6746
 			}
@@ -6749,7 +6749,7 @@  discard block
 block discarded – undo
6749 6749
 		$out .= '</select>';
6750 6750
 
6751 6751
 		// Make select dynamic
6752
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6752
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6753 6753
 		$out .= ajax_combobox($htmlname);
6754 6754
 
6755 6755
 		return $out;
@@ -6780,7 +6780,7 @@  discard block
 block discarded – undo
6780 6780
 		$sql .= " WHERE t.fk_pays = c.rowid";
6781 6781
 		$sql .= " AND t.active > 0";
6782 6782
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6783
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6783
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6784 6784
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6785 6785
 
6786 6786
 		$resql = $this->db->query($sql);
@@ -6792,30 +6792,30 @@  discard block
 block discarded – undo
6792 6792
 
6793 6793
 					$tmparray = array();
6794 6794
 					$tmparray['rowid']			= $obj->rowid;
6795
-					$tmparray['type_vat']		= $obj->type_vat;
6796
-					$tmparray['code']			= $obj->code;
6795
+					$tmparray['type_vat'] = $obj->type_vat;
6796
+					$tmparray['code'] = $obj->code;
6797 6797
 					$tmparray['txtva']			= $obj->taux;
6798
-					$tmparray['nprtva']			= $obj->recuperableonly;
6798
+					$tmparray['nprtva'] = $obj->recuperableonly;
6799 6799
 					$tmparray['localtax1']	    = $obj->localtax1;
6800 6800
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6801 6801
 					$tmparray['localtax2']	    = $obj->localtax2;
6802 6802
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6803
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6804
-					$tmparray['labelallrates']	= $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6803
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6804
+					$tmparray['labelallrates']	= $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6805 6805
 					$positiverates = '';
6806 6806
 					if ($obj->taux) {
6807
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6807
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6808 6808
 					}
6809 6809
 					if ($obj->localtax1) {
6810
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6810
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6811 6811
 					}
6812 6812
 					if ($obj->localtax2) {
6813
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6813
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6814 6814
 					}
6815 6815
 					if (empty($positiverates)) {
6816 6816
 						$positiverates = '0';
6817 6817
 					}
6818
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6818
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6819 6819
 
6820 6820
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6821 6821
 				}
@@ -6835,7 +6835,7 @@  discard block
 block discarded – undo
6835 6835
 				return -1;
6836 6836
 			}
6837 6837
 		} else {
6838
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6838
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6839 6839
 			return -2;
6840 6840
 		}
6841 6841
 	}
@@ -6888,9 +6888,9 @@  discard block
 block discarded – undo
6888 6888
 		// Check parameters
6889 6889
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6890 6890
 			if ($societe_vendeuse->id == $mysoc->id) {
6891
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6891
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6892 6892
 			} else {
6893
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6893
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6894 6894
 			}
6895 6895
 			return $return;
6896 6896
 		}
@@ -6902,12 +6902,12 @@  discard block
 block discarded – undo
6902 6902
 		// Define list of countries to use to search VAT rates to show
6903 6903
 		// First we defined code_country to use to find list
6904 6904
 		if (is_object($societe_vendeuse)) {
6905
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6905
+			$code_country = "'".$societe_vendeuse->country_code."'";
6906 6906
 		} else {
6907
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6907
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6908 6908
 		}
6909 6909
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6910
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6910
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6911 6911
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6912 6912
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6913 6913
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6917,27 +6917,27 @@  discard block
 block discarded – undo
6917 6917
 					if ($type == 1) { // We know product is a service
6918 6918
 						switch ($selectVatComboMode) {
6919 6919
 							case '1':
6920
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6920
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6921 6921
 								break;
6922 6922
 							case '2':
6923
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6923
+								$code_country = "'".$societe_acheteuse->country_code."'";
6924 6924
 								break;
6925 6925
 						}
6926 6926
 					}
6927 6927
 				} elseif (!$idprod) {  // We don't know type of product
6928 6928
 					switch ($selectVatComboMode) {
6929 6929
 						case '1':
6930
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6930
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6931 6931
 							break;
6932 6932
 						case '2':
6933
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6933
+							$code_country = "'".$societe_acheteuse->country_code."'";
6934 6934
 							break;
6935 6935
 					}
6936 6936
 				} else {
6937 6937
 					$prodstatic = new Product($this->db);
6938 6938
 					$prodstatic->fetch($idprod);
6939 6939
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6940
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6940
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6941 6941
 					}
6942 6942
 				}
6943 6943
 			}
@@ -6999,13 +6999,13 @@  discard block
 block discarded – undo
6999 6999
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
7000 7000
 				// of using supplier invoices (this is a very bad idea !)
7001 7001
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
7002
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
7002
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
7003 7003
 					$disabled = true;
7004 7004
 				}
7005 7005
 			}
7006 7006
 
7007 7007
 			if (!$options_only) {
7008
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
7008
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
7009 7009
 			}
7010 7010
 
7011 7011
 			$selectedfound = false;
@@ -7019,13 +7019,13 @@  discard block
 block discarded – undo
7019 7019
 				$key = $rate['txtva'];
7020 7020
 				$key .= $rate['nprtva'] ? '*' : '';
7021 7021
 				if ($mode > 0 && $rate['code']) {
7022
-					$key .= ' (' . $rate['code'] . ')';
7022
+					$key .= ' ('.$rate['code'].')';
7023 7023
 				}
7024 7024
 				if ($mode < 0) {
7025 7025
 					$key = $rate['rowid'];
7026 7026
 				}
7027 7027
 
7028
-				$return .= '<option value="' . $key . '"';
7028
+				$return .= '<option value="'.$key.'"';
7029 7029
 				if (!$selectedfound) {
7030 7030
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
7031 7031
 						if ($defaultcode == $rate['code']) {
@@ -7096,7 +7096,7 @@  discard block
 block discarded – undo
7096 7096
 	public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '')
7097 7097
 	{
7098 7098
 		// phpcs:enable
7099
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7099
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7100 7100
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
7101 7101
 		if (!empty($nooutput)) {
7102 7102
 			return $retstring;
@@ -7125,11 +7125,11 @@  discard block
 block discarded – undo
7125 7125
 	{
7126 7126
 		global $langs;
7127 7127
 
7128
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7128
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7129 7129
 		if ($forcenewline) {
7130 7130
 			$ret .= '<br>';
7131 7131
 		}
7132
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7132
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7133 7133
 		return $ret;
7134 7134
 	}
7135 7135
 
@@ -7195,7 +7195,7 @@  discard block
 block discarded – undo
7195 7195
 		$orig_set_time = $set_time;
7196 7196
 
7197 7197
 		if ($set_time === '' && $emptydate == 0) {
7198
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7198
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7199 7199
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7200 7200
 				$set_time = dol_now($gm);
7201 7201
 			} else {
@@ -7267,38 +7267,38 @@  discard block
 block discarded – undo
7267 7267
 				// Calendrier popup version eldy
7268 7268
 				if ($usecalendar == "eldy") {
7269 7269
 					// Input area to enter date manually
7270
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7270
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7271 7271
 					$retstring .= ($disabled ? ' disabled' : '');
7272
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7272
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7273 7273
 					$retstring .= ' autocomplete="off">';
7274 7274
 
7275 7275
 					// Icon calendar
7276 7276
 					$retstringbuttom = '';
7277 7277
 					if (!$disabled) {
7278
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7279
-						$base = DOL_URL_ROOT . '/core/';
7280
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7281
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7278
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7279
+						$base = DOL_URL_ROOT.'/core/';
7280
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7281
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7282 7282
 					} else {
7283
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7283
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7284 7284
 					}
7285
-					$retstring = $retstringbuttom . $retstring;
7285
+					$retstring = $retstringbuttom.$retstring;
7286 7286
 
7287
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7288
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7289
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7287
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7288
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7289
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7290 7290
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7291 7291
 					if (!$disabled && $usecalendar != 'html') {
7292 7292
 						// Output javascript for datepicker
7293 7293
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7294 7294
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7295 7295
 
7296
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7297
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7298
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7296
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7297
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7298
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7299 7299
 							autoclose: true,
7300 7300
 							todayHighlight: true,
7301
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7301
+							yearRange: '" . $minYear.":".$maxYear."',";
7302 7302
 						if (!empty($conf->dol_use_jmobile)) {
7303 7303
 							$retstring .= "
7304 7304
 								beforeShow: function (input, datePicker) {
@@ -7313,7 +7313,7 @@  discard block
 block discarded – undo
7313 7313
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7314 7314
 							$retstring .= "
7315 7315
 								showOn: 'button',	/* both has problem with autocompletion */
7316
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
7316
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
7317 7317
 								buttonImageOnly: true";
7318 7318
 						}
7319 7319
 						$retstring .= "
@@ -7325,46 +7325,46 @@  discard block
 block discarded – undo
7325 7325
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7326 7326
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7327 7327
 					$retstring .= ($disabled ? ' disabled' : '');
7328
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7329
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7328
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7329
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7330 7330
 					$retstring .= ' autocomplete="off">';
7331 7331
 
7332 7332
 					// Icone calendrier
7333 7333
 					if ($disabled) {
7334
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7335
-						$retstring = $retstringbutton . $retstring;
7334
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7335
+						$retstring = $retstringbutton.$retstring;
7336 7336
 					}
7337 7337
 
7338 7338
 					$retstring .= '</div>';
7339
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7340
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7341
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7339
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7340
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7341
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7342 7342
 				} else {
7343 7343
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7344 7344
 				}
7345 7345
 			} else {
7346 7346
 				// Show date with combo selects
7347 7347
 				// Day
7348
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7348
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7349 7349
 
7350 7350
 				if ($emptydate || $set_time == -1) {
7351 7351
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7352 7352
 				}
7353 7353
 
7354 7354
 				for ($day = 1; $day <= 31; $day++) {
7355
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7355
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7356 7356
 				}
7357 7357
 
7358 7358
 				$retstring .= "</select>";
7359 7359
 
7360
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7360
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7361 7361
 				if ($emptydate || $set_time == -1) {
7362 7362
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7363 7363
 				}
7364 7364
 
7365 7365
 				// Month
7366 7366
 				for ($month = 1; $month <= 12; $month++) {
7367
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7367
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7368 7368
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7369 7369
 					$retstring .= "</option>";
7370 7370
 				}
@@ -7372,13 +7372,13 @@  discard block
 block discarded – undo
7372 7372
 
7373 7373
 				// Year
7374 7374
 				if ($emptydate || $set_time == -1) {
7375
-					$retstring .= '<input' . ($disabled ? ' disabled' : '') . ' placeholder="' . dol_escape_htmltag($langs->trans("Year")) . '" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">';
7375
+					$retstring .= '<input'.($disabled ? ' disabled' : '').' placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" class="flat maxwidth50imp valignmiddle" type="number" min="0" max="3000" maxlength="4" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">';
7376 7376
 				} else {
7377
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7377
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7378 7378
 
7379 7379
 					$syear = (int) $syear;
7380 7380
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7381
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7381
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7382 7382
 					}
7383 7383
 					$retstring .= "</select>\n";
7384 7384
 				}
@@ -7402,15 +7402,15 @@  discard block
 block discarded – undo
7402 7402
 				}
7403 7403
 			}
7404 7404
 			// Show hour
7405
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7405
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7406 7406
 			if ($emptyhours) {
7407 7407
 				$retstring .= '<option value="-1">&nbsp;</option>';
7408 7408
 			}
7409 7409
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7410 7410
 				if (strlen($hour) < 2) {
7411
-					$hour = "0" . $hour;
7411
+					$hour = "0".$hour;
7412 7412
 				}
7413
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7413
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7414 7414
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7415 7415
 				$retstring .= '</option>';
7416 7416
 			}
@@ -7423,17 +7423,17 @@  discard block
 block discarded – undo
7423 7423
 
7424 7424
 		if ($m) {
7425 7425
 			// Show minutes
7426
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7426
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7427 7427
 			if ($emptyhours) {
7428 7428
 				$retstring .= '<option value="-1">&nbsp;</option>';
7429 7429
 			}
7430 7430
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7431 7431
 				$min_str = sprintf("%02d", $min);
7432
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7432
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7433 7433
 			}
7434 7434
 			$retstring .= '</select>';
7435 7435
 
7436
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7436
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7437 7437
 		}
7438 7438
 
7439 7439
 		if ($d && $h) {
@@ -7456,10 +7456,10 @@  discard block
 block discarded – undo
7456 7456
 
7457 7457
 			// Generate the date part, depending on the use or not of the javascript calendar
7458 7458
 			if ($addnowlink == 1) { // server time expressed in user time setup
7459
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7460
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7461
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7462
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7459
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7460
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7461
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7462
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7463 7463
 			} elseif ($addnowlink == 2) {
7464 7464
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7465 7465
 				 * This break application for foreign languages.
@@ -7468,10 +7468,10 @@  discard block
 block discarded – undo
7468 7468
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7469 7469
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7470 7470
 				*/
7471
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7472
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7473
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7474
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7471
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7472
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7473
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7474
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7475 7475
 			}
7476 7476
 			/*if ($usecalendar == "eldy")
7477 7477
 			{
@@ -7491,11 +7491,11 @@  discard block
 block discarded – undo
7491 7491
 				}
7492 7492
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7493 7493
 				if ($addnowlink == 1) {
7494
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7495
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7494
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7495
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7496 7496
 				} elseif ($addnowlink == 2) {
7497
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7498
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7497
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7498
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7499 7499
 				}
7500 7500
 
7501 7501
 				if ($fullday) {
@@ -7509,11 +7509,11 @@  discard block
 block discarded – undo
7509 7509
 				}
7510 7510
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7511 7511
 				if ($addnowlink == 1) {
7512
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7513
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7512
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7513
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7514 7514
 				} elseif ($addnowlink == 2) {
7515
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7516
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7515
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7516
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7517 7517
 				}
7518 7518
 				if ($fullday) {
7519 7519
 					$reset_scripts .= ' } ';
@@ -7521,7 +7521,7 @@  discard block
 block discarded – undo
7521 7521
 			}
7522 7522
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7523 7523
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7524
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7524
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7525 7525
 				$retstring .= $langs->trans("Now");
7526 7526
 				$retstring .= '</button> ';
7527 7527
 			}
@@ -7533,16 +7533,16 @@  discard block
 block discarded – undo
7533 7533
 			$reset_scripts = "";
7534 7534
 
7535 7535
 			// Generate the date part, depending on the use or not of the javascript calendar
7536
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7537
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7538
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7539
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7536
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7537
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7538
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7539
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7540 7540
 			// Update the hour part
7541 7541
 			if ($h) {
7542 7542
 				if ($fullday) {
7543 7543
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7544 7544
 				}
7545
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7545
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7546 7546
 				if ($fullday) {
7547 7547
 					$reset_scripts .= ' } ';
7548 7548
 				}
@@ -7552,14 +7552,14 @@  discard block
 block discarded – undo
7552 7552
 				if ($fullday) {
7553 7553
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7554 7554
 				}
7555
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7555
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7556 7556
 				if ($fullday) {
7557 7557
 					$reset_scripts .= ' } ';
7558 7558
 				}
7559 7559
 			}
7560 7560
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7561 7561
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7562
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7562
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7563 7563
 				$retstring .= $langs->trans("DateStartPlusOne");
7564 7564
 				$retstring .= '</button> ';
7565 7565
 			}
@@ -7617,17 +7617,17 @@  discard block
 block discarded – undo
7617 7617
 			unset($TDurationTypes[$value]);
7618 7618
 		}
7619 7619
 
7620
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7620
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7621 7621
 		foreach ($TDurationTypes as $key => $typeduration) {
7622
-			$retstring .= '<option value="' . $key . '"';
7622
+			$retstring .= '<option value="'.$key.'"';
7623 7623
 			if ($key == $selected) {
7624 7624
 				$retstring .= " selected";
7625 7625
 			}
7626
-			$retstring .= ">" . $typeduration . "</option>";
7626
+			$retstring .= ">".$typeduration."</option>";
7627 7627
 		}
7628 7628
 		$retstring .= "</select>";
7629 7629
 
7630
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7630
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7631 7631
 
7632 7632
 		return $retstring;
7633 7633
 	}
@@ -7659,30 +7659,30 @@  discard block
 block discarded – undo
7659 7659
 
7660 7660
 		// Hours
7661 7661
 		if ($iSecond != '') {
7662
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7662
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7663 7663
 
7664 7664
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7665 7665
 			$minSelected = convertSecondToTime($iSecond, 'min');
7666 7666
 		}
7667 7667
 
7668 7668
 		if ($typehour == 'select') {
7669
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7669
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7670 7670
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7671
-				$retstring .= '<option value="' . $hour . '"';
7671
+				$retstring .= '<option value="'.$hour.'"';
7672 7672
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7673 7673
 					$retstring .= " selected";
7674 7674
 				}
7675
-				$retstring .= ">" . $hour . "</option>";
7675
+				$retstring .= ">".$hour."</option>";
7676 7676
 			}
7677 7677
 			$retstring .= "</select>";
7678 7678
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7679
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7679
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7680 7680
 		} else {
7681 7681
 			return 'BadValueForParameterTypeHour';
7682 7682
 		}
7683 7683
 
7684 7684
 		if ($typehour != 'text') {
7685
-			$retstring .= ' ' . $langs->trans('HourShort');
7685
+			$retstring .= ' '.$langs->trans('HourShort');
7686 7686
 		} else {
7687 7687
 			$retstring .= '<span class="">:</span>';
7688 7688
 		}
@@ -7697,21 +7697,21 @@  discard block
 block discarded – undo
7697 7697
 		}
7698 7698
 
7699 7699
 		if ($typehour == 'select' || $typehour == 'textselect') {
7700
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7700
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7701 7701
 			for ($min = 0; $min <= 55; $min += 5) {
7702
-				$retstring .= '<option value="' . $min . '"';
7702
+				$retstring .= '<option value="'.$min.'"';
7703 7703
 				if (is_numeric($minSelected) && $minSelected == $min) {
7704 7704
 					$retstring .= ' selected';
7705 7705
 				}
7706
-				$retstring .= '>' . $min . '</option>';
7706
+				$retstring .= '>'.$min.'</option>';
7707 7707
 			}
7708 7708
 			$retstring .= "</select>";
7709 7709
 		} elseif ($typehour == 'text') {
7710
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7710
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7711 7711
 		}
7712 7712
 
7713 7713
 		if ($typehour != 'text') {
7714
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7714
+			$retstring .= ' '.$langs->trans('MinuteShort');
7715 7715
 		}
7716 7716
 
7717 7717
 		$retstring .= "</span>";
@@ -7759,7 +7759,7 @@  discard block
 block discarded – undo
7759 7759
 			$placeholder = '';
7760 7760
 
7761 7761
 			if ($selected && empty($selected_input_value)) {
7762
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7762
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7763 7763
 				$tickettmpselect = new Ticket($this->db);
7764 7764
 				$tickettmpselect->fetch($selected);
7765 7765
 				$selected_input_value = $tickettmpselect->ref;
@@ -7767,17 +7767,17 @@  discard block
 block discarded – undo
7767 7767
 			}
7768 7768
 
7769 7769
 			$urloption = '';
7770
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7770
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7771 7771
 
7772 7772
 			if (empty($hidelabel)) {
7773
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7773
+				$out .= $langs->trans("RefOrLabel").' : ';
7774 7774
 			} elseif ($hidelabel > 1) {
7775
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7775
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7776 7776
 				if ($hidelabel == 2) {
7777 7777
 					$out .= img_picto($langs->trans("Search"), 'search');
7778 7778
 				}
7779 7779
 			}
7780
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7780
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7781 7781
 			if ($hidelabel == 3) {
7782 7782
 				$out .= img_picto($langs->trans("Search"), 'search');
7783 7783
 			}
@@ -7821,8 +7821,8 @@  discard block
 block discarded – undo
7821 7821
 
7822 7822
 		$sql = "SELECT ";
7823 7823
 		$sql .= $selectFields;
7824
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7825
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7824
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7825
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7826 7826
 
7827 7827
 		// Add criteria on ref/label
7828 7828
 		if ($filterkey != '') {
@@ -7838,7 +7838,7 @@  discard block
 block discarded – undo
7838 7838
 				if ($i > 0) {
7839 7839
 					$sql .= " AND ";
7840 7840
 				}
7841
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7841
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7842 7842
 				$sql .= ")";
7843 7843
 				$i++;
7844 7844
 			}
@@ -7851,22 +7851,22 @@  discard block
 block discarded – undo
7851 7851
 		$sql .= $this->db->plimit($limit, 0);
7852 7852
 
7853 7853
 		// Build output string
7854
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7854
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7855 7855
 		$result = $this->db->query($sql);
7856 7856
 		if ($result) {
7857
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7858
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7857
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7858
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7859 7859
 
7860 7860
 			$num = $this->db->num_rows($result);
7861 7861
 
7862 7862
 			$events = array();
7863 7863
 
7864 7864
 			if (!$forcecombo) {
7865
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7865
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7866 7866
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT'));
7867 7867
 			}
7868 7868
 
7869
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7869
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7870 7870
 
7871 7871
 			$textifempty = '';
7872 7872
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7883,7 +7883,7 @@  discard block
 block discarded – undo
7883 7883
 				}
7884 7884
 			}
7885 7885
 			if ($showempty) {
7886
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7886
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7887 7887
 			}
7888 7888
 
7889 7889
 			$i = 0;
@@ -7938,13 +7938,13 @@  discard block
 block discarded – undo
7938 7938
 		$outkey = $objp->rowid;
7939 7939
 		$outref = $objp->ref;
7940 7940
 
7941
-		$opt = '<option value="' . $objp->rowid . '"';
7941
+		$opt = '<option value="'.$objp->rowid.'"';
7942 7942
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7943 7943
 		$opt .= '>';
7944 7944
 		$opt .= $objp->ref;
7945 7945
 		$objRef = $objp->ref;
7946 7946
 		if (!empty($filterkey) && $filterkey != '') {
7947
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7947
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7948 7948
 		}
7949 7949
 
7950 7950
 		$opt .= "</option>\n";
@@ -7985,7 +7985,7 @@  discard block
 block discarded – undo
7985 7985
 			$placeholder = '';
7986 7986
 
7987 7987
 			if ($selected && empty($selected_input_value)) {
7988
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7988
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7989 7989
 				$projecttmpselect = new Project($this->db);
7990 7990
 				$projecttmpselect->fetch($selected);
7991 7991
 				$selected_input_value = $projecttmpselect->ref;
@@ -7993,17 +7993,17 @@  discard block
 block discarded – undo
7993 7993
 			}
7994 7994
 
7995 7995
 			$urloption = '';
7996
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7996
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7997 7997
 
7998 7998
 			if (empty($hidelabel)) {
7999
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7999
+				$out .= $langs->trans("RefOrLabel").' : ';
8000 8000
 			} elseif ($hidelabel > 1) {
8001
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8001
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8002 8002
 				if ($hidelabel == 2) {
8003 8003
 					$out .= img_picto($langs->trans("Search"), 'search');
8004 8004
 				}
8005 8005
 			}
8006
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8006
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8007 8007
 			if ($hidelabel == 3) {
8008 8008
 				$out .= img_picto($langs->trans("Search"), 'search');
8009 8009
 			}
@@ -8046,8 +8046,8 @@  discard block
 block discarded – undo
8046 8046
 
8047 8047
 		$sql = "SELECT ";
8048 8048
 		$sql .= $selectFields;
8049
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
8050
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
8049
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
8050
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
8051 8051
 
8052 8052
 		// Add criteria on ref/label
8053 8053
 		if ($filterkey != '') {
@@ -8063,7 +8063,7 @@  discard block
 block discarded – undo
8063 8063
 				if ($i > 0) {
8064 8064
 					$sql .= " AND ";
8065 8065
 				}
8066
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8066
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
8067 8067
 				$sql .= "";
8068 8068
 				$i++;
8069 8069
 			}
@@ -8076,22 +8076,22 @@  discard block
 block discarded – undo
8076 8076
 		$sql .= $this->db->plimit($limit, 0);
8077 8077
 
8078 8078
 		// Build output string
8079
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
8079
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
8080 8080
 		$result = $this->db->query($sql);
8081 8081
 		if ($result) {
8082
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8083
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
8082
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8083
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
8084 8084
 
8085 8085
 			$num = $this->db->num_rows($result);
8086 8086
 
8087 8087
 			$events = array();
8088 8088
 
8089 8089
 			if (!$forcecombo) {
8090
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8090
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8091 8091
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT'));
8092 8092
 			}
8093 8093
 
8094
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8094
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8095 8095
 
8096 8096
 			$textifempty = '';
8097 8097
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8108,7 +8108,7 @@  discard block
 block discarded – undo
8108 8108
 				}
8109 8109
 			}
8110 8110
 			if ($showempty) {
8111
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
8111
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
8112 8112
 			}
8113 8113
 
8114 8114
 			$i = 0;
@@ -8166,13 +8166,13 @@  discard block
 block discarded – undo
8166 8166
 		$outlabel = $objp->label;
8167 8167
 		$outtype = $objp->fk_product_type;
8168 8168
 
8169
-		$opt = '<option value="' . $objp->rowid . '"';
8169
+		$opt = '<option value="'.$objp->rowid.'"';
8170 8170
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8171 8171
 		$opt .= '>';
8172 8172
 		$opt .= $objp->ref;
8173 8173
 		$objRef = $objp->ref;
8174 8174
 		if (!empty($filterkey) && $filterkey != '') {
8175
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
8175
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
8176 8176
 		}
8177 8177
 
8178 8178
 		$opt .= "</option>\n";
@@ -8214,7 +8214,7 @@  discard block
 block discarded – undo
8214 8214
 			$placeholder = '';
8215 8215
 
8216 8216
 			if ($selected && empty($selected_input_value)) {
8217
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8217
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8218 8218
 				$adherenttmpselect = new Adherent($this->db);
8219 8219
 				$adherenttmpselect->fetch($selected);
8220 8220
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8223,17 +8223,17 @@  discard block
 block discarded – undo
8223 8223
 
8224 8224
 			$urloption = '';
8225 8225
 
8226
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8226
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8227 8227
 
8228 8228
 			if (empty($hidelabel)) {
8229
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8229
+				$out .= $langs->trans("RefOrLabel").' : ';
8230 8230
 			} elseif ($hidelabel > 1) {
8231
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8231
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8232 8232
 				if ($hidelabel == 2) {
8233 8233
 					$out .= img_picto($langs->trans("Search"), 'search');
8234 8234
 				}
8235 8235
 			}
8236
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8236
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8237 8237
 			if ($hidelabel == 3) {
8238 8238
 				$out .= img_picto($langs->trans("Search"), 'search');
8239 8239
 			}
@@ -8278,8 +8278,8 @@  discard block
 block discarded – undo
8278 8278
 
8279 8279
 		$sql = "SELECT ";
8280 8280
 		$sql .= $selectFields;
8281
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8282
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8281
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8282
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8283 8283
 
8284 8284
 		// Add criteria on ref/label
8285 8285
 		if ($filterkey != '') {
@@ -8295,8 +8295,8 @@  discard block
 block discarded – undo
8295 8295
 				if ($i > 0) {
8296 8296
 					$sql .= " AND ";
8297 8297
 				}
8298
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8299
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8298
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8299
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8300 8300
 				$i++;
8301 8301
 			}
8302 8302
 			if (count($search_crit) > 1) {
@@ -8305,27 +8305,27 @@  discard block
 block discarded – undo
8305 8305
 			$sql .= ')';
8306 8306
 		}
8307 8307
 		if ($status != -1) {
8308
-			$sql .= ' AND statut = ' . ((int) $status);
8308
+			$sql .= ' AND statut = '.((int) $status);
8309 8309
 		}
8310 8310
 		$sql .= $this->db->plimit($limit, 0);
8311 8311
 
8312 8312
 		// Build output string
8313
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8313
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8314 8314
 		$result = $this->db->query($sql);
8315 8315
 		if ($result) {
8316
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8317
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8316
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8317
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8318 8318
 
8319 8319
 			$num = $this->db->num_rows($result);
8320 8320
 
8321 8321
 			$events = array();
8322 8322
 
8323 8323
 			if (!$forcecombo) {
8324
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8324
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8325 8325
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8326 8326
 			}
8327 8327
 
8328
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8328
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8329 8329
 
8330 8330
 			$textifempty = '';
8331 8331
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8342,7 +8342,7 @@  discard block
 block discarded – undo
8342 8342
 				}
8343 8343
 			}
8344 8344
 			if ($showempty) {
8345
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8345
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8346 8346
 			}
8347 8347
 
8348 8348
 			$i = 0;
@@ -8398,11 +8398,11 @@  discard block
 block discarded – undo
8398 8398
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8399 8399
 		$outtype = $objp->fk_adherent_type;
8400 8400
 
8401
-		$opt = '<option value="' . $objp->rowid . '"';
8401
+		$opt = '<option value="'.$objp->rowid.'"';
8402 8402
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8403 8403
 		$opt .= '>';
8404 8404
 		if (!empty($filterkey) && $filterkey != '') {
8405
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8405
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8406 8406
 		}
8407 8407
 		$opt .= $outlabel;
8408 8408
 		$opt .= "</option>\n";
@@ -8457,8 +8457,8 @@  discard block
 block discarded – undo
8457 8457
 		$objecttmp = null;
8458 8458
 		$InfoFieldList = array();
8459 8459
 		$classname = '';
8460
-		$filter = '';  // Ensure filter has value (for static analysis)
8461
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8460
+		$filter = ''; // Ensure filter has value (for static analysis)
8461
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8462 8462
 
8463 8463
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8464 8464
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8502,9 +8502,9 @@  discard block
 block discarded – undo
8502 8502
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8503 8503
 			$reg = array();
8504 8504
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8505
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8505
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8506 8506
 			}
8507
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8507
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8508 8508
 
8509 8509
 			$classname = $InfoFieldList[0];
8510 8510
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8535,8 +8535,8 @@  discard block
 block discarded – undo
8535 8535
 		);
8536 8536
 
8537 8537
 		if (!is_object($objecttmp)) {
8538
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8539
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8538
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8539
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8540 8540
 		}
8541 8541
 		'@phan-var-force CommonObject $objecttmp';
8542 8542
 		/** @var CommonObject $objecttmp */
@@ -8548,9 +8548,9 @@  discard block
 block discarded – undo
8548 8548
 		if ($prefixforautocompletemode == 'product') {
8549 8549
 			$prefixforautocompletemode = 'produit';
8550 8550
 		}
8551
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8551
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8552 8552
 
8553
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8553
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8554 8554
 
8555 8555
 		// Generate the combo HTML component
8556 8556
 		$out = '';
@@ -8579,13 +8579,13 @@  discard block
 block discarded – undo
8579 8579
 			}
8580 8580
 
8581 8581
 			// Set url and param to call to get json of the search results
8582
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8583
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8582
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8583
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8584 8584
 
8585 8585
 			// Activate the auto complete using ajax call.
8586 8586
 			$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0);
8587 8587
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8588
-			$out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />';
8588
+			$out .= '<input type="text" class="'.$morecss.'"'.($disabled ? ' disabled="disabled"' : '').' name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' />';
8589 8589
 		} else {
8590 8590
 			// Immediate load of table record.
8591 8591
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8625,16 +8625,16 @@  discard block
 block discarded – undo
8625 8625
 		if ($prefixforautocompletemode == 'societe') {
8626 8626
 			$prefixforautocompletemode = 'company';
8627 8627
 		}
8628
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8628
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8629 8629
 
8630 8630
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8631 8631
 			$tmpfieldstoshow = '';
8632 8632
 			foreach ($objecttmp->fields as $key => $val) {
8633
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8633
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8634 8634
 					continue;
8635 8635
 				}
8636 8636
 				if (!empty($val['showoncombobox'])) {
8637
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8637
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8638 8638
 				}
8639 8639
 			}
8640 8640
 			if ($tmpfieldstoshow) {
@@ -8671,25 +8671,25 @@  discard block
 block discarded – undo
8671 8671
 		$num = 0;
8672 8672
 
8673 8673
 		// Search data
8674
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t";
8674
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t";
8675 8675
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8676
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object";
8676
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object";
8677 8677
 		}
8678 8678
 		if (!empty($objecttmp->parent_element)) {
8679 8679
 			$parent_properties = getElementProperties($objecttmp->parent_element);
8680
-			$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8680
+			$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8681 8681
 		}
8682 8682
 		if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) {
8683
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product";
8683
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product";
8684 8684
 		}
8685 8685
 		if (isset($objecttmp->ismultientitymanaged)) {
8686 8686
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8687 8687
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8688
-				$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]);
8688
+				$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]);
8689 8689
 			}
8690 8690
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8691 8691
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8692
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8692
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8693 8693
 				}
8694 8694
 			}
8695 8695
 		}
@@ -8709,27 +8709,27 @@  discard block
 block discarded – undo
8709 8709
 			$sql .= " WHERE 1=1";
8710 8710
 			if (isset($objecttmp->ismultientitymanaged)) {
8711 8711
 				if ($objecttmp->ismultientitymanaged == 1) {
8712
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8712
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8713 8713
 				}
8714 8714
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8715
-					$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]);
8715
+					$sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]);
8716 8716
 				}
8717 8717
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8718 8718
 					if ($objecttmp->element == 'societe') {
8719
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8719
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8720 8720
 					} else {
8721
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8721
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8722 8722
 					}
8723 8723
 				}
8724 8724
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8725 8725
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8726
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8726
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8727 8727
 					}
8728 8728
 				}
8729 8729
 			}
8730 8730
 			$splittedfieldstoshow = explode(',', $fieldstoshow);
8731 8731
 			foreach ($splittedfieldstoshow as &$field2) {
8732
-				if (is_numeric($pos=strpos($field2, ' '))) {
8732
+				if (is_numeric($pos = strpos($field2, ' '))) {
8733 8733
 					$field2 = substr($field2, 0, $pos);
8734 8734
 				}
8735 8735
 			}
@@ -8741,7 +8741,7 @@  discard block
 block discarded – undo
8741 8741
 				$errormessage = '';
8742 8742
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8743 8743
 				if ($errormessage) {
8744
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8744
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8745 8745
 				}
8746 8746
 			}
8747 8747
 		}
@@ -8753,7 +8753,7 @@  discard block
 block discarded – undo
8753 8753
 		$resql = $this->db->query($sql);
8754 8754
 		if ($resql) {
8755 8755
 			// Construct $out and $outarray
8756
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8756
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8757 8757
 
8758 8758
 			// Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
8759 8759
 			$textifempty = '&nbsp;';
@@ -8767,7 +8767,7 @@  discard block
 block discarded – undo
8767 8767
 				}
8768 8768
 			}
8769 8769
 			if ($showempty) {
8770
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8770
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8771 8771
 			}
8772 8772
 
8773 8773
 			$num = $this->db->num_rows($resql);
@@ -8790,9 +8790,9 @@  discard block
 block discarded – undo
8790 8790
 					}
8791 8791
 					if (empty($outputmode)) {
8792 8792
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8793
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8793
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8794 8794
 						} else {
8795
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8795
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8796 8796
 						}
8797 8797
 					} else {
8798 8798
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8805,10 +8805,10 @@  discard block
 block discarded – undo
8805 8805
 				}
8806 8806
 			}
8807 8807
 
8808
-			$out .= '</select>' . "\n";
8808
+			$out .= '</select>'."\n";
8809 8809
 
8810 8810
 			if (!$forcecombo) {
8811
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8811
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8812 8812
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8813 8813
 			}
8814 8814
 		} else {
@@ -8872,8 +8872,8 @@  discard block
 block discarded – undo
8872 8872
 			}
8873 8873
 		}
8874 8874
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8875
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8876
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8875
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8876
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8877 8877
 		$out .= '>'."\n";
8878 8878
 
8879 8879
 		if ($show_empty) {
@@ -8884,7 +8884,7 @@  discard block
 block discarded – undo
8884 8884
 			if (!is_numeric($show_empty)) {
8885 8885
 				$textforempty = $show_empty;
8886 8886
 			}
8887
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8887
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8888 8888
 		}
8889 8889
 		if (is_array($array)) {
8890 8890
 			// Translate
@@ -8909,7 +8909,7 @@  discard block
 block discarded – undo
8909 8909
 					$value = $tmpvalue['label'];
8910 8910
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8911 8911
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8912
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8912
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8913 8913
 				} else {
8914 8914
 					$value = $tmpvalue;
8915 8915
 					//$valuehtml = $tmpvalue;
@@ -8925,9 +8925,9 @@  discard block
 block discarded – undo
8925 8925
 				}
8926 8926
 				if ($key_in_label) {
8927 8927
 					if (empty($nohtmlescape)) {
8928
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8928
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8929 8929
 					} else {
8930
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8930
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8931 8931
 					}
8932 8932
 				} else {
8933 8933
 					if (empty($nohtmlescape)) {
@@ -8939,8 +8939,8 @@  discard block
 block discarded – undo
8939 8939
 						$selectOptionValue = '&nbsp;';
8940 8940
 					}
8941 8941
 				}
8942
-				$out .= '<option value="' . $key . '"';
8943
-				$out .= $style . $disabled;
8942
+				$out .= '<option value="'.$key.'"';
8943
+				$out .= $style.$disabled;
8944 8944
 				if (is_array($id)) {
8945 8945
 					if (in_array($key, $id) && !$disabled) {
8946 8946
 						$out .= ' selected'; // To preselect a value
@@ -8952,7 +8952,7 @@  discard block
 block discarded – undo
8952 8952
 					}
8953 8953
 				}
8954 8954
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8955
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8955
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8956 8956
 				}
8957 8957
 
8958 8958
 				if (is_array($tmpvalue)) {
@@ -8975,7 +8975,7 @@  discard block
 block discarded – undo
8975 8975
 		// Add code for jquery to use multiselect
8976 8976
 		if ($addjscombo && $jsbeautify) {
8977 8977
 			// Enhance with select2
8978
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8978
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8979 8979
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
8980 8980
 		}
8981 8981
 
@@ -9003,28 +9003,28 @@  discard block
 block discarded – undo
9003 9003
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
9004 9004
 	{
9005 9005
 		global $conf, $langs;
9006
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9006
+		global $delayedhtmlcontent; // Will be used later outside of this function
9007 9007
 
9008 9008
 		// TODO Use an internal dolibarr component instead of select2
9009 9009
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9010 9010
 			return '';
9011 9011
 		}
9012 9012
 
9013
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
9013
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
9014 9014
 
9015 9015
 		$outdelayed = '';
9016 9016
 		if (!empty($conf->use_javascript_ajax)) {
9017 9017
 			$tmpplugin = 'select2';
9018
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9019
-		    	<script nonce="' . getNonce() . '">
9018
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9019
+		    	<script nonce="' . getNonce().'">
9020 9020
 		    	$(document).ready(function () {
9021 9021
 
9022
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
9022
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
9023 9023
 
9024
-	                $(".' . $htmlname . '").select2({
9024
+	                $(".' . $htmlname.'").select2({
9025 9025
 				    	ajax: {
9026 9026
 					    	dir: "ltr",
9027
-					    	url: "' . $url . '",
9027
+					    	url: "' . $url.'",
9028 9028
 					    	dataType: \'json\',
9029 9029
 					    	delay: 250,
9030 9030
 					    	data: function (params) {
@@ -9051,9 +9051,9 @@  discard block
 block discarded – undo
9051 9051
 				    	},
9052 9052
 		 				language: select2arrayoflanguage,
9053 9053
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9054
-					    placeholder: "' . dol_escape_js($placeholder) . '",
9054
+					    placeholder: "' . dol_escape_js($placeholder).'",
9055 9055
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9056
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
9056
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
9057 9057
 				        formatResult: function (result, container, query, escapeMarkup) {
9058 9058
 	                        return escapeMarkup(result.text);
9059 9059
 	                    },
@@ -9061,10 +9061,10 @@  discard block
 block discarded – undo
9061 9061
 
9062 9062
 	                ' . ($callurlonselect ? '
9063 9063
 	                /* Code to execute a GET when we select a value */
9064
-	                $(".' . $htmlname . '").change(function() {
9065
-				    	var selected = $(".' . $htmlname . '").val();
9064
+	                $(".' . $htmlname.'").change(function() {
9065
+				    	var selected = $(".' . $htmlname.'").val();
9066 9066
 	                	console.log("We select in selectArrayAjax the entry "+selected)
9067
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
9067
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
9068 9068
 	    			    $.each( saveRemoteData, function( key, value ) {
9069 9069
 	    				        if (key == selected)
9070 9070
 	    			            {
@@ -9072,7 +9072,7 @@  discard block
 block discarded – undo
9072 9072
 	    			                 location.assign(value.url);
9073 9073
 	    			            }
9074 9074
 	                    });
9075
-	    			});' : '') . '
9075
+	    			});' : '').'
9076 9076
 
9077 9077
 	    	   });
9078 9078
 		       </script>';
@@ -9108,14 +9108,14 @@  discard block
 block discarded – undo
9108 9108
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
9109 9109
 	{
9110 9110
 		global $conf, $langs;
9111
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9111
+		global $delayedhtmlcontent; // Will be used later outside of this function
9112 9112
 
9113 9113
 		// TODO Use an internal dolibarr component instead of select2
9114 9114
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9115 9115
 			return '';
9116 9116
 		}
9117 9117
 
9118
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9118
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9119 9119
 
9120 9120
 		$formattedarrayresult = array();
9121 9121
 
@@ -9130,20 +9130,20 @@  discard block
 block discarded – undo
9130 9130
 		$outdelayed = '';
9131 9131
 		if (!empty($conf->use_javascript_ajax)) {
9132 9132
 			$tmpplugin = 'select2';
9133
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9134
-				<script nonce="' . getNonce() . '">
9133
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9134
+				<script nonce="' . getNonce().'">
9135 9135
 				$(document).ready(function () {
9136
-					var data = ' . json_encode($formattedarrayresult) . ';
9136
+					var data = ' . json_encode($formattedarrayresult).';
9137 9137
 
9138
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
9138
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
9139 9139
 
9140
-					$(".' . $htmlname . '").select2({
9140
+					$(".' . $htmlname.'").select2({
9141 9141
 						data: data,
9142 9142
 						language: select2arrayoflanguage,
9143 9143
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9144
-						placeholder: "' . dol_escape_js($placeholder) . '",
9144
+						placeholder: "' . dol_escape_js($placeholder).'",
9145 9145
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9146
-						minimumInputLength: ' . $minimumInputLength . ',
9146
+						minimumInputLength: ' . $minimumInputLength.',
9147 9147
 						formatResult: function (result, container, query, escapeMarkup) {
9148 9148
 							return escapeMarkup(result.text);
9149 9149
 						},
@@ -9182,11 +9182,11 @@  discard block
 block discarded – undo
9182 9182
 
9183 9183
 					' . ($callurlonselect ? '
9184 9184
 					/* Code to execute a GET when we select a value */
9185
-					$(".' . $htmlname . '").change(function() {
9186
-						var selected = $(".' . $htmlname . '").val();
9185
+					$(".' . $htmlname.'").change(function() {
9186
+						var selected = $(".' . $htmlname.'").val();
9187 9187
 						console.log("We select "+selected)
9188 9188
 
9189
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
9189
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
9190 9190
 						$.each( saveRemoteData, function( key, value ) {
9191 9191
 							if (key == selected)
9192 9192
 							{
@@ -9194,7 +9194,7 @@  discard block
 block discarded – undo
9194 9194
 								location.assign(value.url);
9195 9195
 							}
9196 9196
 						});
9197
-					});' : '') . '
9197
+					});' : '').'
9198 9198
 
9199 9199
 				});
9200 9200
 				</script>';
@@ -9242,7 +9242,7 @@  discard block
 block discarded – undo
9242 9242
 		$useenhancedmultiselect = 0;
9243 9243
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9244 9244
 			if ($addjscombo) {
9245
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9245
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9246 9246
 			}
9247 9247
 		}
9248 9248
 
@@ -9251,7 +9251,7 @@  discard block
 block discarded – undo
9251 9251
 		// submitted to nothing.
9252 9252
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9253 9253
 		// Output select component
9254
-		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
9254
+		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n";
9255 9255
 		if (is_array($array) && !empty($array)) {
9256 9256
 			if ($value_as_key) {
9257 9257
 				$array = array_combine($array, $array);
@@ -9272,33 +9272,33 @@  discard block
 block discarded – undo
9272 9272
 						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9273 9273
 					}
9274 9274
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9275
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9275
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9276 9276
 
9277
-					$out .= '<option value="' . $tmpkey . '"';
9277
+					$out .= '<option value="'.$tmpkey.'"';
9278 9278
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9279 9279
 						$out .= ' selected';
9280 9280
 					}
9281 9281
 					if (!empty($tmplabelhtml)) {
9282
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9282
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9283 9283
 					} else {
9284
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9285
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9284
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9285
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9286 9286
 					}
9287 9287
 					$out .= '>';
9288 9288
 					$out .= dol_htmlentitiesbr($newval);
9289
-					$out .= '</option>' . "\n";
9289
+					$out .= '</option>'."\n";
9290 9290
 				}
9291 9291
 			}
9292 9292
 		}
9293
-		$out .= '</select>' . "\n";
9293
+		$out .= '</select>'."\n";
9294 9294
 
9295 9295
 		// Add code for jquery to use multiselect
9296 9296
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9297
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9298
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9297
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9298
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9299 9299
 			if ($addjscombo == 1) {
9300 9300
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9301
-				$out .= 'function formatResult(record, container) {' . "\n";
9301
+				$out .= 'function formatResult(record, container) {'."\n";
9302 9302
 				// If property data-html set, we decode html entities and use this.
9303 9303
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9304 9304
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9306,26 +9306,26 @@  discard block
 block discarded – undo
9306 9306
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9307 9307
 				$out .= '	}'."\n";
9308 9308
 				$out .= '	return record.text;';
9309
-				$out .= '}' . "\n";
9310
-				$out .= 'function formatSelection(record) {' . "\n";
9309
+				$out .= '}'."\n";
9310
+				$out .= 'function formatSelection(record) {'."\n";
9311 9311
 				if ($elemtype == 'category') {
9312
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9312
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9313 9313
 				} else {
9314 9314
 					$out .= 'return record.text;';
9315 9315
 				}
9316
-				$out .= '}' . "\n";
9316
+				$out .= '}'."\n";
9317 9317
 				$out .= '$(document).ready(function () {
9318
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9318
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9319 9319
 				if ($placeholder) {
9320 9320
 					$out .= '
9321 9321
 								placeholder: {
9322 9322
 								    id: \'-1\',
9323
-								    text: \'' . dol_escape_js($placeholder) . '\'
9323
+								    text: \'' . dol_escape_js($placeholder).'\'
9324 9324
 								  },';
9325 9325
 				}
9326 9326
 				$out .= '		dir: \'ltr\',
9327 9327
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9328
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9328
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9329 9329
 								// Specify format function for dropdown item
9330 9330
 								formatResult: formatResult,
9331 9331
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9337,21 +9337,21 @@  discard block
 block discarded – undo
9337 9337
 
9338 9338
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9339 9339
 								 the size only if component is not hidden by default on load */
9340
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9340
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9341 9341
 						});' . "\n";
9342 9342
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9343 9343
 				// Add other js lib
9344 9344
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9345 9345
 				// ...
9346
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9346
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9347 9347
 				$out .= '$(document).ready(function () {
9348
-							$(\'#' . $htmlname . '\').multiSelect({
9348
+							$(\'#' . $htmlname.'\').multiSelect({
9349 9349
 								containerHTML: \'<div class="multi-select-container">\',
9350 9350
 								menuHTML: \'<div class="multi-select-menu">\',
9351
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9351
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9352 9352
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9353 9353
 								activeClass: \'multi-select-container--open\',
9354
-								noneText: \'' . $placeholder . '\'
9354
+								noneText: \'' . $placeholder.'\'
9355 9355
 							});
9356 9356
 						})';
9357 9357
 			}
@@ -9384,7 +9384,7 @@  discard block
 block discarded – undo
9384 9384
 			return '';
9385 9385
 		}
9386 9386
 
9387
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9387
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9388 9388
 
9389 9389
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9390 9390
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9427,19 +9427,19 @@  discard block
 block discarded – undo
9427 9427
 				}
9428 9428
 
9429 9429
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9430
-				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
9431
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9430
+				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
9431
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9432 9432
 			}
9433 9433
 		}
9434 9434
 
9435
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9435
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9436 9436
 
9437 9437
         <dl class="dropdown">
9438 9438
             <dt>
9439
-            <a href="#' . $htmlname . '">
9440
-              ' . img_picto('', 'list') . '
9439
+            <a href="#' . $htmlname.'">
9440
+              ' . img_picto('', 'list').'
9441 9441
             </a>
9442
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9442
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9443 9443
             </dt>
9444 9444
             <dd class="dropdowndd">
9445 9445
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9451,19 +9451,19 @@  discard block
 block discarded – undo
9451 9451
             </dd>
9452 9452
         </dl>
9453 9453
 
9454
-        <script nonce="' . getNonce() . '" type="text/javascript">
9454
+        <script nonce="' . getNonce().'" type="text/javascript">
9455 9455
           jQuery(document).ready(function () {
9456
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9456
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9457 9457
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9458 9458
 
9459 9459
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9460 9460
 
9461 9461
                   var title = $(this).val() + ",";
9462 9462
                   if ($(this).is(\':checked\')) {
9463
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9463
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9464 9464
                   }
9465 9465
                   else {
9466
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9466
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9467 9467
                   }
9468 9468
                   // Now, we submit page
9469 9469
                   //$(this).parents(\'form:first\').submit();
@@ -9494,7 +9494,7 @@  discard block
 block discarded – undo
9494 9494
 	 */
9495 9495
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9496 9496
 	{
9497
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9497
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9498 9498
 
9499 9499
 		$cat = new Categorie($this->db);
9500 9500
 		$categories = $cat->containing($id, $type);
@@ -9504,13 +9504,13 @@  discard block
 block discarded – undo
9504 9504
 			foreach ($categories as $c) {
9505 9505
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9506 9506
 				foreach ($ways as $way) {
9507
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9507
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9508 9508
 				}
9509 9509
 			}
9510 9510
 			if (empty($toprint)) {
9511 9511
 				return '';
9512 9512
 			} else {
9513
-				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9513
+				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9514 9514
 			}
9515 9515
 		}
9516 9516
 
@@ -9559,15 +9559,15 @@  discard block
 block discarded – undo
9559 9559
 
9560 9560
 
9561 9561
 			print '<div class="div-table-responsive-no-min">';
9562
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9562
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9563 9563
 
9564 9564
 			print '<tr class="liste_titre">';
9565
-			print '<td>' . $langs->trans("Type") . '</td>';
9566
-			print '<td>' . $langs->trans("Ref") . '</td>';
9565
+			print '<td>'.$langs->trans("Type").'</td>';
9566
+			print '<td>'.$langs->trans("Ref").'</td>';
9567 9567
 			print '<td class="center"></td>';
9568
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9569
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9570
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9568
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9569
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9570
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9571 9571
 			print '<td></td>';
9572 9572
 			print '</tr>';
9573 9573
 
@@ -9586,13 +9586,13 @@  discard block
 block discarded – undo
9586 9586
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9587 9587
 					$element = $regs[1];
9588 9588
 					$subelement = $regs[2];
9589
-					$tplpath = $element . '/' . $subelement;
9589
+					$tplpath = $element.'/'.$subelement;
9590 9590
 				}
9591 9591
 				$tplname = 'linkedobjectblock';
9592 9592
 
9593 9593
 				// To work with non standard path
9594 9594
 				if ($objecttype == 'facture') {
9595
-					$tplpath = 'compta/' . $element;
9595
+					$tplpath = 'compta/'.$element;
9596 9596
 					if (!isModEnabled('invoice')) {
9597 9597
 						continue; // Do not show if module disabled
9598 9598
 					}
@@ -9603,7 +9603,7 @@  discard block
 block discarded – undo
9603 9603
 						continue; // Do not show if module disabled
9604 9604
 					}
9605 9605
 				} elseif ($objecttype == 'propal') {
9606
-					$tplpath = 'comm/' . $element;
9606
+					$tplpath = 'comm/'.$element;
9607 9607
 					if (!isModEnabled('propal')) {
9608 9608
 						continue; // Do not show if module disabled
9609 9609
 					}
@@ -9656,7 +9656,7 @@  discard block
 block discarded – undo
9656 9656
 				$linkedObjectBlock = $objects;
9657 9657
 
9658 9658
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9659
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9659
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9660 9660
 				foreach ($dirtpls as $reldir) {
9661 9661
 					$reldir = rtrim($reldir, '/');
9662 9662
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9664,7 +9664,7 @@  discard block
 block discarded – undo
9664 9664
 						$noMoreLinkedObjectBlockAfter = 1;
9665 9665
 					}
9666 9666
 
9667
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9667
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9668 9668
 					if ($res) {
9669 9669
 						$nboftypesoutput++;
9670 9670
 						break;
@@ -9673,7 +9673,7 @@  discard block
 block discarded – undo
9673 9673
 			}
9674 9674
 
9675 9675
 			if (!$nboftypesoutput) {
9676
-				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9676
+				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9677 9677
 			}
9678 9678
 
9679 9679
 			print '</table>';
@@ -9721,14 +9721,14 @@  discard block
 block discarded – undo
9721 9721
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9722 9722
 			$listofidcompanytoscan = (int) $object->thirdparty->id;
9723 9723
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9724
-				$listofidcompanytoscan .= ',' . (int) $object->thirdparty->parent;
9724
+				$listofidcompanytoscan .= ','.(int) $object->thirdparty->parent;
9725 9725
 			}
9726 9726
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9727
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9727
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9728 9728
 				$tmpproject = new Project($this->db);
9729 9729
 				$tmpproject->fetch($object->fk_project);
9730 9730
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9731
-					$listofidcompanytoscan .= ',' . (int) $tmpproject->socid;
9731
+					$listofidcompanytoscan .= ','.(int) $tmpproject->socid;
9732 9732
 				}
9733 9733
 				unset($tmpproject);
9734 9734
 			}
@@ -9738,75 +9738,75 @@  discard block
 block discarded – undo
9738 9738
 					'enabled' => isModEnabled('propal'),
9739 9739
 					'perms' => 1,
9740 9740
 					'label' => 'LinkToProposal',
9741
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('propal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9741
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9742 9742
 				),
9743 9743
 				'shipping' => array(
9744 9744
 					'enabled' => isModEnabled('shipping'),
9745 9745
 					'perms' => 1,
9746 9746
 					'label' => 'LinkToExpedition',
9747
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('shipping') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''),
9747
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."expedition as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('shipping').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : ''),
9748 9748
 				),
9749 9749
 				'order' => array(
9750 9750
 					'enabled' => isModEnabled('order'),
9751 9751
 					'perms' => 1,
9752 9752
 					'label' => 'LinkToOrder',
9753
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''),
9753
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : ''),
9754 9754
 					'linkname' => 'commande',
9755 9755
 				),
9756 9756
 				'invoice' => array(
9757 9757
 					'enabled' => isModEnabled('invoice'),
9758 9758
 					'perms' => 1,
9759 9759
 					'label' => 'LinkToInvoice',
9760
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9760
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9761 9761
 					'linkname' => 'facture',
9762 9762
 				),
9763 9763
 				'invoice_template' => array(
9764 9764
 					'enabled' => isModEnabled('invoice'),
9765 9765
 					'perms' => 1,
9766 9766
 					'label' => 'LinkToTemplateInvoice',
9767
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('invoice') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9767
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9768 9768
 				),
9769 9769
 				'contrat' => array(
9770 9770
 					'enabled' => isModEnabled('contract'),
9771 9771
 					'perms' => 1,
9772 9772
 					'label' => 'LinkToContract',
9773 9773
 					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
9774
-							FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "contrat as t, " . $this->db->prefix() . "contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('contract') . ') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier',
9774
+							FROM " . $this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier',
9775 9775
 				),
9776 9776
 				'fichinter' => array(
9777 9777
 					'enabled' => isModEnabled('intervention'),
9778 9778
 					'perms' => 1,
9779 9779
 					'label' => 'LinkToIntervention',
9780
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('intervention') . ')',
9780
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')',
9781 9781
 				),
9782 9782
 				'supplier_proposal' => array(
9783 9783
 					'enabled' => isModEnabled('supplier_proposal'),
9784 9784
 					'perms' => 1,
9785 9785
 					'label' => 'LinkToSupplierProposal',
9786
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('supplier_proposal') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9786
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : ''),
9787 9787
 				),
9788 9788
 				'order_supplier' => array(
9789 9789
 					'enabled' => isModEnabled("supplier_order"),
9790 9790
 					'perms' => 1,
9791 9791
 					'label' => 'LinkToSupplierOrder',
9792
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('commande_fournisseur') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''),
9792
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : ''),
9793 9793
 				),
9794 9794
 				'invoice_supplier' => array(
9795 9795
 					'enabled' => isModEnabled("supplier_invoice"),
9796 9796
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9797
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('facture_fourn') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9797
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : ''),
9798 9798
 				),
9799 9799
 				'ticket' => array(
9800 9800
 					'enabled' => isModEnabled('ticket'),
9801 9801
 					'perms' => 1,
9802 9802
 					'label' => 'LinkToTicket',
9803
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM " . $this->db->prefix() . "societe as s, " . $this->db->prefix() . "ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('ticket') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''),
9803
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : ''),
9804 9804
 				),
9805 9805
 				'mo' => array(
9806 9806
 					'enabled' => isModEnabled('mrp'),
9807 9807
 					'perms' => 1,
9808 9808
 					'label' => 'LinkToMo',
9809
-					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM " . $this->db->prefix() . "societe as s INNER JOIN " . $this->db->prefix() . "mrp_mo as t ON t.fk_soc = s.rowid  WHERE  t.fk_soc IN (" . $this->db->sanitize($listofidcompanytoscan) . ') AND t.entity IN (' . getEntity('mo') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''),
9809
+					'sql' => "SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid  WHERE  t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''),
9810 9810
 				),
9811 9811
 			);
9812 9812
 		}
@@ -9848,23 +9848,23 @@  discard block
 block discarded – undo
9848 9848
 			}
9849 9849
 
9850 9850
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9851
-				$htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9851
+				$htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9852 9852
 
9853 9853
 				// Section for free ref input
9854 9854
 				if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9855 9855
 					$htmltoenteralink .= '<br>'."\n";
9856 9856
 					$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n";
9857
-					$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9858
-					$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9857
+					$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9858
+					$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9859 9859
 					$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">';
9860
-					$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9861
-					$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9860
+					$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9861
+					$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9862 9862
 					$htmltoenteralink .= '<table class="noborder">';
9863 9863
 					$htmltoenteralink .= '<tr class="liste_titre">';
9864 9864
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9865
-					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9866
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9867
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9865
+					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9866
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9867
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9868 9868
 					$htmltoenteralink .= '</tr>';
9869 9869
 					$htmltoenteralink .= '</table>';
9870 9870
 					$htmltoenteralink .= '</form>';
@@ -9883,18 +9883,18 @@  discard block
 block discarded – undo
9883 9883
 							$htmltoenteralink .= '<br>';
9884 9884
 						}
9885 9885
 						$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n";
9886
-						$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9887
-						$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9886
+						$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9887
+						$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9888 9888
 						$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">';
9889
-						$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9890
-						$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9889
+						$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9890
+						$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9891 9891
 						$htmltoenteralink .= '<table class="noborder">';
9892 9892
 						$htmltoenteralink .= '<tr class="liste_titre">';
9893 9893
 						$htmltoenteralink .= '<td class="nowrap"></td>';
9894
-						$htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>';
9895
-						$htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>';
9896
-						$htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9897
-						$htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>';
9894
+						$htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>';
9895
+						$htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>';
9896
+						$htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9897
+						$htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>';
9898 9898
 						$htmltoenteralink .= '</tr>';
9899 9899
 						while ($i < $num) {
9900 9900
 							$objp = $this->db->fetch_object($resqllist);
@@ -9909,30 +9909,30 @@  discard block
 block discarded – undo
9909 9909
 							if ($alreadylinked) {
9910 9910
 								$htmltoenteralink .= img_picto('', 'link');
9911 9911
 							} else {
9912
-								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9912
+								$htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9913 9913
 							}
9914 9914
 							$htmltoenteralink .= '</td>';
9915
-							$htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9916
-							$htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9915
+							$htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9916
+							$htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9917 9917
 							$htmltoenteralink .= '<td class="right">';
9918 9918
 							if ($possiblelink['label'] == 'LinkToContract') {
9919
-								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9919
+								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9920 9920
 							}
9921
-							$htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9921
+							$htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9922 9922
 							$htmltoenteralink .= '</td>';
9923
-							$htmltoenteralink .= '<td>' . $objp->name . '</td>';
9923
+							$htmltoenteralink .= '<td>'.$objp->name.'</td>';
9924 9924
 							$htmltoenteralink .= '</tr>';
9925 9925
 							$i++;
9926 9926
 						}
9927 9927
 						$htmltoenteralink .= '</table>';
9928 9928
 						$htmltoenteralink .= '<div class="center">';
9929 9929
 						if ($num) {
9930
-							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">';
9930
+							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">';
9931 9931
 						}
9932 9932
 						if (empty($conf->use_javascript_ajax)) {
9933
-							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9933
+							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9934 9934
 						} else {
9935
-							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9935
+							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9936 9936
 						}
9937 9937
 						$htmltoenteralink .= '</form>';
9938 9938
 					}
@@ -9946,10 +9946,10 @@  discard block
 block discarded – undo
9946 9946
 
9947 9947
 				// Complete the list for the combo box
9948 9948
 				if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9949
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9949
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9950 9950
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9951 9951
 				} else {
9952
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9952
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9953 9953
 				}
9954 9954
 			}
9955 9955
 		}
@@ -9959,11 +9959,11 @@  discard block
 block discarded – undo
9959 9959
 			<dl class="dropdown" id="linktoobjectname">
9960 9960
 			';
9961 9961
 			if (!empty($conf->use_javascript_ajax)) {
9962
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9962
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9963 9963
 			}
9964 9964
 			$linktoelem .= '<dd>
9965 9965
 			<div class="multiselectlinkto">
9966
-			<ul class="ulselectedfields">' . $linktoelemlist . '
9966
+			<ul class="ulselectedfields">' . $linktoelemlist.'
9967 9967
 			</ul>
9968 9968
 			</div>
9969 9969
 			</dd>
@@ -9974,7 +9974,7 @@  discard block
 block discarded – undo
9974 9974
 
9975 9975
 		if (!empty($conf->use_javascript_ajax)) {
9976 9976
 			print '<!-- Add js to show linkto box -->
9977
-				<script nonce="' . getNonce() . '">
9977
+				<script nonce="' . getNonce().'">
9978 9978
 				jQuery(document).ready(function() {
9979 9979
 					jQuery(".linkto").click(function() {
9980 9980
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -10021,19 +10021,19 @@  discard block
 block discarded – undo
10021 10021
 
10022 10022
 		$disabled = ($disabled ? ' disabled' : '');
10023 10023
 
10024
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
10024
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
10025 10025
 		if ($useempty) {
10026
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10026
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
10027 10027
 		}
10028 10028
 		if (("$value" == 'yes') || ($value == 1)) {
10029
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
10030
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
10029
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
10030
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
10031 10031
 		} else {
10032 10032
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
10033
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
10034
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
10033
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
10034
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
10035 10035
 		}
10036
-		$resultyesno .= '</select>' . "\n";
10036
+		$resultyesno .= '</select>'."\n";
10037 10037
 
10038 10038
 		if ($addjscombo) {
10039 10039
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -10057,12 +10057,12 @@  discard block
 block discarded – undo
10057 10057
 	{
10058 10058
 		// phpcs:enable
10059 10059
 		$sql = "SELECT rowid, label";
10060
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
10061
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
10060
+		$sql .= " FROM ".$this->db->prefix()."export_model";
10061
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
10062 10062
 		$sql .= " ORDER BY rowid";
10063 10063
 		$result = $this->db->query($sql);
10064 10064
 		if ($result) {
10065
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
10065
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
10066 10066
 			if ($useempty) {
10067 10067
 				print '<option value="-1">&nbsp;</option>';
10068 10068
 			}
@@ -10072,9 +10072,9 @@  discard block
 block discarded – undo
10072 10072
 			while ($i < $num) {
10073 10073
 				$obj = $this->db->fetch_object($result);
10074 10074
 				if ($selected == $obj->rowid) {
10075
-					print '<option value="' . $obj->rowid . '" selected>';
10075
+					print '<option value="'.$obj->rowid.'" selected>';
10076 10076
 				} else {
10077
-					print '<option value="' . $obj->rowid . '">';
10077
+					print '<option value="'.$obj->rowid.'">';
10078 10078
 				}
10079 10079
 				print $obj->label;
10080 10080
 				print '</option>';
@@ -10165,8 +10165,8 @@  discard block
 block discarded – undo
10165 10165
 				$stringforfirstkey .= ' CTL +';
10166 10166
 			}
10167 10167
 
10168
-			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
10169
-			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
10168
+			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
10169
+			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
10170 10170
 		}
10171 10171
 
10172 10172
 		//print "xx".$previous_ref."x".$next_ref;
@@ -10174,18 +10174,18 @@  discard block
 block discarded – undo
10174 10174
 
10175 10175
 		// Right part of banner
10176 10176
 		if ($morehtmlright) {
10177
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
10177
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
10178 10178
 		}
10179 10179
 
10180 10180
 		if ($previous_ref || $next_ref || $morehtml) {
10181 10181
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
10182 10182
 		}
10183 10183
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
10184
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
10184
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
10185 10185
 		}
10186 10186
 		if ($shownav && ($previous_ref || $next_ref)) {
10187
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
10188
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
10187
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
10188
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
10189 10189
 		}
10190 10190
 		if ($previous_ref || $next_ref || $morehtml) {
10191 10191
 			$ret .= '</ul></div>';
@@ -10200,7 +10200,7 @@  discard block
 block discarded – undo
10200 10200
 			$morehtmlstatus = $hookmanager->resPrint;
10201 10201
 		}
10202 10202
 		if ($morehtmlstatus) {
10203
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
10203
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
10204 10204
 		}
10205 10205
 
10206 10206
 		$parameters = array();
@@ -10214,14 +10214,14 @@  discard block
 block discarded – undo
10214 10214
 		// Left part of banner
10215 10215
 		if ($morehtmlleft) {
10216 10216
 			if ($conf->browser->layout == 'phone') {
10217
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
10217
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
10218 10218
 			} else {
10219
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
10219
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
10220 10220
 			}
10221 10221
 		}
10222 10222
 
10223 10223
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
10224
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
10224
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
10225 10225
 
10226 10226
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
10227 10227
 		if ($object->element == 'societe') {
@@ -10235,7 +10235,7 @@  discard block
 block discarded – undo
10235 10235
 
10236 10236
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
10237 10237
 				if (!is_object($extralanguages)) {
10238
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
10238
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
10239 10239
 					$extralanguages = new ExtraLanguages($this->db);
10240 10240
 				}
10241 10241
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -10250,21 +10250,21 @@  discard block
 block discarded – undo
10250 10250
 						if ($object->array_languages['name'][$extralangcode]) {
10251 10251
 							$htmltext .= $object->array_languages['name'][$extralangcode];
10252 10252
 						} else {
10253
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
10253
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
10254 10254
 						}
10255 10255
 					}
10256
-					$ret .= '<!-- Show translations of name -->' . "\n";
10256
+					$ret .= '<!-- Show translations of name -->'."\n";
10257 10257
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
10258 10258
 				}
10259 10259
 			}
10260 10260
 		} elseif ($object->element == 'member') {
10261 10261
 			'@phan-var-force Adherent $object';
10262
-			$ret .= $object->ref . '<br>';
10262
+			$ret .= $object->ref.'<br>';
10263 10263
 			$fullname = $object->getFullName($langs);
10264 10264
 			if ($object->morphy == 'mor' && $object->societe) {
10265
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
10265
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
10266 10266
 			} else {
10267
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
10267
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
10268 10268
 			}
10269 10269
 		} elseif (in_array($object->element, array('contact', 'user'))) {
10270 10270
 			$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt;
@@ -10272,7 +10272,7 @@  discard block
 block discarded – undo
10272 10272
 			$ret .= dol_htmlentities($object->name);
10273 10273
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
10274 10274
 			'@phan-var-force ActionComm $object';
10275
-			$ret .= $object->ref . '<br>' . $object->label;
10275
+			$ret .= $object->ref.'<br>'.$object->label;
10276 10276
 		} elseif (in_array($object->element, array('adherent_type'))) {
10277 10277
 			$ret .= $object->label;
10278 10278
 		} elseif ($object->element == 'ecm_directories') {
@@ -10325,9 +10325,9 @@  discard block
 block discarded – undo
10325 10325
 		}
10326 10326
 
10327 10327
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10328
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10329
-		$out = '<!-- url barcode = ' . $url . ' -->';
10330
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10328
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10329
+		$out = '<!-- url barcode = '.$url.' -->';
10330
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10331 10331
 
10332 10332
 		return $out;
10333 10333
 	}
@@ -10354,7 +10354,7 @@  discard block
 block discarded – undo
10354 10354
 		global $conf, $langs;
10355 10355
 
10356 10356
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10357
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10357
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10358 10358
 
10359 10359
 		$dir = '';
10360 10360
 		$file = '';
@@ -10367,28 +10367,28 @@  discard block
 block discarded – undo
10367 10367
 			if (!empty($object->logo)) {
10368 10368
 				if (dolIsAllowedForPreview($object->logo)) {
10369 10369
 					if ((string) $imagesize == 'mini') {
10370
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10370
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10371 10371
 					} elseif ((string) $imagesize == 'small') {
10372
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10372
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10373 10373
 					} else {
10374
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10374
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10375 10375
 					}
10376
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10376
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10377 10377
 				}
10378 10378
 			}
10379 10379
 			$email = $object->email;
10380 10380
 		} elseif ($modulepart == 'contact') {
10381
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10381
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10382 10382
 			if (!empty($object->photo)) {
10383 10383
 				if (dolIsAllowedForPreview($object->photo)) {
10384 10384
 					if ((string) $imagesize == 'mini') {
10385
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10385
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10386 10386
 					} elseif ((string) $imagesize == 'small') {
10387
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10387
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10388 10388
 					} else {
10389
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10389
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10390 10390
 					}
10391
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10391
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10392 10392
 				}
10393 10393
 			}
10394 10394
 			$email = $object->email;
@@ -10398,17 +10398,17 @@  discard block
 block discarded – undo
10398 10398
 			if (!empty($object->photo)) {
10399 10399
 				if (dolIsAllowedForPreview($object->photo)) {
10400 10400
 					if ((string) $imagesize == 'mini') {
10401
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10401
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10402 10402
 					} elseif ((string) $imagesize == 'small') {
10403
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10403
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10404 10404
 					} else {
10405
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10405
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10406 10406
 					}
10407
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10407
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10408 10408
 				}
10409 10409
 			}
10410 10410
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10411
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10411
+				$altfile = $object->id.".jpg"; // For backward compatibility
10412 10412
 			}
10413 10413
 			$email = $object->email;
10414 10414
 			$capture = 'user';
@@ -10417,17 +10417,17 @@  discard block
 block discarded – undo
10417 10417
 			if (!empty($object->photo)) {
10418 10418
 				if (dolIsAllowedForPreview($object->photo)) {
10419 10419
 					if ((string) $imagesize == 'mini') {
10420
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10420
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10421 10421
 					} elseif ((string) $imagesize == 'small') {
10422
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10422
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10423 10423
 					} else {
10424
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10424
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10425 10425
 					}
10426
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10426
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10427 10427
 				}
10428 10428
 			}
10429 10429
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10430
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10430
+				$altfile = $object->id.".jpg"; // For backward compatibility
10431 10431
 			}
10432 10432
 			$email = $object->email;
10433 10433
 			$capture = 'user';
@@ -10453,35 +10453,35 @@  discard block
 block discarded – undo
10453 10453
 		$ret = '';
10454 10454
 
10455 10455
 		if ($dir) {
10456
-			if ($file && file_exists($dir . "/" . $file)) {
10456
+			if ($file && file_exists($dir."/".$file)) {
10457 10457
 				if ($addlinktofullsize) {
10458
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10458
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10459 10459
 					if ($urladvanced) {
10460
-						$ret .= '<a href="' . $urladvanced . '">';
10460
+						$ret .= '<a href="'.$urladvanced.'">';
10461 10461
 					} else {
10462
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10462
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10463 10463
 					}
10464 10464
 				}
10465
-				$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
10465
+				$ret .= '<img alt="" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
10466 10466
 				if ($addlinktofullsize) {
10467 10467
 					$ret .= '</a>';
10468 10468
 				}
10469
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10469
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10470 10470
 				if ($addlinktofullsize) {
10471
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10471
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10472 10472
 					if ($urladvanced) {
10473
-						$ret .= '<a href="' . $urladvanced . '">';
10473
+						$ret .= '<a href="'.$urladvanced.'">';
10474 10474
 					} else {
10475
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10475
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10476 10476
 					}
10477 10477
 				}
10478
-				$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="Photo alt" id="photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" class="' . $cssclass . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($altfile) . '&cache=' . $cache . '">';
10478
+				$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" class="'.$cssclass.'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
10479 10479
 				if ($addlinktofullsize) {
10480 10480
 					$ret .= '</a>';
10481 10481
 				}
10482 10482
 			} else {
10483 10483
 				$nophoto = '/public/theme/common/nophoto.png';
10484
-				$defaultimg = 'identicon';        // For gravatar
10484
+				$defaultimg = 'identicon'; // For gravatar
10485 10485
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10486 10486
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10487 10487
 						$nophoto = 'company';
@@ -10499,13 +10499,13 @@  discard block
 block discarded – undo
10499 10499
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10500 10500
 					// see https://gravatar.com/site/implement/images/php/
10501 10501
 					$ret .= '<!-- Put link to gravatar -->';
10502
-					$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
10502
+					$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 'sha256', 1).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
10503 10503
 				} else {
10504 10504
 					if ($nophoto == 'company') {
10505
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10505
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10506 10506
 						//$ret .= '<div class="difforspanimgright"></div>';
10507 10507
 					} else {
10508
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10508
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10509 10509
 					}
10510 10510
 				}
10511 10511
 			}
@@ -10516,15 +10516,15 @@  discard block
 block discarded – undo
10516 10516
 				}
10517 10517
 				$ret .= '<table class="nobordernopadding centpercent">';
10518 10518
 				if ($object->photo) {
10519
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10519
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10520 10520
 				}
10521 10521
 				$ret .= '<tr><td class="tdoverflow">';
10522 10522
 				$maxfilesizearray = getMaxFileSizeArray();
10523 10523
 				$maxmin = $maxfilesizearray['maxmin'];
10524 10524
 				if ($maxmin > 0) {
10525
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10525
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10526 10526
 				}
10527
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10527
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10528 10528
 				$ret .= '</td></tr>';
10529 10529
 				$ret .= '</table>';
10530 10530
 			}
@@ -10578,38 +10578,38 @@  discard block
 block discarded – undo
10578 10578
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10579 10579
 			$sql .= ", e.label";
10580 10580
 		}
10581
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10581
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10582 10582
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10583
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10583
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10584 10584
 			if ($force_entity) {
10585
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10585
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10586 10586
 			} else {
10587 10587
 				$sql .= " WHERE ug.entity IS NOT NULL";
10588 10588
 			}
10589 10589
 		} else {
10590
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10590
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10591 10591
 		}
10592 10592
 		if (is_array($exclude) && $excludeGroups) {
10593
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10593
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10594 10594
 		}
10595 10595
 		if (is_array($include) && $includeGroups) {
10596
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10596
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10597 10597
 		}
10598 10598
 		$sql .= " ORDER BY ug.nom ASC";
10599 10599
 
10600
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10600
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10601 10601
 		$resql = $this->db->query($sql);
10602 10602
 		if ($resql) {
10603 10603
 			// Enhance with select2
10604
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10604
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10605 10605
 
10606
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10606
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10607 10607
 
10608 10608
 			$num = $this->db->num_rows($resql);
10609 10609
 			$i = 0;
10610 10610
 			if ($num) {
10611 10611
 				if ($show_empty && !$multiple) {
10612
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10612
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10613 10613
 				}
10614 10614
 
10615 10615
 				while ($i < $num) {
@@ -10622,11 +10622,11 @@  discard block
 block discarded – undo
10622 10622
 					$label = $obj->name;
10623 10623
 					$labelhtml = $obj->name;
10624 10624
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10625
-						$label .= " (" . $obj->label . ")";
10626
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10625
+						$label .= " (".$obj->label.")";
10626
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10627 10627
 					}
10628 10628
 
10629
-					$out .= '<option value="' . $obj->rowid . '"';
10629
+					$out .= '<option value="'.$obj->rowid.'"';
10630 10630
 					if ($disableline) {
10631 10631
 						$out .= ' disabled';
10632 10632
 					}
@@ -10642,9 +10642,9 @@  discard block
 block discarded – undo
10642 10642
 				}
10643 10643
 			} else {
10644 10644
 				if ($show_empty) {
10645
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10645
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10646 10646
 				}
10647
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10647
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10648 10648
 			}
10649 10649
 			$out .= '</select>';
10650 10650
 
@@ -10688,25 +10688,25 @@  discard block
 block discarded – undo
10688 10688
 		$out = '';
10689 10689
 
10690 10690
 		if (!empty($conf->use_javascript_ajax)) {
10691
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10691
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10692 10692
 		}
10693
-		$out .= '<script nonce="' . getNonce() . '">
10693
+		$out .= '<script nonce="'.getNonce().'">
10694 10694
             $(document).ready(function() {
10695
-                $("#' . $cssclass . 's").click(function() {
10695
+                $("#' . $cssclass.'s").click(function() {
10696 10696
                     if($(this).is(\':checked\')){
10697
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10698
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10697
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10698
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10699 10699
                     }
10700 10700
                     else
10701 10701
                     {
10702 10702
                         console.log("We uncheck all");
10703
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10703
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10704 10704
                     }' . "\n";
10705 10705
 		if ($calljsfunction) {
10706
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10706
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10707 10707
 		}
10708 10708
 		$out .= '         });
10709
-        	        $(".' . $cssclass . '").change(function() {
10709
+        	        $(".' . $cssclass.'").change(function() {
10710 10710
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10711 10711
 				});
10712 10712
 		 	});
@@ -10751,67 +10751,67 @@  discard block
 block discarded – undo
10751 10751
 		global $langs, $user;
10752 10752
 
10753 10753
 		$out = '';
10754
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10755
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10754
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10755
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10756 10756
 		if (!empty($excludeid)) {
10757
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10757
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10758 10758
 		}
10759 10759
 		$sql .= " ORDER BY label";
10760 10760
 
10761 10761
 		$resql = $this->db->query($sql);
10762 10762
 		if ($resql) {
10763
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10763
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10764 10764
 			if ($useempty) {
10765 10765
 				$out .= '<option value="0">&nbsp;</option>';
10766 10766
 			}
10767 10767
 
10768 10768
 			while ($obj = $this->db->fetch_object($resql)) {
10769
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10769
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10770 10770
 			}
10771 10771
 			$out .= '</select>';
10772
-			$out .= ajax_combobox('select_' . $htmlname);
10772
+			$out .= ajax_combobox('select_'.$htmlname);
10773 10773
 
10774 10774
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10775
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10775
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10776 10776
 			}
10777 10777
 
10778 10778
 			if (!empty($target)) {
10779
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10779
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10780 10780
 				$resql = $this->db->query($sql);
10781 10781
 				if ($resql) {
10782 10782
 					if ($this->db->num_rows($resql) > 0) {
10783 10783
 						$obj = $this->db->fetch_object($resql);
10784
-						$out .= '<script nonce="' . getNonce() . '">
10784
+						$out .= '<script nonce="'.getNonce().'">
10785 10785
 							$(function() {
10786
-								$("select[name=' . $target . ']").on("change", function() {
10786
+								$("select[name=' . $target.']").on("change", function() {
10787 10787
 									var current_val = $(this).val();
10788
-									if (current_val == ' . $obj->id . ') {';
10788
+									if (current_val == ' . $obj->id.') {';
10789 10789
 						if (!empty($default_selected) || !empty($selected)) {
10790
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10790
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10791 10791
 						}
10792 10792
 
10793 10793
 						$out .= '
10794
-										$("select[name=' . $htmlname . ']").change();
10794
+										$("select[name=' . $htmlname.']").change();
10795 10795
 									}
10796 10796
 								});
10797 10797
 
10798
-								$("select[name=' . $htmlname . ']").change(function() {
10798
+								$("select[name=' . $htmlname.']").change(function() {
10799 10799
 
10800
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10800
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10801 10801
 										// get price of kilometer to fill the unit price
10802 10802
 										$.ajax({
10803 10803
 											method: "POST",
10804 10804
 											dataType: "json",
10805
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10806
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10805
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10806
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10807 10807
 										}).done(function( data, textStatus, jqXHR ) {
10808 10808
 											console.log(data);
10809 10809
 											if (typeof data.up != "undefined") {
10810 10810
 												$("input[name=value_unit]").val(data.up);
10811
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10811
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10812 10812
 											} else {
10813 10813
 												$("input[name=value_unit]").val("");
10814
-												$("select[name=' . $htmlname . ']").attr("title", "");
10814
+												$("select[name=' . $htmlname.']").attr("title", "");
10815 10815
 											}
10816 10816
 										});
10817 10817
 									}
@@ -10841,18 +10841,18 @@  discard block
 block discarded – undo
10841 10841
 		global $conf, $langs;
10842 10842
 
10843 10843
 		$out = '';
10844
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10845
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10844
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10845
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10846 10846
 
10847 10847
 		$resql = $this->db->query($sql);
10848 10848
 		if ($resql) {
10849
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10849
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10850 10850
 			if ($useempty) {
10851 10851
 				$out .= '<option value="0"></option>';
10852 10852
 			}
10853 10853
 
10854 10854
 			while ($obj = $this->db->fetch_object($resql)) {
10855
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10855
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10856 10856
 			}
10857 10857
 			$out .= '</select>';
10858 10858
 		} else {
@@ -10883,12 +10883,12 @@  discard block
 block discarded – undo
10883 10883
 
10884 10884
 		$resql = $this->db->query($sql);
10885 10885
 		if ($resql) {
10886
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10886
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10887 10887
 			if ($useempty) {
10888 10888
 				$out .= '<option value="0"></option>';
10889 10889
 			}
10890 10890
 			if ($allchoice) {
10891
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10891
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10892 10892
 			}
10893 10893
 
10894 10894
 			$field = 'code';
@@ -10898,7 +10898,7 @@  discard block
 block discarded – undo
10898 10898
 
10899 10899
 			while ($obj = $this->db->fetch_object($resql)) {
10900 10900
 				$key = $langs->trans($obj->code);
10901
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10901
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10902 10902
 			}
10903 10903
 			$out .= '</select>';
10904 10904
 
@@ -10932,7 +10932,7 @@  discard block
 block discarded – undo
10932 10932
 	{
10933 10933
 		global $user, $conf, $langs;
10934 10934
 
10935
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10935
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10936 10936
 
10937 10937
 		if (is_null($usertofilter)) {
10938 10938
 			$usertofilter = $user;
@@ -10956,10 +10956,10 @@  discard block
 block discarded – undo
10956 10956
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10957 10957
             p.title, p.fk_soc, p.fk_statut, p.public,";
10958 10958
 		$sql .= ' s.nom as name';
10959
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10960
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10961
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10962
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10959
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10960
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10961
+		$sql .= ' '.$this->db->prefix().'facture as f';
10962
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10963 10963
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10964 10964
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10965 10965
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10970,14 +10970,14 @@  discard block
 block discarded – undo
10970 10970
 		if ($resql) {
10971 10971
 			// Use select2 selector
10972 10972
 			if (!empty($conf->use_javascript_ajax)) {
10973
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10973
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10974 10974
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10975 10975
 				$out .= $comboenhancement;
10976 10976
 				$morecss = 'minwidth200imp maxwidth500';
10977 10977
 			}
10978 10978
 
10979 10979
 			if (empty($option_only)) {
10980
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10980
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10981 10981
 			}
10982 10982
 			if (!empty($show_empty)) {
10983 10983
 				$out .= '<option value="0" class="optiongrey">';
@@ -11007,33 +11007,33 @@  discard block
 block discarded – undo
11007 11007
 						if ($showproject == 'all') {
11008 11008
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
11009 11009
 							if ($obj->name) {
11010
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
11010
+								$labeltoshow .= ' - '.$obj->name; // Soc name
11011 11011
 							}
11012 11012
 
11013 11013
 							$disabled = 0;
11014 11014
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
11015 11015
 								$disabled = 1;
11016
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
11016
+								$labeltoshow .= ' - '.$langs->trans("Draft");
11017 11017
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
11018 11018
 								if ($discard_closed == 2) {
11019 11019
 									$disabled = 1;
11020 11020
 								}
11021
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
11021
+								$labeltoshow .= ' - '.$langs->trans("Closed");
11022 11022
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
11023 11023
 								$disabled = 1;
11024
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
11024
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
11025 11025
 							}
11026 11026
 						}
11027 11027
 
11028 11028
 						if (!empty($selected) && $selected == $obj->rowid) {
11029
-							$out .= '<option value="' . $obj->rowid . '" selected';
11029
+							$out .= '<option value="'.$obj->rowid.'" selected';
11030 11030
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11031
-							$out .= '>' . $labeltoshow . '</option>';
11031
+							$out .= '>'.$labeltoshow.'</option>';
11032 11032
 						} else {
11033 11033
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
11034 11034
 								$resultat = '';
11035 11035
 							} else {
11036
-								$resultat = '<option value="' . $obj->rowid . '"';
11036
+								$resultat = '<option value="'.$obj->rowid.'"';
11037 11037
 								if ($disabled) {
11038 11038
 									$resultat .= ' disabled';
11039 11039
 								}
@@ -11085,22 +11085,22 @@  discard block
 block discarded – undo
11085 11085
 
11086 11086
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
11087 11087
 		//$sql.= ', el.fk_source';
11088
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
11089
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
11088
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
11089
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
11090 11090
 		$sql .= " ORDER BY f.titre ASC";
11091 11091
 
11092 11092
 		$resql = $this->db->query($sql);
11093 11093
 		if ($resql) {
11094 11094
 			// Use select2 selector
11095 11095
 			if (!empty($conf->use_javascript_ajax)) {
11096
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11096
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11097 11097
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11098 11098
 				$out .= $comboenhancement;
11099 11099
 				$morecss = 'minwidth200imp maxwidth500';
11100 11100
 			}
11101 11101
 
11102 11102
 			if (empty($option_only)) {
11103
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11103
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11104 11104
 			}
11105 11105
 			if (!empty($show_empty)) {
11106 11106
 				$out .= '<option value="0" class="optiongrey">';
@@ -11119,19 +11119,19 @@  discard block
 block discarded – undo
11119 11119
 					$disabled = 0;
11120 11120
 					if (!empty($obj->suspended)) {
11121 11121
 						$disabled = 1;
11122
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
11122
+						$labeltoshow .= ' - '.$langs->trans("Closed");
11123 11123
 					}
11124 11124
 
11125 11125
 
11126 11126
 					if (!empty($selected) && $selected == $obj->rowid) {
11127
-						$out .= '<option value="' . $obj->rowid . '" selected';
11127
+						$out .= '<option value="'.$obj->rowid.'" selected';
11128 11128
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11129
-						$out .= '>' . $labeltoshow . '</option>';
11129
+						$out .= '>'.$labeltoshow.'</option>';
11130 11130
 					} else {
11131 11131
 						if ($disabled && ($selected != $obj->rowid)) {
11132 11132
 							$resultat = '';
11133 11133
 						} else {
11134
-							$resultat = '<option value="' . $obj->rowid . '"';
11134
+							$resultat = '<option value="'.$obj->rowid.'"';
11135 11135
 							if ($disabled) {
11136 11136
 								$resultat .= ' disabled';
11137 11137
 							}
@@ -11176,14 +11176,14 @@  discard block
 block discarded – undo
11176 11176
 		$formother = new FormOther($this->db);
11177 11177
 
11178 11178
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
11179
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
11179
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
11180 11180
 		}
11181 11181
 
11182 11182
 		$ret = '';
11183 11183
 
11184 11184
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
11185 11185
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
11186
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
11186
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
11187 11187
 		$ret .= '</a>';
11188 11188
 
11189 11189
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -11227,30 +11227,30 @@  discard block
 block discarded – undo
11227 11227
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
11228 11228
 		}
11229 11229
 		$ret .= "<!-- We store the full Universal Search String into this field. For example: (t.ref:like:'SO-%') AND ((t.ref:like:'CO-%') OR (t.ref:like:'AA%')) -->";
11230
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
11230
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
11231 11231
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
11232 11232
 
11233 11233
 		// TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias
11234 11234
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
11235 11235
 		foreach ($arrayofcriterias as $criteria) {
11236 11236
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
11237
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11237
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11238 11238
 					continue;
11239 11239
 				}
11240 11240
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
11241 11241
 					continue;
11242 11242
 				}
11243 11243
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
11244
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
11245
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
11246
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
11247
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
11248
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
11249
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
11250
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
11251
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
11244
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
11245
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
11246
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
11247
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
11248
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
11249
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
11250
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
11251
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
11252 11252
 				} else {
11253
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
11253
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
11254 11254
 				}
11255 11255
 			}
11256 11256
 		}
@@ -11258,7 +11258,7 @@  discard block
 block discarded – undo
11258 11258
 		$ret .= '</div>';
11259 11259
 
11260 11260
 		$ret .= "<!-- Field to enter a generic filter string: t.ref:like:'SO-%', t.date_creation:<:'20160101', t.date_creation:<:'2016-01-01 12:30:00', t.nature:is:NULL, t.field2:isnot:NULL -->\n";
11261
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11261
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11262 11262
 
11263 11263
 		$ret .= '</div>';
11264 11264
 		$ret .= '</div>';
@@ -11322,9 +11322,9 @@  discard block
 block discarded – undo
11322 11322
 		$ret .= '<div class="search-component-assistance">';
11323 11323
 		$ret .= '<div>';
11324 11324
 
11325
-		$ret .= '<p class="assistance-title">' . img_picto('', 'filter') . ' ' . $langs->trans('FilterAssistance') . ' </p>';
11325
+		$ret .= '<p class="assistance-title">'.img_picto('', 'filter').' '.$langs->trans('FilterAssistance').' </p>';
11326 11326
 
11327
-		$ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>';
11327
+		$ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>';
11328 11328
 
11329 11329
 		$ret .= '<div class="operand">';
11330 11330
 		$ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'width250', 1);
@@ -11338,7 +11338,7 @@  discard block
 block discarded – undo
11338 11338
 		$ret .= '</select>';
11339 11339
 		$ret .= '<script>$(document).ready(function() {';
11340 11340
 		$ret .= '   $(".operator-selector").select2({';
11341
-		$ret .= '       placeholder: \'' . dol_escape_js($langs->trans('Operator')) . '\'';
11341
+		$ret .= '       placeholder: \''.dol_escape_js($langs->trans('Operator')).'\'';
11342 11342
 		$ret .= '   });';
11343 11343
 		$ret .= '});</script>';
11344 11344
 		$ret .= '</div>';
@@ -11347,18 +11347,18 @@  discard block
 block discarded – undo
11347 11347
 
11348 11348
 		$ret .= '<div class="value">';
11349 11349
 		// Input field for entering values
11350
-		$ret .= '<input type="text" class="flat width100 value-input" placeholder="' . dolPrintHTML($langs->trans('Value')) . '">';
11350
+		$ret .= '<input type="text" class="flat width100 value-input" placeholder="'.dolPrintHTML($langs->trans('Value')).'">';
11351 11351
 
11352 11352
 		// Date selector
11353 11353
 		$dateOne = '';
11354 11354
 		$ret .= '<span class="date-one" style="display:none">';
11355
-		$ret .=  $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11355
+		$ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11356 11356
 		$ret .= '</span>';
11357 11357
 
11358 11358
 		$ret .= '</div>';
11359 11359
 
11360 11360
 		$ret .= '<div class="btn-div">';
11361
-		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>';
11361
+		$ret .= '<button class="button buttongen button-save add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>';
11362 11362
 		$ret .= '</div>';
11363 11363
 
11364 11364
 		$ret .= '</div>';
@@ -11469,7 +11469,7 @@  discard block
 block discarded – undo
11469 11469
 
11470 11470
 		$TModels = array();
11471 11471
 
11472
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11472
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11473 11473
 		$formmail = new FormMail($this->db);
11474 11474
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11475 11475
 
@@ -11482,20 +11482,20 @@  discard block
 block discarded – undo
11482 11482
 			}
11483 11483
 		}
11484 11484
 
11485
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11485
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11486 11486
 
11487 11487
 		foreach ($TModels as $id_model => $label_model) {
11488
-			$retstring .= '<option value="' . $id_model . '"';
11488
+			$retstring .= '<option value="'.$id_model.'"';
11489 11489
 			if (!empty($selected) && $selected == $id_model) {
11490 11490
 				$retstring .= "selected";
11491 11491
 			}
11492
-			$retstring .= ">" . $label_model . "</option>";
11492
+			$retstring .= ">".$label_model."</option>";
11493 11493
 		}
11494 11494
 
11495 11495
 		$retstring .= "</select>";
11496 11496
 
11497 11497
 		if ($addjscombo) {
11498
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11498
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11499 11499
 		}
11500 11500
 
11501 11501
 		return $retstring;
@@ -11546,16 +11546,16 @@  discard block
 block discarded – undo
11546 11546
 
11547 11547
 		foreach ($buttons as $button) {
11548 11548
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11549
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
11549
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
11550 11550
 		}
11551 11551
 		$retstring .= $withoutdiv ? '' : '</div>';
11552 11552
 
11553 11553
 		if ($dol_openinpopup) {
11554
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n";
11555
-			$retstring .= '<script nonce="' . getNonce() . '">';
11554
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n";
11555
+			$retstring .= '<script nonce="'.getNonce().'">';
11556 11556
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11557
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\');
11558
-				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\');
11557
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\');
11558
+				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\');
11559 11559
 				 });';
11560 11560
 			$retstring .= '</script>';
11561 11561
 		}
@@ -11584,7 +11584,7 @@  discard block
 block discarded – undo
11584 11584
 		dol_syslog(__METHOD__, LOG_DEBUG);
11585 11585
 
11586 11586
 		$sql = "SELECT rowid, code, label as label";
11587
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11587
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11588 11588
 		$sql .= " WHERE active = 1";
11589 11589
 
11590 11590
 		$resql = $this->db->query($sql);
@@ -11595,7 +11595,7 @@  discard block
 block discarded – undo
11595 11595
 				$obj = $this->db->fetch_object($resql);
11596 11596
 
11597 11597
 				// If translation exists, we use it, otherwise we take the default wording
11598
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11598
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11599 11599
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11600 11600
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11601 11601
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11627,18 +11627,18 @@  discard block
 block discarded – undo
11627 11627
 		global $langs, $user;
11628 11628
 
11629 11629
 		$out = '';
11630
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11630
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11631 11631
 
11632 11632
 		$this->load_cache_invoice_subtype();
11633 11633
 
11634
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11634
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11635 11635
 		if ($addempty) {
11636 11636
 			$out .= '<option value="0">&nbsp;</option>';
11637 11637
 		}
11638 11638
 
11639 11639
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11640 11640
 			$label = $subtype['label'];
11641
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11641
+			$out .= '<option value="'.$subtype['rowid'].'"';
11642 11642
 			if ($selected == $subtype['rowid']) {
11643 11643
 				$out .= ' selected="selected"';
11644 11644
 			}
Please login to merge, or discard this patch.