Completed
Branch develop (29f223)
by
unknown
19:41
created
htdocs/public/payment/newpayment.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 	if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
306 306
 		if ($tmpsource && $REF) {
307 307
 			// Use the source in the hash to avoid duplicates if the references are identical
308
-			$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $tmpsource.$REF, $SECUREKEY, '2');
308
+			$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$tmpsource.$REF, $SECUREKEY, '2');
309 309
 			// Do a second test for retro-compatibility (token may have been hashed with membersubscription in external module)
310 310
 			if ($tmpsource != $source) {
311
-				$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $source.$REF, $SECUREKEY, '2');
311
+				$tokenisok = dol_verifyHash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$source.$REF, $SECUREKEY, '2');
312 312
 			}
313 313
 		} else {
314 314
 			$tokenisok = dol_verifyHash($conf->global->PAYMENT_SECURITY_TOKEN, $SECUREKEY, '2');
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$tokenisok = ($conf->global->PAYMENT_SECURITY_TOKEN == $SECUREKEY);
318 318
 	}
319 319
 
320
-	if (! $tokenisok) {
320
+	if (!$tokenisok) {
321 321
 		if (!getDolGlobalString('PAYMENT_SECURITY_ACCEPT_ANY_TOKEN')) {
322 322
 			$valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility
323 323
 		} else {
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 $paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
347 347
 $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
348 348
 if (getDolGlobalString($paramcreditorlong)) {
349
-	$creditor = getDolGlobalString($paramcreditorlong);	// use label long of the seller to show
349
+	$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
350 350
 } elseif (getDolGlobalString($paramcreditor)) {
351
-	$creditor = getDolGlobalString($paramcreditor);		// use label short of the seller to show
351
+	$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
352 352
 }
353 353
 
354 354
 $mesg = '';
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 	$remoteip = getUserRemoteIP();
797 797
 
798 798
 	$_SESSION["onlinetoken"] = $stripeToken;
799
-	$_SESSION["FinalPaymentAmt"] = $amount;			// amount really paid (coming from Stripe). Will be used for check in paymentok.php.
800
-	$_SESSION["currencyCodeType"] = $currency;		// currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
799
+	$_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php.
800
+	$_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
801 801
 	$_SESSION["paymentType"] = '';
802 802
 	$_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip
803 803
 	$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 
844 844
 $head = '';
845 845
 if (getDolGlobalString('ONLINE_PAYMENT_CSS_URL')) {
846
-	$head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n";
846
+	$head = '<link rel="stylesheet" type="text/css" href="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'?lang='.(!empty($getpostlang) ? $getpostlang : $langs->defaultlang).'">'."\n";
847 847
 }
848 848
 
849 849
 $conf->dol_hide_topmenu = 1;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 	if (preg_match('/^\((.*)\)$/', $conf->global->PAYMENT_NEWFORM_TEXT, $reg)) {
969 969
 		$text .= $langs->trans($reg[1])."<br>\n";
970 970
 	} else {
971
-		$text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT') . "<br>\n";
971
+		$text .= getDolGlobalString('PAYMENT_NEWFORM_TEXT')."<br>\n";
972 972
 	}
973 973
 	$text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
974 974
 }
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
 print $text;
980 980
 
981 981
 // Output payment summary form
982
-print '<tr><td align="center">';	// class=center does not have the payment button centered so we keep align here.
982
+print '<tr><td align="center">'; // class=center does not have the payment button centered so we keep align here.
983 983
 print '<table class="centpercent left" id="tablepublicpayment">';
984 984
 print '<tr class="hideonsmartphone"><td colspan="2" align="left" class="opacitymedium">'.$langs->trans("ThisIsInformationOnPayment").' :</td></tr>'."\n";
985 985
 
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 		// Currency
1020 1020
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1021 1021
 	} else {
1022
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1022
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1023 1023
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1024 1024
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1025 1025
 	}
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 		// Currency
1121 1121
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1122 1122
 	} else {
1123
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1123
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1124 1124
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1125 1125
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1126 1126
 	}
@@ -1252,12 +1252,12 @@  discard block
 block discarded – undo
1252 1252
 			print '<input class="flat maxwidth75" type="text" name="newamount" value="'.price2num(GETPOST("newamount", "alpha"), 'MT').'">';
1253 1253
 			print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1254 1254
 		} else {
1255
-			print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1255
+			print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1256 1256
 			print '<input type="hidden" name="amount" value="'.$amount.'">';
1257 1257
 			print '<input type="hidden" name="newamount" value="'.$amount.'">';
1258 1258
 		}
1259 1259
 	} else {
1260
-		print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1260
+		print '<b class="amount">'.price($object->total_ttc, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1261 1261
 	}
1262 1262
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
1263 1263
 	print '</td></tr>'."\n";
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 		// Currency
1462 1462
 		print ' <b>'.$langs->trans("Currency".$currency).'</b>';
1463 1463
 	} else {
1464
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1464
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1465 1465
 		print '<input type="hidden" name="amount" value="'.$amount.'">';
1466 1466
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1467 1467
 	}
@@ -1663,7 +1663,7 @@  discard block
 block discarded – undo
1663 1663
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
1664 1664
 	// This place no longer allows amount edition
1665 1665
 	if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
1666
-		print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1666
+		print ' - <a href="'.getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1667 1667
 	}
1668 1668
 	print '</td><td class="CTableRow2">';
1669 1669
 	if (getDolGlobalString('MEMBER_MIN_AMOUNT') && $amount) {
@@ -1679,9 +1679,9 @@  discard block
 block discarded – undo
1679 1679
 			print '<input type="text" class="width75" name="newamount" value="'.price($amount, 1, $langs, 1, -1, -1).'">';
1680 1680
 		}
1681 1681
 	} else {
1682
-		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1682
+		print '<b class="amount">'.price($amount, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1683 1683
 		if ($minimumamount > $amount) {
1684
-			print ' &nbsp; <span class="opacitymedium small">'. $langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>';
1684
+			print ' &nbsp; <span class="opacitymedium small">'.$langs->trans("AmountIsLowerToMinimumNotice", price($minimumamount, 1, $langs, 1, -1, -1, $currency)).'</span>';
1685 1685
 		}
1686 1686
 		print '<input type="hidden" name="newamount" value="'.$amount.'">';
1687 1687
 	}
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 			print ' ('.$langs->trans("ToComplete");
1803 1803
 		}
1804 1804
 		if (getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO')) {
1805
-			print ' - <a href="' . getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1805
+			print ' - <a href="'.getDolGlobalString('DONATION_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
1806 1806
 		}
1807 1807
 		if (!getDolGlobalString('DONATION_NEWFORM_AMOUNT')) {
1808 1808
 			print ')';
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 			$valtoshow = max(getDolGlobalString('DONATION_MIN_AMOUNT'), $valtoshow);
1841 1841
 			$amount = $valtoshow;
1842 1842
 		}
1843
-		print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1843
+		print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1844 1844
 		print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
1845 1845
 		print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
1846 1846
 	}
@@ -1916,7 +1916,7 @@  discard block
 block discarded – undo
1916 1916
 	print '</b>';
1917 1917
 	print '</td></tr>'."\n";
1918 1918
 
1919
-	if (! is_object($attendee->project)) {
1919
+	if (!is_object($attendee->project)) {
1920 1920
 		$text = 'ErrorProjectNotFound';
1921 1921
 	} else {
1922 1922
 		$text = $langs->trans("PaymentEvent").' - '.$attendee->project->title;
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
1934 1934
 	print '</td><td class="CTableRow2">';
1935 1935
 	$valtoshow = $amount;
1936
-	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
1936
+	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
1937 1937
 	print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
1938 1938
 	print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
1939 1939
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
 	print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
2018 2018
 	print '</td><td class="CTableRow2">';
2019 2019
 	$valtoshow = $amount;
2020
-	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>';	// Price with currency
2020
+	print '<b class="amount">'.price($valtoshow, 1, $langs, 1, -1, -1, $currency).'</b>'; // Price with currency
2021 2021
 	print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
2022 2022
 	print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
2023 2023
 	print '<input type="hidden" name="currency" value="'.$currency.'">';
@@ -2268,7 +2268,7 @@  discard block
 block discarded – undo
2268 2268
 
2269 2269
 		//print '<br>';
2270 2270
 
2271
-		print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = ' . getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = ' . getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n";
2271
+		print '<!-- Show Stripe form payment-form STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = '.getDolGlobalString('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION').' STRIPE_USE_NEW_CHECKOUT = '.getDolGlobalString('STRIPE_USE_NEW_CHECKOUT').' -->'."\n";
2272 2272
 		print '<form action="'.$_SERVER['REQUEST_URI'].'" method="POST" id="payment-form">'."\n";
2273 2273
 
2274 2274
 		print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
Please login to merge, or discard this patch.
htdocs/admin/dict.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 $tabcond[DICT_STCOMM] = isModEnabled("societe");
569 569
 $tabcond[DICT_HOLIDAY_TYPES] = isModEnabled('holiday');
570 570
 $tabcond[DICT_LEAD_STATUS] = isModEnabled('project');
571
-$tabcond[DICT_FORMAT_CARDS] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('member'));	// stickers format dictionary
571
+$tabcond[DICT_FORMAT_CARDS] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('member')); // stickers format dictionary
572 572
 $tabcond[DICT_INVOICE_SUBTYPE] = ((isModEnabled('invoice') || isModEnabled('supplier_invoice')) && $mysoc->country_code == 'GR');
573 573
 $tabcond[DICT_HRM_PUBLIC_HOLIDAY] = (isModEnabled('holiday') || isModEnabled('hrm'));
574 574
 $tabcond[DICT_HRM_DEPARTMENT] = isModEnabled('hrm');
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 				if ($value == 'price' || preg_match('/^amount/i', $value)) {
972 972
 					$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
973 973
 				} elseif ($value == 'taux' || $value == 'localtax1') {
974
-					$_POST[$keycode] = price2num(GETPOST($keycode), 8);	// Note that localtax2 can be a list of rates separated by coma like X:Y:Z
974
+					$_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z
975 975
 				} elseif ($value == 'entity') {
976 976
 					$_POST[$keycode] = getEntity($tablename);
977 977
 				}
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
 				if ($field == 'price' || preg_match('/^amount/i', $field)) {
1041 1041
 					$_POST[$keycode] = price2num(GETPOST($keycode), 'MU');
1042 1042
 				} elseif ($field == 'taux' || $field == 'localtax1') {
1043
-					$_POST[$keycode] = price2num(GETPOST($keycode), 8);	// Note that localtax2 can be a list of rates separated by coma like X:Y:Z
1043
+					$_POST[$keycode] = price2num(GETPOST($keycode), 8); // Note that localtax2 can be a list of rates separated by coma like X:Y:Z
1044 1044
 				} elseif ($field == 'entity') {
1045 1045
 					$_POST[$keycode] = getEntity($tablename);
1046 1046
 				}
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 							}
2475 2475
 							// Show value for field
2476 2476
 							if ($showfield) {
2477
-								print '<!-- '. $value .' --><td class="'.$class.'"'.($titletoshow ? ' title="'.dolPrintHTMLForAttribute($titletoshow).'"' : '').'>'.$valuetoshow.'</td>';
2477
+								print '<!-- '.$value.' --><td class="'.$class.'"'.($titletoshow ? ' title="'.dolPrintHTMLForAttribute($titletoshow).'"' : '').'>'.$valuetoshow.'</td>';
2478 2478
 							}
2479 2479
 						}
2480 2480
 
@@ -2656,7 +2656,7 @@  discard block
 block discarded – undo
2656 2656
 			// Special case for c_actioncomm (field that should not be modified)
2657 2657
 			$hidden = (!empty($obj->{$value}) ? $obj->{$value} : '');
2658 2658
 			print '<td>';
2659
-			print '<input type="hidden" name="'. $value .'" value="'.$hidden.'">';
2659
+			print '<input type="hidden" name="'.$value.'" value="'.$hidden.'">';
2660 2660
 			print $langs->trans($hidden);
2661 2661
 			print '</td>';
2662 2662
 		} elseif ($value == 'country') {
@@ -2677,7 +2677,7 @@  discard block
 block discarded – undo
2677 2677
 			if (!in_array('country', $fieldlist)) {	// If there is already a field country, we don't show country_id (avoid duplicate)
2678 2678
 				$country_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2679 2679
 				print '<td class="tdoverflowmax100">';
2680
-				print '<input type="hidden" name="'. $value .'" value="'.$country_id.'">';
2680
+				print '<input type="hidden" name="'.$value.'" value="'.$country_id.'">';
2681 2681
 				print '</td>';
2682 2682
 			}
2683 2683
 		} elseif ($value == 'region') {
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 		} elseif ($value == 'region_id') {
2688 2688
 			$region_id = (!empty($obj->{$value}) ? $obj->{$value} : 0);
2689 2689
 			print '<td>';
2690
-			print '<input type="hidden" name="'. $value .'" value="'.$region_id.'">';
2690
+			print '<input type="hidden" name="'.$value.'" value="'.$region_id.'">';
2691 2691
 			print '</td>';
2692 2692
 		} elseif ($value == 'lang') {
2693 2693
 			print '<td>';
@@ -2743,7 +2743,7 @@  discard block
 block discarded – undo
2743 2743
 				$class = "center"; // Fields aligned on right
2744 2744
 			}
2745 2745
 			print '<td class="'.$class.'">';
2746
-			print '<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} : '').'" size="3" name="'. $value .'">';
2746
+			print '<input type="text" class="flat" value="'.(isset($obj->{$value}) ? $obj->{$value} : '').'" size="3" name="'.$value.'">';
2747 2747
 			print '</td>';
2748 2748
 		} elseif (in_array($value, array('libelle_facture'))) {
2749 2749
 			print '<td>';
@@ -2753,7 +2753,7 @@  discard block
 block discarded – undo
2753 2753
 			if ($tabname == 'c_payment_term') {
2754 2754
 				$langs->load("bills");
2755 2755
 				if (isset($obj->code) && !empty($obj->code)) {
2756
-					$transkey = "PaymentCondition" . strtoupper($obj->code);
2756
+					$transkey = "PaymentCondition".strtoupper($obj->code);
2757 2757
 					if ($langs->trans($transkey) != $transkey) {
2758 2758
 						$transfound = 1;
2759 2759
 						print $form->textwithpicto($langs->trans($transkey), $langs->trans("GoIntoTranslationMenuToChangeThis"));
@@ -2761,21 +2761,21 @@  discard block
 block discarded – undo
2761 2761
 				}
2762 2762
 			}
2763 2763
 			if (!$transfound) {
2764
-				print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'. $value .'">'.(!empty($obj->{$value}) ? $obj->{$value} : '').'</textarea>';
2764
+				print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$value.'">'.(!empty($obj->{$value}) ? $obj->{$value} : '').'</textarea>';
2765 2765
 			} else {
2766
-				print '<input type="hidden" name="'. $value .'" value="'.$transkey.'">';
2766
+				print '<input type="hidden" name="'.$value.'" value="'.$transkey.'">';
2767 2767
 			}
2768 2768
 			print '</td>';
2769 2769
 		} elseif ($value == 'price' || preg_match('/^amount/i', $value)) {
2770
-			print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} : '')).'" name="'. $value .'"></td>';
2770
+			print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$value}) ? $obj->{$value} : '')).'" name="'.$value.'"></td>';
2771 2771
 		} elseif ($value == 'code' && isset($obj->{$value})) {
2772 2772
 			print '<td>';
2773 2773
 			if ($tabname == 'c_paiement' && in_array($obj->{$value}, array('LIQ', 'CB', 'CHQ', 'VIR'))) {
2774 2774
 				// Case of code that should not be modified
2775
-				print '<input type="hidden" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value} : '').'" name="'. $value .'">';
2775
+				print '<input type="hidden" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value} : '').'" name="'.$value.'">';
2776 2776
 				print $obj->{$value};
2777 2777
 			} else {
2778
-				print '<input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value} : '').'" name="'. $value .'">';
2778
+				print '<input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$value}) ? $obj->{$value} : '').'" name="'.$value.'">';
2779 2779
 			}
2780 2780
 			print '</td>';
2781 2781
 		} elseif ($value == 'unit') {
@@ -2803,10 +2803,10 @@  discard block
 block discarded – undo
2803 2803
 			if (isModEnabled('accounting')) {
2804 2804
 				$fieldname = $value;
2805 2805
 				$accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
2806
-				print $formaccounting->select_account($accountancy_account, '.'. $value, 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
2806
+				print $formaccounting->select_account($accountancy_account, '.'.$value, 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
2807 2807
 			} else {
2808 2808
 				$fieldname = $value;
2809
-				print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'. $value .'">';
2809
+				print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$value.'">';
2810 2810
 			}
2811 2811
 			print '</td>';
2812 2812
 		} elseif ($value == 'fk_tva') {
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
 			print '</td>';
2828 2828
 		} elseif ($value == 'type_duration') {
2829 2829
 			print '<td>';
2830
-			print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i','h'));
2830
+			print $form->selectTypeDuration('', (empty($obj->type_duration) ? '' : $obj->type_duration), array('i', 'h'));
2831 2831
 			print '</td>';
2832 2832
 		} else {
2833 2833
 			$fieldValue = isset($obj->{$value}) ? $obj->{$value} : '';
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
785 785
 			$flags .= '';
786 786
 		} else {
787
-			$flags .= '/' . $this->imap_encryption;
787
+			$flags .= '/'.$this->imap_encryption;
788 788
 		}
789 789
 
790 790
 		$flags .= '/novalidate-cert';
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
 	{
815 815
 		if (function_exists('mb_convert_encoding')) {
816 816
 			// change spaces by entropy because mb_convert fail with spaces
817
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
818
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
817
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
818
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
819 819
 			// if mb_convert work
820 820
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
821 821
 				// change characters
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 				}
1436 1436
 
1437 1437
 				if ($rule['type'] == 'from') {
1438
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1438
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1439 1439
 					if (count($tmprulevaluearray) >= 2) {
1440 1440
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1441 1441
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 					}
1446 1446
 				}
1447 1447
 				if ($rule['type'] == 'to') {
1448
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1448
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1449 1449
 					if (count($tmprulevaluearray) >= 2) {
1450 1450
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1451 1451
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1574 1574
 				}
1575 1575
 
1576
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1576
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1577 1577
 				if ($f) {
1578 1578
 					$folder = $f[0];
1579 1579
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1632,7 +1632,7 @@  discard block
 block discarded – undo
1632 1632
 			}
1633 1633
 		}
1634 1634
 
1635
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1635
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1636 1636
 
1637 1637
 		// Loop on each email found
1638 1638
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 						$isreplytook = 0;
1805 1805
 						foreach ($rulesreplyto as $key => $rulereplyto) {
1806 1806
 							if (preg_match('/'.preg_quote($rulereplyto, '/').'/', $headers['Reply-To'])) {
1807
-								$isreplytook ++;
1807
+								$isreplytook++;
1808 1808
 							}
1809 1809
 						}
1810 1810
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 						$attachments = [];
1865 1865
 					}
1866 1866
 				} else {
1867
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1867
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1868 1868
 				}
1869 1869
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1870 1870
 
@@ -1964,7 +1964,7 @@  discard block
 block discarded – undo
1964 1964
 					$tmpdate = $overview['date']->toDate();
1965 1965
 					$tmptimezone = $tmpdate->getTimezone()->getName();
1966 1966
 
1967
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
1967
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
1968 1968
 					if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) {
1969 1969
 						if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) {
1970 1970
 							$dateemail -= (3600 * (int) $reg[2]);
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 					$subject = $overview['subject'];
1979 1979
 				} else {
1980 1980
 					$fromstring = $overview[0]->from;
1981
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
1981
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
1982 1982
 
1983 1983
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
1984 1984
 					$to = $overview[0]->to;
@@ -2049,17 +2049,17 @@  discard block
 block discarded – undo
2049 2049
 				foreach ($arrayofreferences as $reference) {
2050 2050
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2051 2051
 					if (!empty($trackidfoundintorecipienttype)) {
2052
-						$resultsearchtrackid = -1;		// trackid found
2052
+						$resultsearchtrackid = -1; // trackid found
2053 2053
 						$reg[1] = $trackidfoundintorecipienttype;
2054 2054
 						$reg[2] = $trackidfoundintorecipientid;
2055 2055
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2056
-						$resultsearchtrackid = -1;		// trackid found
2056
+						$resultsearchtrackid = -1; // trackid found
2057 2057
 						$reg[1] = $trackidfoundintomsgidtype;
2058 2058
 						$reg[2] = $trackidfoundintomsgidid;
2059 2059
 					} else {
2060
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2060
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2061 2061
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2062
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2062
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2063 2063
 						}
2064 2064
 					}
2065 2065
 
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 								} else {
2221 2221
 									foreach ($arrayofreferences as $key => $referencetmp) {
2222 2222
 										if (!str_contains($objectemail->origin_references, $referencetmp)) {
2223
-											$objectemail->origin_references.= " ".$referencetmp;
2223
+											$objectemail->origin_references .= " ".$referencetmp;
2224 2224
 											$changeonticket_references = true;
2225 2225
 										}
2226 2226
 									}
@@ -2355,7 +2355,7 @@  discard block
 block discarded – undo
2355 2355
 
2356 2356
 						// Make Operation
2357 2357
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2358
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2358
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2359 2359
 
2360 2360
 						// Try to guess if this is an email in or out.
2361 2361
 						$actioncode = 'EMAIL_IN';
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2409 2409
 									$ticketalreadyexists = 0;
2410 2410
 								} else {
2411
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid;	// We change the operation type to do
2411
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do
2412 2412
 									$ticketalreadyexists = 1;
2413 2413
 									$operation['type'] = 'recordevent';
2414 2414
 								}
@@ -2645,11 +2645,11 @@  discard block
 block discarded – undo
2645 2645
 									$result = $contactstatic->fetch(0, null, '', $from);
2646 2646
 									if ($result < 0) {
2647 2647
 										$errorforactions++;
2648
-										$this->error = 'Error when getting contact with email ' . $from;
2648
+										$this->error = 'Error when getting contact with email '.$from;
2649 2649
 										$this->errors[] = $this->error;
2650 2650
 										break;
2651 2651
 									} elseif ($result == 0) {
2652
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2652
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2653 2653
 										$contactstatic = new Contact($this->db);
2654 2654
 
2655 2655
 										// Create contact
@@ -2664,28 +2664,28 @@  discard block
 block discarded – undo
2664 2664
 										} else {
2665 2665
 											// Search country by name or code
2666 2666
 											if (!empty($contactstatic->country)) {
2667
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2667
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2668 2668
 												$result = getCountry('', 3, $this->db, null, 1, $contactstatic->country);
2669 2669
 												if ($result == 'NotDefined') {
2670 2670
 													$errorforactions++;
2671
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2671
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2672 2672
 												} elseif (!($result > 0)) {
2673 2673
 													$errorforactions++;
2674
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2674
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2675 2675
 													$this->errors[] = $this->db->lasterror();
2676 2676
 												} else {
2677 2677
 													$contactstatic->country_id = $result;
2678 2678
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2679 2679
 												}
2680 2680
 											} elseif (!empty($contactstatic->country_code)) {
2681
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2681
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2682 2682
 												$result = getCountry($contactstatic->country_code, 3, $this->db);
2683 2683
 												if ($result == 'NotDefined') {
2684 2684
 													$errorforactions++;
2685
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2685
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2686 2686
 												} elseif (!($result > 0)) {
2687 2687
 													$errorforactions++;
2688
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2688
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2689 2689
 													$this->errors[] = $this->db->lasterror();
2690 2690
 												} else {
2691 2691
 													$contactstatic->country_id = $result;
@@ -2696,28 +2696,28 @@  discard block
 block discarded – undo
2696 2696
 											if (!$errorforactions) {
2697 2697
 												// Search state by name or code (for country if defined)
2698 2698
 												if (!empty($contactstatic->state)) {
2699
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2699
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2700 2700
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2701 2701
 													if (empty($result)) {
2702 2702
 														$errorforactions++;
2703
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2703
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2704 2704
 													} elseif (!($result > 0)) {
2705 2705
 														$errorforactions++;
2706
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2706
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2707 2707
 														$this->errors[] = $this->db->lasterror();
2708 2708
 													} else {
2709 2709
 														$contactstatic->state_id = $result;
2710 2710
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2711 2711
 													}
2712 2712
 												} elseif (!empty($contactstatic->state_code)) {
2713
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2713
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2714 2714
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2715 2715
 													if (empty($result)) {
2716 2716
 														$errorforactions++;
2717
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2717
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2718 2718
 													} elseif (!($result > 0)) {
2719 2719
 														$errorforactions++;
2720
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2720
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2721 2721
 														$this->errors[] = $this->db->lasterror();
2722 2722
 													} else {
2723 2723
 														$contactstatic->state_id = $result;
@@ -2782,8 +2782,8 @@  discard block
 block discarded – undo
2782 2782
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2783 2783
 								$actioncomm->note_private = $descriptionfull;
2784 2784
 								$actioncomm->fk_project  = $projectstatic->id;
2785
-								$actioncomm->datep       = $dateemail;	// date of email
2786
-								$actioncomm->datef       = $dateemail;	// date of email
2785
+								$actioncomm->datep       = $dateemail; // date of email
2786
+								$actioncomm->datef       = $dateemail; // date of email
2787 2787
 								$actioncomm->percentage  = -1; // Not applicable
2788 2788
 								$actioncomm->socid       = $thirdpartystatic->id;
2789 2789
 								$actioncomm->contact_id = $contactstatic->id;
@@ -2982,7 +2982,7 @@  discard block
 block discarded – undo
2982 2982
 								}
2983 2983
 								$hookmanager->initHooks(array('emailcolector'));
2984 2984
 								$parameters = array('arrayobject' => $arrayobject);
2985
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
2985
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
2986 2986
 								if ($reshook > 0) {
2987 2987
 									$arrayobject = $hookmanager->resArray;
2988 2988
 								}
@@ -2991,10 +2991,10 @@  discard block
 block discarded – undo
2991 2991
 
2992 2992
 								foreach ($arrayobject as $key => $objectdesc) {
2993 2993
 									$sql = 'SELECT DISTINCT t.rowid ';
2994
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
2994
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
2995 2995
 									$sql .= ' WHERE ';
2996 2996
 									foreach ($objectdesc['fields'] as $field) {
2997
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
2997
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
2998 2998
 									}
2999 2999
 									$sql = substr($sql, 0, -4);
3000 3000
 
@@ -3014,8 +3014,8 @@  discard block
 block discarded – undo
3014 3014
 									foreach ($ids as $val) {
3015 3015
 										$res = $objectmanaged->fetch($val);
3016 3016
 										if ($res) {
3017
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3018
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
3017
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3018
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3019 3019
 										} else {
3020 3020
 											$this->errors[] = 'object not found';
3021 3021
 										}
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 								foreach ($dirs as $target) {
3025 3025
 									$prefix = $this->actions[$this->id]['actionparam'];
3026 3026
 									foreach ($data as $filename => $content) {
3027
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3027
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3028 3028
 										if ($resr == -1) {
3029 3029
 											$this->errors[] = 'Doc not saved';
3030 3030
 										}
@@ -3071,7 +3071,7 @@  discard block
 block discarded – undo
3071 3071
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3072 3072
 
3073 3073
 								$projecttocreate->title = $subject;
3074
-								$projecttocreate->date_start = $dateemail;	// date of email
3074
+								$projecttocreate->date_start = $dateemail; // date of email
3075 3075
 								$projecttocreate->date_end = 0;
3076 3076
 								$projecttocreate->opp_status = $id_opp_status;
3077 3077
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3333,7 +3333,7 @@  discard block
 block discarded – undo
3333 3333
 								$candidaturetocreate->note_private = $descriptionfull;
3334 3334
 								$candidaturetocreate->entity = $conf->entity;
3335 3335
 								$candidaturetocreate->email_msgid = $msgid;
3336
-								$candidaturetocreate->email_date = $dateemail;		// date of email
3336
+								$candidaturetocreate->email_date = $dateemail; // date of email
3337 3337
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3338 3338
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3339 3339
 
@@ -3723,8 +3723,8 @@  discard block
 block discarded – undo
3723 3723
 				 * append increment number to the original filename
3724 3724
 				 */
3725 3725
 				while (file_exists($destdir.$file_name.".".$extension)) {
3726
-					$file_name = $file_name_original . ' (' . $num . ')';
3727
-					$file_name_complete = $file_name . "." . $extension;
3726
+					$file_name = $file_name_original.' ('.$num.')';
3727
+					$file_name_complete = $file_name.".".$extension;
3728 3728
 					$destination = $destdir.$file_name_complete;
3729 3729
 					$num++;
3730 3730
 				}
@@ -3838,7 +3838,7 @@  discard block
 block discarded – undo
3838 3838
 	 */
3839 3839
 	private function saveAttachment($destdir, $filename, $content)
3840 3840
 	{
3841
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3841
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3842 3842
 
3843 3843
 		$tmparraysize = getDefaultImageSizes();
3844 3844
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/core/class/html.formcompany.class.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  *	Only common components are here.
33 33
  */
34 34
 
35
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
36 36
 
37 37
 
38 38
 /**
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		$effs = array();
57 57
 
58 58
 		$sql = "SELECT id, code, libelle as label";
59
-		$sql .= " FROM " . $this->db->prefix() . "c_typent";
60
-		$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . (empty($mysoc->country_id) ? '0' : $mysoc->country_id) . ")";
59
+		$sql .= " FROM ".$this->db->prefix()."c_typent";
60
+		$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")";
61 61
 		if ($filter) {
62
-			$sql .= " " . $filter;
62
+			$sql .= " ".$filter;
63 63
 		}
64 64
 		$sql .= " ORDER by position, id";
65
-		dol_syslog(get_class($this) . '::typent_array', LOG_DEBUG);
65
+		dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
66 66
 		$resql = $this->db->query($sql);
67 67
 		if ($resql) {
68 68
 			$num = $this->db->num_rows($resql);
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 		$effs = array();
106 106
 
107 107
 		$sql = "SELECT id, code, libelle as label";
108
-		$sql .= " FROM " . $this->db->prefix() . "c_effectif";
108
+		$sql .= " FROM ".$this->db->prefix()."c_effectif";
109 109
 		$sql .= " WHERE active = 1";
110 110
 		if ($filter) {
111
-			$sql .= " " . $filter;
111
+			$sql .= " ".$filter;
112 112
 		}
113 113
 		$sql .= " ORDER BY id ASC";
114
-		dol_syslog(get_class($this) . '::effectif_array', LOG_DEBUG);
114
+		dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG);
115 115
 		$resql = $this->db->query($sql);
116 116
 		if ($resql) {
117 117
 			$num = $this->db->num_rows($resql);
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
 		// phpcs:enable
152 152
 		global $user, $langs;
153 153
 
154
-		print '<form method="post" action="' . $page . '">';
154
+		print '<form method="post" action="'.$page.'">';
155 155
 		print '<input type="hidden" name="action" value="setprospectlevel">';
156
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
156
+		print '<input type="hidden" name="token" value="'.newToken().'">';
157 157
 
158
-		dol_syslog(get_class($this) . '::form_prospect_level', LOG_DEBUG);
158
+		dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
159 159
 		$sql = "SELECT code, label";
160
-		$sql .= " FROM " . $this->db->prefix() . "c_prospectlevel";
160
+		$sql .= " FROM ".$this->db->prefix()."c_prospectlevel";
161 161
 		$sql .= " WHERE active > 0";
162 162
 		$sql .= " ORDER BY sortorder";
163 163
 		$resql = $this->db->query($sql);
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 			dol_print_error($this->db);
184 184
 		}
185 185
 		if (!empty($htmlname) && $user->admin) {
186
-			print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
186
+			print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
187 187
 		}
188
-		print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
188
+		print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
189 189
 		print '</form>';
190 190
 	}
191 191
 
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 	{
203 203
 		global $user, $langs;
204 204
 
205
-		print '<form method="post" action="' . $page . '">';
205
+		print '<form method="post" action="'.$page.'">';
206 206
 		print '<input type="hidden" name="action" value="setprospectcontactlevel">';
207
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
207
+		print '<input type="hidden" name="token" value="'.newToken().'">';
208 208
 
209 209
 		dol_syslog(__METHOD__, LOG_DEBUG);
210 210
 		$sql = "SELECT code, label";
211
-		$sql .= " FROM " . $this->db->prefix() . "c_prospectcontactlevel";
211
+		$sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel";
212 212
 		$sql .= " WHERE active > 0";
213 213
 		$sql .= " ORDER BY sortorder";
214 214
 		$resql = $this->db->query($sql);
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 			dol_print_error($this->db);
235 235
 		}
236 236
 		if (!empty($htmlname) && $user->admin) {
237
-			print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
237
+			print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
238 238
 		}
239
-		print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
239
+		print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
240 240
 		print '</form>';
241 241
 	}
242 242
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		// phpcs:enable
278 278
 		global $conf, $langs, $user;
279 279
 
280
-		dol_syslog(get_class($this) . "::select_departement selected=" . $selected . ", country_codeid=" . $country_codeid, LOG_DEBUG);
280
+		dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG);
281 281
 
282 282
 		$langs->load("dict");
283 283
 
@@ -285,28 +285,28 @@  discard block
 block discarded – undo
285 285
 
286 286
 		// Search departements/cantons/province active d'une region et pays actif
287 287
 		$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
288
-		$sql .= " " . $this->db->prefix() . "c_departements as d, " . $this->db->prefix() . "c_regions as r," . $this->db->prefix() . "c_country as c";
288
+		$sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c";
289 289
 		$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
290 290
 		$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
291 291
 		if ($country_codeid && is_numeric($country_codeid)) {
292
-			$sql .= " AND c.rowid = '" . $this->db->escape($country_codeid) . "'";
292
+			$sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'";
293 293
 		}
294 294
 		if ($country_codeid && !is_numeric($country_codeid)) {
295
-			$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
295
+			$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
296 296
 		}
297 297
 		$sql .= " ORDER BY c.code, d.code_departement";
298 298
 
299 299
 		$result = $this->db->query($sql);
300 300
 		if ($result) {
301 301
 			if (!empty($htmlname)) {
302
-				$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
302
+				$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
303 303
 			}
304 304
 			if ($country_codeid) {
305 305
 				$out .= '<option value="0">&nbsp;</option>';
306 306
 			}
307 307
 			$num = $this->db->num_rows($result);
308 308
 			$i = 0;
309
-			dol_syslog(get_class($this) . "::select_departement num=" . $num, LOG_DEBUG);
309
+			dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG);
310 310
 			if ($num) {
311 311
 				$country = '';
312 312
 				while ($i < $num) {
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 						if (!$country || $country != $obj->country) {
318 318
 							// Show break if we are in list with multiple countries
319 319
 							if (!$country_codeid && $obj->country_code) {
320
-								$out .= '<option value="-1" disabled data-html="----- ' . $obj->country . ' -----">----- ' . $obj->country . " -----</option>\n";
320
+								$out .= '<option value="-1" disabled data-html="----- '.$obj->country.' -----">----- '.$obj->country." -----</option>\n";
321 321
 								$country = $obj->country;
322 322
 							}
323 323
 						}
324 324
 
325 325
 						if (!empty($selected) && $selected == $obj->rowid) {
326
-							$out .= '<option value="' . $obj->rowid . '" selected>';
326
+							$out .= '<option value="'.$obj->rowid.'" selected>';
327 327
 						} else {
328
-							$out .= '<option value="' . $obj->rowid . '">';
328
+							$out .= '<option value="'.$obj->rowid.'">';
329 329
 						}
330 330
 
331 331
 						// Si traduction existe, on l'utilise, sinon on prend le libelle par default
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 							(getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || getDolGlobalString('MAIN_SHOW_STATE_CODE') === 'all')
335 335
 						) {
336 336
 							if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) {
337
-								$out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
337
+								$out .= $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
338 338
 							} else {
339
-								$out .= $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
339
+								$out .= $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
340 340
 							}
341 341
 						} else {
342 342
 							if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) {
343
-								$out .= $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
343
+								$out .= $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
344 344
 							} else {
345 345
 								$out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
346 346
 							}
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 				$out .= '</select>';
356 356
 			}
357 357
 			if (!empty($htmlname) && $user->admin) {
358
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
358
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
359 359
 			}
360 360
 		} else {
361 361
 			dol_print_error($this->db);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
 		// Make select dynamic
365 365
 		if (!empty($htmlname)) {
366
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
366
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
367 367
 			$out .= ajax_combobox($htmlname);
368 368
 		}
369 369
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	public function select_state_ajax($parent_field_id = 'country_id', $selected = 0, $country_codeid = 0, $htmlname = 'state_id', $morecss = 'maxwidth200onsmartphone  minwidth300')
389 389
 	{
390 390
 		$html = '<script>';
391
-		$html.='$("select[name=\"'.$parent_field_id.'\"]").change(function(){
391
+		$html .= '$("select[name=\"'.$parent_field_id.'\"]").change(function(){
392 392
 				$.ajax( "'.dol_buildpath('/core/ajax/ziptown.php', 2).'", { data:{ selected: $("select[name=\"'.$htmlname.'\"]").val(), country_codeid: $(this).val(), htmlname:"'.$htmlname.'", morecss:"'.$morecss.'" } } )
393 393
 				.done(function(msg) {
394 394
 					$("span#target_'.$htmlname.'").html(msg);
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
 		$langs->load("dict");
416 416
 
417 417
 		$sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
418
-		$sql .= " FROM " . $this->db->prefix() . "c_regions as r, " . $this->db->prefix() . "c_country as c";
418
+		$sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c";
419 419
 		$sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
420 420
 		$sql .= " ORDER BY c.code, c.label ASC";
421 421
 
422
-		dol_syslog(get_class($this) . "::select_region", LOG_DEBUG);
422
+		dol_syslog(get_class($this)."::select_region", LOG_DEBUG);
423 423
 		$resql = $this->db->query($sql);
424 424
 		if ($resql) {
425
-			print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
425
+			print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
426 426
 			$num = $this->db->num_rows($resql);
427 427
 			$i = 0;
428 428
 			if ($num) {
@@ -434,16 +434,16 @@  discard block
 block discarded – undo
434 434
 					} else {
435 435
 						if ($country == '' || $country != $obj->country) {
436 436
 							// Show break
437
-							$key = $langs->trans("Country" . strtoupper($obj->country_code));
438
-							$valuetoshow = ($key != "Country" . strtoupper($obj->country_code)) ? $obj->country_code . " - " . $key : $obj->country;
439
-							print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option>\n";
437
+							$key = $langs->trans("Country".strtoupper($obj->country_code));
438
+							$valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country;
439
+							print '<option value="-2" disabled>----- '.$valuetoshow." -----</option>\n";
440 440
 							$country = $obj->country;
441 441
 						}
442 442
 
443 443
 						if ($selected > 0 && $selected == $obj->code) {
444
-							print '<option value="' . $obj->code . '" selected>' . $obj->label . '</option>';
444
+							print '<option value="'.$obj->code.'" selected>'.$obj->label.'</option>';
445 445
 						} else {
446
-							print '<option value="' . $obj->code . '">' . $obj->label . '</option>';
446
+							print '<option value="'.$obj->code.'">'.$obj->label.'</option>';
447 447
 						}
448 448
 					}
449 449
 					$i++;
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
 
475 475
 		$out = '';
476 476
 
477
-		$sql = "SELECT rowid, code, label, active FROM " . $this->db->prefix() . "c_civility";
477
+		$sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility";
478 478
 		$sql .= " WHERE active = 1";
479 479
 
480 480
 		dol_syslog("Form::select_civility", LOG_DEBUG);
481 481
 		$resql = $this->db->query($sql);
482 482
 		if ($resql) {
483
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
483
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
484 484
 			$out .= '<option value="">&nbsp;</option>';
485 485
 			$num = $this->db->num_rows($resql);
486 486
 			$i = 0;
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 				while ($i < $num) {
489 489
 					$obj = $this->db->fetch_object($resql);
490 490
 					if ($selected == $obj->code) {
491
-						$out .= '<option value="' . $obj->code . '" selected>';
491
+						$out .= '<option value="'.$obj->code.'" selected>';
492 492
 					} else {
493
-						$out .= '<option value="' . $obj->code . '">';
493
+						$out .= '<option value="'.$obj->code.'">';
494 494
 					}
495 495
 					// If translation exists, we use it, otherwise, we use the hard coded label
496
-					$out .= ($langs->trans("Civility" . $obj->code) != "Civility" . $obj->code ? $langs->trans("Civility" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
496
+					$out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
497 497
 					$out .= '</option>';
498 498
 					$i++;
499 499
 				}
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 			if ($addjscombo) {
507 507
 				// Enhance with select2
508
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
508
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
509 509
 				$out .= ajax_combobox($htmlname);
510 510
 			}
511 511
 		} else {
@@ -555,22 +555,22 @@  discard block
 block discarded – undo
555 555
 
556 556
 		// Lookup the active juridical types for the active countries
557 557
 		$sql  = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
558
-		$sql .= " FROM " . $this->db->prefix() . "c_forme_juridique as f, " . $this->db->prefix() . "c_country as c";
558
+		$sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c";
559 559
 		$sql .= " WHERE f.fk_pays=c.rowid";
560 560
 		$sql .= " AND f.active = 1 AND c.active = 1";
561 561
 		if ($country_codeid) {
562
-			$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
562
+			$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
563 563
 		}
564 564
 		if ($filter) {
565
-			$sql .= " " . $filter;
565
+			$sql .= " ".$filter;
566 566
 		}
567 567
 		$sql .= " ORDER BY c.code";
568 568
 
569
-		dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG);
569
+		dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG);
570 570
 		$resql = $this->db->query($sql);
571 571
 		if ($resql) {
572 572
 			$out .= '<div id="particulier2" class="visible">';
573
-			$out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
573
+			$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
574 574
 			if ($country_codeid) {
575 575
 				$out .= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
576 576
 			}
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 					$obj = $this->db->fetch_object($resql);
585 585
 
586 586
 					if ($obj->code) {		// We exclude empty line, we will add it later
587
-						$labelcountry = (($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) ? $langs->trans("Country" . $obj->country_code) : $obj->country);
588
-						$labeljs = (($langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code) ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
589
-						$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
587
+						$labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country);
588
+						$labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
589
+						$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry.'_'.$labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
590 590
 					}
591 591
 					$i++;
592 592
 				}
@@ -600,15 +600,15 @@  discard block
 block discarded – undo
600 600
 					if (!$country || $country != $val['country']) {
601 601
 						// Show break when we are in multi country mode
602 602
 						if (empty($country_codeid) && $val['country_code']) {
603
-							$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n";
603
+							$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n";
604 604
 							$country = $val['country'];
605 605
 						}
606 606
 					}
607 607
 
608 608
 					if ($selected > 0 && $selected == $val['code']) {
609
-						$out .= '<option value="' . $val['code'] . '" selected>';
609
+						$out .= '<option value="'.$val['code'].'" selected>';
610 610
 					} else {
611
-						$out .= '<option value="' . $val['code'] . '">';
611
+						$out .= '<option value="'.$val['code'].'">';
612 612
 					}
613 613
 					// If translation exists, we use it, otherwise we use default label in database
614 614
 					$out .= $val['label'];
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
 			}
618 618
 			$out .= '</select>';
619 619
 			if ($user->admin) {
620
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
620
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
621 621
 			}
622 622
 
623 623
 			// Make select dynamic
624
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
624
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
625 625
 			$out .= ajax_combobox($htmlname);
626 626
 
627 627
 			$out .= '</div>';
@@ -675,13 +675,13 @@  discard block
 block discarded – undo
675 675
 			$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
676 676
 
677 677
 			if (count($events)) {	// If there is some ajax events to run once selection is done, we add code here to run events
678
-				print '<script nonce="' . getNonce() . '" type="text/javascript">
678
+				print '<script nonce="'.getNonce().'" type="text/javascript">
679 679
 				jQuery(document).ready(function() {
680
-					$("#search_' . $htmlname . '").change(function() {
681
-						var obj = ' . json_encode($events) . ';
680
+					$("#search_' . $htmlname.'").change(function() {
681
+						var obj = ' . json_encode($events).';
682 682
 						$.each(obj, function(key,values) {
683 683
 							if (values.method.length) {
684
-								runJsCodeForEvent' . $htmlname . '(values);
684
+								runJsCodeForEvent' . $htmlname.'(values);
685 685
 							}
686 686
 						});
687 687
 
@@ -689,13 +689,13 @@  discard block
 block discarded – undo
689 689
 					});
690 690
 
691 691
 					// Function used to execute events when search_htmlname change
692
-					function runJsCodeForEvent' . $htmlname . '(obj) {
693
-						var id = $("#' . $htmlname . '").val();
692
+					function runJsCodeForEvent' . $htmlname.'(obj) {
693
+						var id = $("#' . $htmlname.'").val();
694 694
 						var method = obj.method;
695 695
 						var url = obj.url;
696 696
 						var htmlname = obj.htmlname;
697 697
 						var showempty = obj.showempty;
698
-						console.log("Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
698
+						console.log("Run runJsCodeForEvent-' . $htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
699 699
 						$.getJSON(url,
700 700
 							{
701 701
 								action: method,
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 				</script>';
726 726
 			}
727 727
 
728
-			print "\n" . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . "\n";
729
-			print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />';
730
-			print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
728
+			print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
729
+			print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />';
730
+			print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
731 731
 			return $socid;
732 732
 		} else {
733 733
 			// Search to list thirdparties
@@ -739,14 +739,14 @@  discard block
 block discarded – undo
739 739
 				$sql .= ", s.address, s.zip, s.town";
740 740
 				$sql .= ", dictp.code as country_code";
741 741
 			}
742
-			$sql .= " FROM " . $this->db->prefix() . "societe as s";
742
+			$sql .= " FROM ".$this->db->prefix()."societe as s";
743 743
 			if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
744
-				$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
744
+				$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
745 745
 			}
746
-			$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
746
+			$sql .= " WHERE s.entity IN (".getEntity('societe').")";
747 747
 			// For ajax search we limit here. For combo list, we limit later
748 748
 			if (is_array($limitto) && count($limitto)) {
749
-				$sql .= " AND s.rowid IN (" . $this->db->sanitize(implode(',', $limitto)) . ")";
749
+				$sql .= " AND s.rowid IN (".$this->db->sanitize(implode(',', $limitto)).")";
750 750
 			}
751 751
 			// Add where from hooks
752 752
 			$parameters = array();
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
 
757 757
 			$resql = $this->db->query($sql);
758 758
 			if ($resql) {
759
-				print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"';
759
+				print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"';
760 760
 				if ($conf->use_javascript_ajax) {
761
-					$javaScript = "window.location='" . dol_escape_js($_SERVER['PHP_SELF']) . "?" . $var_id . "=" . ($forceid > 0 ? $forceid : $object->id) . $moreparam . "&" . $htmlname . "=' + form." . $htmlname . ".options[form." . $htmlname . ".selectedIndex].value;";
762
-					print ' onChange="' . $javaScript . '"';
761
+					$javaScript = "window.location='".dol_escape_js($_SERVER['PHP_SELF'])."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
762
+					print ' onChange="'.$javaScript.'"';
763 763
 				}
764 764
 				print '>';
765 765
 				print '<option value="-1">&nbsp;</option>';
@@ -777,18 +777,18 @@  discard block
 block discarded – undo
777 777
 							$disabled = 1;
778 778
 						}
779 779
 						if ($selected > 0 && $selected == $obj->rowid) {
780
-							print '<option value="' . $obj->rowid . '"';
780
+							print '<option value="'.$obj->rowid.'"';
781 781
 							if ($disabled) {
782 782
 								print ' disabled';
783 783
 							}
784
-							print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
784
+							print ' selected>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>';
785 785
 							$firstCompany = $obj->rowid;
786 786
 						} else {
787
-							print '<option value="' . $obj->rowid . '"';
787
+							print '<option value="'.$obj->rowid.'"';
788 788
 							if ($disabled) {
789 789
 								print ' disabled';
790 790
 							}
791
-							print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
791
+							print '>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>';
792 792
 						}
793 793
 						$i++;
794 794
 					}
@@ -823,22 +823,22 @@  discard block
 block discarded – undo
823 823
 
824 824
 		$out = '';
825 825
 		if (is_object($object) && method_exists($object, 'liste_type_contact')) {
826
-			$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);	// List of types into c_type_contact for element=$object->element
826
+			$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); // List of types into c_type_contact for element=$object->element
827 827
 
828
-			$out .= '<select class="flat valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
828
+			$out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
829 829
 			if ($showempty) {
830 830
 				$out .= '<option value="0">&nbsp;</option>';
831 831
 			}
832 832
 			foreach ($lesTypes as $key => $value) {
833
-				$out .= '<option value="' . $key . '"';
833
+				$out .= '<option value="'.$key.'"';
834 834
 				if ($key == $selected) {
835 835
 					$out .= ' selected';
836 836
 				}
837
-				$out .= '>' . $value . '</option>';
837
+				$out .= '>'.$value.'</option>';
838 838
 			}
839 839
 			$out .= "</select>";
840 840
 			if ($user->admin && empty($forcehidetooltip)) {
841
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
841
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
842 842
 			}
843 843
 
844 844
 			$out .= ajax_combobox($htmlname);
@@ -867,9 +867,9 @@  discard block
 block discarded – undo
867 867
 		if ($rendermode === 'view') {
868 868
 			$toprint = array();
869 869
 			foreach ($contact->roles as $key => $val) {
870
-				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val['label'] . '</li>';
870
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val['label'].'</li>';
871 871
 			}
872
-			return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
872
+			return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.'"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
873 873
 		}
874 874
 
875 875
 		if ($rendermode === 'edit') {
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 
916 916
 		$size = '';
917 917
 		if (!empty($fieldsize)) {
918
-			$size = 'size="' . $fieldsize . '"';
918
+			$size = 'size="'.$fieldsize.'"';
919 919
 		}
920 920
 
921 921
 		if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
922
-			$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n";
922
+			$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n";
923 923
 			$moreattrib .= ' autocomplete="off"';
924 924
 		}
925
-		$out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ($morecss ? ' ' . $morecss : '') . '" type="text"' . ($moreattrib ? ' ' . $moreattrib : '') . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . "\n";
925
+		$out .= '<input id="'.$htmlname.'" class="maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" type="text"'.($moreattrib ? ' '.$moreattrib : '').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
926 926
 
927 927
 		return $out;
928 928
 	}
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 		$parameters = array('formlength' => $formlength, 'selected' => $preselected, 'idprof' => $idprof, 'htmlname' => $htmlname, 'country_code' => $country_code);
999 999
 		$reshook = $hookmanager->executeHooks('getInputIdProf', $parameters);
1000 1000
 		if (empty($reshook)) {
1001
-			$out .= '<input type="text" ' . ($morecss ? 'class="' . $morecss . '" ' : '') . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">';
1001
+			$out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
1002 1002
 		}
1003 1003
 		$out .= $hookmanager->resPrint;
1004 1004
 
@@ -1029,9 +1029,9 @@  discard block
 block discarded – undo
1029 1029
 				$i = 0;
1030 1030
 				while ($i < $nbvalues) {
1031 1031
 					if ($selected == $valors[$i]) {
1032
-						print '<option value="' . $valors[$i] . '" selected>';
1032
+						print '<option value="'.$valors[$i].'" selected>';
1033 1033
 					} else {
1034
-						print '<option value="' . $valors[$i] . '">';
1034
+						print '<option value="'.$valors[$i].'">';
1035 1035
 					}
1036 1036
 					print $valors[$i];
1037 1037
 					print '</option>';
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 			return '';
1061 1061
 		}
1062 1062
 
1063
-		$out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">';
1063
+		$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
1064 1064
 		if ($typeinput == 'form') {
1065 1065
 			if ($allowempty || ($selected == '' || $selected == '-1')) {
1066 1066
 				$out .= '<option value="-1">';
@@ -1072,33 +1072,33 @@  discard block
 block discarded – undo
1072 1072
 				$out .= '</option>';
1073 1073
 			}
1074 1074
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1075
-				$out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
1075
+				$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
1076 1076
 			}
1077 1077
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
1078
-				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
1078
+				$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
1079 1079
 			}
1080 1080
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1081
-				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1081
+				$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1082 1082
 			}
1083
-			$out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
1083
+			$out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
1084 1084
 		} elseif ($typeinput == 'list') {
1085
-			$out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '>&nbsp;</option>';
1085
+			$out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'>&nbsp;</option>';
1086 1086
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1087
-				$out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
1087
+				$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
1088 1088
 			}
1089 1089
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1090
-				$out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1090
+				$out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1091 1091
 			}
1092 1092
 			if (isModEnabled("fournisseur")) {
1093
-				$out .= '<option value="4"' . ($selected == '4' ? ' selected' : '') . '>' . $langs->trans('Supplier') . '</option>';
1093
+				$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
1094 1094
 			}
1095
-			$out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>';
1095
+			$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
1096 1096
 		} elseif ($typeinput == 'admin') {
1097 1097
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
1098
-				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
1098
+				$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
1099 1099
 			}
1100 1100
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1101
-				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1101
+				$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1102 1102
 			}
1103 1103
 		}
1104 1104
 		$out .= '</select>';
@@ -1124,12 +1124,12 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 		$out = '';
1126 1126
 		if ($htmlname != "none") {
1127
-			$out .= '<form method="post" action="' . $page . '">';
1127
+			$out .= '<form method="post" action="'.$page.'">';
1128 1128
 			$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
1129
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1129
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1130 1130
 			$sortparam = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
1131 1131
 			$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
1132
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
1132
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
1133 1133
 			$out .= '</form>';
1134 1134
 		} else {
1135 1135
 			if ($selected > 0) {
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 
1169 1169
 			//print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']);
1170 1170
 			print img_action('', $actioncode, $actionpicto, 'class="inline-block valignmiddle paddingright pictoprospectstatus"');
1171
-			print '<select class="flat selectprospectstatus maxwidth150" id="'. $htmlname.$idprospect .'" data-socid="'.$idprospect.'" name="' . $htmlname .'"';
1171
+			print '<select class="flat selectprospectstatus maxwidth150" id="'.$htmlname.$idprospect.'" data-socid="'.$idprospect.'" name="'.$htmlname.'"';
1172 1172
 			if (!$user->hasRight('societe', 'creer')) {
1173 1173
 				print ' disabled';
1174 1174
 			}
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 						var image = $(this).prev(".pictoprospectstatus");
1199 1199
 						$.ajax({
1200 1200
 							type: "POST",
1201
-							url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\',
1202
-							data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\' },
1201
+							url: \'' . DOL_URL_ROOT.'/core/ajax/ajaxstatusprospect.php\',
1202
+							data: { id: statusid, prospectid: prospectid, token: \''. newToken().'\', action: \'updatestatusprospect\' },
1203 1203
 							success: function(response) {
1204 1204
 								console.log(response.img);
1205 1205
 								image.replaceWith(response.img);
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1226 added lines, -1226 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
123 123
 			if (!empty($perm)) {
124 124
 				$tmp = explode(':', $typeofdata);
125
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
125
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
126 126
 				if ($fieldrequired) {
127 127
 					$ret .= '<span class="fieldrequired">';
128 128
 				}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				if ($fieldrequired) {
135 135
 					$ret .= '</span>';
136 136
 				}
137
-				$ret .= '</div>' . "\n";
137
+				$ret .= '</div>'."\n";
138 138
 			} else {
139 139
 				if ($fieldrequired) {
140 140
 					$ret .= '<span class="fieldrequired">';
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 			if (empty($notabletag) && $perm) {
173 173
 				$ret .= '<td class="right">';
174 174
 			}
175
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
176
-				$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>';
175
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
176
+				$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>';
177 177
 			}
178 178
 			if (!empty($notabletag) && $notabletag == 1) {
179 179
 				if ($text) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			} elseif ($reg[1] == 'int') {
241 241
 				$typeofdata = 'numeric';
242 242
 			} else {
243
-				return 'ErrorBadParameter ' . $typeofdata;
243
+				return 'ErrorBadParameter '.$typeofdata;
244 244
 			}
245 245
 		}
246 246
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			if ($editaction == '') {
252 252
 				$editaction = GETPOST('action', 'aZ09');
253 253
 			}
254
-			$editmode = ($editaction == 'edit' . $htmlname);
254
+			$editmode = ($editaction == 'edit'.$htmlname);
255 255
 			if ($editmode) {	// edit mode
256 256
 				$ret .= "\n";
257
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
258
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
259
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
260
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
257
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
258
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
259
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
260
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
261 261
 				if (empty($notabletag)) {
262 262
 					$ret .= '<table class="nobordernopadding centpercent">';
263 263
 				}
@@ -266,28 +266,28 @@  discard block
 block discarded – undo
266 266
 				}
267 267
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
268 268
 					$tmp = explode(':', $typeofdata);
269
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
269
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
270 270
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
271 271
 					$tmp = explode(':', $typeofdata);
272 272
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
273
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
273
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
274 274
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
275 275
 					$tmp = explode(':', $typeofdata);
276 276
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
277
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
277
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
278 278
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
279 279
 					$tmp = explode(':', $typeofdata);
280
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
280
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
281 281
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
282 282
 					$tmp = explode(':', $typeofdata);
283 283
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
284 284
 					$morealt = '';
285 285
 					if (preg_match('/%/', $cols)) {
286
-						$morealt = ' style="width: ' . $cols . '"';
286
+						$morealt = ' style="width: '.$cols.'"';
287 287
 						$cols = '';
288 288
 					}
289 289
 					$valuetoshow = ($editvalue ? $editvalue : $value);
290
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
290
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
291 291
 					// textarea convert automatically entities chars into simple chars.
292 292
 					// 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.
293 293
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
298 298
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
299 299
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
300
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
300
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301 301
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
302 302
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
303 303
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
304 304
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
305
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
305
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306 306
 				} elseif (preg_match('/^select;/', $typeofdata)) {
307 307
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
308 308
 					$arraylist = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 					// TODO Not yet implemented. See code for extrafields
317 317
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
318 318
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
319
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
319
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
320 320
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
321 321
 					$ret .= $doleditor->Create(1);
322 322
 				} elseif ($typeofdata == 'asis') {
@@ -331,19 +331,19 @@  discard block
 block discarded – undo
331 331
 					$ret .= '<td>';
332 332
 				}
333 333
 				//else $ret.='<div class="clearboth"></div>';
334
-				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
334
+				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
335 335
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
336
-					$ret .= '<br>' . "\n";
336
+					$ret .= '<br>'."\n";
337 337
 				}
338
-				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
338
+				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
339 339
 				if (empty($notabletag)) {
340 340
 					$ret .= '</td>';
341 341
 				}
342 342
 
343 343
 				if (empty($notabletag)) {
344
-					$ret .= '</tr></table>' . "\n";
344
+					$ret .= '</tr></table>'."\n";
345 345
 				}
346
-				$ret .= '</form>' . "\n";
346
+				$ret .= '</form>'."\n";
347 347
 			} else {		// view mode
348 348
 				if (preg_match('/^email/', $typeofdata)) {
349 349
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -355,15 +355,15 @@  discard block
 block discarded – undo
355 355
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
356 356
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
357 357
 					$tmp = explode(':', $typeofdata);
358
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
358
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
359 359
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
360 360
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
361 361
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
362 362
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
363 363
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
364
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
364
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
365 365
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
366
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
366
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
367 367
 				} elseif (preg_match('/^select;/', $typeofdata)) {
368 368
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
369 369
 					$arraylist = array();
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 					$ret .= $arraylist[$value];
375 375
 					if ($htmlname == 'fk_product_type') {
376 376
 						if ($value == 0) {
377
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
377
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
378 378
 						} else {
379
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
379
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
380 380
 						}
381 381
 					}
382 382
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
385 385
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
386 386
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
387
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
387
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388 388
 					}
389 389
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
390 390
 					// clean data from some dangerous html
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
394 394
 						$ret .= dol_escape_htmltag($value);
395 395
 					} else {
396
-						$ret .= $value;        // $value must be already html escaped.
396
+						$ret .= $value; // $value must be already html escaped.
397 397
 					}
398 398
 				}
399 399
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
433 433
 			if (!is_object($extralanguages)) {
434
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
434
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
435 435
 				$extralanguages = new ExtraLanguages($this->db);
436 436
 			}
437 437
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
 				return ''; // No extralang field to show
441 441
 			}
442 442
 
443
-			$result .= '<!-- Widget for translation -->' . "\n";
444
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
443
+			$result .= '<!-- Widget for translation -->'."\n";
444
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
445 445
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
446 446
 			$result .= $s;
447 447
 			$result .= '</div>';
448 448
 
449
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
449
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
450 450
 
451 451
 			$resultforextrlang = '';
452 452
 			foreach ($arrayoflangcode as $langcode) {
453
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
453
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
454 454
 				if (empty($valuetoshow)) {
455 455
 					$object->fetchValuesForExtraLanguages();
456 456
 					//var_dump($object->array_languages);
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
 
463 463
 				// TODO Use the showInputField() method of ExtraLanguages object
464 464
 				if ($typeofdata == 'textarea') {
465
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
465
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
466 466
 					$resultforextrlang .= $valuetoshow;
467 467
 					$resultforextrlang .= '</textarea>';
468 468
 				} else {
469
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
469
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
470 470
 				}
471 471
 			}
472 472
 			$result .= $resultforextrlang;
473 473
 
474 474
 			$result .= '</div>';
475
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
475
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
476 476
 		}
477 477
 
478 478
 		return $result;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				if (!empty($tmp[2])) {
536 536
 					$savemethod = $tmp[2];
537 537
 				}
538
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
538
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
539 539
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
540 540
 				$tmp = explode(':', $inputType);
541 541
 				$inputType = $tmp[0];
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 					$savemethod = $tmp[2];
547 547
 				}
548 548
 
549
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
549
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
550 550
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
551 551
 				$tmp = explode(':', $inputType);
552 552
 				$inputType = $tmp[0];
@@ -577,40 +577,40 @@  discard block
 block discarded – undo
577 577
 				}
578 578
 
579 579
 				if (isModEnabled('fckeditor')) {
580
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
580
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
581 581
 				} else {
582 582
 					$inputType = 'textarea';
583 583
 				}
584 584
 			}
585 585
 
586
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
587
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
586
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
587
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
590 590
 			if (!empty($savemethod)) {
591
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
591
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
592 592
 			}
593 593
 			if (!empty($ext_element)) {
594
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
594
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
595 595
 			}
596 596
 			if (!empty($custommsg)) {
597 597
 				if (is_array($custommsg)) {
598 598
 					if (!empty($custommsg['success'])) {
599
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
599
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
600 600
 					}
601 601
 					if (!empty($custommsg['error'])) {
602
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
602
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
603 603
 					}
604 604
 				} else {
605
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
605
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
606 606
 				}
607 607
 			}
608 608
 			if ($inputType == 'textarea') {
609
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
610
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
609
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
611 611
 			}
612
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
613
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
612
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
613
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
614 614
 		} else {
615 615
 			$out = $value;
616 616
 		}
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
640 640
 	{
641 641
 		if ($incbefore) {
642
-			$text = $incbefore . $text;
642
+			$text = $incbefore.$text;
643 643
 		}
644 644
 		if (!$htmltext) {
645 645
 			return $text;
646 646
 		}
647
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
647
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
648 648
 
649 649
 		$tag = 'td';
650 650
 		if ($notabs == 2) {
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 
659 659
 		$extrastyle = '';
660 660
 		if ($direction < 0) {
661
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
661
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
662 662
 			$extrastyle = 'padding: 0px; padding-left: 3px;';
663 663
 		}
664 664
 		if ($direction > 0) {
665
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
665
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
666 666
 			$extrastyle = 'padding: 0px; padding-right: 3px;';
667 667
 		}
668 668
 
@@ -675,53 +675,53 @@  discard block
 block discarded – undo
675 675
 			$htmltext = str_replace('"', '&quot;', $htmltext);
676 676
 		} else {
677 677
 			$classfortooltip = 'classfortooltiponclick';
678
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
678
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
679 679
 		}
680 680
 		if ($tooltipon == 2 || $tooltipon == 3) {
681
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
681
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
682 682
 			if ($tooltiptrigger == '') {
683
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
683
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
684 684
 			} else {
685
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
685
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
686 686
 			}
687 687
 		} else {
688
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
688
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
689 689
 		}
690 690
 		if ($tooltipon == 1 || $tooltipon == 3) {
691
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
691
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
692 692
 			if ($tooltiptrigger == '') {
693
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
693
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
694 694
 			} else {
695
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
695
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
696 696
 			}
697 697
 		} else {
698
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
698
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
699 699
 		}
700 700
 		if (empty($notabs)) {
701 701
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
702 702
 		} elseif ($notabs == 2) {
703
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
703
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
704 704
 		}
705 705
 		// Define value if value is before
706 706
 		if ($direction < 0) {
707
-			$s .= '<' . $tag . $paramfortooltipimg;
707
+			$s .= '<'.$tag.$paramfortooltipimg;
708 708
 			if ($tag == 'td') {
709 709
 				$s .= ' class="valigntop" width="14"';
710 710
 			}
711
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
711
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
712 712
 		}
713 713
 		// Use another method to help avoid having a space in value in order to use this value with jquery
714 714
 		// Define label
715 715
 		if ((string) $text != '') {
716
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
716
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
717 717
 		}
718 718
 		// Define value if value is after
719 719
 		if ($direction > 0) {
720
-			$s .= '<' . $tag . $paramfortooltipimg;
720
+			$s .= '<'.$tag.$paramfortooltipimg;
721 721
 			if ($tag == 'td') {
722 722
 				$s .= ' class="valignmiddle" width="14"';
723 723
 			}
724
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
724
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
725 725
 		}
726 726
 		if (empty($notabs)) {
727 727
 			$s .= '</tr></table>';
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
 		$disabled = 0;
830 830
 		$ret = '<div class="centpercent center">';
831
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
831
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
832 832
 
833 833
 		// 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.
834 834
 		$parameters = array();
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
 			return;
840 840
 		}
841 841
 		if (empty($reshook)) {
842
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
842
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
843 843
 			if (is_array($arrayofaction)) {
844 844
 				foreach ($arrayofaction as $code => $label) {
845
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
845
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
846 846
 				}
847 847
 			}
848 848
 		}
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 		$ret .= '</select>';
852 852
 
853 853
 		if (empty($conf->dol_optimize_smallscreen)) {
854
-			$ret .= ajax_combobox('.' . $name . 'select');
854
+			$ret .= ajax_combobox('.'.$name.'select');
855 855
 		}
856 856
 
857 857
 		// 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
858 858
 		$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.
859
-		$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")) . '">';
859
+		$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 860
 		$ret .= '</div>';
861 861
 
862 862
 		if (!empty($conf->use_javascript_ajax)) {
863 863
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
864
-    		<script nonce="' . getNonce() . '">
864
+    		<script nonce="' . getNonce().'">
865 865
                         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 */
866 866
         		{
867 867
         			atleastoneselected=0;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
874 874
 
875
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
875
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
876 876
     	  			{
877 877
                                     jQuery("."+name).show();
878
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
879
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
878
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
879
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
880 880
     	  			}
881 881
     	  			else
882 882
     	  			{
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
         		}
887 887
 
888 888
         	jQuery(document).ready(function () {
889
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
890
-                    jQuery(".' . $cssclass . '").click(function() {
891
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
889
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
890
+                    jQuery(".' . $cssclass.'").click(function() {
891
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
892 892
                     });
893
-                        jQuery(".' . $name . 'select").change(function() {
893
+                        jQuery(".' . $name.'select").change(function() {
894 894
         			var massaction = $( this ).val();
895 895
         			var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
896 896
         			if (massaction == "builddoc")
@@ -898,18 +898,18 @@  discard block
 block discarded – undo
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 904
     	  			{
905
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
906
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
907
-                                        jQuery(".' . $name . '"+massaction).show();
905
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
906
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
907
+                                        jQuery(".' . $name.'"+massaction).show();
908 908
     	  			}
909 909
     	  			else
910 910
     	  			{
911
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
912
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
911
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
912
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
913 913
     	  			}
914 914
     	        });
915 915
         	});
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 		$atleastonefavorite = 0;
953 953
 
954 954
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
955
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
955
+		$sql .= " FROM ".$this->db->prefix()."c_country";
956 956
 		$sql .= " WHERE active > 0";
957 957
 		//$sql.= " ORDER BY code ASC";
958 958
 
959
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
959
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
960 960
 		$resql = $this->db->query($sql);
961 961
 		if ($resql) {
962
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
962
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
963 963
 			$num = $this->db->num_rows($resql);
964 964
 			$i = 0;
965 965
 			if ($num) {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 					$countryArray[$i]['rowid'] = $obj->rowid;
970 970
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
971 971
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
972
-					$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 : ''));
972
+					$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 : ''));
973 973
 					$countryArray[$i]['favorite'] = $obj->favorite;
974 974
 					$countryArray[$i]['eec'] = $obj->eec;
975 975
 					$favorite[$i] = $obj->favorite;
@@ -987,20 +987,20 @@  discard block
 block discarded – undo
987 987
 
988 988
 				if ($showempty) {
989 989
 					if (is_numeric($showempty)) {
990
-						$out .= '<option value="">&nbsp;</option>' . "\n";
990
+						$out .= '<option value="">&nbsp;</option>'."\n";
991 991
 					} else {
992
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
992
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
993 993
 					}
994 994
 				}
995 995
 
996 996
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
997 997
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
998
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
999
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
998
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
999
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
1000 1000
 					if ($mysoc->isInEEC()) {
1001
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
1001
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
1002 1002
 					}
1003
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
1003
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
1004 1004
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
1005 1005
 				}
1006 1006
 
@@ -1028,20 +1028,20 @@  discard block
 block discarded – undo
1028 1028
 						$labeltoshow .= '&nbsp;';
1029 1029
 					}
1030 1030
 					if ($row['code_iso']) {
1031
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1031
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1032 1032
 						if (empty($hideflags)) {
1033 1033
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1034
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1034
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1035 1035
 						}
1036 1036
 					}
1037 1037
 
1038 1038
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1039
-						$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']) . '">';
1039
+						$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']).'">';
1040 1040
 					} else {
1041
-						$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']) . '">';
1041
+						$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']).'">';
1042 1042
 					}
1043 1043
 					$out .= $labeltoshow;
1044
-					$out .= '</option>' . "\n";
1044
+					$out .= '</option>'."\n";
1045 1045
 				}
1046 1046
 			}
1047 1047
 			$out .= '</select>';
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make select dynamic
1053
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1054
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1053
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1054
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1055 1055
 
1056 1056
 		return $out;
1057 1057
 	}
@@ -1083,25 +1083,25 @@  discard block
 block discarded – undo
1083 1083
 		$incotermArray = array();
1084 1084
 
1085 1085
 		$sql = "SELECT rowid, code";
1086
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1086
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1087 1087
 		$sql .= " WHERE active > 0";
1088 1088
 		$sql .= " ORDER BY code ASC";
1089 1089
 
1090
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1090
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1091 1091
 		$resql = $this->db->query($sql);
1092 1092
 		if ($resql) {
1093 1093
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1094
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1094
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1095 1095
 				$out .= ajax_combobox($htmlname, $events);
1096 1096
 			}
1097 1097
 
1098 1098
 			if (!empty($page)) {
1099
-				$out .= '<form method="post" action="' . $page . '">';
1099
+				$out .= '<form method="post" action="'.$page.'">';
1100 1100
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1101
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1101
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1102 1102
 			}
1103 1103
 
1104
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1104
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1105 1105
 			$out .= '<option value="0">&nbsp;</option>';
1106 1106
 			$num = $this->db->num_rows($resql);
1107 1107
 			$i = 0;
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
 				foreach ($incotermArray as $row) {
1117 1117
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1118
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1118
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1119 1119
 					} else {
1120
-						$out .= '<option value="' . $row['rowid'] . '">';
1120
+						$out .= '<option value="'.$row['rowid'].'">';
1121 1121
 					}
1122 1122
 
1123 1123
 					if ($row['code']) {
@@ -1130,13 +1130,13 @@  discard block
 block discarded – undo
1130 1130
 			$out .= '</select>';
1131 1131
 
1132 1132
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1133
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1133
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1134 1134
 				$moreattrib .= ' autocomplete="off"';
1135 1135
 			}
1136
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1136
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1137 1137
 
1138 1138
 			if (!empty($page)) {
1139
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1139
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1140 1140
 			}
1141 1141
 		} else {
1142 1142
 			dol_print_error($this->db);
@@ -1168,9 +1168,9 @@  discard block
 block discarded – undo
1168 1168
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1169 1169
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1170 1170
 			if (empty($hidetext)) {
1171
-				print $langs->trans("Type") . ': ';
1171
+				print $langs->trans("Type").': ';
1172 1172
 			}
1173
-			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1173
+			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1174 1174
 			if ($showempty) {
1175 1175
 				print '<option value="-1"';
1176 1176
 				if ($selected == -1) {
@@ -1189,28 +1189,28 @@  discard block
 block discarded – undo
1189 1189
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1190 1190
 				print ' selected';
1191 1191
 			}
1192
-			print '>' . $langs->trans("Product");
1192
+			print '>'.$langs->trans("Product");
1193 1193
 
1194 1194
 			print '<option value="1"';
1195 1195
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1196 1196
 				print ' selected';
1197 1197
 			}
1198
-			print '>' . $langs->trans("Service");
1198
+			print '>'.$langs->trans("Service");
1199 1199
 
1200 1200
 			print '</select>';
1201
-			print ajax_combobox('select_' . $htmlname);
1201
+			print ajax_combobox('select_'.$htmlname);
1202 1202
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1203 1203
 		}
1204 1204
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1205 1205
 			print $langs->trans("Service");
1206
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1206
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1207 1207
 		}
1208 1208
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1209 1209
 			print $langs->trans("Product");
1210
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1210
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1211 1211
 		}
1212 1212
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1213
-			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
1213
+			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
1214 1214
 		}
1215 1215
 	}
1216 1216
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		$langs->load("trips");
1237 1237
 
1238 1238
 		$sql = "SELECT c.code, c.label";
1239
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1239
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1240 1240
 		$sql .= " WHERE active > 0";
1241 1241
 
1242 1242
 		$resql = $this->db->query($sql);
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 		// phpcs:enable
1278 1278
 		global $user, $langs;
1279 1279
 
1280
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1280
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1281 1281
 
1282 1282
 		$this->load_cache_types_fees();
1283 1283
 
1284
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1284
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1285 1285
 		if ($showempty) {
1286 1286
 			print '<option value="-1"';
1287 1287
 			if ($selected == -1) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 		}
1292 1292
 
1293 1293
 		foreach ($this->cache_types_fees as $key => $value) {
1294
-			print '<option value="' . $key . '"';
1294
+			print '<option value="'.$key.'"';
1295 1295
 			if ($key == $selected) {
1296 1296
 				print ' selected';
1297 1297
 			}
@@ -1343,12 +1343,12 @@  discard block
 block discarded – undo
1343 1343
 				$ajaxoptions = array();
1344 1344
 			}
1345 1345
 
1346
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1346
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1347 1347
 
1348 1348
 			// No immediate load of all database
1349 1349
 			$placeholder = '';
1350 1350
 			if ($selected && empty($selected_input_value)) {
1351
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1351
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1352 1352
 				$societetmp = new Societe($this->db);
1353 1353
 				$societetmp->fetch($selected);
1354 1354
 				$selected_input_value = $societetmp->name;
@@ -1356,18 +1356,18 @@  discard block
 block discarded – undo
1356 1356
 			}
1357 1357
 
1358 1358
 			// mode 1
1359
-			$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)) : '');
1359
+			$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)) : '');
1360 1360
 
1361 1361
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1362 1362
 			if (empty($hidelabel)) {
1363
-				print $langs->trans("RefOrLabel") . ' : ';
1363
+				print $langs->trans("RefOrLabel").' : ';
1364 1364
 			} elseif ($hidelabel > 1) {
1365 1365
 				$placeholder = $langs->trans("RefOrLabel");
1366 1366
 				if ($hidelabel == 2) {
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 {
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 		}
1800 1800
 
1801 1801
 		if (!is_object($hookmanager)) {
1802
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1802
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1803 1803
 			$hookmanager = new HookManager($this->db);
1804 1804
 		}
1805 1805
 
@@ -1808,13 +1808,13 @@  discard block
 block discarded – undo
1808 1808
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1809 1809
 			$sql .= ", s.nom as company, s.town AS company_town";
1810 1810
 		}
1811
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1811
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1812 1812
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1813
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1813
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1814 1814
 		}
1815
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1815
+		$sql .= " WHERE sp.entity IN (".getEntity('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,10 +2260,10 @@  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
 				if ($show_every) {
2266
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2266
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2267 2267
 				}
2268 2268
 
2269 2269
 				$userstatic = new User($this->db);
@@ -2311,21 +2311,21 @@  discard block
 block discarded – undo
2311 2311
 					}
2312 2312
 					if ($showstatus >= 0) {
2313 2313
 						if ($obj->status == 1 && $showstatus == 1) {
2314
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2315
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2314
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2315
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2316 2316
 						}
2317 2317
 						if ($obj->status == 0 && $showstatus == 1) {
2318
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2319
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2318
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2319
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2320 2320
 						}
2321 2321
 					}
2322 2322
 					if ($showlabelofentity) {
2323 2323
 						if (empty($obj->entity)) {
2324
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2325
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2324
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2325
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2326 2326
 						} else {
2327 2327
 							if ($obj->entity != $conf->entity) {
2328
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2328
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2329 2329
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2330 2330
 							}
2331 2331
 						}
@@ -2334,13 +2334,13 @@  discard block
 block discarded – undo
2334 2334
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2335 2335
 					if (!empty($disableline) && $disableline != '1') {
2336 2336
 						// Add text from $enableonlytext parameter
2337
-						$moreinfo .= ' - ' . $disableline;
2338
-						$moreinfohtml .= ' - ' . $disableline;
2337
+						$moreinfo .= ' - '.$disableline;
2338
+						$moreinfohtml .= ' - '.$disableline;
2339 2339
 					}
2340 2340
 					$labeltoshow .= $moreinfo;
2341 2341
 					$labeltoshowhtml .= $moreinfohtml;
2342 2342
 
2343
-					$out .= '<option value="' . $obj->rowid . '"';
2343
+					$out .= '<option value="'.$obj->rowid.'"';
2344 2344
 					if (!empty($disableline)) {
2345 2345
 						$out .= ' disabled';
2346 2346
 					}
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 					}
2350 2350
 					$out .= ' data-html="';
2351 2351
 
2352
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2352
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2353 2353
 					if ($showstatus >= 0 && $obj->status == 0) {
2354 2354
 						$outhtml .= '<strike class="opacitymediumxxx">';
2355 2355
 					}
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 					$out .= $labeltoshow;
2365 2365
 					$out .= '</option>';
2366 2366
 
2367
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2367
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2368 2368
 					$outarray2[$userstatic->id] = array(
2369 2369
 						'id' => $userstatic->id,
2370 2370
 						'label' => $labeltoshow,
@@ -2376,14 +2376,14 @@  discard block
 block discarded – undo
2376 2376
 					$i++;
2377 2377
 				}
2378 2378
 			} else {
2379
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2380
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2379
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2380
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2381 2381
 			}
2382 2382
 			$out .= '</select>';
2383 2383
 
2384 2384
 			if ($num && !$forcecombo) {
2385 2385
 				// Enhance with select2
2386
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2386
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2387 2387
 				$out .= ajax_combobox($htmlname);
2388 2388
 			}
2389 2389
 		} else {
@@ -2459,16 +2459,16 @@  discard block
 block discarded – undo
2459 2459
 			$out .= $userstatic->getNomUrl(-1);
2460 2460
 			if ($i == 0) {
2461 2461
 				$ownerid = $value['id'];
2462
-				$out .= ' (' . $langs->trans("Owner") . ')';
2462
+				$out .= ' ('.$langs->trans("Owner").')';
2463 2463
 			}
2464 2464
 			if ($nbassignetouser > 1 && $action != 'view') {
2465
-				$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 . '">';
2465
+				$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.'">';
2466 2466
 			}
2467 2467
 			// Show my availability
2468 2468
 			if ($showproperties) {
2469 2469
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2470 2470
 					$out .= '<div class="myavailability inline-block">';
2471
-					$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>';
2471
+					$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>';
2472 2472
 					$out .= '</div>';
2473 2473
 				}
2474 2474
 			}
@@ -2485,15 +2485,15 @@  discard block
 block discarded – undo
2485 2485
 		// Method with no ajax
2486 2486
 		if ($action != 'view') {
2487 2487
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2488
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2488
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2489 2489
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2490 2490
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2491
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2492
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2491
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2492
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2493 2493
 			$out .= '});';
2494 2494
 			$out .= '})</script>';
2495 2495
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2496
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2496
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2497 2497
 			$out .= '<br>';
2498 2498
 		}
2499 2499
 
@@ -2552,13 +2552,13 @@  discard block
 block discarded – undo
2552 2552
 			$resourcestatic->fetch($value['id']);
2553 2553
 			$out .= $resourcestatic->getNomUrl(-1);
2554 2554
 			if ($nbassignetoresource > 1 && $action != 'view') {
2555
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2555
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2556 2556
 			}
2557 2557
 			// Show my availability
2558 2558
 			if ($showproperties) {
2559 2559
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2560 2560
 					$out .= '<div class="myavailability inline-block">';
2561
-					$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>';
2561
+					$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>';
2562 2562
 					$out .= '</div>';
2563 2563
 				}
2564 2564
 			}
@@ -2575,11 +2575,11 @@  discard block
 block discarded – undo
2575 2575
 		// Method with no ajax
2576 2576
 		if ($action != 'view') {
2577 2577
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';
2578
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2578
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2579 2579
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2580 2580
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2581
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2582
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2581
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2582
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2583 2583
 			$out .= '});';
2584 2584
 			$out .= '})</script>';
2585 2585
 
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2588 2588
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2589 2589
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2590
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2590
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2591 2591
 			$out .= '<br>';
2592 2592
 		}
2593 2593
 
@@ -2649,7 +2649,7 @@  discard block
 block discarded – undo
2649 2649
 			$placeholder = '';
2650 2650
 
2651 2651
 			if ($selected && empty($selected_input_value)) {
2652
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2652
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2653 2653
 				$producttmpselect = new Product($this->db);
2654 2654
 				$producttmpselect->fetch($selected);
2655 2655
 				$selected_input_value = $producttmpselect->ref;
@@ -2664,17 +2664,17 @@  discard block
 block discarded – undo
2664 2664
 				}
2665 2665
 			}
2666 2666
 			// mode=1 means customers products
2667
-			$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;
2668
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2667
+			$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;
2668
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2669 2669
 
2670 2670
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2671 2671
 				// Code to automatically insert with javascript the select of attributes under the select of product
2672 2672
 				// when a parent of variant has been selected.
2673 2673
 				$out .= '
2674 2674
 				<!-- script to auto show attributes select tags if a variant was selected -->
2675
-				<script nonce="' . getNonce() . '">
2675
+				<script nonce="' . getNonce().'">
2676 2676
 					// auto show attributes fields
2677
-					selected = ' . json_encode($selected_combinations) . ';
2677
+					selected = ' . json_encode($selected_combinations).';
2678 2678
 					combvalues = {};
2679 2679
 
2680 2680
 					jQuery(document).ready(function () {
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
 							}
2686 2686
 						});
2687 2687
 
2688
-						jQuery("input#' . $htmlname . '").change(function () {
2688
+						jQuery("input#' . $htmlname.'").change(function () {
2689 2689
 
2690 2690
 							if (!jQuery(this).val()) {
2691 2691
 								jQuery(\'div#attributes_box\').empty();
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
 
2695 2695
 							console.log("A change has started. We get variants fields to inject html select");
2696 2696
 
2697
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2697
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2698 2698
 								id: jQuery(this).val()
2699 2699
 							}, function (data) {
2700 2700
 								jQuery(\'div#attributes_box\').empty();
@@ -2737,21 +2737,21 @@  discard block
 block discarded – undo
2737 2737
 							})
2738 2738
 						});
2739 2739
 
2740
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2740
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2741 2741
 					});
2742 2742
 				</script>
2743 2743
                 ';
2744 2744
 			}
2745 2745
 
2746 2746
 			if (empty($hidelabel)) {
2747
-				$out .= $langs->trans("RefOrLabel") . ' : ';
2747
+				$out .= $langs->trans("RefOrLabel").' : ';
2748 2748
 			} elseif ($hidelabel > 1) {
2749
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2749
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2750 2750
 				if ($hidelabel == 2) {
2751 2751
 					$out .= img_picto($langs->trans("Search"), 'search');
2752 2752
 				}
2753 2753
 			}
2754
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2754
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2755 2755
 			if ($hidelabel == 3) {
2756 2756
 				$out .= img_picto($langs->trans("Search"), 'search');
2757 2757
 			}
@@ -2788,33 +2788,33 @@  discard block
 block discarded – undo
2788 2788
 		// phpcs:enable
2789 2789
 		global $db;
2790 2790
 
2791
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2791
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2792 2792
 
2793 2793
 		$error = 0;
2794 2794
 		$out = '';
2795 2795
 
2796 2796
 		if (!$forcecombo) {
2797
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2797
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2798 2798
 			$events = array();
2799 2799
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2800 2800
 		}
2801 2801
 
2802
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2802
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2803 2803
 
2804 2804
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2805
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2806
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2805
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2806
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2807 2807
 		if (!empty($status)) {
2808
-			$sql .= ' AND status = ' . (int) $status;
2808
+			$sql .= ' AND status = '.(int) $status;
2809 2809
 		}
2810 2810
 		if (!empty($type)) {
2811
-			$sql .= ' AND bomtype = ' . (int) $type;
2811
+			$sql .= ' AND bomtype = '.(int) $type;
2812 2812
 		}
2813 2813
 		if (!empty($TProducts)) {
2814
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2814
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2815 2815
 		}
2816 2816
 		if (!empty($limit)) {
2817
-			$sql .= ' LIMIT ' . (int) $limit;
2817
+			$sql .= ' LIMIT '.(int) $limit;
2818 2818
 		}
2819 2819
 		$resql = $db->query($sql);
2820 2820
 		if ($resql) {
@@ -2828,11 +2828,11 @@  discard block
 block discarded – undo
2828 2828
 			while ($obj = $db->fetch_object($resql)) {
2829 2829
 				$product = new Product($db);
2830 2830
 				$res = $product->fetch($obj->fk_product);
2831
-				$out .= '<option value="' . $obj->rowid . '"';
2831
+				$out .= '<option value="'.$obj->rowid.'"';
2832 2832
 				if ($obj->rowid == $selected) {
2833 2833
 					$out .= 'selected';
2834 2834
 				}
2835
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2835
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2836 2836
 			}
2837 2837
 		} else {
2838 2838
 			$error++;
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
 		$warehouseStatusArray = array();
2891 2891
 		if (!empty($warehouseStatus)) {
2892
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2892
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2893 2893
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2894 2894
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2895 2895
 			}
@@ -2903,9 +2903,9 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
 		$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";
2905 2905
 		if (count($warehouseStatusArray)) {
2906
-			$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
2906
+			$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
2907 2907
 		} else {
2908
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2908
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2909 2909
 		}
2910 2910
 
2911 2911
 		$sql = "SELECT ";
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
 
2922 2922
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2923 2923
 			//Product category
2924
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2925
-						FROM " . $this->db->prefix() . "categorie_product
2926
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2924
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2925
+						FROM " . $this->db->prefix()."categorie_product
2926
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2927 2927
 						LIMIT 1
2928 2928
 				) AS categorie_product_id ";
2929 2929
 		}
@@ -2949,15 +2949,15 @@  discard block
 block discarded – undo
2949 2949
 		}
2950 2950
 		// Price by quantity
2951 2951
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2952
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2952
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2953 2953
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2954
-				$sql .= " AND price_level = " . ((int) $price_level);
2954
+				$sql .= " AND price_level = ".((int) $price_level);
2955 2955
 			}
2956 2956
 			$sql .= " ORDER BY date_price";
2957 2957
 			$sql .= " DESC LIMIT 1) as price_rowid";
2958
-			$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
2958
+			$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
2959 2959
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2960
-				$sql .= " AND price_level = " . ((int) $price_level);
2960
+				$sql .= " AND price_level = ".((int) $price_level);
2961 2961
 			}
2962 2962
 			$sql .= " ORDER BY date_price";
2963 2963
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2967,7 +2967,7 @@  discard block
 block discarded – undo
2967 2967
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2968 2968
 
2969 2969
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
2970
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
2970
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
2971 2971
 		}
2972 2972
 
2973 2973
 		// Add from (left join) from hooks
@@ -2976,53 +2976,53 @@  discard block
 block discarded – undo
2976 2976
 		$sql .= $hookmanager->resPrint;
2977 2977
 
2978 2978
 		if (count($warehouseStatusArray)) {
2979
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
2980
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
2981
-			$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.
2979
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
2980
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
2981
+			$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.
2982 2982
 		}
2983 2983
 
2984 2984
 		// include search in supplier ref
2985 2985
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
2986
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2986
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2987 2987
 		}
2988 2988
 
2989 2989
 		//Price by customer
2990 2990
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
2991
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
2991
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
2992 2992
 		}
2993 2993
 		// Units
2994 2994
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
2995
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
2995
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
2996 2996
 		}
2997 2997
 		// Multilang : we add translation
2998 2998
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
2999
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
2999
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3000 3000
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3001
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3001
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3002 3002
 				$soc = new Societe($this->db);
3003 3003
 				$result = $soc->fetch($socid);
3004 3004
 				if ($result > 0 && !empty($soc->default_lang)) {
3005
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3005
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3006 3006
 				} else {
3007
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3007
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3008 3008
 				}
3009 3009
 			} else {
3010
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3010
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3011 3011
 			}
3012 3012
 		}
3013 3013
 
3014 3014
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3015
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3015
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3016 3016
 		}
3017 3017
 
3018
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3018
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3019 3019
 
3020 3020
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3021 3021
 			$sql .= " AND pac.rowid IS NULL";
3022 3022
 		}
3023 3023
 
3024 3024
 		if ($finished == 0) {
3025
-			$sql .= " AND p.finished = " . ((int) $finished);
3025
+			$sql .= " AND p.finished = ".((int) $finished);
3026 3026
 		} elseif ($finished == 1) {
3027 3027
 			$sql .= " AND p.finished = ".((int) $finished);
3028 3028
 		}
@@ -3030,11 +3030,11 @@  discard block
 block discarded – undo
3030 3030
 			$sql .= " AND p.tosell = ".((int) $status);
3031 3031
 		}
3032 3032
 		if ($status_purchase >= 0) {
3033
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3033
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3034 3034
 		}
3035 3035
 		// Filter by product type
3036 3036
 		if (strval($filtertype) != '') {
3037
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3037
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3038 3038
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3039 3039
 			$sql .= " AND p.fk_product_type = 1";
3040 3040
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3058,21 +3058,21 @@  discard block
 block discarded – undo
3058 3058
 				if ($i > 0) {
3059 3059
 					$sql .= " AND ";
3060 3060
 				}
3061
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3061
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3062 3062
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3063
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3063
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3064 3064
 				}
3065 3065
 				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
3066
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3066
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3067 3067
 				}
3068 3068
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3069
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3069
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3070 3070
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3071
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3071
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3072 3072
 					}
3073 3073
 				}
3074 3074
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3075
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3075
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3076 3076
 				}
3077 3077
 				$sql .= ")";
3078 3078
 				$i++;
@@ -3081,12 +3081,12 @@  discard block
 block discarded – undo
3081 3081
 				$sql .= ")";
3082 3082
 			}
3083 3083
 			if (isModEnabled('barcode')) {
3084
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3084
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3085 3085
 			}
3086 3086
 			$sql .= ')';
3087 3087
 		}
3088 3088
 		if (count($warehouseStatusArray)) {
3089
-			$sql .= " GROUP BY " . $selectFields;
3089
+			$sql .= " GROUP BY ".$selectFields;
3090 3090
 		}
3091 3091
 
3092 3092
 		//Sort by category
@@ -3101,23 +3101,23 @@  discard block
 block discarded – undo
3101 3101
 		$sql .= $this->db->plimit($limit, 0);
3102 3102
 
3103 3103
 		// Build output string
3104
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3104
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3105 3105
 		$result = $this->db->query($sql);
3106 3106
 		if ($result) {
3107
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3108
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3109
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3107
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3108
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3109
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3110 3110
 
3111 3111
 			$num = $this->db->num_rows($result);
3112 3112
 
3113 3113
 			$events = array();
3114 3114
 
3115 3115
 			if (!$forcecombo) {
3116
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3116
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3117 3117
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3118 3118
 			}
3119 3119
 
3120
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3120
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3121 3121
 
3122 3122
 			$textifempty = '';
3123 3123
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3134,7 +3134,7 @@  discard block
 block discarded – undo
3134 3134
 				}
3135 3135
 			}
3136 3136
 			if ($showempty) {
3137
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3137
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3138 3138
 			}
3139 3139
 
3140 3140
 			$i = 0;
@@ -3145,11 +3145,11 @@  discard block
 block discarded – undo
3145 3145
 
3146 3146
 				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
3147 3147
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3148
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3149
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3148
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3149
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3150 3150
 					$sql .= " ORDER BY quantity ASC";
3151 3151
 
3152
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3152
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3153 3153
 					$result2 = $this->db->query($sql);
3154 3154
 					if ($result2) {
3155 3155
 						$nb_prices = $this->db->num_rows($result2);
@@ -3187,7 +3187,7 @@  discard block
 block discarded – undo
3187 3187
 						$price_product = new Product($this->db);
3188 3188
 						$price_product->fetch($objp->rowid, '', '', 1);
3189 3189
 
3190
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3190
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3191 3191
 						$priceparser = new PriceParser($this->db);
3192 3192
 						$price_result = $priceparser->parseProduct($price_product);
3193 3193
 						if ($price_result >= 0) {
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
 			$label = $objp->label_translated;
3272 3272
 		}
3273 3273
 		if (!empty($filterkey) && $filterkey != '') {
3274
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3274
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3275 3275
 		}
3276 3276
 
3277 3277
 		$outkey = $objp->rowid;
@@ -3292,32 +3292,32 @@  discard block
 block discarded – undo
3292 3292
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3293 3293
 
3294 3294
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3295
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3295
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3296 3296
 		}
3297 3297
 
3298 3298
 		// Units
3299 3299
 		$outvalUnits = '';
3300 3300
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3301 3301
 			if (!empty($objp->unit_short)) {
3302
-				$outvalUnits .= ' - ' . $objp->unit_short;
3302
+				$outvalUnits .= ' - '.$objp->unit_short;
3303 3303
 			}
3304 3304
 		}
3305 3305
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3306 3306
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3307 3307
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3308
-				$outvalUnits .= ' - ' . $unitToShow;
3308
+				$outvalUnits .= ' - '.$unitToShow;
3309 3309
 			}
3310 3310
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3311
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3312
-				$outvalUnits .= ' - ' . $unitToShow;
3311
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3312
+				$outvalUnits .= ' - '.$unitToShow;
3313 3313
 			}
3314 3314
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3315 3315
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3316
-				$outvalUnits .= ' - ' . $unitToShow;
3316
+				$outvalUnits .= ' - '.$unitToShow;
3317 3317
 			}
3318 3318
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3319 3319
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3320
-				$outvalUnits .= ' - ' . $unitToShow;
3320
+				$outvalUnits .= ' - '.$unitToShow;
3321 3321
 			}
3322 3322
 		}
3323 3323
 		if ($outdurationvalue && $outdurationunit) {
@@ -3329,14 +3329,14 @@  discard block
 block discarded – undo
3329 3329
 				'y' => $langs->trans('Year')
3330 3330
 			);
3331 3331
 			if (isset($da[$outdurationunit])) {
3332
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3332
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3333 3333
 			}
3334 3334
 		}
3335 3335
 
3336
-		$opt = '<option value="' . $objp->rowid . '"';
3336
+		$opt = '<option value="'.$objp->rowid.'"';
3337 3337
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3338 3338
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3339
-			$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 . '"';
3339
+			$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.'"';
3340 3340
 		}
3341 3341
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3342 3342
 			if ($user->hasRight('stock', 'lire')) {
@@ -3348,36 +3348,36 @@  discard block
 block discarded – undo
3348 3348
 			}
3349 3349
 		}
3350 3350
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3351
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3352
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3351
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3352
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3353 3353
 		}
3354 3354
 		$opt .= '>';
3355 3355
 		$opt .= $objp->ref;
3356 3356
 		if (!empty($objp->custref)) {
3357
-			$opt .= ' (' . $objp->custref . ')';
3357
+			$opt .= ' ('.$objp->custref.')';
3358 3358
 		}
3359 3359
 		if ($outbarcode) {
3360
-			$opt .= ' (' . $outbarcode . ')';
3360
+			$opt .= ' ('.$outbarcode.')';
3361 3361
 		}
3362
-		$opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
3362
+		$opt .= ' - '.dol_trunc($label, $maxlengtharticle);
3363 3363
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3364
-			$opt .= ' (' . getCountry($outorigin, 1) . ')';
3364
+			$opt .= ' ('.getCountry($outorigin, 1).')';
3365 3365
 		}
3366 3366
 
3367 3367
 		$objRef = $objp->ref;
3368 3368
 		if (!empty($objp->custref)) {
3369
-			$objRef .= ' (' . $objp->custref . ')';
3369
+			$objRef .= ' ('.$objp->custref.')';
3370 3370
 		}
3371 3371
 		if (!empty($filterkey) && $filterkey != '') {
3372
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3372
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3373 3373
 		}
3374 3374
 		$outval .= $objRef;
3375 3375
 		if ($outbarcode) {
3376
-			$outval .= ' (' . $outbarcode . ')';
3376
+			$outval .= ' ('.$outbarcode.')';
3377 3377
 		}
3378
-		$outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
3378
+		$outval .= ' - '.dol_trunc($label, $maxlengtharticle);
3379 3379
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3380
-			$outval .= ' (' . getCountry($outorigin, 1) . ')';
3380
+			$outval .= ' ('.getCountry($outorigin, 1).')';
3381 3381
 		}
3382 3382
 
3383 3383
 		// Units
@@ -3390,35 +3390,35 @@  discard block
 block discarded – undo
3390 3390
 		// If we need a particular price level (from 1 to n)
3391 3391
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) {
3392 3392
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3393
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3394
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3395
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3396
-			$sql .= " AND price_level = " . ((int) $price_level);
3393
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3394
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3395
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3396
+			$sql .= " AND price_level = ".((int) $price_level);
3397 3397
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3398 3398
 			$sql .= " LIMIT 1";
3399 3399
 
3400
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3400
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3401 3401
 			$result2 = $this->db->query($sql);
3402 3402
 			if ($result2) {
3403 3403
 				$objp2 = $this->db->fetch_object($result2);
3404 3404
 				if ($objp2) {
3405 3405
 					$found = 1;
3406 3406
 					if ($objp2->price_base_type == 'HT') {
3407
-						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3408
-						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3407
+						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3408
+						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3409 3409
 					} else {
3410
-						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3411
-						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3410
+						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3411
+						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3412 3412
 					}
3413 3413
 					$outprice_ht = price($objp2->price);
3414 3414
 					$outprice_ttc = price($objp2->price_ttc);
3415 3415
 					$outpricebasetype = $objp2->price_base_type;
3416 3416
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3417
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3418
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3417
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3418
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3419 3419
 					} else {
3420
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3421
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3420
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3421
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3422 3422
 					}
3423 3423
 				}
3424 3424
 			} else {
@@ -3432,13 +3432,13 @@  discard block
 block discarded – undo
3432 3432
 			$outqty = $objp->quantity;
3433 3433
 			$outdiscount = $objp->remise_percent;
3434 3434
 			if ($objp->quantity == 1) {
3435
-				$opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3436
-				$outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3435
+				$opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3436
+				$outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3437 3437
 				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3438 3438
 				$outval .= $langs->transnoentities("Unit");
3439 3439
 			} else {
3440
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3441
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3440
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3441
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3442 3442
 				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3443 3443
 				$outval .= $langs->transnoentities("Units");
3444 3444
 			}
@@ -3446,16 +3446,16 @@  discard block
 block discarded – undo
3446 3446
 			$outprice_ht = price($objp->unitprice);
3447 3447
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3448 3448
 			$outpricebasetype = $objp->price_base_type;
3449
-			$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
3450
-			$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
3449
+			$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
3450
+			$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
3451 3451
 		}
3452 3452
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3453
-			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3454
-			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3453
+			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3454
+			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3455 3455
 		}
3456 3456
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3457
-			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3458
-			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3457
+			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3458
+			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3459 3459
 		}
3460 3460
 
3461 3461
 		// Price by customer
@@ -3464,11 +3464,11 @@  discard block
 block discarded – undo
3464 3464
 				$found = 1;
3465 3465
 
3466 3466
 				if ($objp->custprice_base_type == 'HT') {
3467
-					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3468
-					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3467
+					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3468
+					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3469 3469
 				} else {
3470
-					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3471
-					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3470
+					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3471
+					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3472 3472
 				}
3473 3473
 
3474 3474
 				$outprice_ht = price($objp->custprice);
@@ -3482,11 +3482,11 @@  discard block
 block discarded – undo
3482 3482
 		// If level no defined or multiprice not found, we used the default price
3483 3483
 		if (empty($hidepriceinlabel) && !$found) {
3484 3484
 			if ($objp->price_base_type == 'HT') {
3485
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3486
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3485
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3486
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3487 3487
 			} else {
3488
-				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3489
-				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3488
+				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3489
+				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3490 3490
 			}
3491 3491
 			$outprice_ht = price($objp->price);
3492 3492
 			$outprice_ttc = price($objp->price_ttc);
@@ -3497,14 +3497,14 @@  discard block
 block discarded – undo
3497 3497
 
3498 3498
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3499 3499
 			if ($user->hasRight('stock', 'lire')) {
3500
-				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3500
+				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3501 3501
 
3502 3502
 				if ($objp->stock > 0) {
3503 3503
 					$outval .= ' - <span class="product_line_stock_ok">';
3504 3504
 				} elseif ($objp->stock <= 0) {
3505 3505
 					$outval .= ' - <span class="product_line_stock_too_low">';
3506 3506
 				}
3507
-				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3507
+				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
3508 3508
 				$outval .= '</span>';
3509 3509
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3510 3510
 					$langs->load("stocks");
@@ -3514,9 +3514,9 @@  discard block
 block discarded – undo
3514 3514
 					$tmpproduct->load_virtual_stock();
3515 3515
 					$virtualstock = $tmpproduct->stock_theorique;
3516 3516
 
3517
-					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3517
+					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3518 3518
 
3519
-					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3519
+					$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
3520 3520
 					if ($virtualstock > 0) {
3521 3521
 						$outval .= '<span class="product_line_stock_ok">';
3522 3522
 					} elseif ($virtualstock <= 0) {
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 		$selected_input_value = '';
3595 3595
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3596 3596
 			if ($selected > 0) {
3597
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3597
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3598 3598
 				$producttmpselect = new Product($this->db);
3599 3599
 				$producttmpselect->fetch($selected);
3600 3600
 				$selected_input_value = $producttmpselect->ref;
@@ -3602,10 +3602,10 @@  discard block
 block discarded – undo
3602 3602
 			}
3603 3603
 
3604 3604
 			// mode=2 means suppliers products
3605
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3606
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3605
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3606
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3607 3607
 
3608
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3608
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3609 3609
 		} else {
3610 3610
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3611 3611
 		}
@@ -3665,25 +3665,25 @@  discard block
 block discarded – undo
3665 3665
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3666 3666
 			$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";
3667 3667
 		}
3668
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3669
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3668
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3669
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3670 3670
 		if ($socid > 0) {
3671
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3671
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3672 3672
 		}
3673
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3673
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3674 3674
 		// Units
3675 3675
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3676
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3676
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3677 3677
 		}
3678
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3678
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3679 3679
 		if ($statut != -1) {
3680
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3680
+			$sql .= " AND p.tobuy = ".((int) $statut);
3681 3681
 		}
3682 3682
 		if (strval($filtertype) != '') {
3683
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3683
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3684 3684
 		}
3685 3685
 		if (!empty($filtre)) {
3686
-			$sql .= " " . $filtre;
3686
+			$sql .= " ".$filtre;
3687 3687
 		}
3688 3688
 		// Add where from hooks
3689 3689
 		$parameters = array();
@@ -3703,9 +3703,9 @@  discard block
 block discarded – undo
3703 3703
 				if ($i > 0) {
3704 3704
 					$sql .= " AND ";
3705 3705
 				}
3706
-				$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) . "%'";
3706
+				$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)."%'";
3707 3707
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3708
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3708
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3709 3709
 				}
3710 3710
 				$sql .= ")";
3711 3711
 				$i++;
@@ -3714,8 +3714,8 @@  discard block
 block discarded – undo
3714 3714
 				$sql .= ")";
3715 3715
 			}
3716 3716
 			if (isModEnabled('barcode')) {
3717
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3718
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3717
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3718
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3719 3719
 			}
3720 3720
 			$sql .= ')';
3721 3721
 		}
@@ -3724,20 +3724,20 @@  discard block
 block discarded – undo
3724 3724
 
3725 3725
 		// Build output string
3726 3726
 
3727
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3727
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3728 3728
 		$result = $this->db->query($sql);
3729 3729
 		if ($result) {
3730
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3731
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3730
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3731
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3732 3732
 
3733 3733
 			$num = $this->db->num_rows($result);
3734 3734
 
3735 3735
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3736
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3736
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3737 3737
 			if (!$selected) {
3738
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3738
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3739 3739
 			} else {
3740
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3740
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3741 3741
 			}
3742 3742
 
3743 3743
 			$i = 0;
@@ -3752,7 +3752,7 @@  discard block
 block discarded – undo
3752 3752
 
3753 3753
 				$outkey = $objp->idprodfournprice; // id in table of price
3754 3754
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3755
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3755
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3756 3756
 				}
3757 3757
 
3758 3758
 				$outref = $objp->ref;
@@ -3767,23 +3767,23 @@  discard block
 block discarded – undo
3767 3767
 				$outvalUnits = '';
3768 3768
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3769 3769
 					if (!empty($objp->unit_short)) {
3770
-						$outvalUnits .= ' - ' . $objp->unit_short;
3770
+						$outvalUnits .= ' - '.$objp->unit_short;
3771 3771
 					}
3772 3772
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3773 3773
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3774
-						$outvalUnits .= ' - ' . $unitToShow;
3774
+						$outvalUnits .= ' - '.$unitToShow;
3775 3775
 					}
3776 3776
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3777
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3778
-						$outvalUnits .= ' - ' . $unitToShow;
3777
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3778
+						$outvalUnits .= ' - '.$unitToShow;
3779 3779
 					}
3780 3780
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3781 3781
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3782
-						$outvalUnits .= ' - ' . $unitToShow;
3782
+						$outvalUnits .= ' - '.$unitToShow;
3783 3783
 					}
3784 3784
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3785 3785
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3786
-						$outvalUnits .= ' - ' . $unitToShow;
3786
+						$outvalUnits .= ' - '.$unitToShow;
3787 3787
 					}
3788 3788
 					if ($outdurationvalue && $outdurationunit) {
3789 3789
 						$da = array(
@@ -3794,22 +3794,22 @@  discard block
 block discarded – undo
3794 3794
 							'y' => $langs->trans('Year')
3795 3795
 						);
3796 3796
 						if (isset($da[$outdurationunit])) {
3797
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3797
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3798 3798
 						}
3799 3799
 					}
3800 3800
 				}
3801 3801
 
3802 3802
 				$objRef = $objp->ref;
3803 3803
 				if ($filterkey && $filterkey != '') {
3804
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3804
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3805 3805
 				}
3806 3806
 				$objRefFourn = $objp->ref_fourn;
3807 3807
 				if ($filterkey && $filterkey != '') {
3808
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3808
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3809 3809
 				}
3810 3810
 				$label = $objp->label;
3811 3811
 				if ($filterkey && $filterkey != '') {
3812
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3812
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3813 3813
 				}
3814 3814
 
3815 3815
 				switch ($objp->fk_product_type) {
@@ -3832,21 +3832,21 @@  discard block
 block discarded – undo
3832 3832
 
3833 3833
 				$optlabel .= $objp->ref;
3834 3834
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3835
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3835
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3836 3836
 				}
3837 3837
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3838
-					$optlabel .= ' (' . $outbarcode . ')';
3838
+					$optlabel .= ' ('.$outbarcode.')';
3839 3839
 				}
3840
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3840
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3841 3841
 
3842 3842
 				$outvallabel = $objRef;
3843 3843
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3844
-					$outvallabel .= ' (' . $objRefFourn . ')';
3844
+					$outvallabel .= ' ('.$objRefFourn.')';
3845 3845
 				}
3846 3846
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3847
-					$outvallabel .= ' (' . $outbarcode . ')';
3847
+					$outvallabel .= ' ('.$outbarcode.')';
3848 3848
 				}
3849
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3849
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3850 3850
 
3851 3851
 				// Units
3852 3852
 				$optlabel .= $outvalUnits;
@@ -3863,7 +3863,7 @@  discard block
 block discarded – undo
3863 3863
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3864 3864
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3865 3865
 
3866
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3866
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3867 3867
 						$priceparser = new PriceParser($this->db);
3868 3868
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3869 3869
 						if ($price_result >= 0) {
@@ -3874,57 +3874,57 @@  discard block
 block discarded – undo
3874 3874
 						}
3875 3875
 					}
3876 3876
 					if ($objp->quantity == 1) {
3877
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3878
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3877
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3878
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3879 3879
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3880 3880
 						$outvallabel .= $langs->transnoentities("Unit");
3881 3881
 					} else {
3882
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3883
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3884
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3885
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3882
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3883
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3884
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3885
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3886 3886
 					}
3887 3887
 
3888 3888
 					if ($objp->quantity > 1) {
3889
-						$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
3890
-						$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
3889
+						$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
3890
+						$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
3891 3891
 					}
3892 3892
 					if ($objp->remise_percent >= 1) {
3893
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3894
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3893
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3894
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3895 3895
 					}
3896 3896
 					if ($objp->duration) {
3897
-						$optlabel .= " - " . $objp->duration;
3898
-						$outvallabel .= " - " . $objp->duration;
3897
+						$optlabel .= " - ".$objp->duration;
3898
+						$outvallabel .= " - ".$objp->duration;
3899 3899
 					}
3900 3900
 					if (!$socid) {
3901
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3902
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3901
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3902
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3903 3903
 					}
3904 3904
 					if ($objp->supplier_reputation) {
3905 3905
 						//TODO dictionary
3906 3906
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3907 3907
 
3908
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3909
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3908
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3909
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3910 3910
 					}
3911 3911
 				} else {
3912
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3913
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3912
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3913
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3914 3914
 				}
3915 3915
 
3916 3916
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3917 3917
 					$novirtualstock = ($showstockinlist == 2);
3918 3918
 
3919 3919
 					if ($user->hasRight('stock', 'lire')) {
3920
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3920
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3921 3921
 
3922 3922
 						if ($objp->stock > 0) {
3923 3923
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3924 3924
 						} elseif ($objp->stock <= 0) {
3925 3925
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3926 3926
 						}
3927
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3927
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3928 3928
 						$optlabel .= '</span>';
3929 3929
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3930 3930
 							$langs->load("stocks");
@@ -3934,9 +3934,9 @@  discard block
 block discarded – undo
3934 3934
 							$tmpproduct->load_virtual_stock();
3935 3935
 							$virtualstock = $tmpproduct->stock_theorique;
3936 3936
 
3937
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3937
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3938 3938
 
3939
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3939
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
3940 3940
 							if ($virtualstock > 0) {
3941 3941
 								$optlabel .= '<span class="product_line_stock_ok">';
3942 3942
 							} elseif ($virtualstock <= 0) {
@@ -3950,7 +3950,7 @@  discard block
 block discarded – undo
3950 3950
 					}
3951 3951
 				}
3952 3952
 
3953
-				$optstart = '<option value="' . $outkey . '"';
3953
+				$optstart = '<option value="'.$outkey.'"';
3954 3954
 				if ($selected && $selected == $objp->idprodfournprice) {
3955 3955
 					$optstart .= ' selected';
3956 3956
 				}
@@ -3959,31 +3959,31 @@  discard block
 block discarded – undo
3959 3959
 				}
3960 3960
 
3961 3961
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
3962
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
3963
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
3964
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
3965
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
3966
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
3967
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
3968
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
3969
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
3970
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
3971
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
3962
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
3963
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
3964
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
3965
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
3966
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
3967
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
3968
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
3969
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
3970
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
3971
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
3972 3972
 					if (isModEnabled('multicurrency')) {
3973
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
3974
-						$optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
3973
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
3974
+						$optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
3975 3975
 					}
3976 3976
 				}
3977
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
3977
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
3978 3978
 
3979 3979
 				$outarrayentry = array(
3980 3980
 					'key' => $outkey,
3981 3981
 					'value' => $outref,
3982 3982
 					'label' => $outvallabel,
3983 3983
 					'qty' => $outqty,
3984
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
3985
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
3986
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
3984
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3985
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3986
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3987 3987
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
3988 3988
 					'tva_tx' => price2num($objp->tva_tx),
3989 3989
 					'default_vat_code' => $objp->default_vat_code,
@@ -4013,17 +4013,17 @@  discard block
 block discarded – undo
4013 4013
 				// Add new entry
4014 4014
 				// "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
4015 4015
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4016
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4016
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4017 4017
 				$outarraypush = array(
4018 4018
 					'key' => $outkey,
4019 4019
 					'value' => $outref,
4020 4020
 					'label' => $outvallabel,
4021 4021
 					'qty' => $outqty,
4022
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4022
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4023 4023
 					'price_qty_ht_locale' => price($objp->fprice),
4024
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4024
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4025 4025
 					'price_unit_ht_locale' => price($objp->unitprice),
4026
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4026
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4027 4027
 					'tva_tx_formated' => price($objp->tva_tx),
4028 4028
 					'tva_tx' => price2num($objp->tva_tx),
4029 4029
 					'default_vat_code' => $objp->default_vat_code,
@@ -4056,7 +4056,7 @@  discard block
 block discarded – undo
4056 4056
 
4057 4057
 			$this->db->free($result);
4058 4058
 
4059
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4059
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4060 4060
 			$out .= ajax_combobox($htmlname);
4061 4061
 		} else {
4062 4062
 			dol_print_error($this->db);
@@ -4088,43 +4088,43 @@  discard block
 block discarded – undo
4088 4088
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4089 4089
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4090 4090
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4091
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4092
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4093
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4094
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4091
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4092
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4093
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4094
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4095 4095
 		$sql .= " AND p.tobuy = 1";
4096 4096
 		$sql .= " AND s.fournisseur = 1";
4097
-		$sql .= " AND p.rowid = " . ((int) $productid);
4097
+		$sql .= " AND p.rowid = ".((int) $productid);
4098 4098
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4099 4099
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4100 4100
 		} else {
4101 4101
 			$sql .= " ORDER BY pfp.unitprice ASC";
4102 4102
 		}
4103 4103
 
4104
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4104
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4105 4105
 		$result = $this->db->query($sql);
4106 4106
 
4107 4107
 		if ($result) {
4108 4108
 			$num = $this->db->num_rows($result);
4109 4109
 
4110
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4110
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4111 4111
 
4112 4112
 			if (!$num) {
4113
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4113
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4114 4114
 			} else {
4115
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4115
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4116 4116
 				$form .= '<option value="0">&nbsp;</option>';
4117 4117
 
4118 4118
 				$i = 0;
4119 4119
 				while ($i < $num) {
4120 4120
 					$objp = $this->db->fetch_object($result);
4121 4121
 
4122
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4122
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4123 4123
 					//if there is only one supplier, preselect it
4124 4124
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4125 4125
 						$opt .= ' selected';
4126 4126
 					}
4127
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4127
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4128 4128
 
4129 4129
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4130 4130
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4134,7 +4134,7 @@  discard block
 block discarded – undo
4134 4134
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4135 4135
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4136 4136
 
4137
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4137
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4138 4138
 						$priceparser = new PriceParser($this->db);
4139 4139
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4140 4140
 						if ($price_result >= 0) {
@@ -4145,10 +4145,10 @@  discard block
 block discarded – undo
4145 4145
 						}
4146 4146
 					}
4147 4147
 					if ($objp->quantity == 1) {
4148
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4148
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4149 4149
 					}
4150 4150
 
4151
-					$opt .= $objp->quantity . ' ';
4151
+					$opt .= $objp->quantity.' ';
4152 4152
 
4153 4153
 					if ($objp->quantity == 1) {
4154 4154
 						$opt .= $langs->trans("Unit");
@@ -4157,10 +4157,10 @@  discard block
 block discarded – undo
4157 4157
 					}
4158 4158
 					if ($objp->quantity > 1) {
4159 4159
 						$opt .= " - ";
4160
-						$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");
4160
+						$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");
4161 4161
 					}
4162 4162
 					if ($objp->duration) {
4163
-						$opt .= " - " . $objp->duration;
4163
+						$opt .= " - ".$objp->duration;
4164 4164
 					}
4165 4165
 					$opt .= "</option>\n";
4166 4166
 
@@ -4198,8 +4198,8 @@  discard block
 block discarded – undo
4198 4198
 		dol_syslog(__METHOD__, LOG_DEBUG);
4199 4199
 
4200 4200
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4201
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4202
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4201
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4202
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4203 4203
 		$sql .= " AND active > 0";
4204 4204
 		$sql .= " ORDER BY sortorder";
4205 4205
 
@@ -4211,7 +4211,7 @@  discard block
 block discarded – undo
4211 4211
 				$obj = $this->db->fetch_object($resql);
4212 4212
 
4213 4213
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4214
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4214
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4215 4215
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4216 4216
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4217 4217
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4239,7 +4239,7 @@  discard block
 block discarded – undo
4239 4239
 		// phpcs:enable
4240 4240
 		global $langs;
4241 4241
 
4242
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4242
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4243 4243
 		if ($num > 0) {
4244 4244
 			return 0; // Cache already loaded
4245 4245
 		}
@@ -4249,7 +4249,7 @@  discard block
 block discarded – undo
4249 4249
 		$langs->load('propal');
4250 4250
 
4251 4251
 		$sql = "SELECT rowid, code, label, position";
4252
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4252
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4253 4253
 		$sql .= " WHERE active > 0";
4254 4254
 
4255 4255
 		$resql = $this->db->query($sql);
@@ -4260,7 +4260,7 @@  discard block
 block discarded – undo
4260 4260
 				$obj = $this->db->fetch_object($resql);
4261 4261
 
4262 4262
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4263
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4263
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4264 4264
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4265 4265
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4266 4266
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4292,17 +4292,17 @@  discard block
 block discarded – undo
4292 4292
 
4293 4293
 		$this->load_cache_availability();
4294 4294
 
4295
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4295
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4296 4296
 
4297
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4297
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4298 4298
 		if ($addempty) {
4299 4299
 			print '<option value="0">&nbsp;</option>';
4300 4300
 		}
4301 4301
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4302 4302
 			if ($selected == $id) {
4303
-				print '<option value="' . $id . '" selected>';
4303
+				print '<option value="'.$id.'" selected>';
4304 4304
 			} else {
4305
-				print '<option value="' . $id . '">';
4305
+				print '<option value="'.$id.'">';
4306 4306
 			}
4307 4307
 			print dol_escape_htmltag($arrayavailability['label']);
4308 4308
 			print '</option>';
@@ -4323,13 +4323,13 @@  discard block
 block discarded – undo
4323 4323
 	{
4324 4324
 		global $langs;
4325 4325
 
4326
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4326
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4327 4327
 		if ($num > 0) {
4328 4328
 			return 0; // Cache already loaded
4329 4329
 		}
4330 4330
 
4331 4331
 		$sql = "SELECT rowid, code, label";
4332
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4332
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4333 4333
 		$sql .= " WHERE active > 0";
4334 4334
 
4335 4335
 		$resql = $this->db->query($sql);
@@ -4342,8 +4342,8 @@  discard block
 block discarded – undo
4342 4342
 
4343 4343
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4344 4344
 				$label = ($obj->label != '-' ? $obj->label : '');
4345
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4346
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4345
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4346
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4347 4347
 				}
4348 4348
 				if ($langs->trans($obj->code) != $obj->code) {
4349 4349
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4383,9 +4383,9 @@  discard block
 block discarded – undo
4383 4383
 
4384 4384
 		$this->loadCacheInputReason();
4385 4385
 
4386
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4386
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4387 4387
 		if ($addempty) {
4388
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4388
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4389 4389
 		}
4390 4390
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4391 4391
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4393,9 +4393,9 @@  discard block
 block discarded – undo
4393 4393
 			}
4394 4394
 
4395 4395
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4396
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4396
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4397 4397
 			} else {
4398
-				print '<option value="' . $arraydemandreason['id'] . '">';
4398
+				print '<option value="'.$arraydemandreason['id'].'">';
4399 4399
 			}
4400 4400
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4401 4401
 			print $langs->trans($label);
@@ -4405,7 +4405,7 @@  discard block
 block discarded – undo
4405 4405
 		if ($user->admin && empty($notooltip)) {
4406 4406
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4407 4407
 		}
4408
-		print ajax_combobox('select_' . $htmlname);
4408
+		print ajax_combobox('select_'.$htmlname);
4409 4409
 	}
4410 4410
 
4411 4411
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4420,7 +4420,7 @@  discard block
 block discarded – undo
4420 4420
 		// phpcs:enable
4421 4421
 		global $langs;
4422 4422
 
4423
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4423
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4424 4424
 		if ($num > 0) {
4425 4425
 			return $num; // Cache already loaded
4426 4426
 		}
@@ -4430,8 +4430,8 @@  discard block
 block discarded – undo
4430 4430
 		$this->cache_types_paiements = array();
4431 4431
 
4432 4432
 		$sql = "SELECT id, code, libelle as label, type, active";
4433
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4434
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4433
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4434
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4435 4435
 
4436 4436
 		$resql = $this->db->query($sql);
4437 4437
 		if ($resql) {
@@ -4441,7 +4441,7 @@  discard block
 block discarded – undo
4441 4441
 				$obj = $this->db->fetch_object($resql);
4442 4442
 
4443 4443
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4444
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4444
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4445 4445
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4446 4446
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4447 4447
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4513,17 +4513,17 @@  discard block
 block discarded – undo
4513 4513
 		global $langs, $user, $conf;
4514 4514
 
4515 4515
 		$out = '';
4516
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4516
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4517 4517
 
4518 4518
 		$this->load_cache_conditions_paiements();
4519 4519
 
4520 4520
 		// Set default value if not already set by caller
4521 4521
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4522
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4522
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4523 4523
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4524 4524
 		}
4525 4525
 
4526
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4526
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4527 4527
 		if ($addempty) {
4528 4528
 			$out .= '<option value="0">&nbsp;</option>';
4529 4529
 		}
@@ -4537,9 +4537,9 @@  discard block
 block discarded – undo
4537 4537
 
4538 4538
 			if ($selected == $id) {
4539 4539
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4540
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4540
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4541 4541
 			} else {
4542
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4542
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4543 4543
 			}
4544 4544
 			$label = $arrayconditions['label'];
4545 4545
 
@@ -4557,21 +4557,21 @@  discard block
 block discarded – undo
4557 4557
 		$out .= ajax_combobox($htmlname);
4558 4558
 
4559 4559
 		if ($deposit_percent >= 0) {
4560
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4561
-			$out .= $langs->trans('DepositPercent') . ' : ';
4562
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4560
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4561
+			$out .= $langs->trans('DepositPercent').' : ';
4562
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4563 4563
 			$out .= '</span>';
4564 4564
 			$out .= '
4565
-				<script nonce="' . getNonce() . '">
4565
+				<script nonce="' . getNonce().'">
4566 4566
 					$(document).ready(function () {
4567
-						$("#' . $htmlname . '").change(function () {
4567
+						$("#' . $htmlname.'").change(function () {
4568 4568
 							let $selected = $(this).find("option:selected");
4569 4569
 							let depositPercent = $selected.attr("data-deposit_percent");
4570 4570
 
4571 4571
 							if (depositPercent.length > 0) {
4572
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4572
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4573 4573
 							} else {
4574
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4574
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4575 4575
 							}
4576 4576
 
4577 4577
 							return true;
@@ -4609,7 +4609,7 @@  discard block
 block discarded – undo
4609 4609
 
4610 4610
 		$out = '';
4611 4611
 
4612
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4612
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4613 4613
 
4614 4614
 		$filterarray = array();
4615 4615
 		if ($filtertype == 'CRDT') {
@@ -4624,11 +4624,11 @@  discard block
 block discarded – undo
4624 4624
 
4625 4625
 		// Set default value if not already set by caller
4626 4626
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4627
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4627
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4628 4628
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4629 4629
 		}
4630 4630
 
4631
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4631
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4632 4632
 		if ($empty) {
4633 4633
 			$out .= '<option value="">&nbsp;</option>';
4634 4634
 		}
@@ -4649,13 +4649,13 @@  discard block
 block discarded – undo
4649 4649
 			}
4650 4650
 
4651 4651
 			if ($format == 0) {
4652
-				$out .= '<option value="' . $id . '"';
4652
+				$out .= '<option value="'.$id.'"';
4653 4653
 			} elseif ($format == 1) {
4654
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4654
+				$out .= '<option value="'.$arraytypes['code'].'"';
4655 4655
 			} elseif ($format == 2) {
4656
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4656
+				$out .= '<option value="'.$arraytypes['code'].'"';
4657 4657
 			} elseif ($format == 3) {
4658
-				$out .= '<option value="' . $id . '"';
4658
+				$out .= '<option value="'.$id.'"';
4659 4659
 			}
4660 4660
 			// Print attribute selected or not
4661 4661
 			if ($format == 1 || $format == 2) {
@@ -4685,7 +4685,7 @@  discard block
 block discarded – undo
4685 4685
 		if ($user->admin && !$noadmininfo) {
4686 4686
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4687 4687
 		}
4688
-		$out .= ajax_combobox('select' . $htmlname);
4688
+		$out .= ajax_combobox('select'.$htmlname);
4689 4689
 
4690 4690
 		if (empty($nooutput)) {
4691 4691
 			print $out;
@@ -4707,22 +4707,22 @@  discard block
 block discarded – undo
4707 4707
 	{
4708 4708
 		global $langs;
4709 4709
 
4710
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4710
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4711 4711
 		$options = array(
4712 4712
 			'HT' => $langs->trans("HT"),
4713 4713
 			'TTC' => $langs->trans("TTC")
4714 4714
 		);
4715 4715
 		foreach ($options as $id => $value) {
4716 4716
 			if ($selected == $id) {
4717
-				$return .= '<option value="' . $id . '" selected>' . $value;
4717
+				$return .= '<option value="'.$id.'" selected>'.$value;
4718 4718
 			} else {
4719
-				$return .= '<option value="' . $id . '">' . $value;
4719
+				$return .= '<option value="'.$id.'">'.$value;
4720 4720
 			}
4721 4721
 			$return .= '</option>';
4722 4722
 		}
4723 4723
 		$return .= '</select>';
4724 4724
 		if ($addjscombo) {
4725
-			$return .= ajax_combobox('select_' . $htmlname);
4725
+			$return .= ajax_combobox('select_'.$htmlname);
4726 4726
 		}
4727 4727
 
4728 4728
 		return $return;
@@ -4740,7 +4740,7 @@  discard block
 block discarded – undo
4740 4740
 		// phpcs:enable
4741 4741
 		global $langs;
4742 4742
 
4743
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4743
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4744 4744
 		if ($num > 0) {
4745 4745
 			return $num; // Cache already loaded
4746 4746
 		}
@@ -4750,8 +4750,8 @@  discard block
 block discarded – undo
4750 4750
 		$this->cache_transport_mode = array();
4751 4751
 
4752 4752
 		$sql = "SELECT rowid, code, label, active";
4753
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4754
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4753
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4754
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4755 4755
 
4756 4756
 		$resql = $this->db->query($sql);
4757 4757
 		if ($resql) {
@@ -4761,7 +4761,7 @@  discard block
 block discarded – undo
4761 4761
 				$obj = $this->db->fetch_object($resql);
4762 4762
 
4763 4763
 				// If traduction exist, we use it else we take the default label
4764
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4764
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4765 4765
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4766 4766
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4767 4767
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4795,11 +4795,11 @@  discard block
 block discarded – undo
4795 4795
 	{
4796 4796
 		global $langs, $user;
4797 4797
 
4798
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4798
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4799 4799
 
4800 4800
 		$this->load_cache_transport_mode();
4801 4801
 
4802
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4802
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4803 4803
 		if ($empty) {
4804 4804
 			print '<option value="">&nbsp;</option>';
4805 4805
 		}
@@ -4815,13 +4815,13 @@  discard block
 block discarded – undo
4815 4815
 			}
4816 4816
 
4817 4817
 			if ($format == 0) {
4818
-				print '<option value="' . $id . '"';
4818
+				print '<option value="'.$id.'"';
4819 4819
 			} elseif ($format == 1) {
4820
-				print '<option value="' . $arraytypes['code'] . '"';
4820
+				print '<option value="'.$arraytypes['code'].'"';
4821 4821
 			} elseif ($format == 2) {
4822
-				print '<option value="' . $arraytypes['code'] . '"';
4822
+				print '<option value="'.$arraytypes['code'].'"';
4823 4823
 			} elseif ($format == 3) {
4824
-				print '<option value="' . $id . '"';
4824
+				print '<option value="'.$id.'"';
4825 4825
 			}
4826 4826
 			// If text is selected, we compare with code, else with id
4827 4827
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4869,31 +4869,31 @@  discard block
 block discarded – undo
4869 4869
 		$langs->load("deliveries");
4870 4870
 
4871 4871
 		$sql = "SELECT rowid, code, libelle as label";
4872
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4872
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4873 4873
 		$sql .= " WHERE active > 0";
4874 4874
 		if ($filtre) {
4875
-			$sql .= " AND " . $filtre;
4875
+			$sql .= " AND ".$filtre;
4876 4876
 		}
4877 4877
 		$sql .= " ORDER BY libelle ASC";
4878 4878
 
4879
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4879
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4880 4880
 		$result = $this->db->query($sql);
4881 4881
 		if ($result) {
4882 4882
 			$num = $this->db->num_rows($result);
4883 4883
 			$i = 0;
4884 4884
 			if ($num) {
4885
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4885
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4886 4886
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4887 4887
 					print '<option value="-1">&nbsp;</option>';
4888 4888
 				}
4889 4889
 				while ($i < $num) {
4890 4890
 					$obj = $this->db->fetch_object($result);
4891 4891
 					if ($selected == $obj->rowid) {
4892
-						print '<option value="' . $obj->rowid . '" selected>';
4892
+						print '<option value="'.$obj->rowid.'" selected>';
4893 4893
 					} else {
4894
-						print '<option value="' . $obj->rowid . '">';
4894
+						print '<option value="'.$obj->rowid.'">';
4895 4895
 					}
4896
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
4896
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
4897 4897
 					print '</option>';
4898 4898
 					$i++;
4899 4899
 				}
@@ -4902,7 +4902,7 @@  discard block
 block discarded – undo
4902 4902
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4903 4903
 				}
4904 4904
 
4905
-				print ajax_combobox('select' . $htmlname);
4905
+				print ajax_combobox('select'.$htmlname);
4906 4906
 			} else {
4907 4907
 				print $langs->trans("NoShippingMethodDefined");
4908 4908
 			}
@@ -4927,16 +4927,16 @@  discard block
 block discarded – undo
4927 4927
 		$langs->load("deliveries");
4928 4928
 
4929 4929
 		if ($htmlname != "none") {
4930
-			print '<form method="POST" action="' . $page . '">';
4930
+			print '<form method="POST" action="'.$page.'">';
4931 4931
 			print '<input type="hidden" name="action" value="setshippingmethod">';
4932
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
4932
+			print '<input type="hidden" name="token" value="'.newToken().'">';
4933 4933
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
4934
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4934
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4935 4935
 			print '</form>';
4936 4936
 		} else {
4937 4937
 			if ($selected) {
4938 4938
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
4939
-				print $langs->trans("SendingMethod" . strtoupper($code));
4939
+				print $langs->trans("SendingMethod".strtoupper($code));
4940 4940
 			} else {
4941 4941
 				print "&nbsp;";
4942 4942
 			}
@@ -4959,10 +4959,10 @@  discard block
 block discarded – undo
4959 4959
 
4960 4960
 		$opt = '<option value="" selected></option>';
4961 4961
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
4962
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
4963
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
4962
+		$sql .= ' FROM '.$this->db->prefix().'facture';
4963
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
4964 4964
 		$sql .= ' AND situation_counter >= 1';
4965
-		$sql .= ' AND fk_soc = ' . (int) $socid;
4965
+		$sql .= ' AND fk_soc = '.(int) $socid;
4966 4966
 		$sql .= ' AND type <> 2';
4967 4967
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
4968 4968
 		$resql = $this->db->query($sql);
@@ -4980,19 +4980,19 @@  discard block
 block discarded – undo
4980 4980
 						//Not prov?
4981 4981
 						if (substr($obj->ref, 1, 4) != 'PROV') {
4982 4982
 							if ($selected == $obj->rowid) {
4983
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
4983
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
4984 4984
 							} else {
4985
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
4985
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
4986 4986
 							}
4987 4987
 						}
4988 4988
 					}
4989 4989
 				}
4990 4990
 			}
4991 4991
 		} else {
4992
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
4992
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
4993 4993
 		}
4994 4994
 		if ($opt == '<option value ="" selected></option>') {
4995
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
4995
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
4996 4996
 		}
4997 4997
 		return $opt;
4998 4998
 	}
@@ -5012,12 +5012,12 @@  discard block
 block discarded – undo
5012 5012
 
5013 5013
 		$langs->load('products');
5014 5014
 
5015
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5015
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5016 5016
 
5017
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5017
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5018 5018
 		$sql .= ' WHERE active > 0';
5019 5019
 		if (!empty($unit_type)) {
5020
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5020
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5021 5021
 		}
5022 5022
 		$sql .= " ORDER BY sortorder";
5023 5023
 
@@ -5029,14 +5029,14 @@  discard block
 block discarded – undo
5029 5029
 
5030 5030
 			while ($res = $this->db->fetch_object($resql)) {
5031 5031
 				$unitLabel = $res->label;
5032
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5033
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5032
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5033
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5034 5034
 				}
5035 5035
 
5036 5036
 				if ($selected == $res->rowid) {
5037
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5037
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5038 5038
 				} else {
5039
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5039
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5040 5040
 				}
5041 5041
 			}
5042 5042
 			$return .= '</select>';
@@ -5071,23 +5071,23 @@  discard block
 block discarded – undo
5071 5071
 		$num = 0;
5072 5072
 
5073 5073
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5074
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5075
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5074
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5075
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5076 5076
 		if ($status != 2) {
5077
-			$sql .= " AND clos = " . (int) $status;
5077
+			$sql .= " AND clos = ".(int) $status;
5078 5078
 		}
5079 5079
 		if ($filtre) {	// TODO Support USF
5080
-			$sql .= " AND " . $filtre;
5080
+			$sql .= " AND ".$filtre;
5081 5081
 		}
5082 5082
 		$sql .= " ORDER BY label";
5083 5083
 
5084
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5084
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5085 5085
 		$result = $this->db->query($sql);
5086 5086
 		if ($result) {
5087 5087
 			$num = $this->db->num_rows($result);
5088 5088
 			$i = 0;
5089 5089
 			if ($num) {
5090
-				$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5090
+				$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5091 5091
 
5092 5092
 				if (!empty($useempty) && !is_numeric($useempty)) {
5093 5093
 					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';
@@ -5098,27 +5098,27 @@  discard block
 block discarded – undo
5098 5098
 				while ($i < $num) {
5099 5099
 					$obj = $this->db->fetch_object($result);
5100 5100
 					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5101
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';
5101
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';
5102 5102
 					} else {
5103
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';
5103
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';
5104 5104
 					}
5105 5105
 					$out .= trim($obj->label);
5106 5106
 					if ($showcurrency) {
5107
-						$out .= ' (' . $obj->currency_code . ')';
5107
+						$out .= ' ('.$obj->currency_code.')';
5108 5108
 					}
5109 5109
 					if ($status == 2 && $obj->status == 1) {
5110
-						$out .= ' (' . $langs->trans("Closed") . ')';
5110
+						$out .= ' ('.$langs->trans("Closed").')';
5111 5111
 					}
5112 5112
 					$out .= '</option>';
5113 5113
 					$i++;
5114 5114
 				}
5115 5115
 				$out .= "</select>";
5116
-				$out .= ajax_combobox('select' . $htmlname);
5116
+				$out .= ajax_combobox('select'.$htmlname);
5117 5117
 			} else {
5118 5118
 				if ($status == 0) {
5119
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5119
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5120 5120
 				} else {
5121
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
5121
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
5122 5122
 				}
5123 5123
 			}
5124 5124
 		} else {
@@ -5154,23 +5154,23 @@  discard block
 block discarded – undo
5154 5154
 		$num = 0;
5155 5155
 
5156 5156
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5157
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5157
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5158 5158
 		$sql .= " WHERE 1=1";
5159 5159
 		if ($status != 2) {
5160
-			$sql .= " AND status = " . (int) $status;
5160
+			$sql .= " AND status = ".(int) $status;
5161 5161
 		}
5162 5162
 		if ($filtre) {	// TODO Support USF
5163
-			$sql .= " AND " . $filtre;
5163
+			$sql .= " AND ".$filtre;
5164 5164
 		}
5165 5165
 		$sql .= " ORDER BY name";
5166 5166
 
5167
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5167
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5168 5168
 		$result = $this->db->query($sql);
5169 5169
 		if ($result) {
5170 5170
 			$num = $this->db->num_rows($result);
5171 5171
 			$i = 0;
5172 5172
 			if ($num) {
5173
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5173
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5174 5174
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5175 5175
 					print '<option value="-1">&nbsp;</option>';
5176 5176
 				}
@@ -5178,13 +5178,13 @@  discard block
 block discarded – undo
5178 5178
 				while ($i < $num) {
5179 5179
 					$obj = $this->db->fetch_object($result);
5180 5180
 					if ($selected == $obj->rowid) {
5181
-						print '<option value="' . $obj->rowid . '" selected>';
5181
+						print '<option value="'.$obj->rowid.'" selected>';
5182 5182
 					} else {
5183
-						print '<option value="' . $obj->rowid . '">';
5183
+						print '<option value="'.$obj->rowid.'">';
5184 5184
 					}
5185 5185
 					print trim($obj->name);
5186 5186
 					if ($status == 2 && $obj->status == 1) {
5187
-						print ' (' . $langs->trans("Closed") . ')';
5187
+						print ' ('.$langs->trans("Closed").')';
5188 5188
 					}
5189 5189
 					print '</option>';
5190 5190
 					$i++;
@@ -5192,9 +5192,9 @@  discard block
 block discarded – undo
5192 5192
 				print "</select>";
5193 5193
 			} else {
5194 5194
 				if ($status == 0) {
5195
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5195
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5196 5196
 				} else {
5197
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5197
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5198 5198
 				}
5199 5199
 			}
5200 5200
 
@@ -5218,20 +5218,20 @@  discard block
 block discarded – undo
5218 5218
 	{
5219 5219
 		global $langs;
5220 5220
 		if ($htmlname != "none") {
5221
-			print '<form method="POST" action="' . $page . '">';
5221
+			print '<form method="POST" action="'.$page.'">';
5222 5222
 			print '<input type="hidden" name="action" value="setbankaccount">';
5223
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5223
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5224 5224
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5225 5225
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5226 5226
 			if ($nbaccountfound > 0) {
5227
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5227
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5228 5228
 			}
5229 5229
 			print '</form>';
5230 5230
 		} else {
5231 5231
 			$langs->load('banks');
5232 5232
 
5233 5233
 			if ($selected) {
5234
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5234
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5235 5235
 				$bankstatic = new Account($this->db);
5236 5236
 				$result = $bankstatic->fetch($selected);
5237 5237
 				if ($result) {
@@ -5270,19 +5270,19 @@  discard block
 block discarded – undo
5270 5270
 		global $conf, $langs;
5271 5271
 		$langs->load("categories");
5272 5272
 
5273
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5273
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5274 5274
 
5275 5275
 		// For backward compatibility
5276 5276
 		if (is_numeric($type)) {
5277
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5277
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5278 5278
 		}
5279 5279
 
5280 5280
 		if ($type === Categorie::TYPE_BANK_LINE) {
5281 5281
 			// TODO Move this into common category feature
5282 5282
 			$cate_arbo = array();
5283 5283
 			$sql = "SELECT c.label, c.rowid";
5284
-			$sql .= " FROM " . $this->db->prefix() . "bank_categ as c";
5285
-			$sql .= " WHERE entity = " . $conf->entity;
5284
+			$sql .= " FROM ".$this->db->prefix()."bank_categ as c";
5285
+			$sql .= " WHERE entity = ".$conf->entity;
5286 5286
 			$sql .= " ORDER BY c.label";
5287 5287
 			$result = $this->db->query($sql);
5288 5288
 			if ($result) {
@@ -5308,12 +5308,12 @@  discard block
 block discarded – undo
5308 5308
 		$outarrayrichhtml = array();
5309 5309
 
5310 5310
 
5311
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5311
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5312 5312
 		if (is_array($cate_arbo)) {
5313 5313
 			$num = count($cate_arbo);
5314 5314
 
5315 5315
 			if (!$num) {
5316
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5316
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5317 5317
 			} else {
5318 5318
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5319 5319
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5325,15 +5325,15 @@  discard block
 block discarded – undo
5325 5325
 						$add = '';
5326 5326
 					}
5327 5327
 
5328
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5328
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5329 5329
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5330 5330
 
5331 5331
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5332 5332
 
5333 5333
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5334 5334
 
5335
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5336
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5335
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5336
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5337 5337
 					$output .= '>';
5338 5338
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5339 5339
 					$output .= '</option>';
@@ -5377,7 +5377,7 @@  discard block
 block discarded – undo
5377 5377
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5378 5378
 	{
5379 5379
 		// phpcs:enable
5380
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5380
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5381 5381
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5382 5382
 	}
5383 5383
 
@@ -5412,7 +5412,7 @@  discard block
 block discarded – undo
5412 5412
 	{
5413 5413
 		global $langs, $conf;
5414 5414
 
5415
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5415
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5416 5416
 		$formconfirm = '';
5417 5417
 		$inputok = array();
5418 5418
 		$inputko = array();
@@ -5436,27 +5436,27 @@  discard block
 block discarded – undo
5436 5436
 			foreach ($formquestion as $key => $input) {
5437 5437
 				if (is_array($input) && !empty($input)) {
5438 5438
 					if ($input['type'] == 'hidden') {
5439
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5440
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5439
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5440
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5441 5441
 
5442
-						$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";
5442
+						$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";
5443 5443
 					}
5444 5444
 				}
5445 5445
 			}
5446 5446
 
5447 5447
 			// Now add questions
5448 5448
 			$moreonecolumn = '';
5449
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5449
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5450 5450
 			foreach ($formquestion as $key => $input) {
5451 5451
 				if (is_array($input) && !empty($input)) {
5452
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5453
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5454
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5452
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5453
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5454
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5455 5455
 
5456 5456
 					if ($input['type'] == 'text') {
5457
-						$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";
5457
+						$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";
5458 5458
 					} elseif ($input['type'] == 'password') {
5459
-						$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";
5459
+						$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";
5460 5460
 					} elseif ($input['type'] == 'textarea') {
5461 5461
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5462 5462
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5464,8 +5464,8 @@  discard block
 block discarded – undo
5464 5464
 						$more .= '</textarea>';
5465 5465
 						$more .= '</div></div>'."\n";*/
5466 5466
 						$moreonecolumn .= '<div class="margintoponly">';
5467
-						$moreonecolumn .= $input['label'] . '<br>';
5468
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5467
+						$moreonecolumn .= $input['label'].'<br>';
5468
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5469 5469
 						$moreonecolumn .= $input['value'];
5470 5470
 						$moreonecolumn .= '</textarea>';
5471 5471
 						$moreonecolumn .= '</div>';
@@ -5482,20 +5482,20 @@  discard block
 block discarded – undo
5482 5482
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5483 5483
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5484 5484
 
5485
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5485
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5486 5486
 						if (!empty($input['label'])) {
5487
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5487
+							$more .= $input['label'].'</div><div class="tagtd left">';
5488 5488
 						}
5489 5489
 						if ($input['type'] == 'select') {
5490 5490
 							$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);
5491 5491
 						} else {
5492 5492
 							$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);
5493 5493
 						}
5494
-						$more .= '</div></div>' . "\n";
5494
+						$more .= '</div></div>'."\n";
5495 5495
 					} elseif ($input['type'] == 'checkbox') {
5496 5496
 						$more .= '<div class="tagtr">';
5497
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5498
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5497
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5498
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5499 5499
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5500 5500
 							$more .= ' checked';
5501 5501
 						}
@@ -5506,19 +5506,19 @@  discard block
 block discarded – undo
5506 5506
 							$more .= ' disabled';
5507 5507
 						}
5508 5508
 						$more .= ' /></div>';
5509
-						$more .= '</div>' . "\n";
5509
+						$more .= '</div>'."\n";
5510 5510
 					} elseif ($input['type'] == 'radio') {
5511 5511
 						$i = 0;
5512 5512
 						foreach ($input['values'] as $selkey => $selval) {
5513 5513
 							$more .= '<div class="tagtr">';
5514 5514
 							if (isset($input['label'])) {
5515 5515
 								if ($i == 0) {
5516
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5516
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5517 5517
 								} else {
5518
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5518
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5519 5519
 								}
5520 5520
 							}
5521
-							$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;
5521
+							$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;
5522 5522
 							if (!empty($input['disabled'])) {
5523 5523
 								$more .= ' disabled';
5524 5524
 							}
@@ -5526,12 +5526,12 @@  discard block
 block discarded – undo
5526 5526
 								$more .= ' checked="checked"';
5527 5527
 							}
5528 5528
 							$more .= ' /> ';
5529
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5530
-							$more .= '</div></div>' . "\n";
5529
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5530
+							$more .= '</div></div>'."\n";
5531 5531
 							$i++;
5532 5532
 						}
5533 5533
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5534
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5534
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5535 5535
 						$more .= '<div class="tagtd">';
5536 5536
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5537 5537
 						$h = $m = 0;
@@ -5549,24 +5549,24 @@  discard block
 block discarded – undo
5549 5549
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5550 5550
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5551 5551
 						if (!empty($input['label'])) {
5552
-							$more .= $input['label'] . '</div><div class="tagtd">';
5552
+							$more .= $input['label'].'</div><div class="tagtd">';
5553 5553
 						}
5554 5554
 						$more .= $input['value'];
5555
-						$more .= '</div></div>' . "\n";
5555
+						$more .= '</div></div>'."\n";
5556 5556
 					} elseif ($input['type'] == 'onecolumn') {
5557 5557
 						$moreonecolumn .= '<div class="margintoponly">';
5558 5558
 						$moreonecolumn .= $input['value'];
5559
-						$moreonecolumn .= '</div>' . "\n";
5559
+						$moreonecolumn .= '</div>'."\n";
5560 5560
 					} elseif ($input['type'] == 'hidden') {
5561 5561
 						// Do nothing more, already added by a previous loop
5562 5562
 					} elseif ($input['type'] == 'separator') {
5563 5563
 						$more .= '<br>';
5564 5564
 					} else {
5565
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5565
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5566 5566
 					}
5567 5567
 				}
5568 5568
 			}
5569
-			$more .= '</div>' . "\n";
5569
+			$more .= '</div>'."\n";
5570 5570
 			$more .= $moreonecolumn;
5571 5571
 		}
5572 5572
 
@@ -5588,10 +5588,10 @@  discard block
 block discarded – undo
5588 5588
 				$button = $useajax;
5589 5589
 				$useajax = 1;
5590 5590
 				$autoOpen = false;
5591
-				$dialogconfirm .= '-' . $button;
5591
+				$dialogconfirm .= '-'.$button;
5592 5592
 			}
5593
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5594
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5593
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5594
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5595 5595
 
5596 5596
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5597 5597
 			if (is_array($formquestion)) {
@@ -5614,24 +5614,24 @@  discard block
 block discarded – undo
5614 5614
 			}
5615 5615
 
5616 5616
 			// Show JQuery confirm box.
5617
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5617
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5618 5618
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5619
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5619
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5620 5620
 			}
5621 5621
 			if (!empty($more)) {
5622
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5622
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5623 5623
 			}
5624
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5625
-			$formconfirm .= '</div>' . "\n";
5624
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5625
+			$formconfirm .= '</div>'."\n";
5626 5626
 
5627
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5628
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5627
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5628
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5629 5629
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5630 5630
 			$formconfirm .= 'jQuery(document).ready(function() {
5631 5631
             $(function() {
5632
-            	$( "#' . $dialogconfirm . '" ).dialog(
5632
+            	$( "#' . $dialogconfirm.'" ).dialog(
5633 5633
             	{
5634
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5634
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5635 5635
 			if ($newselectedchoice == 'no') {
5636 5636
 				$formconfirm .= '
5637 5637
 						open: function() {
@@ -5641,24 +5641,24 @@  discard block
 block discarded – undo
5641 5641
 
5642 5642
 			$jsforcursor = '';
5643 5643
 			if ($useajax == 1) {
5644
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5645
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5644
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5645
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5646 5646
 			}
5647 5647
 
5648 5648
 			$postconfirmas = 'GET';
5649 5649
 
5650 5650
 			$formconfirm .= '
5651 5651
                     resizable: false,
5652
-                    height: "' . $height . '",
5653
-                    width: "' . $width . '",
5652
+                    height: "' . $height.'",
5653
+                    width: "' . $width.'",
5654 5654
                     modal: true,
5655 5655
                     closeOnEscape: false,
5656 5656
                     buttons: {
5657
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5658
-							var options = "token=' . urlencode(newToken()) . '";
5659
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5660
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5661
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5657
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5658
+							var options = "token=' . urlencode(newToken()).'";
5659
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5660
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5661
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5662 5662
 
5663 5663
                          	if (inputok.length > 0) {
5664 5664
                          		$.each(inputok, function(i, inputname) {
@@ -5692,11 +5692,11 @@  discard block
 block discarded – undo
5692 5692
 							}
5693 5693
 	                        $(this).dialog("close");
5694 5694
                         },
5695
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5696
-                        	var options = "token=' . urlencode(newToken()) . '";
5697
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5698
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5699
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5695
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5696
+                        	var options = "token=' . urlencode(newToken()).'";
5697
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5698
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5699
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5700 5700
                          	if (inputko.length > 0) {
5701 5701
                          		$.each(inputko, function(i, inputname) {
5702 5702
                          			var more = "";
@@ -5728,10 +5728,10 @@  discard block
 block discarded – undo
5728 5728
                 }
5729 5729
                 );
5730 5730
 
5731
-            	var button = "' . $button . '";
5731
+            	var button = "' . $button.'";
5732 5732
             	if (button.length > 0) {
5733 5733
                 	$( "#" + button ).click(function() {
5734
-                		$("#' . $dialogconfirm . '").dialog("open");
5734
+                		$("#' . $dialogconfirm.'").dialog("open");
5735 5735
         			});
5736 5736
                 }
5737 5737
             });
@@ -5739,44 +5739,44 @@  discard block
 block discarded – undo
5739 5739
             </script>';
5740 5740
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5741 5741
 		} else {
5742
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5742
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5743 5743
 
5744 5744
 			if (empty($disableformtag)) {
5745
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
5745
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
5746 5746
 			}
5747 5747
 
5748
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5749
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5748
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5749
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5750 5750
 
5751
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5751
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5752 5752
 
5753 5753
 			// Line title
5754 5754
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5755
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5756
-			$formconfirm .= '</td></tr>' . "\n";
5755
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5756
+			$formconfirm .= '</td></tr>'."\n";
5757 5757
 
5758 5758
 			// Line text
5759 5759
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5760
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5760
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5761 5761
 			}
5762 5762
 
5763 5763
 			// Line form fields
5764 5764
 			if ($more) {
5765
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5765
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5766 5766
 				$formconfirm .= $more;
5767
-				$formconfirm .= '</td></tr>' . "\n";
5767
+				$formconfirm .= '</td></tr>'."\n";
5768 5768
 			}
5769 5769
 
5770 5770
 			// Line with question
5771 5771
 			$formconfirm .= '<tr class="valid">';
5772
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5772
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5773 5773
 			$formconfirm .= '<td class="valid center">';
5774 5774
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5775
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5775
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5776 5776
 			$formconfirm .= '</td>';
5777
-			$formconfirm .= '</tr>' . "\n";
5777
+			$formconfirm .= '</tr>'."\n";
5778 5778
 
5779
-			$formconfirm .= '</table>' . "\n";
5779
+			$formconfirm .= '</table>'."\n";
5780 5780
 
5781 5781
 			if (empty($disableformtag)) {
5782 5782
 				$formconfirm .= "</form>\n";
@@ -5785,7 +5785,7 @@  discard block
 block discarded – undo
5785 5785
 
5786 5786
 			if (!empty($conf->use_javascript_ajax)) {
5787 5787
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5788
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5788
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5789 5789
 				$formconfirm .= '
5790 5790
 				$(document).ready(function () {
5791 5791
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5797,7 +5797,7 @@  discard block
 block discarded – undo
5797 5797
 					});
5798 5798
 				});
5799 5799
 				';
5800
-				$formconfirm .= '</script>' . "\n";
5800
+				$formconfirm .= '</script>'."\n";
5801 5801
 			}
5802 5802
 
5803 5803
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -5829,8 +5829,8 @@  discard block
 block discarded – undo
5829 5829
 		// phpcs:enable
5830 5830
 		global $langs;
5831 5831
 
5832
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
5833
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
5832
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
5833
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
5834 5834
 
5835 5835
 		$out = '';
5836 5836
 
@@ -5838,11 +5838,11 @@  discard block
 block discarded – undo
5838 5838
 
5839 5839
 		$langs->load("project");
5840 5840
 		if ($htmlname != "none") {
5841
-			$out .= '<form method="post" action="' . $page . '">';
5841
+			$out .= '<form method="post" action="'.$page.'">';
5842 5842
 			$out .= '<input type="hidden" name="action" value="classin">';
5843
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5843
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5844 5844
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
5845
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5845
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5846 5846
 			$out .= '</form>';
5847 5847
 		} else {
5848 5848
 			$out .= '<span class="project_head_block">';
@@ -5851,7 +5851,7 @@  discard block
 block discarded – undo
5851 5851
 				$projet->fetch($selected);
5852 5852
 				$out .= $projet->getNomUrl(0, '', 1);
5853 5853
 			} else {
5854
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
5854
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
5855 5855
 			}
5856 5856
 			$out .= '</span>';
5857 5857
 		}
@@ -5888,14 +5888,14 @@  discard block
 block discarded – undo
5888 5888
 		$out = '';
5889 5889
 
5890 5890
 		if ($htmlname != "none") {
5891
-			$out .= '<form method="POST" action="' . $page . '">';
5891
+			$out .= '<form method="POST" action="'.$page.'">';
5892 5892
 			$out .= '<input type="hidden" name="action" value="setconditions">';
5893
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5893
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5894 5894
 			if ($type) {
5895
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5895
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5896 5896
 			}
5897 5897
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
5898
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5898
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
5899 5899
 			$out .= '</form>';
5900 5900
 		} else {
5901 5901
 			if ($selected) {
@@ -5940,12 +5940,12 @@  discard block
 block discarded – undo
5940 5940
 		// phpcs:enable
5941 5941
 		global $langs;
5942 5942
 		if ($htmlname != "none") {
5943
-			print '<form method="post" action="' . $page . '">';
5943
+			print '<form method="post" action="'.$page.'">';
5944 5944
 			print '<input type="hidden" name="action" value="setavailability">';
5945
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5945
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5946 5946
 			$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
5947
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5948
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
5947
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5948
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
5949 5949
 			print '</form>';
5950 5950
 		} else {
5951 5951
 			if ($selected) {
@@ -5971,11 +5971,11 @@  discard block
 block discarded – undo
5971 5971
 	{
5972 5972
 		global $langs;
5973 5973
 		if ($htmlname != "none") {
5974
-			print '<form method="post" action="' . $page . '">';
5974
+			print '<form method="post" action="'.$page.'">';
5975 5975
 			print '<input type="hidden" name="action" value="setdemandreason">';
5976
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5976
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5977 5977
 			$this->selectInputReason($selected, $htmlname, -1, $addempty);
5978
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5978
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5979 5979
 			print '</form>';
5980 5980
 		} else {
5981 5981
 			if ($selected) {
@@ -6015,17 +6015,17 @@  discard block
 block discarded – undo
6015 6015
 		$ret = '';
6016 6016
 
6017 6017
 		if ($htmlname != "none") {
6018
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6019
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6020
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6018
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6019
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6020
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6021 6021
 			if ($type) {
6022
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6022
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6023 6023
 			}
6024 6024
 			$ret .= '<table class="nobordernopadding">';
6025 6025
 			$ret .= '<tr><td>';
6026
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6026
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6027 6027
 			$ret .= '</td>';
6028
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6028
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6029 6029
 			$ret .= '</tr></table></form>';
6030 6030
 		} else {
6031 6031
 			if ($displayhour) {
@@ -6060,15 +6060,15 @@  discard block
 block discarded – undo
6060 6060
 		global $langs;
6061 6061
 
6062 6062
 		if ($htmlname != "none") {
6063
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6064
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6065
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6063
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6064
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6065
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6066 6066
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6067
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6067
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6068 6068
 			print '</form>';
6069 6069
 		} else {
6070 6070
 			if ($selected) {
6071
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6071
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6072 6072
 				$theuser = new User($this->db);
6073 6073
 				$theuser->fetch($selected);
6074 6074
 				print $theuser->getNomUrl(1);
@@ -6101,14 +6101,14 @@  discard block
 block discarded – undo
6101 6101
 
6102 6102
 		$out = '';
6103 6103
 		if ($htmlname != "none") {
6104
-			$out .= '<form method="POST" action="' . $page . '">';
6104
+			$out .= '<form method="POST" action="'.$page.'">';
6105 6105
 			$out .= '<input type="hidden" name="action" value="setmode">';
6106
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6106
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6107 6107
 			if ($type) {
6108
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6108
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6109 6109
 			}
6110 6110
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6111
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6111
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6112 6112
 			$out .= '</form>';
6113 6113
 		} else {
6114 6114
 			if ($selected) {
@@ -6141,11 +6141,11 @@  discard block
 block discarded – undo
6141 6141
 	{
6142 6142
 		global $langs;
6143 6143
 		if ($htmlname != "none") {
6144
-			print '<form method="POST" action="' . $page . '">';
6144
+			print '<form method="POST" action="'.$page.'">';
6145 6145
 			print '<input type="hidden" name="action" value="settransportmode">';
6146
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6146
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6147 6147
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6148
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6148
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6149 6149
 			print '</form>';
6150 6150
 		} else {
6151 6151
 			if ($selected) {
@@ -6172,14 +6172,14 @@  discard block
 block discarded – undo
6172 6172
 		// phpcs:enable
6173 6173
 		global $langs;
6174 6174
 		if ($htmlname != "none") {
6175
-			print '<form method="POST" action="' . $page . '">';
6175
+			print '<form method="POST" action="'.$page.'">';
6176 6176
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6177
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6177
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6178 6178
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6179
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6179
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6180 6180
 			print '</form>';
6181 6181
 		} else {
6182
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6182
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6183 6183
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6184 6184
 		}
6185 6185
 	}
@@ -6201,21 +6201,21 @@  discard block
 block discarded – undo
6201 6201
 		global $langs, $mysoc, $conf;
6202 6202
 
6203 6203
 		if ($htmlname != "none") {
6204
-			print '<form method="POST" action="' . $page . '">';
6204
+			print '<form method="POST" action="'.$page.'">';
6205 6205
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6206
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6207
-			print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6206
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6207
+			print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6208 6208
 			print '<select name="calculation_mode">';
6209
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6210
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6209
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6210
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6211 6211
 			print '</select> ';
6212
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6212
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6213 6213
 			print '</form>';
6214 6214
 		} else {
6215 6215
 			if (!empty($rate)) {
6216 6216
 				print price($rate, 1, $langs, 0, 0);
6217 6217
 				if ($currency && $rate != 1) {
6218
-					print ' &nbsp; (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
6218
+					print ' &nbsp; ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')';
6219 6219
 				}
6220 6220
 			} else {
6221 6221
 				print 1;
@@ -6246,9 +6246,9 @@  discard block
 block discarded – undo
6246 6246
 		// phpcs:enable
6247 6247
 		global $conf, $langs;
6248 6248
 		if ($htmlname != "none") {
6249
-			print '<form method="post" action="' . $page . '">';
6249
+			print '<form method="post" action="'.$page.'">';
6250 6250
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6251
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6251
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6252 6252
 			print '<div class="inline-block">';
6253 6253
 			if (!empty($discount_type)) {
6254 6254
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6286,24 +6286,24 @@  discard block
 block discarded – undo
6286 6286
 			print '</div>';
6287 6287
 			if (empty($hidelist)) {
6288 6288
 				print '<div class="inline-block" style="padding-right: 10px">';
6289
-				$newfilter = 'discount_type=' . intval($discount_type);
6289
+				$newfilter = 'discount_type='.intval($discount_type);
6290 6290
 				if (!empty($discount_type)) {
6291 6291
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6292 6292
 				} else {
6293 6293
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6294 6294
 				}
6295 6295
 				if ($filter) {
6296
-					$newfilter .= ' AND (' . $filter . ')';
6296
+					$newfilter .= ' AND ('.$filter.')';
6297 6297
 				}
6298 6298
 				// output the combo of discounts
6299 6299
 				$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
6300 6300
 				if ($nbqualifiedlines > 0) {
6301
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6301
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6302 6302
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6303
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6303
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6304 6304
 					}
6305 6305
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6306
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6306
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6307 6307
 					}
6308 6308
 
6309 6309
 					print '>';
@@ -6343,23 +6343,23 @@  discard block
 block discarded – undo
6343 6343
 		global $langs;
6344 6344
 
6345 6345
 		if ($htmlname != "none") {
6346
-			print '<form method="post" action="' . $page . '">';
6346
+			print '<form method="post" action="'.$page.'">';
6347 6347
 			print '<input type="hidden" name="action" value="set_contact">';
6348
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6348
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6349 6349
 			print '<table class="nobordernopadding">';
6350 6350
 			print '<tr><td>';
6351 6351
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6352 6352
 			$num = $this->num;
6353 6353
 			if ($num == 0) {
6354 6354
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6355
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6355
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6356 6356
 			}
6357 6357
 			print '</td>';
6358
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6358
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6359 6359
 			print '</tr></table></form>';
6360 6360
 		} else {
6361 6361
 			if ($selected) {
6362
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6362
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6363 6363
 				$contact = new Contact($this->db);
6364 6364
 				$contact->fetch($selected);
6365 6365
 				print $contact->getFullName($langs);
@@ -6394,20 +6394,20 @@  discard block
 block discarded – undo
6394 6394
 
6395 6395
 		$out = '';
6396 6396
 		if ($htmlname != "none") {
6397
-			$out .= '<form method="post" action="' . $page . '">';
6397
+			$out .= '<form method="post" action="'.$page.'">';
6398 6398
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6399
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6399
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6400 6400
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6401
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6401
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6402 6402
 			$out .= '</form>';
6403 6403
 		} else {
6404 6404
 			if ($selected) {
6405
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6405
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6406 6406
 				$soc = new Societe($this->db);
6407 6407
 				$soc->fetch($selected);
6408 6408
 				$out .= $soc->getNomUrl(0, '');
6409 6409
 			} else {
6410
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6410
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6411 6411
 			}
6412 6412
 		}
6413 6413
 
@@ -6457,22 +6457,22 @@  discard block
 block discarded – undo
6457 6457
 			$selected = 'EUR'; // Pour compatibilite
6458 6458
 		}
6459 6459
 
6460
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6460
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6461 6461
 		if ($useempty) {
6462 6462
 			$out .= '<option value="-1" selected></option>';
6463 6463
 		}
6464 6464
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6465 6465
 			$labeltoshow = $currency['label'];
6466 6466
 			if ($mode == 1) {
6467
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6467
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6468 6468
 			} else {
6469
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6469
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6470 6470
 			}
6471 6471
 
6472 6472
 			if ($selected && $selected == $code_iso) {
6473
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6473
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6474 6474
 			} else {
6475
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6475
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6476 6476
 			}
6477 6477
 			$out .= $labeltoshow;
6478 6478
 			$out .= '</option>';
@@ -6483,7 +6483,7 @@  discard block
 block discarded – undo
6483 6483
 		}
6484 6484
 
6485 6485
 		// Make select dynamic
6486
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6486
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6487 6487
 		$out .= ajax_combobox($htmlname);
6488 6488
 
6489 6489
 		return $out;
@@ -6509,10 +6509,10 @@  discard block
 block discarded – undo
6509 6509
 
6510 6510
 		$TCurrency = array();
6511 6511
 
6512
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6513
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6512
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6513
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6514 6514
 		if ($filter) {
6515
-			$sql .= " AND " . $filter;
6515
+			$sql .= " AND ".$filter;
6516 6516
 		}
6517 6517
 		$resql = $this->db->query($sql);
6518 6518
 		if ($resql) {
@@ -6522,7 +6522,7 @@  discard block
 block discarded – undo
6522 6522
 		}
6523 6523
 
6524 6524
 		$out = '';
6525
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6525
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6526 6526
 		if ($useempty) {
6527 6527
 			$out .= '<option value="">&nbsp;</option>';
6528 6528
 		}
@@ -6534,13 +6534,13 @@  discard block
 block discarded – undo
6534 6534
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6535 6535
 				if (isset($TCurrency[$code_iso])) {
6536 6536
 					if (!empty($selected) && $selected == $code_iso) {
6537
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6537
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6538 6538
 					} else {
6539
-						$out .= '<option value="' . $code_iso . '">';
6539
+						$out .= '<option value="'.$code_iso.'">';
6540 6540
 					}
6541 6541
 
6542 6542
 					$out .= $currency['label'];
6543
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6543
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6544 6544
 					$out .= '</option>';
6545 6545
 				}
6546 6546
 			}
@@ -6549,7 +6549,7 @@  discard block
 block discarded – undo
6549 6549
 		$out .= '</select>';
6550 6550
 
6551 6551
 		// Make select dynamic
6552
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6552
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6553 6553
 		$out .= ajax_combobox($htmlname);
6554 6554
 
6555 6555
 		return $out;
@@ -6580,7 +6580,7 @@  discard block
 block discarded – undo
6580 6580
 		$sql .= " WHERE t.fk_pays = c.rowid";
6581 6581
 		$sql .= " AND t.active > 0";
6582 6582
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6583
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6583
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6584 6584
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6585 6585
 
6586 6586
 		$resql = $this->db->query($sql);
@@ -6592,30 +6592,30 @@  discard block
 block discarded – undo
6592 6592
 
6593 6593
 					$tmparray = array();
6594 6594
 					$tmparray['rowid']			= $obj->rowid;
6595
-					$tmparray['type_vat']		= $obj->type_vat;
6596
-					$tmparray['code']			= $obj->code;
6595
+					$tmparray['type_vat'] = $obj->type_vat;
6596
+					$tmparray['code'] = $obj->code;
6597 6597
 					$tmparray['txtva']			= $obj->taux;
6598
-					$tmparray['nprtva']			= $obj->recuperableonly;
6598
+					$tmparray['nprtva'] = $obj->recuperableonly;
6599 6599
 					$tmparray['localtax1']	    = $obj->localtax1;
6600 6600
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6601 6601
 					$tmparray['localtax2']	    = $obj->localtax2;
6602 6602
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6603
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6604
-					$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
6603
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6604
+					$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
6605 6605
 					$positiverates = '';
6606 6606
 					if ($obj->taux) {
6607
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6607
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6608 6608
 					}
6609 6609
 					if ($obj->localtax1) {
6610
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6610
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6611 6611
 					}
6612 6612
 					if ($obj->localtax2) {
6613
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6613
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6614 6614
 					}
6615 6615
 					if (empty($positiverates)) {
6616 6616
 						$positiverates = '0';
6617 6617
 					}
6618
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6618
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6619 6619
 
6620 6620
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6621 6621
 				}
@@ -6635,7 +6635,7 @@  discard block
 block discarded – undo
6635 6635
 				return -1;
6636 6636
 			}
6637 6637
 		} else {
6638
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6638
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6639 6639
 			return -2;
6640 6640
 		}
6641 6641
 	}
@@ -6688,9 +6688,9 @@  discard block
 block discarded – undo
6688 6688
 		// Check parameters
6689 6689
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6690 6690
 			if ($societe_vendeuse->id == $mysoc->id) {
6691
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6691
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6692 6692
 			} else {
6693
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6693
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6694 6694
 			}
6695 6695
 			return $return;
6696 6696
 		}
@@ -6702,12 +6702,12 @@  discard block
 block discarded – undo
6702 6702
 		// Define list of countries to use to search VAT rates to show
6703 6703
 		// First we defined code_country to use to find list
6704 6704
 		if (is_object($societe_vendeuse)) {
6705
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6705
+			$code_country = "'".$societe_vendeuse->country_code."'";
6706 6706
 		} else {
6707
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6707
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6708 6708
 		}
6709 6709
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6710
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6710
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6711 6711
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6712 6712
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6713 6713
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6717,27 +6717,27 @@  discard block
 block discarded – undo
6717 6717
 					if ($type == 1) { // We know product is a service
6718 6718
 						switch ($selectVatComboMode) {
6719 6719
 							case '1':
6720
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6720
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6721 6721
 								break;
6722 6722
 							case '2':
6723
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6723
+								$code_country = "'".$societe_acheteuse->country_code."'";
6724 6724
 								break;
6725 6725
 						}
6726 6726
 					}
6727 6727
 				} elseif (!$idprod) {  // We don't know type of product
6728 6728
 					switch ($selectVatComboMode) {
6729 6729
 						case '1':
6730
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6730
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6731 6731
 							break;
6732 6732
 						case '2':
6733
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6733
+							$code_country = "'".$societe_acheteuse->country_code."'";
6734 6734
 							break;
6735 6735
 					}
6736 6736
 				} else {
6737 6737
 					$prodstatic = new Product($this->db);
6738 6738
 					$prodstatic->fetch($idprod);
6739 6739
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6740
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6740
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6741 6741
 					}
6742 6742
 				}
6743 6743
 			}
@@ -6799,13 +6799,13 @@  discard block
 block discarded – undo
6799 6799
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
6800 6800
 				// of using supplier invoices (this is a very bad idea !)
6801 6801
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
6802
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
6802
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
6803 6803
 					$disabled = true;
6804 6804
 				}
6805 6805
 			}
6806 6806
 
6807 6807
 			if (!$options_only) {
6808
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
6808
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
6809 6809
 			}
6810 6810
 
6811 6811
 			$selectedfound = false;
@@ -6819,13 +6819,13 @@  discard block
 block discarded – undo
6819 6819
 				$key = $rate['txtva'];
6820 6820
 				$key .= $rate['nprtva'] ? '*' : '';
6821 6821
 				if ($mode > 0 && $rate['code']) {
6822
-					$key .= ' (' . $rate['code'] . ')';
6822
+					$key .= ' ('.$rate['code'].')';
6823 6823
 				}
6824 6824
 				if ($mode < 0) {
6825 6825
 					$key = $rate['rowid'];
6826 6826
 				}
6827 6827
 
6828
-				$return .= '<option value="' . $key . '"';
6828
+				$return .= '<option value="'.$key.'"';
6829 6829
 				if (!$selectedfound) {
6830 6830
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
6831 6831
 						if ($defaultcode == $rate['code']) {
@@ -6896,7 +6896,7 @@  discard block
 block discarded – undo
6896 6896
 	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 = '')
6897 6897
 	{
6898 6898
 		// phpcs:enable
6899
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6899
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6900 6900
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
6901 6901
 		if (!empty($nooutput)) {
6902 6902
 			return $retstring;
@@ -6925,11 +6925,11 @@  discard block
 block discarded – undo
6925 6925
 	{
6926 6926
 		global $langs;
6927 6927
 
6928
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6928
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6929 6929
 		if ($forcenewline) {
6930 6930
 			$ret .= '<br>';
6931 6931
 		}
6932
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6932
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6933 6933
 		return $ret;
6934 6934
 	}
6935 6935
 
@@ -6995,7 +6995,7 @@  discard block
 block discarded – undo
6995 6995
 		$orig_set_time = $set_time;
6996 6996
 
6997 6997
 		if ($set_time === '' && $emptydate == 0) {
6998
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
6998
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
6999 6999
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7000 7000
 				$set_time = dol_now($gm);
7001 7001
 			} else {
@@ -7067,38 +7067,38 @@  discard block
 block discarded – undo
7067 7067
 				// Calendrier popup version eldy
7068 7068
 				if ($usecalendar == "eldy") {
7069 7069
 					// Input area to enter date manually
7070
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7070
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7071 7071
 					$retstring .= ($disabled ? ' disabled' : '');
7072
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7072
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7073 7073
 					$retstring .= ' autocomplete="off">';
7074 7074
 
7075 7075
 					// Icon calendar
7076 7076
 					$retstringbuttom = '';
7077 7077
 					if (!$disabled) {
7078
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7079
-						$base = DOL_URL_ROOT . '/core/';
7080
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7081
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7078
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7079
+						$base = DOL_URL_ROOT.'/core/';
7080
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7081
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7082 7082
 					} else {
7083
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7083
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7084 7084
 					}
7085
-					$retstring = $retstringbuttom . $retstring;
7085
+					$retstring = $retstringbuttom.$retstring;
7086 7086
 
7087
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7088
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7089
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7087
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7088
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7089
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7090 7090
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7091 7091
 					if (!$disabled && $usecalendar != 'html') {
7092 7092
 						// Output javascript for datepicker
7093 7093
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7094 7094
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7095 7095
 
7096
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7097
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7098
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7096
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7097
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7098
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7099 7099
 							autoclose: true,
7100 7100
 							todayHighlight: true,
7101
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7101
+							yearRange: '" . $minYear.":".$maxYear."',";
7102 7102
 						if (!empty($conf->dol_use_jmobile)) {
7103 7103
 							$retstring .= "
7104 7104
 								beforeShow: function (input, datePicker) {
@@ -7113,7 +7113,7 @@  discard block
 block discarded – undo
7113 7113
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7114 7114
 							$retstring .= "
7115 7115
 								showOn: 'button',	/* both has problem with autocompletion */
7116
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
7116
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
7117 7117
 								buttonImageOnly: true";
7118 7118
 						}
7119 7119
 						$retstring .= "
@@ -7125,46 +7125,46 @@  discard block
 block discarded – undo
7125 7125
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7126 7126
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7127 7127
 					$retstring .= ($disabled ? ' disabled' : '');
7128
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7129
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7128
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7129
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7130 7130
 					$retstring .= ' autocomplete="off">';
7131 7131
 
7132 7132
 					// Icone calendrier
7133 7133
 					if ($disabled) {
7134
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7135
-						$retstring = $retstringbutton . $retstring;
7134
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7135
+						$retstring = $retstringbutton.$retstring;
7136 7136
 					}
7137 7137
 
7138 7138
 					$retstring .= '</div>';
7139
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7140
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7141
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7139
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7140
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7141
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7142 7142
 				} else {
7143 7143
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7144 7144
 				}
7145 7145
 			} else {
7146 7146
 				// Show date with combo selects
7147 7147
 				// Day
7148
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7148
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7149 7149
 
7150 7150
 				if ($emptydate || $set_time == -1) {
7151 7151
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7152 7152
 				}
7153 7153
 
7154 7154
 				for ($day = 1; $day <= 31; $day++) {
7155
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7155
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7156 7156
 				}
7157 7157
 
7158 7158
 				$retstring .= "</select>";
7159 7159
 
7160
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7160
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7161 7161
 				if ($emptydate || $set_time == -1) {
7162 7162
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7163 7163
 				}
7164 7164
 
7165 7165
 				// Month
7166 7166
 				for ($month = 1; $month <= 12; $month++) {
7167
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7167
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7168 7168
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7169 7169
 					$retstring .= "</option>";
7170 7170
 				}
@@ -7172,13 +7172,13 @@  discard block
 block discarded – undo
7172 7172
 
7173 7173
 				// Year
7174 7174
 				if ($emptydate || $set_time == -1) {
7175
-					$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 . '">';
7175
+					$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.'">';
7176 7176
 				} else {
7177
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7177
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7178 7178
 
7179 7179
 					$syear = (int) $syear;
7180 7180
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7181
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7181
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7182 7182
 					}
7183 7183
 					$retstring .= "</select>\n";
7184 7184
 				}
@@ -7202,15 +7202,15 @@  discard block
 block discarded – undo
7202 7202
 				}
7203 7203
 			}
7204 7204
 			// Show hour
7205
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7205
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7206 7206
 			if ($emptyhours) {
7207 7207
 				$retstring .= '<option value="-1">&nbsp;</option>';
7208 7208
 			}
7209 7209
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7210 7210
 				if (strlen($hour) < 2) {
7211
-					$hour = "0" . $hour;
7211
+					$hour = "0".$hour;
7212 7212
 				}
7213
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7213
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7214 7214
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7215 7215
 				$retstring .= '</option>';
7216 7216
 			}
@@ -7223,17 +7223,17 @@  discard block
 block discarded – undo
7223 7223
 
7224 7224
 		if ($m) {
7225 7225
 			// Show minutes
7226
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7226
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7227 7227
 			if ($emptyhours) {
7228 7228
 				$retstring .= '<option value="-1">&nbsp;</option>';
7229 7229
 			}
7230 7230
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7231 7231
 				$min_str = sprintf("%02d", $min);
7232
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7232
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7233 7233
 			}
7234 7234
 			$retstring .= '</select>';
7235 7235
 
7236
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7236
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7237 7237
 		}
7238 7238
 
7239 7239
 		if ($d && $h) {
@@ -7256,10 +7256,10 @@  discard block
 block discarded – undo
7256 7256
 
7257 7257
 			// Generate the date part, depending on the use or not of the javascript calendar
7258 7258
 			if ($addnowlink == 1) { // server time expressed in user time setup
7259
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7260
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7261
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7262
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7259
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7260
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7261
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7262
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7263 7263
 			} elseif ($addnowlink == 2) {
7264 7264
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7265 7265
 				 * This break application for foreign languages.
@@ -7268,10 +7268,10 @@  discard block
 block discarded – undo
7268 7268
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7269 7269
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7270 7270
 				*/
7271
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7272
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7273
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7274
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7271
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7272
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7273
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7274
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7275 7275
 			}
7276 7276
 			/*if ($usecalendar == "eldy")
7277 7277
 			{
@@ -7291,11 +7291,11 @@  discard block
 block discarded – undo
7291 7291
 				}
7292 7292
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7293 7293
 				if ($addnowlink == 1) {
7294
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7295
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7294
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7295
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7296 7296
 				} elseif ($addnowlink == 2) {
7297
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7298
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7297
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7298
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7299 7299
 				}
7300 7300
 
7301 7301
 				if ($fullday) {
@@ -7309,11 +7309,11 @@  discard block
 block discarded – undo
7309 7309
 				}
7310 7310
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7311 7311
 				if ($addnowlink == 1) {
7312
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7313
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7312
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7313
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7314 7314
 				} elseif ($addnowlink == 2) {
7315
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7316
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7315
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7316
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7317 7317
 				}
7318 7318
 				if ($fullday) {
7319 7319
 					$reset_scripts .= ' } ';
@@ -7321,7 +7321,7 @@  discard block
 block discarded – undo
7321 7321
 			}
7322 7322
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7323 7323
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7324
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7324
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7325 7325
 				$retstring .= $langs->trans("Now");
7326 7326
 				$retstring .= '</button> ';
7327 7327
 			}
@@ -7333,16 +7333,16 @@  discard block
 block discarded – undo
7333 7333
 			$reset_scripts = "";
7334 7334
 
7335 7335
 			// Generate the date part, depending on the use or not of the javascript calendar
7336
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7337
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7338
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7339
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7336
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7337
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7338
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7339
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7340 7340
 			// Update the hour part
7341 7341
 			if ($h) {
7342 7342
 				if ($fullday) {
7343 7343
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7344 7344
 				}
7345
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7345
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7346 7346
 				if ($fullday) {
7347 7347
 					$reset_scripts .= ' } ';
7348 7348
 				}
@@ -7352,14 +7352,14 @@  discard block
 block discarded – undo
7352 7352
 				if ($fullday) {
7353 7353
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7354 7354
 				}
7355
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7355
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7356 7356
 				if ($fullday) {
7357 7357
 					$reset_scripts .= ' } ';
7358 7358
 				}
7359 7359
 			}
7360 7360
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7361 7361
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7362
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7362
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7363 7363
 				$retstring .= $langs->trans("DateStartPlusOne");
7364 7364
 				$retstring .= '</button> ';
7365 7365
 			}
@@ -7417,17 +7417,17 @@  discard block
 block discarded – undo
7417 7417
 			unset($TDurationTypes[$value]);
7418 7418
 		}
7419 7419
 
7420
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7420
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7421 7421
 		foreach ($TDurationTypes as $key => $typeduration) {
7422
-			$retstring .= '<option value="' . $key . '"';
7422
+			$retstring .= '<option value="'.$key.'"';
7423 7423
 			if ($key == $selected) {
7424 7424
 				$retstring .= " selected";
7425 7425
 			}
7426
-			$retstring .= ">" . $typeduration . "</option>";
7426
+			$retstring .= ">".$typeduration."</option>";
7427 7427
 		}
7428 7428
 		$retstring .= "</select>";
7429 7429
 
7430
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7430
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7431 7431
 
7432 7432
 		return $retstring;
7433 7433
 	}
@@ -7459,30 +7459,30 @@  discard block
 block discarded – undo
7459 7459
 
7460 7460
 		// Hours
7461 7461
 		if ($iSecond != '') {
7462
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7462
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7463 7463
 
7464 7464
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7465 7465
 			$minSelected = convertSecondToTime($iSecond, 'min');
7466 7466
 		}
7467 7467
 
7468 7468
 		if ($typehour == 'select') {
7469
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7469
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7470 7470
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7471
-				$retstring .= '<option value="' . $hour . '"';
7471
+				$retstring .= '<option value="'.$hour.'"';
7472 7472
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7473 7473
 					$retstring .= " selected";
7474 7474
 				}
7475
-				$retstring .= ">" . $hour . "</option>";
7475
+				$retstring .= ">".$hour."</option>";
7476 7476
 			}
7477 7477
 			$retstring .= "</select>";
7478 7478
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7479
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7479
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7480 7480
 		} else {
7481 7481
 			return 'BadValueForParameterTypeHour';
7482 7482
 		}
7483 7483
 
7484 7484
 		if ($typehour != 'text') {
7485
-			$retstring .= ' ' . $langs->trans('HourShort');
7485
+			$retstring .= ' '.$langs->trans('HourShort');
7486 7486
 		} else {
7487 7487
 			$retstring .= '<span class="">:</span>';
7488 7488
 		}
@@ -7497,21 +7497,21 @@  discard block
 block discarded – undo
7497 7497
 		}
7498 7498
 
7499 7499
 		if ($typehour == 'select' || $typehour == 'textselect') {
7500
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7500
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7501 7501
 			for ($min = 0; $min <= 55; $min += 5) {
7502
-				$retstring .= '<option value="' . $min . '"';
7502
+				$retstring .= '<option value="'.$min.'"';
7503 7503
 				if (is_numeric($minSelected) && $minSelected == $min) {
7504 7504
 					$retstring .= ' selected';
7505 7505
 				}
7506
-				$retstring .= '>' . $min . '</option>';
7506
+				$retstring .= '>'.$min.'</option>';
7507 7507
 			}
7508 7508
 			$retstring .= "</select>";
7509 7509
 		} elseif ($typehour == 'text') {
7510
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7510
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7511 7511
 		}
7512 7512
 
7513 7513
 		if ($typehour != 'text') {
7514
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7514
+			$retstring .= ' '.$langs->trans('MinuteShort');
7515 7515
 		}
7516 7516
 
7517 7517
 		$retstring .= "</span>";
@@ -7559,7 +7559,7 @@  discard block
 block discarded – undo
7559 7559
 			$placeholder = '';
7560 7560
 
7561 7561
 			if ($selected && empty($selected_input_value)) {
7562
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7562
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7563 7563
 				$tickettmpselect = new Ticket($this->db);
7564 7564
 				$tickettmpselect->fetch($selected);
7565 7565
 				$selected_input_value = $tickettmpselect->ref;
@@ -7567,17 +7567,17 @@  discard block
 block discarded – undo
7567 7567
 			}
7568 7568
 
7569 7569
 			$urloption = '';
7570
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7570
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7571 7571
 
7572 7572
 			if (empty($hidelabel)) {
7573
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7573
+				$out .= $langs->trans("RefOrLabel").' : ';
7574 7574
 			} elseif ($hidelabel > 1) {
7575
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7575
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7576 7576
 				if ($hidelabel == 2) {
7577 7577
 					$out .= img_picto($langs->trans("Search"), 'search');
7578 7578
 				}
7579 7579
 			}
7580
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7580
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7581 7581
 			if ($hidelabel == 3) {
7582 7582
 				$out .= img_picto($langs->trans("Search"), 'search');
7583 7583
 			}
@@ -7621,8 +7621,8 @@  discard block
 block discarded – undo
7621 7621
 
7622 7622
 		$sql = "SELECT ";
7623 7623
 		$sql .= $selectFields;
7624
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7625
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7624
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7625
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7626 7626
 
7627 7627
 		// Add criteria on ref/label
7628 7628
 		if ($filterkey != '') {
@@ -7638,7 +7638,7 @@  discard block
 block discarded – undo
7638 7638
 				if ($i > 0) {
7639 7639
 					$sql .= " AND ";
7640 7640
 				}
7641
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7641
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7642 7642
 				$sql .= ")";
7643 7643
 				$i++;
7644 7644
 			}
@@ -7651,22 +7651,22 @@  discard block
 block discarded – undo
7651 7651
 		$sql .= $this->db->plimit($limit, 0);
7652 7652
 
7653 7653
 		// Build output string
7654
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7654
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7655 7655
 		$result = $this->db->query($sql);
7656 7656
 		if ($result) {
7657
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7658
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7657
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7658
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7659 7659
 
7660 7660
 			$num = $this->db->num_rows($result);
7661 7661
 
7662 7662
 			$events = array();
7663 7663
 
7664 7664
 			if (!$forcecombo) {
7665
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7665
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7666 7666
 				$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);
7667 7667
 			}
7668 7668
 
7669
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7669
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7670 7670
 
7671 7671
 			$textifempty = '';
7672 7672
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7683,7 +7683,7 @@  discard block
 block discarded – undo
7683 7683
 				}
7684 7684
 			}
7685 7685
 			if ($showempty) {
7686
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7686
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7687 7687
 			}
7688 7688
 
7689 7689
 			$i = 0;
@@ -7738,13 +7738,13 @@  discard block
 block discarded – undo
7738 7738
 		$outref = $objp->ref;
7739 7739
 		$outtype = $objp->fk_product_type;
7740 7740
 
7741
-		$opt = '<option value="' . $objp->rowid . '"';
7741
+		$opt = '<option value="'.$objp->rowid.'"';
7742 7742
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7743 7743
 		$opt .= '>';
7744 7744
 		$opt .= $objp->ref;
7745 7745
 		$objRef = $objp->ref;
7746 7746
 		if (!empty($filterkey) && $filterkey != '') {
7747
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7747
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7748 7748
 		}
7749 7749
 
7750 7750
 		$opt .= "</option>\n";
@@ -7785,7 +7785,7 @@  discard block
 block discarded – undo
7785 7785
 			$placeholder = '';
7786 7786
 
7787 7787
 			if ($selected && empty($selected_input_value)) {
7788
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7788
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7789 7789
 				$projecttmpselect = new Project($this->db);
7790 7790
 				$projecttmpselect->fetch($selected);
7791 7791
 				$selected_input_value = $projecttmpselect->ref;
@@ -7793,17 +7793,17 @@  discard block
 block discarded – undo
7793 7793
 			}
7794 7794
 
7795 7795
 			$urloption = '';
7796
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7796
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7797 7797
 
7798 7798
 			if (empty($hidelabel)) {
7799
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7799
+				$out .= $langs->trans("RefOrLabel").' : ';
7800 7800
 			} elseif ($hidelabel > 1) {
7801
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7801
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7802 7802
 				if ($hidelabel == 2) {
7803 7803
 					$out .= img_picto($langs->trans("Search"), 'search');
7804 7804
 				}
7805 7805
 			}
7806
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7806
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7807 7807
 			if ($hidelabel == 3) {
7808 7808
 				$out .= img_picto($langs->trans("Search"), 'search');
7809 7809
 			}
@@ -7846,8 +7846,8 @@  discard block
 block discarded – undo
7846 7846
 
7847 7847
 		$sql = "SELECT ";
7848 7848
 		$sql .= $selectFields;
7849
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
7850
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
7849
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
7850
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
7851 7851
 
7852 7852
 		// Add criteria on ref/label
7853 7853
 		if ($filterkey != '') {
@@ -7863,7 +7863,7 @@  discard block
 block discarded – undo
7863 7863
 				if ($i > 0) {
7864 7864
 					$sql .= " AND ";
7865 7865
 				}
7866
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7866
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7867 7867
 				$sql .= "";
7868 7868
 				$i++;
7869 7869
 			}
@@ -7876,22 +7876,22 @@  discard block
 block discarded – undo
7876 7876
 		$sql .= $this->db->plimit($limit, 0);
7877 7877
 
7878 7878
 		// Build output string
7879
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
7879
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
7880 7880
 		$result = $this->db->query($sql);
7881 7881
 		if ($result) {
7882
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7883
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
7882
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7883
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
7884 7884
 
7885 7885
 			$num = $this->db->num_rows($result);
7886 7886
 
7887 7887
 			$events = array();
7888 7888
 
7889 7889
 			if (!$forcecombo) {
7890
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7890
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7891 7891
 				$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
7892 7892
 			}
7893 7893
 
7894
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7894
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7895 7895
 
7896 7896
 			$textifempty = '';
7897 7897
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7908,7 +7908,7 @@  discard block
 block discarded – undo
7908 7908
 				}
7909 7909
 			}
7910 7910
 			if ($showempty) {
7911
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7911
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7912 7912
 			}
7913 7913
 
7914 7914
 			$i = 0;
@@ -7966,13 +7966,13 @@  discard block
 block discarded – undo
7966 7966
 		$outlabel = $objp->label;
7967 7967
 		$outtype = $objp->fk_product_type;
7968 7968
 
7969
-		$opt = '<option value="' . $objp->rowid . '"';
7969
+		$opt = '<option value="'.$objp->rowid.'"';
7970 7970
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7971 7971
 		$opt .= '>';
7972 7972
 		$opt .= $objp->ref;
7973 7973
 		$objRef = $objp->ref;
7974 7974
 		if (!empty($filterkey) && $filterkey != '') {
7975
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7975
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7976 7976
 		}
7977 7977
 
7978 7978
 		$opt .= "</option>\n";
@@ -8014,7 +8014,7 @@  discard block
 block discarded – undo
8014 8014
 			$placeholder = '';
8015 8015
 
8016 8016
 			if ($selected && empty($selected_input_value)) {
8017
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8017
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8018 8018
 				$adherenttmpselect = new Adherent($this->db);
8019 8019
 				$adherenttmpselect->fetch($selected);
8020 8020
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8023,17 +8023,17 @@  discard block
 block discarded – undo
8023 8023
 
8024 8024
 			$urloption = '';
8025 8025
 
8026
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8026
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8027 8027
 
8028 8028
 			if (empty($hidelabel)) {
8029
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8029
+				$out .= $langs->trans("RefOrLabel").' : ';
8030 8030
 			} elseif ($hidelabel > 1) {
8031
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8031
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8032 8032
 				if ($hidelabel == 2) {
8033 8033
 					$out .= img_picto($langs->trans("Search"), 'search');
8034 8034
 				}
8035 8035
 			}
8036
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8036
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8037 8037
 			if ($hidelabel == 3) {
8038 8038
 				$out .= img_picto($langs->trans("Search"), 'search');
8039 8039
 			}
@@ -8078,8 +8078,8 @@  discard block
 block discarded – undo
8078 8078
 
8079 8079
 		$sql = "SELECT ";
8080 8080
 		$sql .= $selectFields;
8081
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8082
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8081
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8082
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8083 8083
 
8084 8084
 		// Add criteria on ref/label
8085 8085
 		if ($filterkey != '') {
@@ -8095,8 +8095,8 @@  discard block
 block discarded – undo
8095 8095
 				if ($i > 0) {
8096 8096
 					$sql .= " AND ";
8097 8097
 				}
8098
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8099
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8098
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8099
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8100 8100
 				$i++;
8101 8101
 			}
8102 8102
 			if (count($search_crit) > 1) {
@@ -8105,27 +8105,27 @@  discard block
 block discarded – undo
8105 8105
 			$sql .= ')';
8106 8106
 		}
8107 8107
 		if ($status != -1) {
8108
-			$sql .= ' AND statut = ' . ((int) $status);
8108
+			$sql .= ' AND statut = '.((int) $status);
8109 8109
 		}
8110 8110
 		$sql .= $this->db->plimit($limit, 0);
8111 8111
 
8112 8112
 		// Build output string
8113
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8113
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8114 8114
 		$result = $this->db->query($sql);
8115 8115
 		if ($result) {
8116
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8117
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8116
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8117
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8118 8118
 
8119 8119
 			$num = $this->db->num_rows($result);
8120 8120
 
8121 8121
 			$events = array();
8122 8122
 
8123 8123
 			if (!$forcecombo) {
8124
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8124
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8125 8125
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8126 8126
 			}
8127 8127
 
8128
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8128
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8129 8129
 
8130 8130
 			$textifempty = '';
8131 8131
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8142,7 +8142,7 @@  discard block
 block discarded – undo
8142 8142
 				}
8143 8143
 			}
8144 8144
 			if ($showempty) {
8145
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8145
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8146 8146
 			}
8147 8147
 
8148 8148
 			$i = 0;
@@ -8198,11 +8198,11 @@  discard block
 block discarded – undo
8198 8198
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8199 8199
 		$outtype = $objp->fk_adherent_type;
8200 8200
 
8201
-		$opt = '<option value="' . $objp->rowid . '"';
8201
+		$opt = '<option value="'.$objp->rowid.'"';
8202 8202
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8203 8203
 		$opt .= '>';
8204 8204
 		if (!empty($filterkey) && $filterkey != '') {
8205
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8205
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8206 8206
 		}
8207 8207
 		$opt .= $outlabel;
8208 8208
 		$opt .= "</option>\n";
@@ -8240,8 +8240,8 @@  discard block
 block discarded – undo
8240 8240
 		$objecttmp = null;
8241 8241
 		$InfoFieldList = array();
8242 8242
 		$classname = '';
8243
-		$filter = '';  // Ensure filter has value (for static analysis)
8244
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8243
+		$filter = ''; // Ensure filter has value (for static analysis)
8244
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8245 8245
 
8246 8246
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8247 8247
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8285,9 +8285,9 @@  discard block
 block discarded – undo
8285 8285
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8286 8286
 			$reg = array();
8287 8287
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8288
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8288
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8289 8289
 			}
8290
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8290
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8291 8291
 
8292 8292
 			$classname = $InfoFieldList[0];
8293 8293
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8318,8 +8318,8 @@  discard block
 block discarded – undo
8318 8318
 		);
8319 8319
 
8320 8320
 		if (!is_object($objecttmp)) {
8321
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8322
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8321
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8322
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8323 8323
 		}
8324 8324
 		'@phan-var-force CommonObject $objecttmp';
8325 8325
 
@@ -8331,9 +8331,9 @@  discard block
 block discarded – undo
8331 8331
 		if ($prefixforautocompletemode == 'product') {
8332 8332
 			$prefixforautocompletemode = 'produit';
8333 8333
 		}
8334
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8334
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8335 8335
 
8336
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8336
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8337 8337
 
8338 8338
 		// Generate the combo HTML component
8339 8339
 		$out = '';
@@ -8362,13 +8362,13 @@  discard block
 block discarded – undo
8362 8362
 			}
8363 8363
 
8364 8364
 			// Set url and param to call to get json of the search results
8365
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8366
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8365
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8366
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8367 8367
 
8368 8368
 			// Activate the auto complete using ajax call.
8369 8369
 			$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);
8370 8370
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8371
-			$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) . '"' : '') . ' />';
8371
+			$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).'"' : '').' />';
8372 8372
 		} else {
8373 8373
 			// Immediate load of table record.
8374 8374
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8408,16 +8408,16 @@  discard block
 block discarded – undo
8408 8408
 		if ($prefixforautocompletemode == 'societe') {
8409 8409
 			$prefixforautocompletemode = 'company';
8410 8410
 		}
8411
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8411
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8412 8412
 
8413 8413
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8414 8414
 			$tmpfieldstoshow = '';
8415 8415
 			foreach ($objecttmp->fields as $key => $val) {
8416
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8416
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8417 8417
 					continue;
8418 8418
 				}
8419 8419
 				if (!empty($val['showoncombobox'])) {
8420
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8420
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8421 8421
 				}
8422 8422
 			}
8423 8423
 			if ($tmpfieldstoshow) {
@@ -8445,18 +8445,18 @@  discard block
 block discarded – undo
8445 8445
 		$num = 0;
8446 8446
 
8447 8447
 		// Search data
8448
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";
8448
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";
8449 8449
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8450
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";
8450
+			$sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";
8451 8451
 		}
8452 8452
 		if (isset($objecttmp->ismultientitymanaged)) {
8453 8453
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8454 8454
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8455
-				$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];
8455
+				$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
8456 8456
 			}
8457 8457
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8458 8458
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8459
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8459
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8460 8460
 				}
8461 8461
 			}
8462 8462
 		}
@@ -8476,21 +8476,21 @@  discard block
 block discarded – undo
8476 8476
 			$sql .= " WHERE 1=1";
8477 8477
 			if (isset($objecttmp->ismultientitymanaged)) {
8478 8478
 				if ($objecttmp->ismultientitymanaged == 1) {
8479
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8479
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8480 8480
 				}
8481 8481
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8482
-					$sql .= " AND parenttable.entity = t." . $tmparray[0];
8482
+					$sql .= " AND parenttable.entity = t.".$tmparray[0];
8483 8483
 				}
8484 8484
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8485 8485
 					if ($objecttmp->element == 'societe') {
8486
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8486
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8487 8487
 					} else {
8488
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8488
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8489 8489
 					}
8490 8490
 				}
8491 8491
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8492 8492
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8493
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8493
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8494 8494
 					}
8495 8495
 				}
8496 8496
 			}
@@ -8502,7 +8502,7 @@  discard block
 block discarded – undo
8502 8502
 				$errormessage = '';
8503 8503
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8504 8504
 				if ($errormessage) {
8505
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8505
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8506 8506
 				}
8507 8507
 			}
8508 8508
 		}
@@ -8514,7 +8514,7 @@  discard block
 block discarded – undo
8514 8514
 		$resql = $this->db->query($sql);
8515 8515
 		if ($resql) {
8516 8516
 			// Construct $out and $outarray
8517
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8517
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8518 8518
 
8519 8519
 			// 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
8520 8520
 			$textifempty = '&nbsp;';
@@ -8528,7 +8528,7 @@  discard block
 block discarded – undo
8528 8528
 				}
8529 8529
 			}
8530 8530
 			if ($showempty) {
8531
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8531
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8532 8532
 			}
8533 8533
 
8534 8534
 			$num = $this->db->num_rows($resql);
@@ -8551,9 +8551,9 @@  discard block
 block discarded – undo
8551 8551
 					}
8552 8552
 					if (empty($outputmode)) {
8553 8553
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8554
-							$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>';
8554
+							$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>';
8555 8555
 						} else {
8556
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8556
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8557 8557
 						}
8558 8558
 					} else {
8559 8559
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8566,10 +8566,10 @@  discard block
 block discarded – undo
8566 8566
 				}
8567 8567
 			}
8568 8568
 
8569
-			$out .= '</select>' . "\n";
8569
+			$out .= '</select>'."\n";
8570 8570
 
8571 8571
 			if (!$forcecombo) {
8572
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8572
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8573 8573
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8574 8574
 			}
8575 8575
 		} else {
@@ -8633,8 +8633,8 @@  discard block
 block discarded – undo
8633 8633
 			}
8634 8634
 		}
8635 8635
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8636
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8637
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8636
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8637
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8638 8638
 		$out .= '>'."\n";
8639 8639
 
8640 8640
 		if ($show_empty) {
@@ -8645,7 +8645,7 @@  discard block
 block discarded – undo
8645 8645
 			if (!is_numeric($show_empty)) {
8646 8646
 				$textforempty = $show_empty;
8647 8647
 			}
8648
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8648
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8649 8649
 		}
8650 8650
 		if (is_array($array)) {
8651 8651
 			// Translate
@@ -8670,7 +8670,7 @@  discard block
 block discarded – undo
8670 8670
 					$value = $tmpvalue['label'];
8671 8671
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8672 8672
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8673
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8673
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8674 8674
 				} else {
8675 8675
 					$value = $tmpvalue;
8676 8676
 					//$valuehtml = $tmpvalue;
@@ -8686,9 +8686,9 @@  discard block
 block discarded – undo
8686 8686
 				}
8687 8687
 				if ($key_in_label) {
8688 8688
 					if (empty($nohtmlescape)) {
8689
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8689
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8690 8690
 					} else {
8691
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8691
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8692 8692
 					}
8693 8693
 				} else {
8694 8694
 					if (empty($nohtmlescape)) {
@@ -8700,8 +8700,8 @@  discard block
 block discarded – undo
8700 8700
 						$selectOptionValue = '&nbsp;';
8701 8701
 					}
8702 8702
 				}
8703
-				$out .= '<option value="' . $key . '"';
8704
-				$out .= $style . $disabled;
8703
+				$out .= '<option value="'.$key.'"';
8704
+				$out .= $style.$disabled;
8705 8705
 				if (is_array($id)) {
8706 8706
 					if (in_array($key, $id) && !$disabled) {
8707 8707
 						$out .= ' selected'; // To preselect a value
@@ -8713,7 +8713,7 @@  discard block
 block discarded – undo
8713 8713
 					}
8714 8714
 				}
8715 8715
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8716
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8716
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8717 8717
 				}
8718 8718
 
8719 8719
 				if (is_array($tmpvalue)) {
@@ -8733,7 +8733,7 @@  discard block
 block discarded – undo
8733 8733
 		// Add code for jquery to use multiselect
8734 8734
 		if ($addjscombo && $jsbeautify) {
8735 8735
 			// Enhance with select2
8736
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8736
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8737 8737
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
8738 8738
 		}
8739 8739
 
@@ -8761,28 +8761,28 @@  discard block
 block discarded – undo
8761 8761
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8762 8762
 	{
8763 8763
 		global $conf, $langs;
8764
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8764
+		global $delayedhtmlcontent; // Will be used later outside of this function
8765 8765
 
8766 8766
 		// TODO Use an internal dolibarr component instead of select2
8767 8767
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8768 8768
 			return '';
8769 8769
 		}
8770 8770
 
8771
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
8771
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
8772 8772
 
8773 8773
 		$outdelayed = '';
8774 8774
 		if (!empty($conf->use_javascript_ajax)) {
8775 8775
 			$tmpplugin = 'select2';
8776
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8777
-		    	<script nonce="' . getNonce() . '">
8776
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8777
+		    	<script nonce="' . getNonce().'">
8778 8778
 		    	$(document).ready(function () {
8779 8779
 
8780
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
8780
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
8781 8781
 
8782
-	                $(".' . $htmlname . '").select2({
8782
+	                $(".' . $htmlname.'").select2({
8783 8783
 				    	ajax: {
8784 8784
 					    	dir: "ltr",
8785
-					    	url: "' . $url . '",
8785
+					    	url: "' . $url.'",
8786 8786
 					    	dataType: \'json\',
8787 8787
 					    	delay: 250,
8788 8788
 					    	data: function (params) {
@@ -8809,9 +8809,9 @@  discard block
 block discarded – undo
8809 8809
 				    	},
8810 8810
 		 				language: select2arrayoflanguage,
8811 8811
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8812
-					    placeholder: "' . dol_escape_js($placeholder) . '",
8812
+					    placeholder: "' . dol_escape_js($placeholder).'",
8813 8813
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8814
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
8814
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
8815 8815
 				        formatResult: function (result, container, query, escapeMarkup) {
8816 8816
 	                        return escapeMarkup(result.text);
8817 8817
 	                    },
@@ -8819,10 +8819,10 @@  discard block
 block discarded – undo
8819 8819
 
8820 8820
 	                ' . ($callurlonselect ? '
8821 8821
 	                /* Code to execute a GET when we select a value */
8822
-	                $(".' . $htmlname . '").change(function() {
8823
-				    	var selected = $(".' . $htmlname . '").val();
8822
+	                $(".' . $htmlname.'").change(function() {
8823
+				    	var selected = $(".' . $htmlname.'").val();
8824 8824
 	                	console.log("We select in selectArrayAjax the entry "+selected)
8825
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
8825
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
8826 8826
 	    			    $.each( saveRemoteData, function( key, value ) {
8827 8827
 	    				        if (key == selected)
8828 8828
 	    			            {
@@ -8830,7 +8830,7 @@  discard block
 block discarded – undo
8830 8830
 	    			                 location.assign(value.url);
8831 8831
 	    			            }
8832 8832
 	                    });
8833
-	    			});' : '') . '
8833
+	    			});' : '').'
8834 8834
 
8835 8835
 	    	   });
8836 8836
 		       </script>';
@@ -8866,14 +8866,14 @@  discard block
 block discarded – undo
8866 8866
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
8867 8867
 	{
8868 8868
 		global $conf, $langs;
8869
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8869
+		global $delayedhtmlcontent; // Will be used later outside of this function
8870 8870
 
8871 8871
 		// TODO Use an internal dolibarr component instead of select2
8872 8872
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8873 8873
 			return '';
8874 8874
 		}
8875 8875
 
8876
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8876
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8877 8877
 
8878 8878
 		$formattedarrayresult = array();
8879 8879
 
@@ -8888,20 +8888,20 @@  discard block
 block discarded – undo
8888 8888
 		$outdelayed = '';
8889 8889
 		if (!empty($conf->use_javascript_ajax)) {
8890 8890
 			$tmpplugin = 'select2';
8891
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8892
-				<script nonce="' . getNonce() . '">
8891
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8892
+				<script nonce="' . getNonce().'">
8893 8893
 				$(document).ready(function () {
8894
-					var data = ' . json_encode($formattedarrayresult) . ';
8894
+					var data = ' . json_encode($formattedarrayresult).';
8895 8895
 
8896
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
8896
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
8897 8897
 
8898
-					$(".' . $htmlname . '").select2({
8898
+					$(".' . $htmlname.'").select2({
8899 8899
 						data: data,
8900 8900
 						language: select2arrayoflanguage,
8901 8901
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8902
-						placeholder: "' . dol_escape_js($placeholder) . '",
8902
+						placeholder: "' . dol_escape_js($placeholder).'",
8903 8903
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8904
-						minimumInputLength: ' . $minimumInputLength . ',
8904
+						minimumInputLength: ' . $minimumInputLength.',
8905 8905
 						formatResult: function (result, container, query, escapeMarkup) {
8906 8906
 							return escapeMarkup(result.text);
8907 8907
 						},
@@ -8940,11 +8940,11 @@  discard block
 block discarded – undo
8940 8940
 
8941 8941
 					' . ($callurlonselect ? '
8942 8942
 					/* Code to execute a GET when we select a value */
8943
-					$(".' . $htmlname . '").change(function() {
8944
-						var selected = $(".' . $htmlname . '").val();
8943
+					$(".' . $htmlname.'").change(function() {
8944
+						var selected = $(".' . $htmlname.'").val();
8945 8945
 						console.log("We select "+selected)
8946 8946
 
8947
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
8947
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
8948 8948
 						$.each( saveRemoteData, function( key, value ) {
8949 8949
 							if (key == selected)
8950 8950
 							{
@@ -8952,7 +8952,7 @@  discard block
 block discarded – undo
8952 8952
 								location.assign(value.url);
8953 8953
 							}
8954 8954
 						});
8955
-					});' : '') . '
8955
+					});' : '').'
8956 8956
 
8957 8957
 				});
8958 8958
 				</script>';
@@ -9001,7 +9001,7 @@  discard block
 block discarded – undo
9001 9001
 		$useenhancedmultiselect = 0;
9002 9002
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9003 9003
 			if ($addjscombo) {
9004
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9004
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9005 9005
 			}
9006 9006
 		}
9007 9007
 
@@ -9010,7 +9010,7 @@  discard block
 block discarded – undo
9010 9010
 		// submitted to nothing.
9011 9011
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9012 9012
 		// Output select component
9013
-		$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";
9013
+		$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";
9014 9014
 		if (is_array($array) && !empty($array)) {
9015 9015
 			if ($value_as_key) {
9016 9016
 				$array = array_combine($array, $array);
@@ -9028,36 +9028,36 @@  discard block
 block discarded – undo
9028 9028
 						$tmpvalue = empty($value['label']) ? '' : $value['label'];
9029 9029
 						$tmpcolor = empty($value['color']) ? '' : $value['color'];
9030 9030
 						$tmppicto = empty($value['picto']) ? '' : $value['picto'];
9031
-						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']): $value['labelhtml'];
9031
+						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9032 9032
 					}
9033 9033
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9034
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9034
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9035 9035
 
9036
-					$out .= '<option value="' . $tmpkey . '"';
9036
+					$out .= '<option value="'.$tmpkey.'"';
9037 9037
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9038 9038
 						$out .= ' selected';
9039 9039
 					}
9040 9040
 					if (!empty($tmplabelhtml)) {
9041
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9041
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9042 9042
 					} else {
9043
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9044
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9043
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9044
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9045 9045
 					}
9046 9046
 					$out .= '>';
9047 9047
 					$out .= dol_htmlentitiesbr($newval);
9048
-					$out .= '</option>' . "\n";
9048
+					$out .= '</option>'."\n";
9049 9049
 				}
9050 9050
 			}
9051 9051
 		}
9052
-		$out .= '</select>' . "\n";
9052
+		$out .= '</select>'."\n";
9053 9053
 
9054 9054
 		// Add code for jquery to use multiselect
9055 9055
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9056
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9057
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9056
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9057
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9058 9058
 			if ($addjscombo == 1) {
9059 9059
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9060
-				$out .= 'function formatResult(record, container) {' . "\n";
9060
+				$out .= 'function formatResult(record, container) {'."\n";
9061 9061
 				// If property data-html set, we decode html entities and use this.
9062 9062
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9063 9063
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9065,26 +9065,26 @@  discard block
 block discarded – undo
9065 9065
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9066 9066
 				$out .= '	}'."\n";
9067 9067
 				$out .= '	return record.text;';
9068
-				$out .= '}' . "\n";
9069
-				$out .= 'function formatSelection(record) {' . "\n";
9068
+				$out .= '}'."\n";
9069
+				$out .= 'function formatSelection(record) {'."\n";
9070 9070
 				if ($elemtype == 'category') {
9071
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9071
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9072 9072
 				} else {
9073 9073
 					$out .= 'return record.text;';
9074 9074
 				}
9075
-				$out .= '}' . "\n";
9075
+				$out .= '}'."\n";
9076 9076
 				$out .= '$(document).ready(function () {
9077
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9077
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9078 9078
 				if ($placeholder) {
9079 9079
 					$out .= '
9080 9080
 								placeholder: {
9081 9081
 								    id: \'-1\',
9082
-								    text: \'' . dol_escape_js($placeholder) . '\'
9082
+								    text: \'' . dol_escape_js($placeholder).'\'
9083 9083
 								  },';
9084 9084
 				}
9085 9085
 				$out .= '		dir: \'ltr\',
9086 9086
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9087
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9087
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9088 9088
 								// Specify format function for dropdown item
9089 9089
 								formatResult: formatResult,
9090 9090
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9096,21 +9096,21 @@  discard block
 block discarded – undo
9096 9096
 
9097 9097
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9098 9098
 								 the size only if component is not hidden by default on load */
9099
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9099
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9100 9100
 						});' . "\n";
9101 9101
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9102 9102
 				// Add other js lib
9103 9103
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9104 9104
 				// ...
9105
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9105
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9106 9106
 				$out .= '$(document).ready(function () {
9107
-							$(\'#' . $htmlname . '\').multiSelect({
9107
+							$(\'#' . $htmlname.'\').multiSelect({
9108 9108
 								containerHTML: \'<div class="multi-select-container">\',
9109 9109
 								menuHTML: \'<div class="multi-select-menu">\',
9110
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9110
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9111 9111
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9112 9112
 								activeClass: \'multi-select-container--open\',
9113
-								noneText: \'' . $placeholder . '\'
9113
+								noneText: \'' . $placeholder.'\'
9114 9114
 							});
9115 9115
 						})';
9116 9116
 			}
@@ -9143,7 +9143,7 @@  discard block
 block discarded – undo
9143 9143
 			return '';
9144 9144
 		}
9145 9145
 
9146
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9146
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9147 9147
 
9148 9148
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9149 9149
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9186,19 +9186,19 @@  discard block
 block discarded – undo
9186 9186
 				}
9187 9187
 
9188 9188
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9189
-				$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>';
9190
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9189
+				$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>';
9190
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9191 9191
 			}
9192 9192
 		}
9193 9193
 
9194
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9194
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9195 9195
 
9196 9196
         <dl class="dropdown">
9197 9197
             <dt>
9198
-            <a href="#' . $htmlname . '">
9199
-              ' . img_picto('', 'list') . '
9198
+            <a href="#' . $htmlname.'">
9199
+              ' . img_picto('', 'list').'
9200 9200
             </a>
9201
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9201
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9202 9202
             </dt>
9203 9203
             <dd class="dropdowndd">
9204 9204
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9210,19 +9210,19 @@  discard block
 block discarded – undo
9210 9210
             </dd>
9211 9211
         </dl>
9212 9212
 
9213
-        <script nonce="' . getNonce() . '" type="text/javascript">
9213
+        <script nonce="' . getNonce().'" type="text/javascript">
9214 9214
           jQuery(document).ready(function () {
9215
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9215
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9216 9216
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9217 9217
 
9218 9218
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9219 9219
 
9220 9220
                   var title = $(this).val() + ",";
9221 9221
                   if ($(this).is(\':checked\')) {
9222
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9222
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9223 9223
                   }
9224 9224
                   else {
9225
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9225
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9226 9226
                   }
9227 9227
                   // Now, we submit page
9228 9228
                   //$(this).parents(\'form:first\').submit();
@@ -9253,7 +9253,7 @@  discard block
 block discarded – undo
9253 9253
 	 */
9254 9254
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9255 9255
 	{
9256
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9256
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9257 9257
 
9258 9258
 		$cat = new Categorie($this->db);
9259 9259
 		$categories = $cat->containing($id, $type);
@@ -9263,10 +9263,10 @@  discard block
 block discarded – undo
9263 9263
 			foreach ($categories as $c) {
9264 9264
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9265 9265
 				foreach ($ways as $way) {
9266
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9266
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9267 9267
 				}
9268 9268
 			}
9269
-			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9269
+			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9270 9270
 		}
9271 9271
 
9272 9272
 		if ($rendermode == 0) {
@@ -9314,15 +9314,15 @@  discard block
 block discarded – undo
9314 9314
 
9315 9315
 
9316 9316
 			print '<div class="div-table-responsive-no-min">';
9317
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9317
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9318 9318
 
9319 9319
 			print '<tr class="liste_titre">';
9320
-			print '<td>' . $langs->trans("Type") . '</td>';
9321
-			print '<td>' . $langs->trans("Ref") . '</td>';
9320
+			print '<td>'.$langs->trans("Type").'</td>';
9321
+			print '<td>'.$langs->trans("Ref").'</td>';
9322 9322
 			print '<td class="center"></td>';
9323
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9324
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9325
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9323
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9324
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9325
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9326 9326
 			print '<td></td>';
9327 9327
 			print '</tr>';
9328 9328
 
@@ -9341,13 +9341,13 @@  discard block
 block discarded – undo
9341 9341
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9342 9342
 					$element = $regs[1];
9343 9343
 					$subelement = $regs[2];
9344
-					$tplpath = $element . '/' . $subelement;
9344
+					$tplpath = $element.'/'.$subelement;
9345 9345
 				}
9346 9346
 				$tplname = 'linkedobjectblock';
9347 9347
 
9348 9348
 				// To work with non standard path
9349 9349
 				if ($objecttype == 'facture') {
9350
-					$tplpath = 'compta/' . $element;
9350
+					$tplpath = 'compta/'.$element;
9351 9351
 					if (!isModEnabled('invoice')) {
9352 9352
 						continue; // Do not show if module disabled
9353 9353
 					}
@@ -9358,7 +9358,7 @@  discard block
 block discarded – undo
9358 9358
 						continue; // Do not show if module disabled
9359 9359
 					}
9360 9360
 				} elseif ($objecttype == 'propal') {
9361
-					$tplpath = 'comm/' . $element;
9361
+					$tplpath = 'comm/'.$element;
9362 9362
 					if (!isModEnabled('propal')) {
9363 9363
 						continue; // Do not show if module disabled
9364 9364
 					}
@@ -9409,7 +9409,7 @@  discard block
 block discarded – undo
9409 9409
 				$linkedObjectBlock = $objects;
9410 9410
 
9411 9411
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9412
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9412
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9413 9413
 				foreach ($dirtpls as $reldir) {
9414 9414
 					$reldir = rtrim($reldir, '/');
9415 9415
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9417,7 +9417,7 @@  discard block
 block discarded – undo
9417 9417
 						$noMoreLinkedObjectBlockAfter = 1;
9418 9418
 					}
9419 9419
 
9420
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9420
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9421 9421
 					if ($res) {
9422 9422
 						$nboftypesoutput++;
9423 9423
 						break;
@@ -9426,7 +9426,7 @@  discard block
 block discarded – undo
9426 9426
 			}
9427 9427
 
9428 9428
 			if (!$nboftypesoutput) {
9429
-				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9429
+				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9430 9430
 			}
9431 9431
 
9432 9432
 			print '</table>';
@@ -9466,14 +9466,14 @@  discard block
 block discarded – undo
9466 9466
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9467 9467
 			$listofidcompanytoscan = $object->thirdparty->id;
9468 9468
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9469
-				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
9469
+				$listofidcompanytoscan .= ','.$object->thirdparty->parent;
9470 9470
 			}
9471 9471
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9472
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9472
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9473 9473
 				$tmpproject = new Project($this->db);
9474 9474
 				$tmpproject->fetch($object->fk_project);
9475 9475
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9476
-					$listofidcompanytoscan .= ',' . $tmpproject->socid;
9476
+					$listofidcompanytoscan .= ','.$tmpproject->socid;
9477 9477
 				}
9478 9478
 				unset($tmpproject);
9479 9479
 			}
@@ -9483,63 +9483,63 @@  discard block
 block discarded – undo
9483 9483
 					'enabled' => isModEnabled('propal'),
9484 9484
 					'perms' => 1,
9485 9485
 					'label' => 'LinkToProposal',
9486
-					'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') . ')'),
9486
+					'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').')'),
9487 9487
 				'shipping' => array(
9488 9488
 					'enabled' => isModEnabled('shipping'),
9489 9489
 					'perms' => 1,
9490 9490
 					'label' => 'LinkToExpedition',
9491
-					'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') . ')'),
9491
+					'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').')'),
9492 9492
 				'order' => array(
9493 9493
 					'enabled' => isModEnabled('order'),
9494 9494
 					'perms' => 1,
9495 9495
 					'label' => 'LinkToOrder',
9496
-					'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') . ')'),
9496
+					'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').')'),
9497 9497
 				'invoice' => array(
9498 9498
 					'enabled' => isModEnabled('invoice'),
9499 9499
 					'perms' => 1,
9500 9500
 					'label' => 'LinkToInvoice',
9501
-					'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') . ')'),
9501
+					'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').')'),
9502 9502
 				'invoice_template' => array(
9503 9503
 					'enabled' => isModEnabled('invoice'),
9504 9504
 					'perms' => 1,
9505 9505
 					'label' => 'LinkToTemplateInvoice',
9506
-					'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') . ')'),
9506
+					'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').')'),
9507 9507
 				'contrat' => array(
9508 9508
 					'enabled' => isModEnabled('contract'),
9509 9509
 					'perms' => 1,
9510 9510
 					'label' => 'LinkToContract',
9511 9511
 					'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
9512
-							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'
9512
+							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'
9513 9513
 				),
9514 9514
 				'fichinter' => array(
9515 9515
 					'enabled' => isModEnabled('intervention'),
9516 9516
 					'perms' => 1,
9517 9517
 					'label' => 'LinkToIntervention',
9518
-					'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') . ')'),
9518
+					'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').')'),
9519 9519
 				'supplier_proposal' => array(
9520 9520
 					'enabled' => isModEnabled('supplier_proposal'),
9521 9521
 					'perms' => 1,
9522 9522
 					'label' => 'LinkToSupplierProposal',
9523
-					'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') . ')'),
9523
+					'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').')'),
9524 9524
 				'order_supplier' => array(
9525 9525
 					'enabled' => isModEnabled("supplier_order"),
9526 9526
 					'perms' => 1,
9527 9527
 					'label' => 'LinkToSupplierOrder',
9528
-					'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') . ')'),
9528
+					'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').')'),
9529 9529
 				'invoice_supplier' => array(
9530 9530
 					'enabled' => isModEnabled("supplier_invoice"),
9531 9531
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9532
-					'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') . ')'),
9532
+					'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').')'),
9533 9533
 				'ticket' => array(
9534 9534
 					'enabled' => isModEnabled('ticket'),
9535 9535
 					'perms' => 1,
9536 9536
 					'label' => 'LinkToTicket',
9537
-					'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') . ')'),
9537
+					'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').')'),
9538 9538
 				'mo' => array(
9539 9539
 					'enabled' => isModEnabled('mrp'),
9540 9540
 					'perms' => 1,
9541 9541
 					'label' => 'LinkToMo',
9542
-					'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') . ')')
9542
+					'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').')')
9543 9543
 			);
9544 9544
 		}
9545 9545
 
@@ -9575,22 +9575,22 @@  discard block
 block discarded – undo
9575 9575
 			}
9576 9576
 
9577 9577
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9578
-				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9578
+				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9579 9579
 
9580 9580
 				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9581 9581
 					print '<br>'."\n";
9582 9582
 					print '<!-- form to add a link from anywhere -->'."\n";
9583
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9584
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9583
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9584
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9585 9585
 					print '<input type="hidden" name="action" value="addlinkbyref">';
9586
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9587
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9586
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9587
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9588 9588
 					print '<table class="noborder">';
9589 9589
 					print '<tr>';
9590 9590
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9591
-					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9592
-					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9593
-					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9591
+					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9592
+					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9593
+					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9594 9594
 					print '</tr>';
9595 9595
 					print '</table>';
9596 9596
 					print '</form>';
@@ -9605,48 +9605,48 @@  discard block
 block discarded – undo
9605 9605
 
9606 9606
 					print '<br>';
9607 9607
 					print '<!-- form to add a link from object to same thirdparty -->'."\n";
9608
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9608
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9609 9609
 					print '<input type="hidden" name="action" value="addlink">';
9610
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9611
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9612
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9610
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9611
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9612
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9613 9613
 					print '<table class="noborder">';
9614 9614
 					print '<tr class="liste_titre">';
9615 9615
 					print '<td class="nowrap"></td>';
9616
-					print '<td class="center">' . $langs->trans("Ref") . '</td>';
9617
-					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>';
9618
-					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9619
-					print '<td class="left">' . $langs->trans("Company") . '</td>';
9616
+					print '<td class="center">'.$langs->trans("Ref").'</td>';
9617
+					print '<td class="left">'.$langs->trans("RefCustomer").'</td>';
9618
+					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9619
+					print '<td class="left">'.$langs->trans("Company").'</td>';
9620 9620
 					print '</tr>';
9621 9621
 					while ($i < $num) {
9622 9622
 						$objp = $this->db->fetch_object($resqllist);
9623 9623
 
9624 9624
 						print '<tr class="oddeven">';
9625 9625
 						print '<td class="left">';
9626
-						print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9626
+						print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9627 9627
 						print '</td>';
9628
-						print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9629
-						print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9628
+						print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9629
+						print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9630 9630
 						print '<td class="right">';
9631 9631
 						if ($possiblelink['label'] == 'LinkToContract') {
9632 9632
 							$form = new Form($this->db);
9633
-							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9633
+							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9634 9634
 						}
9635
-						print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9635
+						print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9636 9636
 						print '</td>';
9637
-						print '<td>' . $objp->name . '</td>';
9637
+						print '<td>'.$objp->name.'</td>';
9638 9638
 						print '</tr>';
9639 9639
 						$i++;
9640 9640
 					}
9641 9641
 					print '</table>';
9642 9642
 					print '<div class="center">';
9643 9643
 					if ($num) {
9644
-						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">';
9644
+						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">';
9645 9645
 					}
9646 9646
 					if (empty($conf->use_javascript_ajax)) {
9647
-						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9647
+						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9648 9648
 					} else {
9649
-						print '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9649
+						print '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9650 9650
 					}
9651 9651
 					print '</form>';
9652 9652
 					$this->db->free($resqllist);
@@ -9657,10 +9657,10 @@  discard block
 block discarded – undo
9657 9657
 
9658 9658
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
9659 9659
 				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9660
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9660
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9661 9661
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9662 9662
 				} else {
9663
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9663
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9664 9664
 				}
9665 9665
 			}
9666 9666
 		}
@@ -9670,11 +9670,11 @@  discard block
 block discarded – undo
9670 9670
     		<dl class="dropdown" id="linktoobjectname">
9671 9671
     		';
9672 9672
 			if (!empty($conf->use_javascript_ajax)) {
9673
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9673
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9674 9674
 			}
9675 9675
 			$linktoelem .= '<dd>
9676 9676
     		<div class="multiselectlinkto">
9677
-    		<ul class="ulselectedfields">' . $linktoelemlist . '
9677
+    		<ul class="ulselectedfields">' . $linktoelemlist.'
9678 9678
     		</ul>
9679 9679
     		</div>
9680 9680
     		</dd>
@@ -9685,7 +9685,7 @@  discard block
 block discarded – undo
9685 9685
 
9686 9686
 		if (!empty($conf->use_javascript_ajax)) {
9687 9687
 			print '<!-- Add js to show linkto box -->
9688
-				<script nonce="' . getNonce() . '">
9688
+				<script nonce="' . getNonce().'">
9689 9689
 				jQuery(document).ready(function() {
9690 9690
 					jQuery(".linkto").click(function() {
9691 9691
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -9726,19 +9726,19 @@  discard block
 block discarded – undo
9726 9726
 
9727 9727
 		$disabled = ($disabled ? ' disabled' : '');
9728 9728
 
9729
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
9729
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
9730 9730
 		if ($useempty) {
9731
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9731
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
9732 9732
 		}
9733 9733
 		if (("$value" == 'yes') || ($value == 1)) {
9734
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
9735
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
9734
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
9735
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
9736 9736
 		} else {
9737 9737
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
9738
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
9739
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
9738
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
9739
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
9740 9740
 		}
9741
-		$resultyesno .= '</select>' . "\n";
9741
+		$resultyesno .= '</select>'."\n";
9742 9742
 
9743 9743
 		if ($addjscombo) {
9744 9744
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -9762,12 +9762,12 @@  discard block
 block discarded – undo
9762 9762
 	{
9763 9763
 		// phpcs:enable
9764 9764
 		$sql = "SELECT rowid, label";
9765
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
9766
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
9765
+		$sql .= " FROM ".$this->db->prefix()."export_model";
9766
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
9767 9767
 		$sql .= " ORDER BY rowid";
9768 9768
 		$result = $this->db->query($sql);
9769 9769
 		if ($result) {
9770
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
9770
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
9771 9771
 			if ($useempty) {
9772 9772
 				print '<option value="-1">&nbsp;</option>';
9773 9773
 			}
@@ -9777,9 +9777,9 @@  discard block
 block discarded – undo
9777 9777
 			while ($i < $num) {
9778 9778
 				$obj = $this->db->fetch_object($result);
9779 9779
 				if ($selected == $obj->rowid) {
9780
-					print '<option value="' . $obj->rowid . '" selected>';
9780
+					print '<option value="'.$obj->rowid.'" selected>';
9781 9781
 				} else {
9782
-					print '<option value="' . $obj->rowid . '">';
9782
+					print '<option value="'.$obj->rowid.'">';
9783 9783
 				}
9784 9784
 				print $obj->label;
9785 9785
 				print '</option>';
@@ -9870,8 +9870,8 @@  discard block
 block discarded – undo
9870 9870
 				$stringforfirstkey .= ' CTL +';
9871 9871
 			}
9872 9872
 
9873
-			$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>';
9874
-			$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>';
9873
+			$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>';
9874
+			$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>';
9875 9875
 		}
9876 9876
 
9877 9877
 		//print "xx".$previous_ref."x".$next_ref;
@@ -9879,18 +9879,18 @@  discard block
 block discarded – undo
9879 9879
 
9880 9880
 		// Right part of banner
9881 9881
 		if ($morehtmlright) {
9882
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
9882
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
9883 9883
 		}
9884 9884
 
9885 9885
 		if ($previous_ref || $next_ref || $morehtml) {
9886 9886
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
9887 9887
 		}
9888 9888
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
9889
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
9889
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
9890 9890
 		}
9891 9891
 		if ($shownav && ($previous_ref || $next_ref)) {
9892
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
9893
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
9892
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
9893
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
9894 9894
 		}
9895 9895
 		if ($previous_ref || $next_ref || $morehtml) {
9896 9896
 			$ret .= '</ul></div>';
@@ -9905,7 +9905,7 @@  discard block
 block discarded – undo
9905 9905
 			$morehtmlstatus = $hookmanager->resPrint;
9906 9906
 		}
9907 9907
 		if ($morehtmlstatus) {
9908
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
9908
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
9909 9909
 		}
9910 9910
 
9911 9911
 		$parameters = array();
@@ -9919,14 +9919,14 @@  discard block
 block discarded – undo
9919 9919
 		// Left part of banner
9920 9920
 		if ($morehtmlleft) {
9921 9921
 			if ($conf->browser->layout == 'phone') {
9922
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
9922
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
9923 9923
 			} else {
9924
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
9924
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
9925 9925
 			}
9926 9926
 		}
9927 9927
 
9928 9928
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
9929
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
9929
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
9930 9930
 
9931 9931
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
9932 9932
 		if ($object->element == 'societe') {
@@ -9940,7 +9940,7 @@  discard block
 block discarded – undo
9940 9940
 
9941 9941
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
9942 9942
 				if (!is_object($extralanguages)) {
9943
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
9943
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
9944 9944
 					$extralanguages = new ExtraLanguages($this->db);
9945 9945
 				}
9946 9946
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -9955,29 +9955,29 @@  discard block
 block discarded – undo
9955 9955
 						if ($object->array_languages['name'][$extralangcode]) {
9956 9956
 							$htmltext .= $object->array_languages['name'][$extralangcode];
9957 9957
 						} else {
9958
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
9958
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
9959 9959
 						}
9960 9960
 					}
9961
-					$ret .= '<!-- Show translations of name -->' . "\n";
9961
+					$ret .= '<!-- Show translations of name -->'."\n";
9962 9962
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
9963 9963
 				}
9964 9964
 			}
9965 9965
 		} elseif ($object->element == 'member') {
9966 9966
 			'@phan-var-force Adherent $object';
9967
-			$ret .= $object->ref . '<br>';
9967
+			$ret .= $object->ref.'<br>';
9968 9968
 			$fullname = $object->getFullName($langs);
9969 9969
 			if ($object->morphy == 'mor' && $object->societe) {
9970
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
9970
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
9971 9971
 			} else {
9972
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
9972
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
9973 9973
 			}
9974 9974
 		} elseif (in_array($object->element, array('contact', 'user'))) {
9975
-			$ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;
9975
+			$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
9976 9976
 		} elseif ($object->element == 'usergroup') {
9977 9977
 			$ret .= dol_htmlentities($object->name);
9978 9978
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
9979 9979
 			'@phan-var-force ActionComm $object';
9980
-			$ret .= $object->ref . '<br>' . $object->label;
9980
+			$ret .= $object->ref.'<br>'.$object->label;
9981 9981
 		} elseif (in_array($object->element, array('adherent_type'))) {
9982 9982
 			$ret .= $object->label;
9983 9983
 		} elseif ($object->element == 'ecm_directories') {
@@ -10030,9 +10030,9 @@  discard block
 block discarded – undo
10030 10030
 		}
10031 10031
 
10032 10032
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10033
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10034
-		$out = '<!-- url barcode = ' . $url . ' -->';
10035
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10033
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10034
+		$out = '<!-- url barcode = '.$url.' -->';
10035
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10036 10036
 
10037 10037
 		return $out;
10038 10038
 	}
@@ -10059,7 +10059,7 @@  discard block
 block discarded – undo
10059 10059
 		global $conf, $langs;
10060 10060
 
10061 10061
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10062
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10062
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10063 10063
 
10064 10064
 		$dir = '';
10065 10065
 		$file = '';
@@ -10072,28 +10072,28 @@  discard block
 block discarded – undo
10072 10072
 			if (!empty($object->logo)) {
10073 10073
 				if (dolIsAllowedForPreview($object->logo)) {
10074 10074
 					if ((string) $imagesize == 'mini') {
10075
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10075
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10076 10076
 					} elseif ((string) $imagesize == 'small') {
10077
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10077
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10078 10078
 					} else {
10079
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10079
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10080 10080
 					}
10081
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10081
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10082 10082
 				}
10083 10083
 			}
10084 10084
 			$email = $object->email;
10085 10085
 		} elseif ($modulepart == 'contact') {
10086
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10086
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10087 10087
 			if (!empty($object->photo)) {
10088 10088
 				if (dolIsAllowedForPreview($object->photo)) {
10089 10089
 					if ((string) $imagesize == 'mini') {
10090
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10090
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10091 10091
 					} elseif ((string) $imagesize == 'small') {
10092
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10092
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10093 10093
 					} else {
10094
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10094
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10095 10095
 					}
10096
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10096
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10097 10097
 				}
10098 10098
 			}
10099 10099
 			$email = $object->email;
@@ -10103,17 +10103,17 @@  discard block
 block discarded – undo
10103 10103
 			if (!empty($object->photo)) {
10104 10104
 				if (dolIsAllowedForPreview($object->photo)) {
10105 10105
 					if ((string) $imagesize == 'mini') {
10106
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10106
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10107 10107
 					} elseif ((string) $imagesize == 'small') {
10108
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10108
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10109 10109
 					} else {
10110
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10110
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10111 10111
 					}
10112
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10112
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10113 10113
 				}
10114 10114
 			}
10115 10115
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10116
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10116
+				$altfile = $object->id.".jpg"; // For backward compatibility
10117 10117
 			}
10118 10118
 			$email = $object->email;
10119 10119
 			$capture = 'user';
@@ -10122,17 +10122,17 @@  discard block
 block discarded – undo
10122 10122
 			if (!empty($object->photo)) {
10123 10123
 				if (dolIsAllowedForPreview($object->photo)) {
10124 10124
 					if ((string) $imagesize == 'mini') {
10125
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10125
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10126 10126
 					} elseif ((string) $imagesize == 'small') {
10127
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10127
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10128 10128
 					} else {
10129
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10129
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10130 10130
 					}
10131
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10131
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10132 10132
 				}
10133 10133
 			}
10134 10134
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10135
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10135
+				$altfile = $object->id.".jpg"; // For backward compatibility
10136 10136
 			}
10137 10137
 			$email = $object->email;
10138 10138
 			$capture = 'user';
@@ -10158,35 +10158,35 @@  discard block
 block discarded – undo
10158 10158
 		$ret = '';
10159 10159
 
10160 10160
 		if ($dir) {
10161
-			if ($file && file_exists($dir . "/" . $file)) {
10161
+			if ($file && file_exists($dir."/".$file)) {
10162 10162
 				if ($addlinktofullsize) {
10163
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10163
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10164 10164
 					if ($urladvanced) {
10165
-						$ret .= '<a href="' . $urladvanced . '">';
10165
+						$ret .= '<a href="'.$urladvanced.'">';
10166 10166
 					} else {
10167
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10167
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10168 10168
 					}
10169 10169
 				}
10170
-				$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 . '">';
10170
+				$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.'">';
10171 10171
 				if ($addlinktofullsize) {
10172 10172
 					$ret .= '</a>';
10173 10173
 				}
10174
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10174
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10175 10175
 				if ($addlinktofullsize) {
10176
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10176
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10177 10177
 					if ($urladvanced) {
10178
-						$ret .= '<a href="' . $urladvanced . '">';
10178
+						$ret .= '<a href="'.$urladvanced.'">';
10179 10179
 					} else {
10180
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10180
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10181 10181
 					}
10182 10182
 				}
10183
-				$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 . '">';
10183
+				$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.'">';
10184 10184
 				if ($addlinktofullsize) {
10185 10185
 					$ret .= '</a>';
10186 10186
 				}
10187 10187
 			} else {
10188 10188
 				$nophoto = '/public/theme/common/nophoto.png';
10189
-				$defaultimg = 'identicon';        // For gravatar
10189
+				$defaultimg = 'identicon'; // For gravatar
10190 10190
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10191 10191
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10192 10192
 						$nophoto = 'company';
@@ -10204,13 +10204,13 @@  discard block
 block discarded – undo
10204 10204
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10205 10205
 					// see https://gravatar.com/site/implement/images/php/
10206 10206
 					$ret .= '<!-- Put link to gravatar -->';
10207
-					$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
10207
+					$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
10208 10208
 				} else {
10209 10209
 					if ($nophoto == 'company') {
10210
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10210
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10211 10211
 						//$ret .= '<div class="difforspanimgright"></div>';
10212 10212
 					} else {
10213
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10213
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10214 10214
 					}
10215 10215
 				}
10216 10216
 			}
@@ -10221,15 +10221,15 @@  discard block
 block discarded – undo
10221 10221
 				}
10222 10222
 				$ret .= '<table class="nobordernopadding centpercent">';
10223 10223
 				if ($object->photo) {
10224
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10224
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10225 10225
 				}
10226 10226
 				$ret .= '<tr><td class="tdoverflow">';
10227 10227
 				$maxfilesizearray = getMaxFileSizeArray();
10228 10228
 				$maxmin = $maxfilesizearray['maxmin'];
10229 10229
 				if ($maxmin > 0) {
10230
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10230
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10231 10231
 				}
10232
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10232
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10233 10233
 				$ret .= '</td></tr>';
10234 10234
 				$ret .= '</table>';
10235 10235
 			}
@@ -10283,38 +10283,38 @@  discard block
 block discarded – undo
10283 10283
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10284 10284
 			$sql .= ", e.label";
10285 10285
 		}
10286
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10286
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10287 10287
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10288
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10288
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10289 10289
 			if ($force_entity) {
10290
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10290
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10291 10291
 			} else {
10292 10292
 				$sql .= " WHERE ug.entity IS NOT NULL";
10293 10293
 			}
10294 10294
 		} else {
10295
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10295
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10296 10296
 		}
10297 10297
 		if (is_array($exclude) && $excludeGroups) {
10298
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10298
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10299 10299
 		}
10300 10300
 		if (is_array($include) && $includeGroups) {
10301
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10301
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10302 10302
 		}
10303 10303
 		$sql .= " ORDER BY ug.nom ASC";
10304 10304
 
10305
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10305
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10306 10306
 		$resql = $this->db->query($sql);
10307 10307
 		if ($resql) {
10308 10308
 			// Enhance with select2
10309
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10309
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10310 10310
 
10311
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10311
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10312 10312
 
10313 10313
 			$num = $this->db->num_rows($resql);
10314 10314
 			$i = 0;
10315 10315
 			if ($num) {
10316 10316
 				if ($show_empty && !$multiple) {
10317
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10317
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10318 10318
 				}
10319 10319
 
10320 10320
 				while ($i < $num) {
@@ -10327,11 +10327,11 @@  discard block
 block discarded – undo
10327 10327
 					$label = $obj->name;
10328 10328
 					$labelhtml = $obj->name;
10329 10329
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10330
-						$label .= " (" . $obj->label . ")";
10331
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10330
+						$label .= " (".$obj->label.")";
10331
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10332 10332
 					}
10333 10333
 
10334
-					$out .= '<option value="' . $obj->rowid . '"';
10334
+					$out .= '<option value="'.$obj->rowid.'"';
10335 10335
 					if ($disableline) {
10336 10336
 						$out .= ' disabled';
10337 10337
 					}
@@ -10347,9 +10347,9 @@  discard block
 block discarded – undo
10347 10347
 				}
10348 10348
 			} else {
10349 10349
 				if ($show_empty) {
10350
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10350
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10351 10351
 				}
10352
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10352
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10353 10353
 			}
10354 10354
 			$out .= '</select>';
10355 10355
 
@@ -10393,25 +10393,25 @@  discard block
 block discarded – undo
10393 10393
 		$out = '';
10394 10394
 
10395 10395
 		if (!empty($conf->use_javascript_ajax)) {
10396
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10396
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10397 10397
 		}
10398
-		$out .= '<script nonce="' . getNonce() . '">
10398
+		$out .= '<script nonce="'.getNonce().'">
10399 10399
             $(document).ready(function() {
10400
-                $("#' . $cssclass . 's").click(function() {
10400
+                $("#' . $cssclass.'s").click(function() {
10401 10401
                     if($(this).is(\':checked\')){
10402
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10403
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10402
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10403
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10404 10404
                     }
10405 10405
                     else
10406 10406
                     {
10407 10407
                         console.log("We uncheck all");
10408
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10408
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10409 10409
                     }' . "\n";
10410 10410
 		if ($calljsfunction) {
10411
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10411
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10412 10412
 		}
10413 10413
 		$out .= '         });
10414
-        	        $(".' . $cssclass . '").change(function() {
10414
+        	        $(".' . $cssclass.'").change(function() {
10415 10415
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10416 10416
 				});
10417 10417
 		 	});
@@ -10456,67 +10456,67 @@  discard block
 block discarded – undo
10456 10456
 		global $langs, $user;
10457 10457
 
10458 10458
 		$out = '';
10459
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10460
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10459
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10460
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10461 10461
 		if (!empty($excludeid)) {
10462
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10462
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10463 10463
 		}
10464 10464
 		$sql .= " ORDER BY label";
10465 10465
 
10466 10466
 		$resql = $this->db->query($sql);
10467 10467
 		if ($resql) {
10468
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10468
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10469 10469
 			if ($useempty) {
10470 10470
 				$out .= '<option value="0">&nbsp;</option>';
10471 10471
 			}
10472 10472
 
10473 10473
 			while ($obj = $this->db->fetch_object($resql)) {
10474
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10474
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10475 10475
 			}
10476 10476
 			$out .= '</select>';
10477
-			$out .= ajax_combobox('select_' . $htmlname);
10477
+			$out .= ajax_combobox('select_'.$htmlname);
10478 10478
 
10479 10479
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10480
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10480
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10481 10481
 			}
10482 10482
 
10483 10483
 			if (!empty($target)) {
10484
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10484
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10485 10485
 				$resql = $this->db->query($sql);
10486 10486
 				if ($resql) {
10487 10487
 					if ($this->db->num_rows($resql) > 0) {
10488 10488
 						$obj = $this->db->fetch_object($resql);
10489
-						$out .= '<script nonce="' . getNonce() . '">
10489
+						$out .= '<script nonce="'.getNonce().'">
10490 10490
 							$(function() {
10491
-								$("select[name=' . $target . ']").on("change", function() {
10491
+								$("select[name=' . $target.']").on("change", function() {
10492 10492
 									var current_val = $(this).val();
10493
-									if (current_val == ' . $obj->id . ') {';
10493
+									if (current_val == ' . $obj->id.') {';
10494 10494
 						if (!empty($default_selected) || !empty($selected)) {
10495
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10495
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10496 10496
 						}
10497 10497
 
10498 10498
 						$out .= '
10499
-										$("select[name=' . $htmlname . ']").change();
10499
+										$("select[name=' . $htmlname.']").change();
10500 10500
 									}
10501 10501
 								});
10502 10502
 
10503
-								$("select[name=' . $htmlname . ']").change(function() {
10503
+								$("select[name=' . $htmlname.']").change(function() {
10504 10504
 
10505
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10505
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10506 10506
 										// get price of kilometer to fill the unit price
10507 10507
 										$.ajax({
10508 10508
 											method: "POST",
10509 10509
 											dataType: "json",
10510
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10511
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10510
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10511
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10512 10512
 										}).done(function( data, textStatus, jqXHR ) {
10513 10513
 											console.log(data);
10514 10514
 											if (typeof data.up != "undefined") {
10515 10515
 												$("input[name=value_unit]").val(data.up);
10516
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10516
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10517 10517
 											} else {
10518 10518
 												$("input[name=value_unit]").val("");
10519
-												$("select[name=' . $htmlname . ']").attr("title", "");
10519
+												$("select[name=' . $htmlname.']").attr("title", "");
10520 10520
 											}
10521 10521
 										});
10522 10522
 									}
@@ -10546,18 +10546,18 @@  discard block
 block discarded – undo
10546 10546
 		global $conf, $langs;
10547 10547
 
10548 10548
 		$out = '';
10549
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10550
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10549
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10550
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10551 10551
 
10552 10552
 		$resql = $this->db->query($sql);
10553 10553
 		if ($resql) {
10554
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10554
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10555 10555
 			if ($useempty) {
10556 10556
 				$out .= '<option value="0"></option>';
10557 10557
 			}
10558 10558
 
10559 10559
 			while ($obj = $this->db->fetch_object($resql)) {
10560
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10560
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10561 10561
 			}
10562 10562
 			$out .= '</select>';
10563 10563
 		} else {
@@ -10588,12 +10588,12 @@  discard block
 block discarded – undo
10588 10588
 
10589 10589
 		$resql = $this->db->query($sql);
10590 10590
 		if ($resql) {
10591
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10591
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10592 10592
 			if ($useempty) {
10593 10593
 				$out .= '<option value="0"></option>';
10594 10594
 			}
10595 10595
 			if ($allchoice) {
10596
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10596
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10597 10597
 			}
10598 10598
 
10599 10599
 			$field = 'code';
@@ -10603,7 +10603,7 @@  discard block
 block discarded – undo
10603 10603
 
10604 10604
 			while ($obj = $this->db->fetch_object($resql)) {
10605 10605
 				$key = $langs->trans($obj->code);
10606
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10606
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10607 10607
 			}
10608 10608
 			$out .= '</select>';
10609 10609
 
@@ -10637,7 +10637,7 @@  discard block
 block discarded – undo
10637 10637
 	{
10638 10638
 		global $user, $conf, $langs;
10639 10639
 
10640
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10640
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10641 10641
 
10642 10642
 		if (is_null($usertofilter)) {
10643 10643
 			$usertofilter = $user;
@@ -10661,10 +10661,10 @@  discard block
 block discarded – undo
10661 10661
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10662 10662
             p.title, p.fk_soc, p.fk_statut, p.public,";
10663 10663
 		$sql .= ' s.nom as name';
10664
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10665
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10666
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10667
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10664
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10665
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10666
+		$sql .= ' '.$this->db->prefix().'facture as f';
10667
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10668 10668
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10669 10669
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10670 10670
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10675,14 +10675,14 @@  discard block
 block discarded – undo
10675 10675
 		if ($resql) {
10676 10676
 			// Use select2 selector
10677 10677
 			if (!empty($conf->use_javascript_ajax)) {
10678
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10678
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10679 10679
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10680 10680
 				$out .= $comboenhancement;
10681 10681
 				$morecss = 'minwidth200imp maxwidth500';
10682 10682
 			}
10683 10683
 
10684 10684
 			if (empty($option_only)) {
10685
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10685
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10686 10686
 			}
10687 10687
 			if (!empty($show_empty)) {
10688 10688
 				$out .= '<option value="0" class="optiongrey">';
@@ -10712,33 +10712,33 @@  discard block
 block discarded – undo
10712 10712
 						if ($showproject == 'all') {
10713 10713
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
10714 10714
 							if ($obj->name) {
10715
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
10715
+								$labeltoshow .= ' - '.$obj->name; // Soc name
10716 10716
 							}
10717 10717
 
10718 10718
 							$disabled = 0;
10719 10719
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
10720 10720
 								$disabled = 1;
10721
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
10721
+								$labeltoshow .= ' - '.$langs->trans("Draft");
10722 10722
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
10723 10723
 								if ($discard_closed == 2) {
10724 10724
 									$disabled = 1;
10725 10725
 								}
10726
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
10726
+								$labeltoshow .= ' - '.$langs->trans("Closed");
10727 10727
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
10728 10728
 								$disabled = 1;
10729
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
10729
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
10730 10730
 							}
10731 10731
 						}
10732 10732
 
10733 10733
 						if (!empty($selected) && $selected == $obj->rowid) {
10734
-							$out .= '<option value="' . $obj->rowid . '" selected';
10734
+							$out .= '<option value="'.$obj->rowid.'" selected';
10735 10735
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10736
-							$out .= '>' . $labeltoshow . '</option>';
10736
+							$out .= '>'.$labeltoshow.'</option>';
10737 10737
 						} else {
10738 10738
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
10739 10739
 								$resultat = '';
10740 10740
 							} else {
10741
-								$resultat = '<option value="' . $obj->rowid . '"';
10741
+								$resultat = '<option value="'.$obj->rowid.'"';
10742 10742
 								if ($disabled) {
10743 10743
 									$resultat .= ' disabled';
10744 10744
 								}
@@ -10790,22 +10790,22 @@  discard block
 block discarded – undo
10790 10790
 
10791 10791
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
10792 10792
 		//$sql.= ', el.fk_source';
10793
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
10794
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
10793
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
10794
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
10795 10795
 		$sql .= " ORDER BY f.titre ASC";
10796 10796
 
10797 10797
 		$resql = $this->db->query($sql);
10798 10798
 		if ($resql) {
10799 10799
 			// Use select2 selector
10800 10800
 			if (!empty($conf->use_javascript_ajax)) {
10801
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10801
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10802 10802
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10803 10803
 				$out .= $comboenhancement;
10804 10804
 				$morecss = 'minwidth200imp maxwidth500';
10805 10805
 			}
10806 10806
 
10807 10807
 			if (empty($option_only)) {
10808
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10808
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10809 10809
 			}
10810 10810
 			if (!empty($show_empty)) {
10811 10811
 				$out .= '<option value="0" class="optiongrey">';
@@ -10824,19 +10824,19 @@  discard block
 block discarded – undo
10824 10824
 					$disabled = 0;
10825 10825
 					if (!empty($obj->suspended)) {
10826 10826
 						$disabled = 1;
10827
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
10827
+						$labeltoshow .= ' - '.$langs->trans("Closed");
10828 10828
 					}
10829 10829
 
10830 10830
 
10831 10831
 					if (!empty($selected) && $selected == $obj->rowid) {
10832
-						$out .= '<option value="' . $obj->rowid . '" selected';
10832
+						$out .= '<option value="'.$obj->rowid.'" selected';
10833 10833
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10834
-						$out .= '>' . $labeltoshow . '</option>';
10834
+						$out .= '>'.$labeltoshow.'</option>';
10835 10835
 					} else {
10836 10836
 						if ($disabled && ($selected != $obj->rowid)) {
10837 10837
 							$resultat = '';
10838 10838
 						} else {
10839
-							$resultat = '<option value="' . $obj->rowid . '"';
10839
+							$resultat = '<option value="'.$obj->rowid.'"';
10840 10840
 							if ($disabled) {
10841 10841
 								$resultat .= ' disabled';
10842 10842
 							}
@@ -10876,14 +10876,14 @@  discard block
 block discarded – undo
10876 10876
 		global $langs;
10877 10877
 
10878 10878
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
10879
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
10879
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
10880 10880
 		}
10881 10881
 
10882 10882
 		$ret = '';
10883 10883
 
10884 10884
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
10885 10885
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
10886
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
10886
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
10887 10887
 		$ret .= '</a>';
10888 10888
 
10889 10889
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -10927,29 +10927,29 @@  discard block
 block discarded – undo
10927 10927
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
10928 10928
 		}
10929 10929
 		$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%')) -->";
10930
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
10930
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
10931 10931
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
10932 10932
 
10933 10933
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
10934 10934
 		foreach ($arrayofcriterias as $criteria) {
10935 10935
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
10936
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10936
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10937 10937
 					continue;
10938 10938
 				}
10939 10939
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
10940 10940
 					continue;
10941 10941
 				}
10942 10942
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
10943
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
10944
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
10945
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
10946
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
10947
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
10948
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
10949
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
10950
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
10943
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
10944
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
10945
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
10946
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
10947
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
10948
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
10949
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
10950
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
10951 10951
 				} else {
10952
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
10952
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
10953 10953
 				}
10954 10954
 			}
10955 10955
 		}
@@ -10957,7 +10957,7 @@  discard block
 block discarded – undo
10957 10957
 		$ret .= '</div>';
10958 10958
 
10959 10959
 		$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";
10960
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10960
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10961 10961
 
10962 10962
 		$ret .= '</div>';
10963 10963
 		$ret .= '</div>';
@@ -11031,7 +11031,7 @@  discard block
 block discarded – undo
11031 11031
 
11032 11032
 		$TModels = array();
11033 11033
 
11034
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11034
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11035 11035
 		$formmail = new FormMail($this->db);
11036 11036
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11037 11037
 
@@ -11044,17 +11044,17 @@  discard block
 block discarded – undo
11044 11044
 			}
11045 11045
 		}
11046 11046
 
11047
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11047
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11048 11048
 
11049 11049
 		foreach ($TModels as $id_model => $label_model) {
11050
-			$retstring .= '<option value="' . $id_model . '"';
11051
-			$retstring .= ">" . $label_model . "</option>";
11050
+			$retstring .= '<option value="'.$id_model.'"';
11051
+			$retstring .= ">".$label_model."</option>";
11052 11052
 		}
11053 11053
 
11054 11054
 		$retstring .= "</select>";
11055 11055
 
11056 11056
 		if ($addjscombo) {
11057
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11057
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11058 11058
 		}
11059 11059
 
11060 11060
 		return $retstring;
@@ -11105,16 +11105,16 @@  discard block
 block discarded – undo
11105 11105
 
11106 11106
 		foreach ($buttons as $button) {
11107 11107
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11108
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
11108
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
11109 11109
 		}
11110 11110
 		$retstring .= $withoutdiv ? '' : '</div>';
11111 11111
 
11112 11112
 		if ($dol_openinpopup) {
11113
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";
11114
-			$retstring .= '<script nonce="' . getNonce() . '">';
11113
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
11114
+			$retstring .= '<script nonce="'.getNonce().'">';
11115 11115
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11116
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');
11117
-				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');
11116
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');
11117
+				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');
11118 11118
 				 });';
11119 11119
 			$retstring .= '</script>';
11120 11120
 		}
@@ -11143,7 +11143,7 @@  discard block
 block discarded – undo
11143 11143
 		dol_syslog(__METHOD__, LOG_DEBUG);
11144 11144
 
11145 11145
 		$sql = "SELECT rowid, code, label as label";
11146
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11146
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11147 11147
 		$sql .= " WHERE active = 1";
11148 11148
 
11149 11149
 		$resql = $this->db->query($sql);
@@ -11154,7 +11154,7 @@  discard block
 block discarded – undo
11154 11154
 				$obj = $this->db->fetch_object($resql);
11155 11155
 
11156 11156
 				// If translation exists, we use it, otherwise we take the default wording
11157
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11157
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11158 11158
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11159 11159
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11160 11160
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11186,18 +11186,18 @@  discard block
 block discarded – undo
11186 11186
 		global $langs, $user;
11187 11187
 
11188 11188
 		$out = '';
11189
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11189
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11190 11190
 
11191 11191
 		$this->load_cache_invoice_subtype();
11192 11192
 
11193
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11193
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11194 11194
 		if ($addempty) {
11195 11195
 			$out .= '<option value="0">&nbsp;</option>';
11196 11196
 		}
11197 11197
 
11198 11198
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11199 11199
 			$label = $subtype['label'];
11200
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11200
+			$out .= '<option value="'.$subtype['rowid'].'"';
11201 11201
 			if ($selected == $subtype['rowid']) {
11202 11202
 				$out .= ' selected="selected"';
11203 11203
 			}
Please login to merge, or discard this patch.
htdocs/core/class/translate.class.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 			$more = array();
131 131
 			$i = 0;
132 132
 			foreach ($conf->file->dol_document_root as $dir) {
133
-				$newdir = $dir . getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX'
133
+				$newdir = $dir.getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX'
134 134
 				if (!in_array($newdir, $this->dir)) {
135
-					$more['module_' . $i] = $newdir;
135
+					$more['module_'.$i] = $newdir;
136 136
 					$i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir.
137 137
 				}
138 138
 			}
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 			if (isset($longforshort[strtolower($langpart[0])]) && !in_array($codetouse, $longforshortexcep)) {
163 163
 				$srclang = $longforshort[strtolower($langpart[0])];
164 164
 			} elseif (!is_numeric($langpart[1])) {		// Second part YY may be a numeric with some Chrome browser
165
-				$srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[1]);
165
+				$srclang = strtolower($langpart[0])."_".strtoupper($langpart[1]);
166 166
 				$longforlong = array('no_nb' => 'nb_NO');
167 167
 				if (isset($longforlong[strtolower($srclang)])) {
168 168
 					$srclang = $longforlong[strtolower($srclang)];
169 169
 				}
170 170
 			} else {
171
-				$srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]);
171
+				$srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
172 172
 			}
173 173
 		} else {						// If it's for a codetouse that is a short code xx
174 174
 			// Array to convert short lang code into long code.
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			if (isset($longforshort[strtolower($langpart[0])])) {
182 182
 				$srclang = $longforshort[strtolower($langpart[0])];
183 183
 			} elseif (!empty($langpart[0])) {
184
-				$srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]);
184
+				$srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]);
185 185
 			} else {
186 186
 				$srclang = 'en_US';
187 187
 			}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
 		// Check parameters
263 263
 		if (empty($domain)) {
264
-			dol_print_error(null, get_class($this) . "::Load ErrorWrongParameters");
264
+			dol_print_error(null, get_class($this)."::Load ErrorWrongParameters");
265 265
 			return -1;
266 266
 		}
267 267
 		if ($this->defaultlang === 'none_NONE') {
@@ -308,18 +308,18 @@  discard block
 block discarded – undo
308 308
 		}
309 309
 
310 310
 		if (empty($langofdir)) {	// This may occurs when load is called without setting the language and without providing a value for forcelangdir
311
-			dol_syslog("Error: " . get_class($this) . "::load was called for domain=" . $domain . " but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
311
+			dol_syslog("Error: ".get_class($this)."::load was called for domain=".$domain." but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
312 312
 			return -1;
313 313
 		}
314 314
 
315 315
 		$usecachekey = '';
316 316
 		foreach ($this->dir as $searchdir) {
317 317
 			// Directory of translation files
318
-			$file_lang = $searchdir . ($modulename ? '/' . $modulename : '') . "/langs/" . $langofdir . "/" . $newdomain . ".lang";
318
+			$file_lang = $searchdir.($modulename ? '/'.$modulename : '')."/langs/".$langofdir."/".$newdomain.".lang";
319 319
 			$file_lang_osencoded = dol_osencode($file_lang);
320 320
 
321 321
 			//$filelangexists = is_file($file_lang_osencoded);
322
-			$filelangexists = @is_file($file_lang_osencoded);	// avoid [php:warn]
322
+			$filelangexists = @is_file($file_lang_osencoded); // avoid [php:warn]
323 323
 
324 324
 			//dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists);
325 325
 			//print 'Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' this->_tab_loaded[newdomain]='.$this->_tab_loaded[$newdomain].' file_lang='.$file_lang." => filelangexists=".$filelangexists."\n";
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 				$usecachekey = '';
333 333
 				// Using a memcached server
334 334
 				if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) {
335
-					$usecachekey = $newdomain . '_' . $langkey . '_' . md5($file_lang); // Should not contains special chars
335
+					$usecachekey = $newdomain.'_'.$langkey.'_'.md5($file_lang); // Should not contains special chars
336 336
 				} elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) {
337 337
 					// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
338 338
 					$usecachekey = $newdomain;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 				if ($usecachekey) {
342 342
 					//dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey);
343
-					require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
343
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
344 344
 					$tmparray = dol_getcache($usecachekey);
345 345
 					if (is_array($tmparray) && count($tmparray)) {
346 346
 						$this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added.
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		if ($alt == 0) {
405 405
 			// This function MUST NOT contains call to syslog
406 406
 			//dol_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$newdomain.".lang file)", LOG_DEBUG);
407
-			$langofdir = strtolower($langarray[0]) . '_' . strtoupper($langarray[0]);
407
+			$langofdir = strtolower($langarray[0]).'_'.strtoupper($langarray[0]);
408 408
 			if ($langofdir == 'el_EL') {
409 409
 				$langofdir = 'el_GR'; // main parent for el_CY is not 'el_EL' but 'el_GR'
410 410
 			}
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 		// This part is deprecated and replaced with table llx_overwrite_trans
437 437
 		// Kept for backward compatibility.
438 438
 		if (empty($loadfromfileonly)) {
439
-			$overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang;
439
+			$overwritekey = 'MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
440 440
 			if (getDolGlobalString($overwritekey)) {    // Overwrite translation with key1:newstring1,key2:newstring2
441 441
 				// Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX
442 442
 				$tmparray = explode(',', getDolGlobalString($overwritekey));
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		if ($usecachekey && count($tabtranslatedomain)) {
454 454
 			$ressetcache = dol_setcache($usecachekey, $tabtranslatedomain);
455 455
 			if ($ressetcache < 0) {
456
-				$error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache;
456
+				$error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache;
457 457
 				dol_syslog($error, LOG_ERR);
458 458
 			}
459 459
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$langofdir = $this->defaultlang;
509 509
 
510 510
 		if (empty($langofdir)) {	// This may occurs when load is called without setting the language and without providing a value for forcelangdir
511
-			dol_syslog("Error: " . get_class($this) . "::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
511
+			dol_syslog("Error: ".get_class($this)."::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING);
512 512
 			return -1;
513 513
 		}
514 514
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		$usecachekey = '';
520 520
 		// Using a memcached server
521 521
 		if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) {
522
-			$usecachekey = $newdomain . '_' . $langofdir; // Should not contains special chars
522
+			$usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars
523 523
 		} elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) {
524 524
 			// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
525 525
 			$usecachekey = $newdomain;
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			//dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey);
530 530
 			//global $aaa; $aaa+=1;
531 531
 			//print $aaa." ".$usecachekey."\n";
532
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
532
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
533 533
 			$tmparray = dol_getcache($usecachekey);
534 534
 			if (is_array($tmparray) && count($tmparray)) {
535 535
 				$this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added.
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 					if ($usecachekey && count($tabtranslatedomain)) {
583 583
 						$ressetcache = dol_setcache($usecachekey, $tabtranslatedomain);
584 584
 						if ($ressetcache < 0) {
585
-							$error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache;
585
+							$error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache;
586 586
 							dol_syslog($error, LOG_ERR);
587 587
 						}
588 588
 					}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 			$str = $this->tab_translate[$key];
681 681
 
682 682
 			// Make some string replacement after translation
683
-			$replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang;
683
+			$replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang;
684 684
 			if (getDolGlobalString($replacekey)) {    // Replacement translation variable with string1:newstring1;string2:newstring2
685 685
 				$tmparray = explode(';', getDolGlobalString($replacekey));
686 686
 				foreach ($tmparray as $tmp) {
687 687
 					$tmparray2 = explode(':', $tmp);
688
-					$str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str);
688
+					$str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str);
689 689
 				}
690 690
 			}
691 691
 
@@ -774,12 +774,12 @@  discard block
 block discarded – undo
774 774
 			$str = $this->tab_translate[$key];
775 775
 
776 776
 			// Make some string replacement after translation
777
-			$replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang;
777
+			$replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang;
778 778
 			if (getDolGlobalString($replacekey)) {    // Replacement translation variable with string1:newstring1;string2:newstring2
779 779
 				$tmparray = explode(';', getDolGlobalString($replacekey));
780 780
 				foreach ($tmparray as $tmp) {
781 781
 					$tmparray2 = explode(':', $tmp);
782
-					$str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str);
782
+					$str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str);
783 783
 				}
784 784
 			}
785 785
 
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		$this->load("languages");
877 877
 
878 878
 		// We scan directory langs to detect available languages
879
-		$handle = opendir($langdir . "/langs");
879
+		$handle = opendir($langdir."/langs");
880 880
 		$langs_available = array();
881 881
 		while ($dir = trim(readdir($handle))) {
882 882
 			$regs = array();
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 				}
927 927
 
928 928
 				if ($usecode == 1 || getDolGlobalString('MAIN_SHOW_LANGUAGE_CODE')) {
929
-					$langs_available[$dir] = $dir . ': ' . dol_trunc($this->trans('Language_' . $dir), $maxlength);
929
+					$langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir), $maxlength);
930 930
 				} else {
931
-					$langs_available[$dir] = $this->trans('Language_' . $dir);
931
+					$langs_available[$dir] = $this->trans('Language_'.$dir);
932 932
 				}
933 933
 				if ($mainlangonly) {
934 934
 					$langs_available[$dir] = str_replace(' (United States)', '', $langs_available[$dir]);
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 		// phpcs:enable
953 953
 		// Test si fichier dans repertoire de la langue
954 954
 		foreach ($this->dir as $searchdir) {
955
-			if (is_readable(dol_osencode($searchdir . "/langs/" . $this->defaultlang . "/" . $filename))) {
955
+			if (is_readable(dol_osencode($searchdir."/langs/".$this->defaultlang."/".$filename))) {
956 956
 				return true;
957 957
 			}
958 958
 
959 959
 			if ($searchalt) {
960 960
 				// Test si fichier dans repertoire de la langue alternative
961 961
 				if ($this->defaultlang != "en_US") {
962
-					$filenamealt = $searchdir . "/langs/en_US/" . $filename;
962
+					$filenamealt = $searchdir."/langs/en_US/".$filename;
963 963
 				}
964 964
 				//else $filenamealt = $searchdir."/langs/fr_FR/".$filename;
965 965
 				if (is_readable(dol_osencode($filenamealt))) {
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
 			}
1001 1001
 
1002 1002
 			$fonc = 'numberwords';
1003
-			if (file_exists($newdir . '/functions_' . $fonc . '.lib.php')) {
1004
-				include_once $newdir . '/functions_' . $fonc . '.lib.php';
1003
+			if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) {
1004
+				include_once $newdir.'/functions_'.$fonc.'.lib.php';
1005 1005
 				if (function_exists('numberwords_getLabelFromNumber')) {
1006 1006
 					$newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
1007 1007
 					break;
@@ -1054,13 +1054,13 @@  discard block
 block discarded – undo
1054 1054
 		}
1055 1055
 
1056 1056
 		// Not found in loaded language file nor in cache. So we will take the label into database.
1057
-		$sql = "SELECT " . $fieldlabel . " as label";
1058
-		$sql .= " FROM " . $db->prefix() . $tablename;
1059
-		$sql .= " WHERE " . $fieldkey . " = '" . $db->escape($keyforselect ? $keyforselect : $key) . "'";
1057
+		$sql = "SELECT ".$fieldlabel." as label";
1058
+		$sql .= " FROM ".$db->prefix().$tablename;
1059
+		$sql .= " WHERE ".$fieldkey." = '".$db->escape($keyforselect ? $keyforselect : $key)."'";
1060 1060
 		if ($filteronentity) {
1061
-			$sql .= " AND entity IN (" . getEntity($tablename) . ')';
1061
+			$sql .= " AND entity IN (".getEntity($tablename).')';
1062 1062
 		}
1063
-		dol_syslog(get_class($this) . '::getLabelFromKey', LOG_DEBUG);
1063
+		dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG);
1064 1064
 		$resql = $db->query($sql);
1065 1065
 		if ($resql) {
1066 1066
 			$obj = $db->fetch_object($resql);
@@ -1093,9 +1093,9 @@  discard block
 block discarded – undo
1093 1093
 		$symbol = $this->getCurrencySymbol($currency_code);
1094 1094
 
1095 1095
 		if (in_array($currency_code, array('USD'))) {
1096
-			return $symbol . $amount;
1096
+			return $symbol.$amount;
1097 1097
 		} else {
1098
-			return $amount . $symbol;
1098
+			return $amount.$symbol;
1099 1099
 		}
1100 1100
 	}
1101 1101
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 			if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode'])) {
1118 1118
 				foreach ($this->cache_currencies[$currency_code]['unicode'] as $unicode) {
1119
-					$currency_sign .= mb_convert_encoding("&#" . $unicode . ";", "UTF-8", 'HTML-ENTITIES');
1119
+					$currency_sign .= mb_convert_encoding("&#".$unicode.";", "UTF-8", 'HTML-ENTITIES');
1120 1120
 				}
1121 1121
 			}
1122 1122
 		}
@@ -1142,14 +1142,14 @@  discard block
 block discarded – undo
1142 1142
 		}
1143 1143
 
1144 1144
 		$sql = "SELECT code_iso, label, unicode";
1145
-		$sql .= " FROM " . $db->prefix() . "c_currencies";
1145
+		$sql .= " FROM ".$db->prefix()."c_currencies";
1146 1146
 		$sql .= " WHERE active = 1";
1147 1147
 		if (!empty($currency_code)) {
1148
-			$sql .= " AND code_iso = '" . $db->escape($currency_code) . "'";
1148
+			$sql .= " AND code_iso = '".$db->escape($currency_code)."'";
1149 1149
 		}
1150 1150
 		//$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later
1151 1151
 
1152
-		dol_syslog(get_class($this) . '::loadCacheCurrencies', LOG_DEBUG);
1152
+		dol_syslog(get_class($this).'::loadCacheCurrencies', LOG_DEBUG);
1153 1153
 		$resql = $db->query($sql);
1154 1154
 		if ($resql) {
1155 1155
 			$this->load("dict");
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 				$obj = $db->fetch_object($resql);
1167 1167
 				if ($obj) {
1168 1168
 					// If a translation exists, we use it lese we use the default label
1169
-					$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency" . $obj->code_iso) != "Currency" . $obj->code_iso ? $this->trans("Currency" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
1169
+					$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency".$obj->code_iso) != "Currency".$obj->code_iso ? $this->trans("Currency".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
1170 1170
 					$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode((empty($obj->unicode) ? '' : $obj->unicode), true);
1171 1171
 					$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
1172 1172
 				}
@@ -1200,8 +1200,8 @@  discard block
 block discarded – undo
1200 1200
 		$substitutionarray = array();
1201 1201
 
1202 1202
 		foreach ($this->tab_translate as $code => $label) {
1203
-			$substitutionarray['lang_' . $code] = $label;
1204
-			$substitutionarray['__(' . $code . ')__'] = $label;
1203
+			$substitutionarray['lang_'.$code] = $label;
1204
+			$substitutionarray['__('.$code.')__'] = $label;
1205 1205
 		}
1206 1206
 
1207 1207
 		return $substitutionarray;
Please login to merge, or discard this patch.
htdocs/core/modules/cheque/mod_chequereceipt_thyme.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// Parametrage du prefix
76 76
 		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
77
-		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskchequereceipts" value="' . getDolGlobalString('CHEQUERECEIPTS_THYME_MASK').'">', $tooltip, 1, 1).'</td>';
77
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskchequereceipts" value="'.getDolGlobalString('CHEQUERECEIPTS_THYME_MASK').'">', $tooltip, 1, 1).'</td>';
78 78
 
79 79
 		$texte .= '<td class="left" rowspan="2">&nbsp;<input type="submit" class="button button-edit reposition smallpaddingimp" name="Button"value="'.$langs->trans("Modify").'"></td>';
80 80
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		global $db, $langs;
97 97
 
98
-		require_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
99
-		require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
98
+		require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
99
+		require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
100 100
 
101 101
 		$remise = new RemiseCheque($db);
102 102
 		$remise->initAsSpecimen();
Please login to merge, or discard this patch.
htdocs/core/modules/holiday/mod_holiday_immaculate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 	public function getExample()
90 90
 	{
91 91
 		global $db, $langs, $user;
92
-		require_once DOL_DOCUMENT_ROOT . '/holiday/class/holiday.class.php';
92
+		require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
93 93
 
94 94
 		$holiday = new Holiday($db);
95 95
 		$holiday->initAsSpecimen();
Please login to merge, or discard this patch.
htdocs/core/modules/product_batch/mod_sn_advanced.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 	{
117 117
 		global $db, $langs;
118 118
 
119
-		require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
119
+		require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
120 120
 
121 121
 		$thirdparty = new Societe($db);
122 122
 		$thirdparty->initAsSpecimen();
Please login to merge, or discard this patch.