Completed
Branch develop (c23a95)
by
unknown
18:46
created
htdocs/public/stripe/ipn.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	$db->commit();
317 317
 } elseif ($event->type == 'payment_intent.succeeded') {		// Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
318 318
 	//dol_syslog("object = ".var_export($event->data, true));
319
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
319
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
320 320
 	global $stripearrayofkeysbyenv;
321 321
 	$error = 0;
322 322
 	$object = $event->data->object;
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	$paymentmethodstripeid = $object->payment_method;
328 328
 	$customer_id = $object->customer;
329 329
 	$invoice_id = "";
330
-	$paymentTypeId = "";			// payment type according to Stripe
331
-	$paymentTypeIdInDolibarr = "";	// payment type according to Dolibarr
330
+	$paymentTypeId = ""; // payment type according to Stripe
331
+	$paymentTypeIdInDolibarr = ""; // payment type according to Dolibarr
332 332
 	$payment_amount = 0;
333 333
 	$payment_amountInDolibarr = 0;
334 334
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 		$s = new \Stripe\StripeClient($stripeacc);
395 395
 
396 396
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
397
-		$paymentTypeId =  $paymentmethodstripe->type;
397
+		$paymentTypeId = $paymentmethodstripe->type;
398 398
 		if ($paymentTypeId == "ban" || $paymentTypeId == "sepa_debit") {
399 399
 			$paymentTypeId = "PRE";
400 400
 		} elseif ($paymentTypeId == "card") {
@@ -418,9 +418,9 @@  discard block
 block discarded – undo
418 418
 			$paiement->datepaye = $now;
419 419
 			$paiement->date = $now;
420 420
 			if ($currencyCodeType == $conf->currency) {
421
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
421
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
422 422
 			} else {
423
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
423
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
424 424
 
425 425
 				$postactionmessages[] = 'Payment was done in a different currency than currency expected of company';
426 426
 				$ispostactionok = -1;
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 			$paiement->paiementid = $paymentTypeId;
431 431
 			$paiement->num_payment = '';
432 432
 			$paiement->note_public = '';
433
-			$paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
434
-			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];		// May be we should store py_... instead of pi_... but we started with pi_... so we continue.
433
+			$paiement->note_private = 'StripeSepa payment '.dol_print_date($now, 'standard').' using '.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID;
434
+			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue.
435 435
 			$paiement->ext_payment_site = $service;
436 436
 
437 437
 			$ispaymentdone = 0;
@@ -449,20 +449,20 @@  discard block
 block discarded – undo
449 449
 			$db->begin();
450 450
 
451 451
 			if (!$error && !$ispaymentdone) {
452
-				dol_syslog('* Record payment for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document');
452
+				dol_syslog('* Record payment for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document');
453 453
 
454 454
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
455 455
 				$paiement_id = $paiement->create($user, 1);
456 456
 				if ($paiement_id < 0) {
457
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("<br>\n", $paiement->errors);
457
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').join("<br>\n", $paiement->errors);
458 458
 					$ispostactionok = -1;
459 459
 					$error++;
460 460
 
461
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
461
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
462 462
 				} else {
463 463
 					$postactionmessages[] = 'Payment created';
464 464
 
465
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
465
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
466 466
 				}
467 467
 			}
468 468
 
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 						$label = '(CustomerInvoicePayment)';
493 493
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
494 494
 						if ($result < 0) {
495
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("<br>\n", $paiement->errors);
495
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').join("<br>\n", $paiement->errors);
496 496
 							$ispostactionok = -1;
497 497
 							$error++;
498 498
 						} else {
499 499
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
500 500
 						}
501 501
 					} else {
502
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
502
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
503 503
 						$ispostactionok = -1;
504 504
 						$error++;
505 505
 					}
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1221 added lines, -1221 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;/', $typeofdata)) {
118 118
 			if (!empty($perm)) {
119 119
 				$tmp = explode(':', $typeofdata);
120
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
120
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
121 121
 				if ($fieldrequired) {
122 122
 					$ret .= '<span class="fieldrequired">';
123 123
 				}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				if ($fieldrequired) {
130 130
 					$ret .= '</span>';
131 131
 				}
132
-				$ret .= '</div>' . "\n";
132
+				$ret .= '</div>'."\n";
133 133
 			} else {
134 134
 				if ($fieldrequired) {
135 135
 					$ret .= '<span class="fieldrequired">';
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 			if (empty($notabletag) && $perm) {
168 168
 				$ret .= '<td class="right">';
169 169
 			}
170
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
171
-				$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>';
170
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
171
+				$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>';
172 172
 			}
173 173
 			if (!empty($notabletag) && $notabletag == 1) {
174 174
 				if ($text) {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			} elseif ($reg[1] == 'int') {
236 236
 				$typeofdata = 'numeric';
237 237
 			} else {
238
-				return 'ErrorBadParameter ' . $typeofdata;
238
+				return 'ErrorBadParameter '.$typeofdata;
239 239
 			}
240 240
 		}
241 241
 
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 			if ($editaction == '') {
247 247
 				$editaction = GETPOST('action', 'aZ09');
248 248
 			}
249
-			$editmode = ($editaction == 'edit' . $htmlname);
249
+			$editmode = ($editaction == 'edit'.$htmlname);
250 250
 			if ($editmode) {	// edit mode
251 251
 				$ret .= "\n";
252
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
253
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
254
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
255
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
252
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
253
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
254
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
255
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
256 256
 				if (empty($notabletag)) {
257 257
 					$ret .= '<table class="nobordernopadding centpercent">';
258 258
 				}
@@ -261,28 +261,28 @@  discard block
 block discarded – undo
261 261
 				}
262 262
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
263 263
 					$tmp = explode(':', $typeofdata);
264
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
264
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
265 265
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
266 266
 					$tmp = explode(':', $typeofdata);
267 267
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
268
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
268
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
269 269
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
270 270
 					$tmp = explode(':', $typeofdata);
271 271
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
272
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
272
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
273 273
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
274 274
 					$tmp = explode(':', $typeofdata);
275
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
275
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
276 276
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
277 277
 					$tmp = explode(':', $typeofdata);
278 278
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
279 279
 					$morealt = '';
280 280
 					if (preg_match('/%/', $cols)) {
281
-						$morealt = ' style="width: ' . $cols . '"';
281
+						$morealt = ' style="width: '.$cols.'"';
282 282
 						$cols = '';
283 283
 					}
284 284
 					$valuetoshow = ($editvalue ? $editvalue : $value);
285
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
285
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
286 286
 					// textarea convert automatically entities chars into simple chars.
287 287
 					// 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 wysiwig is off.
288 288
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -292,12 +292,12 @@  discard block
 block discarded – undo
292 292
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
293 293
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
294 294
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
295
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
295
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
296 296
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
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, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
300
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301 301
 				} elseif (preg_match('/^select;/', $typeofdata)) {
302 302
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
303 303
 					$arraylist = array();
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 					// TODO Not yet implemented. See code for extrafields
312 312
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
313 313
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
314
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
314
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
315 315
 					$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]));
316 316
 					$ret .= $doleditor->Create(1);
317 317
 				} elseif ($typeofdata == 'asis') {
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 					$ret .= '<td>';
327 327
 				}
328 328
 				//else $ret.='<div class="clearboth"></div>';
329
-				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
329
+				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
330 330
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
331
-					$ret .= '<br>' . "\n";
331
+					$ret .= '<br>'."\n";
332 332
 				}
333
-				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
333
+				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
334 334
 				if (empty($notabletag)) {
335 335
 					$ret .= '</td>';
336 336
 				}
337 337
 
338 338
 				if (empty($notabletag)) {
339
-					$ret .= '</tr></table>' . "\n";
339
+					$ret .= '</tr></table>'."\n";
340 340
 				}
341
-				$ret .= '</form>' . "\n";
341
+				$ret .= '</form>'."\n";
342 342
 			} else {		// view mode
343 343
 				if (preg_match('/^email/', $typeofdata)) {
344 344
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -350,15 +350,15 @@  discard block
 block discarded – undo
350 350
 					$ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : '');
351 351
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
352 352
 					$tmp = explode(':', $typeofdata);
353
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
353
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
354 354
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
355 355
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
356 356
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
357 357
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
358 358
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
359
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
359
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
360 360
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
361
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
361
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
362 362
 				} elseif (preg_match('/^select;/', $typeofdata)) {
363 363
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
364 364
 					$arraylist = array();
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
 					$ret .= $arraylist[$value];
370 370
 					if ($htmlname == 'fk_product_type') {
371 371
 						if ($value == 0) {
372
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
372
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
373 373
 						} else {
374
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
374
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
375 375
 						}
376 376
 					}
377 377
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 					if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
380 380
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
381 381
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
382
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
382
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
383 383
 					}
384 384
 					// We dont use dol_escape_htmltag to get the html formating active, but this need we must also
385 385
 					// clean data from some dangerous html
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
389 389
 						$ret .= dol_escape_htmltag($value);
390 390
 					} else {
391
-						$ret .= $value;        // $value must be already html escaped.
391
+						$ret .= $value; // $value must be already html escaped.
392 392
 					}
393 393
 				}
394 394
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
428 428
 			if (!is_object($extralanguages)) {
429
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
429
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
430 430
 				$extralanguages = new ExtraLanguages($this->db);
431 431
 			}
432 432
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -435,17 +435,17 @@  discard block
 block discarded – undo
435 435
 				return ''; // No extralang field to show
436 436
 			}
437 437
 
438
-			$result .= '<!-- Widget for translation -->' . "\n";
439
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
438
+			$result .= '<!-- Widget for translation -->'."\n";
439
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
440 440
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
441 441
 			$result .= $s;
442 442
 			$result .= '</div>';
443 443
 
444
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
444
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
445 445
 
446 446
 			$resultforextrlang = '';
447 447
 			foreach ($arrayoflangcode as $langcode) {
448
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
448
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
449 449
 				if (empty($valuetoshow)) {
450 450
 					$object->fetchValuesForExtraLanguages();
451 451
 					//var_dump($object->array_languages);
@@ -457,17 +457,17 @@  discard block
 block discarded – undo
457 457
 
458 458
 				// TODO Use the showInputField() method of ExtraLanguages object
459 459
 				if ($typeofdata == 'textarea') {
460
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
460
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
461 461
 					$resultforextrlang .= $valuetoshow;
462 462
 					$resultforextrlang .= '</textarea>';
463 463
 				} else {
464
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
464
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
465 465
 				}
466 466
 			}
467 467
 			$result .= $resultforextrlang;
468 468
 
469 469
 			$result .= '</div>';
470
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
470
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
471 471
 		}
472 472
 
473 473
 		return $result;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 				if (!empty($tmp[2])) {
533 533
 					$savemethod = $tmp[2];
534 534
 				}
535
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
535
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
536 536
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
537 537
 				$tmp = explode(':', $inputType);
538 538
 				$inputType = $tmp[0];
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 					$savemethod = $tmp[2];
544 544
 				}
545 545
 
546
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
546
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
547 547
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
548 548
 				$tmp = explode(':', $inputType);
549 549
 				$inputType = $tmp[0];
@@ -574,40 +574,40 @@  discard block
 block discarded – undo
574 574
 				}
575 575
 
576 576
 				if (isModEnabled('fckeditor')) {
577
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
577
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
578 578
 				} else {
579 579
 					$inputType = 'textarea';
580 580
 				}
581 581
 			}
582 582
 
583
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
584
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
585
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
586
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
583
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
584
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
585
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
586
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
587 587
 			if (!empty($savemethod)) {
588
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
588
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
589 589
 			}
590 590
 			if (!empty($ext_element)) {
591
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
591
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
592 592
 			}
593 593
 			if (!empty($custommsg)) {
594 594
 				if (is_array($custommsg)) {
595 595
 					if (!empty($custommsg['success'])) {
596
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
596
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
597 597
 					}
598 598
 					if (!empty($custommsg['error'])) {
599
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
599
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
600 600
 					}
601 601
 				} else {
602
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
602
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
603 603
 				}
604 604
 			}
605 605
 			if ($inputType == 'textarea') {
606
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
607
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
606
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
607
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
608 608
 			}
609
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
610
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
609
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
610
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
611 611
 		} else {
612 612
 			$out = $value;
613 613
 		}
@@ -636,12 +636,12 @@  discard block
 block discarded – undo
636 636
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
637 637
 	{
638 638
 		if ($incbefore) {
639
-			$text = $incbefore . $text;
639
+			$text = $incbefore.$text;
640 640
 		}
641 641
 		if (!$htmltext) {
642 642
 			return $text;
643 643
 		}
644
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
644
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
645 645
 
646 646
 		$tag = 'td';
647 647
 		if ($notabs == 2) {
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 
656 656
 		$extrastyle = '';
657 657
 		if ($direction < 0) {
658
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
658
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
659 659
 			$extrastyle = 'padding: 0px; padding-left: 3px;';
660 660
 		}
661 661
 		if ($direction > 0) {
662
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
662
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
663 663
 			$extrastyle = 'padding: 0px; padding-right: 3px;';
664 664
 		}
665 665
 
@@ -672,53 +672,53 @@  discard block
 block discarded – undo
672 672
 			$htmltext = str_replace('"', '&quot;', $htmltext);
673 673
 		} else {
674 674
 			$classfortooltip = 'classfortooltiponclick';
675
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
675
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
676 676
 		}
677 677
 		if ($tooltipon == 2 || $tooltipon == 3) {
678
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
678
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
679 679
 			if ($tooltiptrigger == '') {
680
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on img tag to store tooltip
680
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip
681 681
 			} else {
682
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
682
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
683 683
 			}
684 684
 		} else {
685
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
685
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
686 686
 		}
687 687
 		if ($tooltipon == 1 || $tooltipon == 3) {
688
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
688
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
689 689
 			if ($tooltiptrigger == '') {
690
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribut to put on td tag to store tooltip
690
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip
691 691
 			} else {
692
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
692
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
693 693
 			}
694 694
 		} else {
695
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribut to put on td text tag
695
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag
696 696
 		}
697 697
 		if (empty($notabs)) {
698 698
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
699 699
 		} elseif ($notabs == 2) {
700
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
700
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
701 701
 		}
702 702
 		// Define value if value is before
703 703
 		if ($direction < 0) {
704
-			$s .= '<' . $tag . $paramfortooltipimg;
704
+			$s .= '<'.$tag.$paramfortooltipimg;
705 705
 			if ($tag == 'td') {
706 706
 				$s .= ' class="valigntop" width="14"';
707 707
 			}
708
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
708
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
709 709
 		}
710 710
 		// Use another method to help avoid having a space in value in order to use this value with jquery
711 711
 		// Define label
712 712
 		if ((string) $text != '') {
713
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
713
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
714 714
 		}
715 715
 		// Define value if value is after
716 716
 		if ($direction > 0) {
717
-			$s .= '<' . $tag . $paramfortooltipimg;
717
+			$s .= '<'.$tag.$paramfortooltipimg;
718 718
 			if ($tag == 'td') {
719 719
 				$s .= ' class="valignmiddle" width="14"';
720 720
 			}
721
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
721
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
722 722
 		}
723 723
 		if (empty($notabs)) {
724 724
 			$s .= '</tr></table>';
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 		$disabled = 0;
825 825
 		$ret = '<div class="centpercent center">';
826
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
826
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
827 827
 
828 828
 		// 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.
829 829
 		$parameters = array();
@@ -833,9 +833,9 @@  discard block
 block discarded – undo
833 833
 			return;
834 834
 		}
835 835
 		if (empty($reshook)) {
836
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
836
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
837 837
 			foreach ($arrayofaction as $code => $label) {
838
-				$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
838
+				$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
839 839
 			}
840 840
 		}
841 841
 		$ret .= $hookmanager->resPrint;
@@ -843,17 +843,17 @@  discard block
 block discarded – undo
843 843
 		$ret .= '</select>';
844 844
 
845 845
 		if (empty($conf->dol_optimize_smallscreen)) {
846
-			$ret .= ajax_combobox('.' . $name . 'select');
846
+			$ret .= ajax_combobox('.'.$name.'select');
847 847
 		}
848 848
 
849 849
 		// 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
850 850
 		$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.
851
-		$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")) . '">';
851
+		$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")).'">';
852 852
 		$ret .= '</div>';
853 853
 
854 854
 		if (!empty($conf->use_javascript_ajax)) {
855 855
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
856
-    		<script nonce="' . getNonce() . '">
856
+    		<script nonce="' . getNonce().'">
857 857
                         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 */
858 858
         		{
859 859
         			atleastoneselected=0;
@@ -864,11 +864,11 @@  discard block
 block discarded – undo
864 864
 
865 865
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
866 866
 
867
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
867
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
868 868
     	  			{
869 869
                                     jQuery("."+name).show();
870
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
871
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
870
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
871
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
872 872
     	  			}
873 873
     	  			else
874 874
     	  			{
@@ -878,11 +878,11 @@  discard block
 block discarded – undo
878 878
         		}
879 879
 
880 880
         	jQuery(document).ready(function () {
881
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
882
-                    jQuery(".' . $cssclass . '").click(function() {
883
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
881
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
882
+                    jQuery(".' . $cssclass.'").click(function() {
883
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
884 884
                     });
885
-                        jQuery(".' . $name . 'select").change(function() {
885
+                        jQuery(".' . $name.'select").change(function() {
886 886
         			var massaction = $( this ).val();
887 887
         			var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
888 888
         			if (massaction == "builddoc")
@@ -890,18 +890,18 @@  discard block
 block discarded – undo
890 890
                         urlform = urlform + "#show_files";
891 891
     	            }
892 892
         			$( this ).closest("form").attr("action", urlform);
893
-                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform);
893
+                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform);
894 894
         	        /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */
895 895
         			if ($(this).val() != \'0\')
896 896
     	  			{
897
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
898
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
899
-                                        jQuery(".' . $name . '"+massaction).show();
897
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
898
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
899
+                                        jQuery(".' . $name.'"+massaction).show();
900 900
     	  			}
901 901
     	  			else
902 902
     	  			{
903
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
904
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
903
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
904
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
905 905
     	  			}
906 906
     	        });
907 907
         	});
@@ -944,14 +944,14 @@  discard block
 block discarded – undo
944 944
 		$atleastonefavorite = 0;
945 945
 
946 946
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
947
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
947
+		$sql .= " FROM ".$this->db->prefix()."c_country";
948 948
 		$sql .= " WHERE active > 0";
949 949
 		//$sql.= " ORDER BY code ASC";
950 950
 
951
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
951
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
952 952
 		$resql = $this->db->query($sql);
953 953
 		if ($resql) {
954
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
954
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
955 955
 			$num = $this->db->num_rows($resql);
956 956
 			$i = 0;
957 957
 			if ($num) {
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 					$countryArray[$i]['rowid'] = $obj->rowid;
962 962
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
963 963
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
964
-					$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 : ''));
964
+					$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 : ''));
965 965
 					$countryArray[$i]['favorite'] = $obj->favorite;
966 966
 					$countryArray[$i]['eec'] = $obj->eec;
967 967
 					$favorite[$i] = $obj->favorite;
@@ -979,20 +979,20 @@  discard block
 block discarded – undo
979 979
 
980 980
 				if ($showempty) {
981 981
 					if (is_numeric($showempty)) {
982
-						$out .= '<option value="">&nbsp;</option>' . "\n";
982
+						$out .= '<option value="">&nbsp;</option>'."\n";
983 983
 					} else {
984
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
984
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
985 985
 					}
986 986
 				}
987 987
 
988 988
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
989 989
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
990
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
991
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
990
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
991
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
992 992
 					if ($mysoc->isInEEC()) {
993
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
993
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
994 994
 					}
995
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
995
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
996 996
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
997 997
 				}
998 998
 
@@ -1020,20 +1020,20 @@  discard block
 block discarded – undo
1020 1020
 						$labeltoshow .= '&nbsp;';
1021 1021
 					}
1022 1022
 					if ($row['code_iso']) {
1023
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1023
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1024 1024
 						if (empty($hideflags)) {
1025 1025
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1026
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1026
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1027 1027
 						}
1028 1028
 					}
1029 1029
 
1030 1030
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1031
-						$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']) . '">';
1031
+						$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']).'">';
1032 1032
 					} else {
1033
-						$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']) . '">';
1033
+						$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']).'">';
1034 1034
 					}
1035 1035
 					$out .= $labeltoshow;
1036
-					$out .= '</option>' . "\n";
1036
+					$out .= '</option>'."\n";
1037 1037
 				}
1038 1038
 			}
1039 1039
 			$out .= '</select>';
@@ -1042,8 +1042,8 @@  discard block
 block discarded – undo
1042 1042
 		}
1043 1043
 
1044 1044
 		// Make select dynamic
1045
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1046
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1045
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1046
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1047 1047
 
1048 1048
 		return $out;
1049 1049
 	}
@@ -1075,25 +1075,25 @@  discard block
 block discarded – undo
1075 1075
 		$incotermArray = array();
1076 1076
 
1077 1077
 		$sql = "SELECT rowid, code";
1078
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1078
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1079 1079
 		$sql .= " WHERE active > 0";
1080 1080
 		$sql .= " ORDER BY code ASC";
1081 1081
 
1082
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1082
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1083 1083
 		$resql = $this->db->query($sql);
1084 1084
 		if ($resql) {
1085 1085
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1086
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1086
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1087 1087
 				$out .= ajax_combobox($htmlname, $events);
1088 1088
 			}
1089 1089
 
1090 1090
 			if (!empty($page)) {
1091
-				$out .= '<form method="post" action="' . $page . '">';
1091
+				$out .= '<form method="post" action="'.$page.'">';
1092 1092
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1093
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1093
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1094 1094
 			}
1095 1095
 
1096
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1096
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1097 1097
 			$out .= '<option value="0">&nbsp;</option>';
1098 1098
 			$num = $this->db->num_rows($resql);
1099 1099
 			$i = 0;
@@ -1107,9 +1107,9 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 				foreach ($incotermArray as $row) {
1109 1109
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1110
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1110
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1111 1111
 					} else {
1112
-						$out .= '<option value="' . $row['rowid'] . '">';
1112
+						$out .= '<option value="'.$row['rowid'].'">';
1113 1113
 					}
1114 1114
 
1115 1115
 					if ($row['code']) {
@@ -1122,13 +1122,13 @@  discard block
 block discarded – undo
1122 1122
 			$out .= '</select>';
1123 1123
 
1124 1124
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1125
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1125
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1126 1126
 				$moreattrib .= ' autocomplete="off"';
1127 1127
 			}
1128
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1128
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1129 1129
 
1130 1130
 			if (!empty($page)) {
1131
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1131
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1132 1132
 			}
1133 1133
 		} else {
1134 1134
 			dol_print_error($this->db);
@@ -1159,9 +1159,9 @@  discard block
 block discarded – undo
1159 1159
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1160 1160
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1161 1161
 			if (empty($hidetext)) {
1162
-				print $langs->trans("Type") . ': ';
1162
+				print $langs->trans("Type").': ';
1163 1163
 			}
1164
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1164
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1165 1165
 			if ($showempty) {
1166 1166
 				print '<option value="-1"';
1167 1167
 				if ($selected == -1) {
@@ -1174,28 +1174,28 @@  discard block
 block discarded – undo
1174 1174
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1175 1175
 				print ' selected';
1176 1176
 			}
1177
-			print '>' . $langs->trans("Product");
1177
+			print '>'.$langs->trans("Product");
1178 1178
 
1179 1179
 			print '<option value="1"';
1180 1180
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1181 1181
 				print ' selected';
1182 1182
 			}
1183
-			print '>' . $langs->trans("Service");
1183
+			print '>'.$langs->trans("Service");
1184 1184
 
1185 1185
 			print '</select>';
1186
-			print ajax_combobox('select_' . $htmlname);
1186
+			print ajax_combobox('select_'.$htmlname);
1187 1187
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1188 1188
 		}
1189 1189
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1190 1190
 			print $langs->trans("Service");
1191
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1191
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1192 1192
 		}
1193 1193
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1194 1194
 			print $langs->trans("Product");
1195
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1195
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1196 1196
 		}
1197 1197
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1198
-			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
1198
+			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
1199 1199
 		}
1200 1200
 	}
1201 1201
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 		$langs->load("trips");
1222 1222
 
1223 1223
 		$sql = "SELECT c.code, c.label";
1224
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1224
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1225 1225
 		$sql .= " WHERE active > 0";
1226 1226
 
1227 1227
 		$resql = $this->db->query($sql);
@@ -1262,11 +1262,11 @@  discard block
 block discarded – undo
1262 1262
 		// phpcs:enable
1263 1263
 		global $user, $langs;
1264 1264
 
1265
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1265
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1266 1266
 
1267 1267
 		$this->load_cache_types_fees();
1268 1268
 
1269
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1269
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1270 1270
 		if ($showempty) {
1271 1271
 			print '<option value="-1"';
1272 1272
 			if ($selected == -1) {
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		}
1277 1277
 
1278 1278
 		foreach ($this->cache_types_fees as $key => $value) {
1279
-			print '<option value="' . $key . '"';
1279
+			print '<option value="'.$key.'"';
1280 1280
 			if ($key == $selected) {
1281 1281
 				print ' selected';
1282 1282
 			}
@@ -1327,12 +1327,12 @@  discard block
 block discarded – undo
1327 1327
 				$ajaxoptions = array();
1328 1328
 			}
1329 1329
 
1330
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1330
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1331 1331
 
1332 1332
 			// No immediate load of all database
1333 1333
 			$placeholder = '';
1334 1334
 			if ($selected && empty($selected_input_value)) {
1335
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1335
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1336 1336
 				$societetmp = new Societe($this->db);
1337 1337
 				$societetmp->fetch($selected);
1338 1338
 				$selected_input_value = $societetmp->name;
@@ -1340,25 +1340,25 @@  discard block
 block discarded – undo
1340 1340
 			}
1341 1341
 
1342 1342
 			// mode 1
1343
-			$urloption = 'htmlname=' . urlencode(str_replace('.', '_', $htmlname)) . '&outjson=1&filter=' . urlencode($filter) . (empty($excludeids) ? '' : '&excludeids=' . join(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode($showtype) : '') . ($showcode ? '&showcode=' . urlencode($showcode) : '');
1343
+			$urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '').($showcode ? '&showcode='.urlencode($showcode) : '');
1344 1344
 
1345 1345
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1346 1346
 			if (empty($hidelabel)) {
1347
-				print $langs->trans("RefOrLabel") . ' : ';
1347
+				print $langs->trans("RefOrLabel").' : ';
1348 1348
 			} elseif ($hidelabel > 1) {
1349 1349
 				$placeholder = $langs->trans("RefOrLabel");
1350 1350
 				if ($hidelabel == 2) {
1351 1351
 					$out .= img_picto($langs->trans("Search"), 'search');
1352 1352
 				}
1353 1353
 			}
1354
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
1354
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
1355 1355
 			if ($hidelabel == 3) {
1356 1356
 				$out .= img_picto($langs->trans("Search"), 'search');
1357 1357
 			}
1358 1358
 
1359 1359
 			$out .= ajax_event($htmlname, $events);
1360 1360
 
1361
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1361
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
1362 1362
 		} else {
1363 1363
 			// Immediate load of all database
1364 1364
 			$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);
@@ -1440,30 +1440,30 @@  discard block
 block discarded – undo
1440 1440
 			$sql .= ", s.address, s.zip, s.town";
1441 1441
 			$sql .= ", dictp.code as country_code";
1442 1442
 		}
1443
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1443
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1444 1444
 		if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
1445
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1445
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1446 1446
 		}
1447 1447
 		if (empty($user->rights->societe->client->voir) && !$user->socid) {
1448
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1448
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1449 1449
 		}
1450
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1450
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1451 1451
 		if (!empty($user->socid)) {
1452
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1452
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1453 1453
 		}
1454 1454
 		if ($filter) {
1455 1455
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1456 1456
 			// if not, by testSqlAndScriptInject() only.
1457
-			$sql .= " AND (" . $filter . ")";
1457
+			$sql .= " AND (".$filter.")";
1458 1458
 		}
1459 1459
 		if (empty($user->rights->societe->client->voir) && !$user->socid) {
1460
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1460
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1461 1461
 		}
1462 1462
 		if (!empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
1463 1463
 			$sql .= " AND s.status <> 0";
1464 1464
 		}
1465 1465
 		if (!empty($excludeids)) {
1466
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(join(',', $excludeids)) . ")";
1466
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")";
1467 1467
 		}
1468 1468
 		// Add where from hooks
1469 1469
 		$parameters = array();
@@ -1483,17 +1483,17 @@  discard block
 block discarded – undo
1483 1483
 				if ($i > 0) {
1484 1484
 					$sql .= " AND ";
1485 1485
 				}
1486
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1486
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1487 1487
 				$i++;
1488 1488
 			}
1489 1489
 			if (count($scrit) > 1) {
1490 1490
 				$sql .= ")";
1491 1491
 			}
1492 1492
 			if (isModEnabled('barcode')) {
1493
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1493
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1494 1494
 			}
1495
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1496
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1495
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1496
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1497 1497
 			$sql .= ")";
1498 1498
 		}
1499 1499
 		$sql .= $this->db->order("nom", "ASC");
@@ -1504,12 +1504,12 @@  discard block
 block discarded – undo
1504 1504
 		$resql = $this->db->query($sql);
1505 1505
 		if ($resql) {
1506 1506
 			if (!$forcecombo) {
1507
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1507
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1508 1508
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT"));
1509 1509
 			}
1510 1510
 
1511 1511
 			// Construct $out and $outarray
1512
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1512
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1513 1513
 
1514 1514
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1515 1515
 			if (!empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 				}
1523 1523
 			}
1524 1524
 			if ($showempty) {
1525
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1525
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1526 1526
 			}
1527 1527
 
1528 1528
 			$companytemp = new Societe($this->db);
@@ -1535,18 +1535,18 @@  discard block
 block discarded – undo
1535 1535
 					$label = '';
1536 1536
 					if ($showcode || !empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
1537 1537
 						if (($obj->client) && (!empty($obj->code_client))) {
1538
-							$label = $obj->code_client . ' - ';
1538
+							$label = $obj->code_client.' - ';
1539 1539
 						}
1540 1540
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1541
-							$label .= $obj->code_fournisseur . ' - ';
1541
+							$label .= $obj->code_fournisseur.' - ';
1542 1542
 						}
1543
-						$label .= ' ' . $obj->name;
1543
+						$label .= ' '.$obj->name;
1544 1544
 					} else {
1545 1545
 						$label = $obj->name;
1546 1546
 					}
1547 1547
 
1548 1548
 					if (!empty($obj->name_alias)) {
1549
-						$label .= ' (' . $obj->name_alias . ')';
1549
+						$label .= ' ('.$obj->name_alias.')';
1550 1550
 					}
1551 1551
 
1552 1552
 					if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) {
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 						$companytemp->fournisseur = $obj->fournisseur;
1562 1562
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1563 1563
 						if ($tmptype) {
1564
-							$labelhtml .= ' ' . $tmptype;
1564
+							$labelhtml .= ' '.$tmptype;
1565 1565
 						}
1566 1566
 
1567 1567
 						if ($obj->client || $obj->fournisseur) {
@@ -1571,10 +1571,10 @@  discard block
 block discarded – undo
1571 1571
 							$label .= $langs->trans("Customer");
1572 1572
 						}
1573 1573
 						if ($obj->client == 2 || $obj->client == 3) {
1574
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1574
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1575 1575
 						}
1576 1576
 						if ($obj->fournisseur) {
1577
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1577
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1578 1578
 						}
1579 1579
 						if ($obj->client || $obj->fournisseur) {
1580 1580
 							$label .= ')';
@@ -1582,9 +1582,9 @@  discard block
 block discarded – undo
1582 1582
 					}
1583 1583
 
1584 1584
 					if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
1585
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1585
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1586 1586
 						if (!empty($obj->country_code)) {
1587
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1587
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1588 1588
 						}
1589 1589
 						$label .= $s;
1590 1590
 						$labelhtml .= $s;
@@ -1592,9 +1592,9 @@  discard block
 block discarded – undo
1592 1592
 
1593 1593
 					if (empty($outputmode)) {
1594 1594
 						if (in_array($obj->rowid, $selected)) {
1595
-							$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>';
1595
+							$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>';
1596 1596
 						} else {
1597
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1597
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1598 1598
 						}
1599 1599
 					} else {
1600 1600
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1606,7 +1606,7 @@  discard block
 block discarded – undo
1606 1606
 					}
1607 1607
 				}
1608 1608
 			}
1609
-			$out .= '</select>' . "\n";
1609
+			$out .= '</select>'."\n";
1610 1610
 		} else {
1611 1611
 			dol_print_error($this->db);
1612 1612
 		}
@@ -1640,18 +1640,18 @@  discard block
 block discarded – undo
1640 1640
 		// On recherche les remises
1641 1641
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
1642 1642
 		$sql .= " re.description, re.fk_facture_source";
1643
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
1644
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
1645
-		$sql .= " AND re.entity = " . $conf->entity;
1643
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
1644
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
1645
+		$sql .= " AND re.entity = ".$conf->entity;
1646 1646
 		if ($filter) {
1647
-			$sql .= " AND " . $filter;
1647
+			$sql .= " AND ".$filter;
1648 1648
 		}
1649 1649
 		$sql .= " ORDER BY re.description ASC";
1650 1650
 
1651
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
1651
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
1652 1652
 		$resql = $this->db->query($sql);
1653 1653
 		if ($resql) {
1654
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
1654
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
1655 1655
 			$num = $this->db->num_rows($resql);
1656 1656
 
1657 1657
 			$qualifiedlines = $num;
@@ -1689,16 +1689,16 @@  discard block
 block discarded – undo
1689 1689
 					if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) {
1690 1690
 						$tmpfac = new Facture($this->db);
1691 1691
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
1692
-							$desc = $desc . ' - ' . $tmpfac->ref;
1692
+							$desc = $desc.' - '.$tmpfac->ref;
1693 1693
 						}
1694 1694
 					}
1695 1695
 
1696
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
1696
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
1697 1697
 					$i++;
1698 1698
 				}
1699 1699
 			}
1700 1700
 			print '</select>';
1701
-			print ajax_combobox('select_' . $htmlname);
1701
+			print ajax_combobox('select_'.$htmlname);
1702 1702
 
1703 1703
 			return $qualifiedlines;
1704 1704
 		} else {
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
 		$out = '';
1780 1780
 
1781 1781
 		if (!is_object($hookmanager)) {
1782
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1782
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1783 1783
 			$hookmanager = new HookManager($this->db);
1784 1784
 		}
1785 1785
 
@@ -1788,13 +1788,13 @@  discard block
 block discarded – undo
1788 1788
 		if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
1789 1789
 			$sql .= ", s.nom as company, s.town AS company_town";
1790 1790
 		}
1791
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1791
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1792 1792
 		if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
1793
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1793
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1794 1794
 		}
1795
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1795
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1796 1796
 		if ($socid > 0 || $socid == -1) {
1797
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1797
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1798 1798
 		}
1799 1799
 		if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
1800 1800
 			$sql .= " AND sp.statut <> 0";
@@ -1805,30 +1805,30 @@  discard block
 block discarded – undo
1805 1805
 		$sql .= $hookmanager->resPrint;
1806 1806
 		$sql .= " ORDER BY sp.lastname ASC";
1807 1807
 
1808
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1808
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1809 1809
 		$resql = $this->db->query($sql);
1810 1810
 		if ($resql) {
1811 1811
 			$num = $this->db->num_rows($resql);
1812 1812
 
1813 1813
 			if ($htmlname != 'none' && !$options_only) {
1814
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1814
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1815 1815
 			}
1816 1816
 
1817 1817
 			if ($showempty && !is_numeric($showempty)) {
1818 1818
 				$textforempty = $showempty;
1819
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1819
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1820 1820
 			} else {
1821 1821
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1822
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1822
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1823 1823
 				}
1824 1824
 				if ($showempty == 2) {
1825
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1825
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1826 1826
 				}
1827 1827
 			}
1828 1828
 
1829 1829
 			$i = 0;
1830 1830
 			if ($num) {
1831
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1831
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1832 1832
 				$contactstatic = new Contact($this->db);
1833 1833
 
1834 1834
 				while ($i < $num) {
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
 						}
1865 1865
 						$extendedInfos = implode(' - ', $extendedInfos);
1866 1866
 						if (!empty($extendedInfos)) {
1867
-							$extendedInfos = ' - ' . $extendedInfos;
1867
+							$extendedInfos = ' - '.$extendedInfos;
1868 1868
 						}
1869 1869
 					}
1870 1870
 
@@ -1881,42 +1881,42 @@  discard block
 block discarded – undo
1881 1881
 								$disabled = 1;
1882 1882
 							}
1883 1883
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1884
-								$out .= '<option value="' . $obj->rowid . '"';
1884
+								$out .= '<option value="'.$obj->rowid.'"';
1885 1885
 								if ($disabled) {
1886 1886
 									$out .= ' disabled';
1887 1887
 								}
1888 1888
 								$out .= ' selected>';
1889
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1889
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1890 1890
 								if ($showfunction && $obj->poste) {
1891
-									$out .= ' (' . $obj->poste . ')';
1891
+									$out .= ' ('.$obj->poste.')';
1892 1892
 								}
1893 1893
 								if (($showsoc > 0) && $obj->company) {
1894
-									$out .= ' - (' . $obj->company . ')';
1894
+									$out .= ' - ('.$obj->company.')';
1895 1895
 								}
1896 1896
 								$out .= '</option>';
1897 1897
 							} else {
1898
-								$out .= '<option value="' . $obj->rowid . '"';
1898
+								$out .= '<option value="'.$obj->rowid.'"';
1899 1899
 								if ($disabled) {
1900 1900
 									$out .= ' disabled';
1901 1901
 								}
1902 1902
 								$out .= '>';
1903
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1903
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1904 1904
 								if ($showfunction && $obj->poste) {
1905
-									$out .= ' (' . $obj->poste . ')';
1905
+									$out .= ' ('.$obj->poste.')';
1906 1906
 								}
1907 1907
 								if (($showsoc > 0) && $obj->company) {
1908
-									$out .= ' - (' . $obj->company . ')';
1908
+									$out .= ' - ('.$obj->company.')';
1909 1909
 								}
1910 1910
 								$out .= '</option>';
1911 1911
 							}
1912 1912
 						} else {
1913 1913
 							if (in_array($obj->rowid, $selected)) {
1914
-								$out .= $contactstatic->getFullName($langs) . $extendedInfos;
1914
+								$out .= $contactstatic->getFullName($langs).$extendedInfos;
1915 1915
 								if ($showfunction && $obj->poste) {
1916
-									$out .= ' (' . $obj->poste . ')';
1916
+									$out .= ' ('.$obj->poste.')';
1917 1917
 								}
1918 1918
 								if (($showsoc > 0) && $obj->company) {
1919
-									$out .= ' - (' . $obj->company . ')';
1919
+									$out .= ' - ('.$obj->company.')';
1920 1920
 								}
1921 1921
 							}
1922 1922
 						}
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 				}
1926 1926
 			} else {
1927 1927
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1928
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1928
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1929 1929
 				$out .= $labeltoshow;
1930 1930
 				$out .= '</option>';
1931 1931
 			}
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 			}
1947 1947
 
1948 1948
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1949
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1949
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1950 1950
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT"));
1951 1951
 			}
1952 1952
 
@@ -2051,37 +2051,37 @@  discard block
 block discarded – undo
2051 2051
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
2052 2052
 			$sql .= ", e.label";
2053 2053
 		}
2054
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2054
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2055 2055
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
2056
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2056
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2057 2057
 			if ($force_entity) {
2058
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2058
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2059 2059
 			} else {
2060 2060
 				$sql .= " WHERE u.entity IS NOT NULL";
2061 2061
 			}
2062 2062
 		} else {
2063 2063
 			if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
2064
-				$sql .= " LEFT JOIN " . $this->db->prefix() . "usergroup_user as ug";
2064
+				$sql .= " LEFT JOIN ".$this->db->prefix()."usergroup_user as ug";
2065 2065
 				$sql .= " ON ug.fk_user = u.rowid";
2066
-				$sql .= " WHERE ug.entity = " . (int) $conf->entity;
2066
+				$sql .= " WHERE ug.entity = ".(int) $conf->entity;
2067 2067
 			} else {
2068
-				$sql .= " WHERE u.entity IN (0, " . ((int) $conf->entity) . ")";
2068
+				$sql .= " WHERE u.entity IN (0, ".((int) $conf->entity).")";
2069 2069
 			}
2070 2070
 		}
2071 2071
 		if (!empty($user->socid)) {
2072
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2072
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2073 2073
 		}
2074 2074
 		if (is_array($exclude) && $excludeUsers) {
2075
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2075
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2076 2076
 		}
2077 2077
 		if ($includeUsers) {
2078
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2078
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2079 2079
 		}
2080 2080
 		if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $notdisabled) {
2081 2081
 			$sql .= " AND u.statut <> 0";
2082 2082
 		}
2083 2083
 		if (!empty($morefilter)) {
2084
-			$sql .= " " . $morefilter;
2084
+			$sql .= " ".$morefilter;
2085 2085
 		}
2086 2086
 
2087 2087
 		//Add hook to filter on user (for exemple on usergroup define in custom modules)
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2097 2097
 		}
2098 2098
 
2099
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2099
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2100 2100
 
2101 2101
 		$resql = $this->db->query($sql);
2102 2102
 		if ($resql) {
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 			$i = 0;
2105 2105
 			if ($num) {
2106 2106
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2107
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2107
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2108 2108
 				if ($show_empty && !$multiple) {
2109 2109
 					$textforempty = ' ';
2110 2110
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2113,10 +2113,10 @@  discard block
 block discarded – undo
2113 2113
 					if (!is_numeric($show_empty)) {
2114 2114
 						$textforempty = $show_empty;
2115 2115
 					}
2116
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2116
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2117 2117
 				}
2118 2118
 				if ($show_every) {
2119
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2119
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2120 2120
 				}
2121 2121
 
2122 2122
 				$userstatic = new User($this->db);
@@ -2163,22 +2163,22 @@  discard block
 block discarded – undo
2163 2163
 					}
2164 2164
 					if ($showstatus >= 0) {
2165 2165
 						if ($obj->status == 1 && $showstatus == 1) {
2166
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2167
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2166
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2167
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2168 2168
 						}
2169 2169
 						if ($obj->status == 0 && $showstatus == 1) {
2170
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2171
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2170
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2171
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2172 2172
 						}
2173 2173
 					}
2174 2174
 					if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
2175 2175
 						if (!$obj->entity) {
2176
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2177
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2176
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2177
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2178 2178
 						} else {
2179 2179
 							if ($obj->entity != $conf->entity) {
2180
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2181
-								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2180
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2181
+								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2182 2182
 							}
2183 2183
 						}
2184 2184
 					}
@@ -2186,13 +2186,13 @@  discard block
 block discarded – undo
2186 2186
 					$moreinfohtml .= ($moreinfohtml ? ')</span>' : '');
2187 2187
 					if ($disableline && $disableline != '1') {
2188 2188
 						// Add text from $enableonlytext parameter
2189
-						$moreinfo .= ' - ' . $disableline;
2190
-						$moreinfohtml .= ' - ' . $disableline;
2189
+						$moreinfo .= ' - '.$disableline;
2190
+						$moreinfohtml .= ' - '.$disableline;
2191 2191
 					}
2192 2192
 					$labeltoshow .= $moreinfo;
2193 2193
 					$labeltoshowhtml .= $moreinfohtml;
2194 2194
 
2195
-					$out .= '<option value="' . $obj->rowid . '"';
2195
+					$out .= '<option value="'.$obj->rowid.'"';
2196 2196
 					if ($disableline) {
2197 2197
 						$out .= ' disabled';
2198 2198
 					}
@@ -2200,7 +2200,7 @@  discard block
 block discarded – undo
2200 2200
 						$out .= ' selected';
2201 2201
 					}
2202 2202
 					$out .= ' data-html="';
2203
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2203
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2204 2204
 					if ($showstatus >= 0 && $obj->status == 0) {
2205 2205
 						$outhtml .= '<strike class="opacitymediumxxx">';
2206 2206
 					}
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
 					$out .= $labeltoshow;
2214 2214
 					$out .= '</option>';
2215 2215
 
2216
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2216
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2217 2217
 					$outarray2[$userstatic->id] = array(
2218 2218
 						'id'=>$userstatic->id,
2219 2219
 						'label'=>$labeltoshow,
@@ -2225,14 +2225,14 @@  discard block
 block discarded – undo
2225 2225
 					$i++;
2226 2226
 				}
2227 2227
 			} else {
2228
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2229
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2228
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2229
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2230 2230
 			}
2231 2231
 			$out .= '</select>';
2232 2232
 
2233 2233
 			if ($num && !$forcecombo) {
2234 2234
 				// Enhance with select2
2235
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2235
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2236 2236
 				$out .= ajax_combobox($htmlname);
2237 2237
 			}
2238 2238
 		} else {
@@ -2304,16 +2304,16 @@  discard block
 block discarded – undo
2304 2304
 			$out .= $userstatic->getNomUrl(-1);
2305 2305
 			if ($i == 0) {
2306 2306
 				$ownerid = $value['id'];
2307
-				$out .= ' (' . $langs->trans("Owner") . ')';
2307
+				$out .= ' ('.$langs->trans("Owner").')';
2308 2308
 			}
2309 2309
 			if ($nbassignetouser > 1 && $action != 'view') {
2310
-				$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 . '">';
2310
+				$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.'">';
2311 2311
 			}
2312 2312
 			// Show my availability
2313 2313
 			if ($showproperties) {
2314 2314
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2315 2315
 					$out .= '<div class="myavailability inline-block">';
2316
-					$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>';
2316
+					$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>';
2317 2317
 					$out .= '</div>';
2318 2318
 				}
2319 2319
 			}
@@ -2330,15 +2330,15 @@  discard block
 block discarded – undo
2330 2330
 		// Method with no ajax
2331 2331
 		if ($action != 'view') {
2332 2332
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2333
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2333
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2334 2334
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2335 2335
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2336
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2337
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2336
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2337
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2338 2338
 			$out .= '});';
2339 2339
 			$out .= '})</script>';
2340 2340
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2341
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2341
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2342 2342
 			$out .= '<br>';
2343 2343
 		}
2344 2344
 
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 			$placeholder = '';
2401 2401
 
2402 2402
 			if ($selected && empty($selected_input_value)) {
2403
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2403
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2404 2404
 				$producttmpselect = new Product($this->db);
2405 2405
 				$producttmpselect->fetch($selected);
2406 2406
 				$selected_input_value = $producttmpselect->ref;
@@ -2415,17 +2415,17 @@  discard block
 block discarded – undo
2415 2415
 				}
2416 2416
 			}
2417 2417
 			// mode=1 means customers products
2418
-			$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;
2419
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2418
+			$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;
2419
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2420 2420
 
2421 2421
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2422 2422
 				// Code to automatically insert with javascript the select of attributes under the select of product
2423 2423
 				// when a parent of variant has been selected.
2424 2424
 				$out .= '
2425 2425
 				<!-- script to auto show attributes select tags if a variant was selected -->
2426
-				<script nonce="' . getNonce() . '">
2426
+				<script nonce="' . getNonce().'">
2427 2427
 					// auto show attributes fields
2428
-					selected = ' . json_encode($selected_combinations) . ';
2428
+					selected = ' . json_encode($selected_combinations).';
2429 2429
 					combvalues = {};
2430 2430
 
2431 2431
 					jQuery(document).ready(function () {
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
 							}
2437 2437
 						});
2438 2438
 
2439
-						jQuery("input#' . $htmlname . '").change(function () {
2439
+						jQuery("input#' . $htmlname.'").change(function () {
2440 2440
 
2441 2441
 							if (!jQuery(this).val()) {
2442 2442
 								jQuery(\'div#attributes_box\').empty();
@@ -2445,7 +2445,7 @@  discard block
 block discarded – undo
2445 2445
 
2446 2446
 							console.log("A change has started. We get variants fields to inject html select");
2447 2447
 
2448
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2448
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2449 2449
 								id: jQuery(this).val()
2450 2450
 							}, function (data) {
2451 2451
 								jQuery(\'div#attributes_box\').empty();
@@ -2488,21 +2488,21 @@  discard block
 block discarded – undo
2488 2488
 							})
2489 2489
 						});
2490 2490
 
2491
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2491
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2492 2492
 					});
2493 2493
 				</script>
2494 2494
                 ';
2495 2495
 			}
2496 2496
 
2497 2497
 			if (empty($hidelabel)) {
2498
-				$out .= $langs->trans("RefOrLabel") . ' : ';
2498
+				$out .= $langs->trans("RefOrLabel").' : ';
2499 2499
 			} elseif ($hidelabel > 1) {
2500
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2500
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2501 2501
 				if ($hidelabel == 2) {
2502 2502
 					$out .= img_picto($langs->trans("Search"), 'search');
2503 2503
 				}
2504 2504
 			}
2505
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
2505
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
2506 2506
 			if ($hidelabel == 3) {
2507 2507
 				$out .= img_picto($langs->trans("Search"), 'search');
2508 2508
 			}
@@ -2539,26 +2539,26 @@  discard block
 block discarded – undo
2539 2539
 		// phpcs:enable
2540 2540
 		global $conf, $user, $langs, $db;
2541 2541
 
2542
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2542
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2543 2543
 
2544 2544
 		$error = 0;
2545 2545
 		$out = '';
2546 2546
 
2547 2547
 		if (!$forcecombo) {
2548
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2548
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2549 2549
 			$events = array();
2550 2550
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2551 2551
 		}
2552 2552
 
2553
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2553
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2554 2554
 
2555 2555
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2556
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2557
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2558
-		if (!empty($status)) $sql .= ' AND status = ' . (int) $status;
2559
-		if (!empty($type)) $sql .= ' AND bomtype = ' . (int) $type;
2560
-		if (!empty($TProducts)) $sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2561
-		if (!empty($limit)) $sql .= ' LIMIT ' . (int) $limit;
2556
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2557
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2558
+		if (!empty($status)) $sql .= ' AND status = '.(int) $status;
2559
+		if (!empty($type)) $sql .= ' AND bomtype = '.(int) $type;
2560
+		if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2561
+		if (!empty($limit)) $sql .= ' LIMIT '.(int) $limit;
2562 2562
 		$resql = $db->query($sql);
2563 2563
 		if ($resql) {
2564 2564
 			if ($showempty) {
@@ -2569,9 +2569,9 @@  discard block
 block discarded – undo
2569 2569
 			while ($obj = $db->fetch_object($resql)) {
2570 2570
 				$product = new Product($db);
2571 2571
 				$res = $product->fetch($obj->fk_product);
2572
-				$out .= '<option value="' . $obj->rowid . '"';
2572
+				$out .= '<option value="'.$obj->rowid.'"';
2573 2573
 				if ($obj->rowid == $selected) $out .= 'selected';
2574
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2574
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2575 2575
 			}
2576 2576
 		} else {
2577 2577
 			$error++;
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
 
2629 2629
 		$warehouseStatusArray = array();
2630 2630
 		if (!empty($warehouseStatus)) {
2631
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2631
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2632 2632
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2633 2633
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2634 2634
 			}
@@ -2642,9 +2642,9 @@  discard block
 block discarded – undo
2642 2642
 
2643 2643
 		$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";
2644 2644
 		if (count($warehouseStatusArray)) {
2645
-			$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
2645
+			$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
2646 2646
 		} else {
2647
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2647
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2648 2648
 		}
2649 2649
 
2650 2650
 		$sql = "SELECT ";
@@ -2660,9 +2660,9 @@  discard block
 block discarded – undo
2660 2660
 
2661 2661
 		if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
2662 2662
 			//Product category
2663
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2664
-						FROM " . $this->db->prefix() . "categorie_product
2665
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2663
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2664
+						FROM " . $this->db->prefix()."categorie_product
2665
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2666 2666
 						LIMIT 1
2667 2667
 				) AS categorie_product_id ";
2668 2668
 		}
@@ -2688,15 +2688,15 @@  discard block
 block discarded – undo
2688 2688
 		}
2689 2689
 		// Price by quantity
2690 2690
 		if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2691
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2691
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2692 2692
 			if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2693
-				$sql .= " AND price_level = " . ((int) $price_level);
2693
+				$sql .= " AND price_level = ".((int) $price_level);
2694 2694
 			}
2695 2695
 			$sql .= " ORDER BY date_price";
2696 2696
 			$sql .= " DESC LIMIT 1) as price_rowid";
2697
-			$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
2697
+			$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
2698 2698
 			if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
2699
-				$sql .= " AND price_level = " . ((int) $price_level);
2699
+				$sql .= " AND price_level = ".((int) $price_level);
2700 2700
 			}
2701 2701
 			$sql .= " ORDER BY date_price";
2702 2702
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2710,67 +2710,67 @@  discard block
 block discarded – undo
2710 2710
 		$sql .= $hookmanager->resPrint;
2711 2711
 
2712 2712
 		if (count($warehouseStatusArray)) {
2713
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
2714
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
2715
-			$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.
2713
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
2714
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
2715
+			$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.
2716 2716
 		}
2717 2717
 
2718 2718
 		// include search in supplier ref
2719 2719
 		if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
2720
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2720
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2721 2721
 		}
2722 2722
 
2723 2723
 		//Price by customer
2724 2724
 		if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
2725
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
2725
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
2726 2726
 		}
2727 2727
 		// Units
2728 2728
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
2729
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
2729
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
2730 2730
 		}
2731 2731
 		// Multilang : we add translation
2732 2732
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
2733
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
2733
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
2734 2734
 			if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
2735
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
2735
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
2736 2736
 				$soc = new Societe($this->db);
2737 2737
 				$result = $soc->fetch($socid);
2738 2738
 				if ($result > 0 && !empty($soc->default_lang)) {
2739
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
2739
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
2740 2740
 				} else {
2741
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
2741
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
2742 2742
 				}
2743 2743
 			} else {
2744
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
2744
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
2745 2745
 			}
2746 2746
 		}
2747 2747
 
2748 2748
 		if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
2749
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2749
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
2750 2750
 		}
2751 2751
 
2752
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
2752
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
2753 2753
 
2754 2754
 		if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
2755 2755
 			$sql .= " AND pac.rowid IS NULL";
2756 2756
 		}
2757 2757
 
2758 2758
 		if ($finished == 0) {
2759
-			$sql .= " AND p.finished = " . ((int) $finished);
2759
+			$sql .= " AND p.finished = ".((int) $finished);
2760 2760
 		} elseif ($finished == 1) {
2761
-			$sql .= " AND p.finished = " . ((int) $finished);
2761
+			$sql .= " AND p.finished = ".((int) $finished);
2762 2762
 			if ($status >= 0) {
2763
-				$sql .= " AND p.tosell = " . ((int) $status);
2763
+				$sql .= " AND p.tosell = ".((int) $status);
2764 2764
 			}
2765 2765
 		} elseif ($status >= 0) {
2766
-			$sql .= " AND p.tosell = " . ((int) $status);
2766
+			$sql .= " AND p.tosell = ".((int) $status);
2767 2767
 		}
2768 2768
 		if ($status_purchase >= 0) {
2769
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
2769
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
2770 2770
 		}
2771 2771
 		// Filter by product type
2772 2772
 		if (strval($filtertype) != '') {
2773
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
2773
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
2774 2774
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
2775 2775
 			$sql .= " AND p.fk_product_type = 1";
2776 2776
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -2794,21 +2794,21 @@  discard block
 block discarded – undo
2794 2794
 				if ($i > 0) {
2795 2795
 					$sql .= " AND ";
2796 2796
 				}
2797
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2797
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
2798 2798
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
2799
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2799
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
2800 2800
 				}
2801 2801
 				if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
2802
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2802
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
2803 2803
 				}
2804 2804
 				if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) {
2805
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2805
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
2806 2806
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
2807
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2807
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
2808 2808
 					}
2809 2809
 				}
2810 2810
 				if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
2811
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
2811
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
2812 2812
 				}
2813 2813
 				$sql .= ")";
2814 2814
 				$i++;
@@ -2817,12 +2817,12 @@  discard block
 block discarded – undo
2817 2817
 				$sql .= ")";
2818 2818
 			}
2819 2819
 			if (isModEnabled('barcode')) {
2820
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
2820
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
2821 2821
 			}
2822 2822
 			$sql .= ')';
2823 2823
 		}
2824 2824
 		if (count($warehouseStatusArray)) {
2825
-			$sql .= " GROUP BY " . $selectFields;
2825
+			$sql .= " GROUP BY ".$selectFields;
2826 2826
 		}
2827 2827
 
2828 2828
 		//Sort by category
@@ -2837,23 +2837,23 @@  discard block
 block discarded – undo
2837 2837
 		$sql .= $this->db->plimit($limit, 0);
2838 2838
 
2839 2839
 		// Build output string
2840
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
2840
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
2841 2841
 		$result = $this->db->query($sql);
2842 2842
 		if ($result) {
2843
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2844
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2845
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
2843
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2844
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2845
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
2846 2846
 
2847 2847
 			$num = $this->db->num_rows($result);
2848 2848
 
2849 2849
 			$events = null;
2850 2850
 
2851 2851
 			if (!$forcecombo) {
2852
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2852
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2853 2853
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2854 2854
 			}
2855 2855
 
2856
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2856
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2857 2857
 
2858 2858
 			$textifempty = '';
2859 2859
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -2870,7 +2870,7 @@  discard block
 block discarded – undo
2870 2870
 				}
2871 2871
 			}
2872 2872
 			if ($showempty) {
2873
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
2873
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
2874 2874
 			}
2875 2875
 
2876 2876
 			$i = 0;
@@ -2881,11 +2881,11 @@  discard block
 block discarded – undo
2881 2881
 
2882 2882
 				if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->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
2883 2883
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
2884
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
2885
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
2884
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
2885
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
2886 2886
 					$sql .= " ORDER BY quantity ASC";
2887 2887
 
2888
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
2888
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
2889 2889
 					$result2 = $this->db->query($sql);
2890 2890
 					if ($result2) {
2891 2891
 						$nb_prices = $this->db->num_rows($result2);
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
 						$price_product = new Product($this->db);
2924 2924
 						$price_product->fetch($objp->rowid, '', '', 1);
2925 2925
 
2926
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
2926
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
2927 2927
 						$priceparser = new PriceParser($this->db);
2928 2928
 						$price_result = $priceparser->parseProduct($price_product);
2929 2929
 						if ($price_result >= 0) {
@@ -3007,7 +3007,7 @@  discard block
 block discarded – undo
3007 3007
 			$label = $objp->label_translated;
3008 3008
 		}
3009 3009
 		if (!empty($filterkey) && $filterkey != '') {
3010
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3010
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3011 3011
 		}
3012 3012
 
3013 3013
 		$outkey = $objp->rowid;
@@ -3028,32 +3028,32 @@  discard block
 block discarded – undo
3028 3028
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3029 3029
 
3030 3030
 		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
3031
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3031
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3032 3032
 		}
3033 3033
 
3034 3034
 		// Units
3035 3035
 		$outvalUnits = '';
3036 3036
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3037 3037
 			if (!empty($objp->unit_short)) {
3038
-				$outvalUnits .= ' - ' . $objp->unit_short;
3038
+				$outvalUnits .= ' - '.$objp->unit_short;
3039 3039
 			}
3040 3040
 		}
3041 3041
 		if (!empty($conf->global->PRODUCT_SHOW_DIMENSIONS_IN_COMBO)) {
3042 3042
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3043 3043
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3044
-				$outvalUnits .= ' - ' . $unitToShow;
3044
+				$outvalUnits .= ' - '.$unitToShow;
3045 3045
 			}
3046 3046
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3047
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3048
-				$outvalUnits .= ' - ' . $unitToShow;
3047
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3048
+				$outvalUnits .= ' - '.$unitToShow;
3049 3049
 			}
3050 3050
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3051 3051
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3052
-				$outvalUnits .= ' - ' . $unitToShow;
3052
+				$outvalUnits .= ' - '.$unitToShow;
3053 3053
 			}
3054 3054
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3055 3055
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3056
-				$outvalUnits .= ' - ' . $unitToShow;
3056
+				$outvalUnits .= ' - '.$unitToShow;
3057 3057
 			}
3058 3058
 		}
3059 3059
 		if ($outdurationvalue && $outdurationunit) {
@@ -3065,14 +3065,14 @@  discard block
 block discarded – undo
3065 3065
 				'y' => $langs->trans('Year')
3066 3066
 			);
3067 3067
 			if (isset($da[$outdurationunit])) {
3068
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3068
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3069 3069
 			}
3070 3070
 		}
3071 3071
 
3072
-		$opt = '<option value="' . $objp->rowid . '"';
3072
+		$opt = '<option value="'.$objp->rowid.'"';
3073 3073
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3074 3074
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3075
-			$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 . '"';
3075
+			$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.'"';
3076 3076
 		}
3077 3077
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
3078 3078
 			if (!empty($user->rights->stock->lire)) {
@@ -3084,36 +3084,36 @@  discard block
 block discarded – undo
3084 3084
 			}
3085 3085
 		}
3086 3086
 		if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
3087
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3088
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3087
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3088
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3089 3089
 		}
3090 3090
 		$opt .= '>';
3091 3091
 		$opt .= $objp->ref;
3092 3092
 		if (!empty($objp->custref)) {
3093
-			$opt .= ' (' . $objp->custref . ')';
3093
+			$opt .= ' ('.$objp->custref.')';
3094 3094
 		}
3095 3095
 		if ($outbarcode) {
3096
-			$opt .= ' (' . $outbarcode . ')';
3096
+			$opt .= ' ('.$outbarcode.')';
3097 3097
 		}
3098
-		$opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
3098
+		$opt .= ' - '.dol_trunc($label, $maxlengtharticle);
3099 3099
 		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
3100
-			$opt .= ' (' . getCountry($outorigin, 1) . ')';
3100
+			$opt .= ' ('.getCountry($outorigin, 1).')';
3101 3101
 		}
3102 3102
 
3103 3103
 		$objRef = $objp->ref;
3104 3104
 		if (!empty($objp->custref)) {
3105
-			$objRef .= ' (' . $objp->custref . ')';
3105
+			$objRef .= ' ('.$objp->custref.')';
3106 3106
 		}
3107 3107
 		if (!empty($filterkey) && $filterkey != '') {
3108
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3108
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3109 3109
 		}
3110 3110
 		$outval .= $objRef;
3111 3111
 		if ($outbarcode) {
3112
-			$outval .= ' (' . $outbarcode . ')';
3112
+			$outval .= ' ('.$outbarcode.')';
3113 3113
 		}
3114
-		$outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
3114
+		$outval .= ' - '.dol_trunc($label, $maxlengtharticle);
3115 3115
 		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
3116
-			$outval .= ' (' . getCountry($outorigin, 1) . ')';
3116
+			$outval .= ' ('.getCountry($outorigin, 1).')';
3117 3117
 		}
3118 3118
 
3119 3119
 		// Units
@@ -3126,35 +3126,35 @@  discard block
 block discarded – undo
3126 3126
 		// If we need a particular price level (from 1 to n)
3127 3127
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
3128 3128
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3129
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3130
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3131
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3132
-			$sql .= " AND price_level = " . ((int) $price_level);
3129
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3130
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3131
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3132
+			$sql .= " AND price_level = ".((int) $price_level);
3133 3133
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3134 3134
 			$sql .= " LIMIT 1";
3135 3135
 
3136
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3136
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3137 3137
 			$result2 = $this->db->query($sql);
3138 3138
 			if ($result2) {
3139 3139
 				$objp2 = $this->db->fetch_object($result2);
3140 3140
 				if ($objp2) {
3141 3141
 					$found = 1;
3142 3142
 					if ($objp2->price_base_type == 'HT') {
3143
-						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3144
-						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3143
+						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3144
+						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3145 3145
 					} else {
3146
-						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3147
-						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3146
+						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3147
+						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3148 3148
 					}
3149 3149
 					$outprice_ht = price($objp2->price);
3150 3150
 					$outprice_ttc = price($objp2->price_ttc);
3151 3151
 					$outpricebasetype = $objp2->price_base_type;
3152 3152
 					if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {  // using this option is a bug. kept for backward compatibility
3153
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3154
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3153
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3154
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3155 3155
 					} else {
3156
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3157
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3156
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3157
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3158 3158
 					}
3159 3159
 				}
3160 3160
 			} else {
@@ -3168,13 +3168,13 @@  discard block
 block discarded – undo
3168 3168
 			$outqty = $objp->quantity;
3169 3169
 			$outdiscount = $objp->remise_percent;
3170 3170
 			if ($objp->quantity == 1) {
3171
-				$opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3172
-				$outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3171
+				$opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3172
+				$outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3173 3173
 				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3174 3174
 				$outval .= $langs->transnoentities("Unit");
3175 3175
 			} else {
3176
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3177
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3176
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3177
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3178 3178
 				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3179 3179
 				$outval .= $langs->transnoentities("Units");
3180 3180
 			}
@@ -3182,16 +3182,16 @@  discard block
 block discarded – undo
3182 3182
 			$outprice_ht = price($objp->unitprice);
3183 3183
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3184 3184
 			$outpricebasetype = $objp->price_base_type;
3185
-			$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
3186
-			$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
3185
+			$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
3186
+			$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
3187 3187
 		}
3188 3188
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3189
-			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3190
-			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3189
+			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3190
+			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3191 3191
 		}
3192 3192
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3193
-			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3194
-			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3193
+			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3194
+			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3195 3195
 		}
3196 3196
 
3197 3197
 		// Price by customer
@@ -3200,11 +3200,11 @@  discard block
 block discarded – undo
3200 3200
 				$found = 1;
3201 3201
 
3202 3202
 				if ($objp->custprice_base_type == 'HT') {
3203
-					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3204
-					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3203
+					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3204
+					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3205 3205
 				} else {
3206
-					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3207
-					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3206
+					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3207
+					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3208 3208
 				}
3209 3209
 
3210 3210
 				$outprice_ht = price($objp->custprice);
@@ -3218,11 +3218,11 @@  discard block
 block discarded – undo
3218 3218
 		// If level no defined or multiprice not found, we used the default price
3219 3219
 		if (empty($hidepriceinlabel) && !$found) {
3220 3220
 			if ($objp->price_base_type == 'HT') {
3221
-				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3222
-				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3221
+				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3222
+				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3223 3223
 			} else {
3224
-				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3225
-				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3224
+				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3225
+				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3226 3226
 			}
3227 3227
 			$outprice_ht = price($objp->price);
3228 3228
 			$outprice_ttc = price($objp->price_ttc);
@@ -3233,14 +3233,14 @@  discard block
 block discarded – undo
3233 3233
 
3234 3234
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
3235 3235
 			if (!empty($user->rights->stock->lire)) {
3236
-				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3236
+				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3237 3237
 
3238 3238
 				if ($objp->stock > 0) {
3239 3239
 					$outval .= ' - <span class="product_line_stock_ok">';
3240 3240
 				} elseif ($objp->stock <= 0) {
3241 3241
 					$outval .= ' - <span class="product_line_stock_too_low">';
3242 3242
 				}
3243
-				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3243
+				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
3244 3244
 				$outval .= '</span>';
3245 3245
 				if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) {  // Warning, this option may slow down combo list generation
3246 3246
 					$langs->load("stocks");
@@ -3250,9 +3250,9 @@  discard block
 block discarded – undo
3250 3250
 					$tmpproduct->load_virtual_stock();
3251 3251
 					$virtualstock = $tmpproduct->stock_theorique;
3252 3252
 
3253
-					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3253
+					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3254 3254
 
3255
-					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3255
+					$outval .= ' - '.$langs->transnoentities("VirtualStock").':';
3256 3256
 					if ($virtualstock > 0) {
3257 3257
 						$outval .= '<span class="product_line_stock_ok">';
3258 3258
 					} elseif ($virtualstock <= 0) {
@@ -3330,7 +3330,7 @@  discard block
 block discarded – undo
3330 3330
 		$selected_input_value = '';
3331 3331
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
3332 3332
 			if ($selected > 0) {
3333
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3333
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3334 3334
 				$producttmpselect = new Product($this->db);
3335 3335
 				$producttmpselect->fetch($selected);
3336 3336
 				$selected_input_value = $producttmpselect->ref;
@@ -3338,10 +3338,10 @@  discard block
 block discarded – undo
3338 3338
 			}
3339 3339
 
3340 3340
 			// mode=2 means suppliers products
3341
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3342
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
3341
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3342
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
3343 3343
 
3344
-			print ($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3344
+			print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3345 3345
 		} else {
3346 3346
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3347 3347
 		}
@@ -3401,25 +3401,25 @@  discard block
 block discarded – undo
3401 3401
 		if (isModEnabled('barcode')) {
3402 3402
 			$sql .= ", pfp.barcode";
3403 3403
 		}
3404
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3405
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3404
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3405
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3406 3406
 		if ($socid > 0) {
3407
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3407
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3408 3408
 		}
3409
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3409
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3410 3410
 		// Units
3411 3411
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3412
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3412
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3413 3413
 		}
3414
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3414
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3415 3415
 		if ($statut != -1) {
3416
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3416
+			$sql .= " AND p.tobuy = ".((int) $statut);
3417 3417
 		}
3418 3418
 		if (strval($filtertype) != '') {
3419
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3419
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3420 3420
 		}
3421 3421
 		if (!empty($filtre)) {
3422
-			$sql .= " " . $filtre;
3422
+			$sql .= " ".$filtre;
3423 3423
 		}
3424 3424
 		// Add where from hooks
3425 3425
 		$parameters = array();
@@ -3439,9 +3439,9 @@  discard block
 block discarded – undo
3439 3439
 				if ($i > 0) {
3440 3440
 					$sql .= " AND ";
3441 3441
 				}
3442
-				$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) . "%'";
3442
+				$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)."%'";
3443 3443
 				if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
3444
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3444
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3445 3445
 				}
3446 3446
 				$sql .= ")";
3447 3447
 				$i++;
@@ -3450,8 +3450,8 @@  discard block
 block discarded – undo
3450 3450
 				$sql .= ")";
3451 3451
 			}
3452 3452
 			if (isModEnabled('barcode')) {
3453
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3454
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3453
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3454
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3455 3455
 			}
3456 3456
 			$sql .= ')';
3457 3457
 		}
@@ -3460,20 +3460,20 @@  discard block
 block discarded – undo
3460 3460
 
3461 3461
 		// Build output string
3462 3462
 
3463
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3463
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3464 3464
 		$result = $this->db->query($sql);
3465 3465
 		if ($result) {
3466
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3467
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3466
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3467
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3468 3468
 
3469 3469
 			$num = $this->db->num_rows($result);
3470 3470
 
3471 3471
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3472
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3472
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3473 3473
 			if (!$selected) {
3474
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3474
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3475 3475
 			} else {
3476
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3476
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3477 3477
 			}
3478 3478
 
3479 3479
 			$i = 0;
@@ -3488,7 +3488,7 @@  discard block
 block discarded – undo
3488 3488
 
3489 3489
 				$outkey = $objp->idprodfournprice; // id in table of price
3490 3490
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3491
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3491
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3492 3492
 				}
3493 3493
 
3494 3494
 				$outref = $objp->ref;
@@ -3503,23 +3503,23 @@  discard block
 block discarded – undo
3503 3503
 				$outvalUnits = '';
3504 3504
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3505 3505
 					if (!empty($objp->unit_short)) {
3506
-						$outvalUnits .= ' - ' . $objp->unit_short;
3506
+						$outvalUnits .= ' - '.$objp->unit_short;
3507 3507
 					}
3508 3508
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3509 3509
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3510
-						$outvalUnits .= ' - ' . $unitToShow;
3510
+						$outvalUnits .= ' - '.$unitToShow;
3511 3511
 					}
3512 3512
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3513
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3514
-						$outvalUnits .= ' - ' . $unitToShow;
3513
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3514
+						$outvalUnits .= ' - '.$unitToShow;
3515 3515
 					}
3516 3516
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3517 3517
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3518
-						$outvalUnits .= ' - ' . $unitToShow;
3518
+						$outvalUnits .= ' - '.$unitToShow;
3519 3519
 					}
3520 3520
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3521 3521
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3522
-						$outvalUnits .= ' - ' . $unitToShow;
3522
+						$outvalUnits .= ' - '.$unitToShow;
3523 3523
 					}
3524 3524
 					if ($outdurationvalue && $outdurationunit) {
3525 3525
 						$da = array(
@@ -3530,22 +3530,22 @@  discard block
 block discarded – undo
3530 3530
 							'y' => $langs->trans('Year')
3531 3531
 						);
3532 3532
 						if (isset($da[$outdurationunit])) {
3533
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3533
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3534 3534
 						}
3535 3535
 					}
3536 3536
 				}
3537 3537
 
3538 3538
 				$objRef = $objp->ref;
3539 3539
 				if ($filterkey && $filterkey != '') {
3540
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3540
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3541 3541
 				}
3542 3542
 				$objRefFourn = $objp->ref_fourn;
3543 3543
 				if ($filterkey && $filterkey != '') {
3544
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3544
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3545 3545
 				}
3546 3546
 				$label = $objp->label;
3547 3547
 				if ($filterkey && $filterkey != '') {
3548
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3548
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3549 3549
 				}
3550 3550
 
3551 3551
 				switch ($objp->fk_product_type) {
@@ -3568,21 +3568,21 @@  discard block
 block discarded – undo
3568 3568
 
3569 3569
 				$optlabel .= $objp->ref;
3570 3570
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3571
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3571
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3572 3572
 				}
3573 3573
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3574
-					$optlabel .= ' (' . $outbarcode . ')';
3574
+					$optlabel .= ' ('.$outbarcode.')';
3575 3575
 				}
3576
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3576
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3577 3577
 
3578 3578
 				$outvallabel = $objRef;
3579 3579
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3580
-					$outvallabel .= ' (' . $objRefFourn . ')';
3580
+					$outvallabel .= ' ('.$objRefFourn.')';
3581 3581
 				}
3582 3582
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3583
-					$outvallabel .= ' (' . $outbarcode . ')';
3583
+					$outvallabel .= ' ('.$outbarcode.')';
3584 3584
 				}
3585
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3585
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3586 3586
 
3587 3587
 				// Units
3588 3588
 				$optlabel .= $outvalUnits;
@@ -3599,7 +3599,7 @@  discard block
 block discarded – undo
3599 3599
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3600 3600
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3601 3601
 
3602
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3602
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3603 3603
 						$priceparser = new PriceParser($this->db);
3604 3604
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3605 3605
 						if ($price_result >= 0) {
@@ -3610,48 +3610,48 @@  discard block
 block discarded – undo
3610 3610
 						}
3611 3611
 					}
3612 3612
 					if ($objp->quantity == 1) {
3613
-						$optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3614
-						$outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3613
+						$optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3614
+						$outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3615 3615
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3616 3616
 						$outvallabel .= $langs->transnoentities("Unit");
3617 3617
 					} else {
3618
-						$optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3619
-						$outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3620
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3621
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3618
+						$optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3619
+						$outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3620
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3621
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3622 3622
 					}
3623 3623
 
3624 3624
 					if ($objp->quantity > 1) {
3625
-						$optlabel .= " (" . price($objp->unitprice * (!empty($conf->global->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
3626
-						$outvallabel .= " (" . price($objp->unitprice * (!empty($conf->global->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
3625
+						$optlabel .= " (".price($objp->unitprice * (!empty($conf->global->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
3626
+						$outvallabel .= " (".price($objp->unitprice * (!empty($conf->global->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
3627 3627
 					}
3628 3628
 					if ($objp->remise_percent >= 1) {
3629
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3630
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3629
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3630
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3631 3631
 					}
3632 3632
 					if ($objp->duration) {
3633
-						$optlabel .= " - " . $objp->duration;
3634
-						$outvallabel .= " - " . $objp->duration;
3633
+						$optlabel .= " - ".$objp->duration;
3634
+						$outvallabel .= " - ".$objp->duration;
3635 3635
 					}
3636 3636
 					if (!$socid) {
3637
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3638
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3637
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3638
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3639 3639
 					}
3640 3640
 					if ($objp->supplier_reputation) {
3641 3641
 						//TODO dictionary
3642 3642
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3643 3643
 
3644
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3645
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3644
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3645
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3646 3646
 					}
3647 3647
 				} else {
3648 3648
 					if (empty($alsoproductwithnosupplierprice)) {     // No supplier price defined for couple product/supplier
3649
-						$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3650
-						$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3649
+						$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3650
+						$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3651 3651
 					} else // No supplier price defined for product, even on other suppliers
3652 3652
 					{
3653
-						$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3654
-						$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3653
+						$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3654
+						$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3655 3655
 					}
3656 3656
 				}
3657 3657
 
@@ -3659,14 +3659,14 @@  discard block
 block discarded – undo
3659 3659
 					$novirtualstock = ($showstockinlist == 2);
3660 3660
 
3661 3661
 					if (!empty($user->rights->stock->lire)) {
3662
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3662
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3663 3663
 
3664 3664
 						if ($objp->stock > 0) {
3665 3665
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3666 3666
 						} elseif ($objp->stock <= 0) {
3667 3667
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3668 3668
 						}
3669
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3669
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3670 3670
 						$optlabel .= '</span>';
3671 3671
 						if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) {  // Warning, this option may slow down combo list generation
3672 3672
 							$langs->load("stocks");
@@ -3676,9 +3676,9 @@  discard block
 block discarded – undo
3676 3676
 							$tmpproduct->load_virtual_stock();
3677 3677
 							$virtualstock = $tmpproduct->stock_theorique;
3678 3678
 
3679
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3679
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3680 3680
 
3681
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3681
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
3682 3682
 							if ($virtualstock > 0) {
3683 3683
 								$optlabel .= '<span class="product_line_stock_ok">';
3684 3684
 							} elseif ($virtualstock <= 0) {
@@ -3692,7 +3692,7 @@  discard block
 block discarded – undo
3692 3692
 					}
3693 3693
 				}
3694 3694
 
3695
-				$optstart = '<option value="' . $outkey . '"';
3695
+				$optstart = '<option value="'.$outkey.'"';
3696 3696
 				if ($selected && $selected == $objp->idprodfournprice) {
3697 3697
 					$optstart .= ' selected';
3698 3698
 				}
@@ -3701,26 +3701,26 @@  discard block
 block discarded – undo
3701 3701
 				}
3702 3702
 
3703 3703
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
3704
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
3705
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
3706
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
3707
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
3708
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
3709
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
3710
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
3711
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
3712
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
3713
-				}
3714
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
3704
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
3705
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
3706
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
3707
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
3708
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
3709
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
3710
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
3711
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
3712
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
3713
+				}
3714
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
3715 3715
 
3716 3716
 				$outarrayentry = array(
3717 3717
 					'key' => $outkey,
3718 3718
 					'value' => $outref,
3719 3719
 					'label' => $outvallabel,
3720 3720
 					'qty' => $outqty,
3721
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
3722
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
3723
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
3721
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3722
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3723
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3724 3724
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
3725 3725
 					'tva_tx' => price2num($objp->tva_tx),
3726 3726
 					'default_vat_code' => $objp->default_vat_code,
@@ -3745,18 +3745,18 @@  discard block
 block discarded – undo
3745 3745
 				// Add new entry
3746 3746
 				// "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
3747 3747
 				// "label" value of json key array is used by jQuery automatically as text for combo box
3748
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
3748
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
3749 3749
 				array_push(
3750 3750
 					$outarray,
3751 3751
 					array('key' => $outkey,
3752 3752
 						'value' => $outref,
3753 3753
 						'label' => $outvallabel,
3754 3754
 						'qty' => $outqty,
3755
-						'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
3755
+						'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
3756 3756
 						'price_qty_ht_locale' => price($objp->fprice),
3757
-						'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
3757
+						'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
3758 3758
 						'price_unit_ht_locale' => price($objp->unitprice),
3759
-						'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
3759
+						'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
3760 3760
 						'tva_tx_formated' => price($objp->tva_tx),
3761 3761
 						'tva_tx' => price2num($objp->tva_tx),
3762 3762
 						'default_vat_code' => $objp->default_vat_code,
@@ -3783,7 +3783,7 @@  discard block
 block discarded – undo
3783 3783
 
3784 3784
 			$this->db->free($result);
3785 3785
 
3786
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3786
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3787 3787
 			$out .= ajax_combobox($htmlname);
3788 3788
 		} else {
3789 3789
 			dol_print_error($this->db);
@@ -3815,43 +3815,43 @@  discard block
 block discarded – undo
3815 3815
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
3816 3816
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
3817 3817
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
3818
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3819
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3820
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3821
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
3818
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3819
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3820
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3821
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
3822 3822
 		$sql .= " AND p.tobuy = 1";
3823 3823
 		$sql .= " AND s.fournisseur = 1";
3824
-		$sql .= " AND p.rowid = " . ((int) $productid);
3824
+		$sql .= " AND p.rowid = ".((int) $productid);
3825 3825
 		if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) {
3826 3826
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
3827 3827
 		} else {
3828 3828
 			$sql .= " ORDER BY pfp.unitprice ASC";
3829 3829
 		}
3830 3830
 
3831
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
3831
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
3832 3832
 		$result = $this->db->query($sql);
3833 3833
 
3834 3834
 		if ($result) {
3835 3835
 			$num = $this->db->num_rows($result);
3836 3836
 
3837
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3837
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
3838 3838
 
3839 3839
 			if (!$num) {
3840
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
3840
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
3841 3841
 			} else {
3842
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3842
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3843 3843
 				$form .= '<option value="0">&nbsp;</option>';
3844 3844
 
3845 3845
 				$i = 0;
3846 3846
 				while ($i < $num) {
3847 3847
 					$objp = $this->db->fetch_object($result);
3848 3848
 
3849
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
3849
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
3850 3850
 					//if there is only one supplier, preselect it
3851 3851
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && !empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED))) {
3852 3852
 						$opt .= ' selected';
3853 3853
 					}
3854
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
3854
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
3855 3855
 
3856 3856
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
3857 3857
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -3861,7 +3861,7 @@  discard block
 block discarded – undo
3861 3861
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3862 3862
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3863 3863
 
3864
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3864
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3865 3865
 						$priceparser = new PriceParser($this->db);
3866 3866
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3867 3867
 						if ($price_result >= 0) {
@@ -3872,10 +3872,10 @@  discard block
 block discarded – undo
3872 3872
 						}
3873 3873
 					}
3874 3874
 					if ($objp->quantity == 1) {
3875
-						$opt .= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3875
+						$opt .= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3876 3876
 					}
3877 3877
 
3878
-					$opt .= $objp->quantity . ' ';
3878
+					$opt .= $objp->quantity.' ';
3879 3879
 
3880 3880
 					if ($objp->quantity == 1) {
3881 3881
 						$opt .= $langs->trans("Unit");
@@ -3884,10 +3884,10 @@  discard block
 block discarded – undo
3884 3884
 					}
3885 3885
 					if ($objp->quantity > 1) {
3886 3886
 						$opt .= " - ";
3887
-						$opt .= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
3887
+						$opt .= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
3888 3888
 					}
3889 3889
 					if ($objp->duration) {
3890
-						$opt .= " - " . $objp->duration;
3890
+						$opt .= " - ".$objp->duration;
3891 3891
 					}
3892 3892
 					$opt .= "</option>\n";
3893 3893
 
@@ -3921,14 +3921,14 @@  discard block
 block discarded – undo
3921 3921
 		// phpcs:enable
3922 3922
 		// looking for users
3923 3923
 		$sql = "SELECT a.rowid, a.label";
3924
-		$sql .= " FROM " . $this->db->prefix() . "societe_address as a";
3925
-		$sql .= " WHERE a.fk_soc = " . ((int) $socid);
3924
+		$sql .= " FROM ".$this->db->prefix()."societe_address as a";
3925
+		$sql .= " WHERE a.fk_soc = ".((int) $socid);
3926 3926
 		$sql .= " ORDER BY a.label ASC";
3927 3927
 
3928
-		dol_syslog(get_class($this) . "::select_address", LOG_DEBUG);
3928
+		dol_syslog(get_class($this)."::select_address", LOG_DEBUG);
3929 3929
 		$resql = $this->db->query($sql);
3930 3930
 		if ($resql) {
3931
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
3931
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
3932 3932
 			if ($showempty) {
3933 3933
 				print '<option value="0">&nbsp;</option>';
3934 3934
 			}
@@ -3939,9 +3939,9 @@  discard block
 block discarded – undo
3939 3939
 					$obj = $this->db->fetch_object($resql);
3940 3940
 
3941 3941
 					if ($selected && $selected == $obj->rowid) {
3942
-						print '<option value="' . $obj->rowid . '" selected>' . $obj->label . '</option>';
3942
+						print '<option value="'.$obj->rowid.'" selected>'.$obj->label.'</option>';
3943 3943
 					} else {
3944
-						print '<option value="' . $obj->rowid . '">' . $obj->label . '</option>';
3944
+						print '<option value="'.$obj->rowid.'">'.$obj->label.'</option>';
3945 3945
 					}
3946 3946
 					$i++;
3947 3947
 				}
@@ -3974,8 +3974,8 @@  discard block
 block discarded – undo
3974 3974
 		dol_syslog(__METHOD__, LOG_DEBUG);
3975 3975
 
3976 3976
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
3977
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
3978
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
3977
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
3978
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
3979 3979
 		$sql .= " AND active > 0";
3980 3980
 		$sql .= " ORDER BY sortorder";
3981 3981
 
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
 				$obj = $this->db->fetch_object($resql);
3988 3988
 
3989 3989
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
3990
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != ("PaymentConditionShort" . $obj->code) ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
3990
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != ("PaymentConditionShort".$obj->code) ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
3991 3991
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
3992 3992
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
3993 3993
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
 		// phpcs:enable
4016 4016
 		global $langs;
4017 4017
 
4018
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4018
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4019 4019
 		if ($num > 0) {
4020 4020
 			return 0; // Cache already loaded
4021 4021
 		}
@@ -4025,7 +4025,7 @@  discard block
 block discarded – undo
4025 4025
 		$langs->load('propal');
4026 4026
 
4027 4027
 		$sql = "SELECT rowid, code, label, position";
4028
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4028
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4029 4029
 		$sql .= " WHERE active > 0";
4030 4030
 
4031 4031
 		$resql = $this->db->query($sql);
@@ -4036,7 +4036,7 @@  discard block
 block discarded – undo
4036 4036
 				$obj = $this->db->fetch_object($resql);
4037 4037
 
4038 4038
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
4039
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != ("AvailabilityType" . $obj->code) ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4039
+				$label = ($langs->trans("AvailabilityType".$obj->code) != ("AvailabilityType".$obj->code) ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4040 4040
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4041 4041
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4042 4042
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4068,17 +4068,17 @@  discard block
 block discarded – undo
4068 4068
 
4069 4069
 		$this->load_cache_availability();
4070 4070
 
4071
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4071
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4072 4072
 
4073
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4073
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4074 4074
 		if ($addempty) {
4075 4075
 			print '<option value="0">&nbsp;</option>';
4076 4076
 		}
4077 4077
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4078 4078
 			if ($selected == $id) {
4079
-				print '<option value="' . $id . '" selected>';
4079
+				print '<option value="'.$id.'" selected>';
4080 4080
 			} else {
4081
-				print '<option value="' . $id . '">';
4081
+				print '<option value="'.$id.'">';
4082 4082
 			}
4083 4083
 			print dol_escape_htmltag($arrayavailability['label']);
4084 4084
 			print '</option>';
@@ -4099,13 +4099,13 @@  discard block
 block discarded – undo
4099 4099
 	{
4100 4100
 		global $langs;
4101 4101
 
4102
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4102
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4103 4103
 		if ($num > 0) {
4104 4104
 			return 0; // Cache already loaded
4105 4105
 		}
4106 4106
 
4107 4107
 		$sql = "SELECT rowid, code, label";
4108
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4108
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4109 4109
 		$sql .= " WHERE active > 0";
4110 4110
 
4111 4111
 		$resql = $this->db->query($sql);
@@ -4118,8 +4118,8 @@  discard block
 block discarded – undo
4118 4118
 
4119 4119
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
4120 4120
 				$label = ($obj->label != '-' ? $obj->label : '');
4121
-				if ($langs->trans("DemandReasonType" . $obj->code) != ("DemandReasonType" . $obj->code)) {
4122
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4121
+				if ($langs->trans("DemandReasonType".$obj->code) != ("DemandReasonType".$obj->code)) {
4122
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4123 4123
 				}
4124 4124
 				if ($langs->trans($obj->code) != $obj->code) {
4125 4125
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4159,9 +4159,9 @@  discard block
 block discarded – undo
4159 4159
 
4160 4160
 		$this->loadCacheInputReason();
4161 4161
 
4162
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4162
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4163 4163
 		if ($addempty) {
4164
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4164
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4165 4165
 		}
4166 4166
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4167 4167
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4169,9 +4169,9 @@  discard block
 block discarded – undo
4169 4169
 			}
4170 4170
 
4171 4171
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4172
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4172
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4173 4173
 			} else {
4174
-				print '<option value="' . $arraydemandreason['id'] . '">';
4174
+				print '<option value="'.$arraydemandreason['id'].'">';
4175 4175
 			}
4176 4176
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4177 4177
 			print $langs->trans($label);
@@ -4181,7 +4181,7 @@  discard block
 block discarded – undo
4181 4181
 		if ($user->admin && empty($notooltip)) {
4182 4182
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4183 4183
 		}
4184
-		print ajax_combobox('select_' . $htmlname);
4184
+		print ajax_combobox('select_'.$htmlname);
4185 4185
 	}
4186 4186
 
4187 4187
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4196,7 +4196,7 @@  discard block
 block discarded – undo
4196 4196
 		// phpcs:enable
4197 4197
 		global $langs;
4198 4198
 
4199
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4199
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4200 4200
 		if ($num > 0) {
4201 4201
 			return $num; // Cache already loaded
4202 4202
 		}
@@ -4206,8 +4206,8 @@  discard block
 block discarded – undo
4206 4206
 		$this->cache_types_paiements = array();
4207 4207
 
4208 4208
 		$sql = "SELECT id, code, libelle as label, type, active";
4209
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4210
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4209
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4210
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4211 4211
 
4212 4212
 		$resql = $this->db->query($sql);
4213 4213
 		if ($resql) {
@@ -4217,7 +4217,7 @@  discard block
 block discarded – undo
4217 4217
 				$obj = $this->db->fetch_object($resql);
4218 4218
 
4219 4219
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
4220
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4220
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4221 4221
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4222 4222
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4223 4223
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4283,17 +4283,17 @@  discard block
 block discarded – undo
4283 4283
 		global $langs, $user, $conf;
4284 4284
 
4285 4285
 		$out = '';
4286
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4286
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4287 4287
 
4288 4288
 		$this->load_cache_conditions_paiements();
4289 4289
 
4290 4290
 		// Set default value if not already set by caller
4291 4291
 		if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) {
4292
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4292
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4293 4293
 			$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
4294 4294
 		}
4295 4295
 
4296
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4296
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4297 4297
 		if ($addempty) {
4298 4298
 			$out .= '<option value="0">&nbsp;</option>';
4299 4299
 		}
@@ -4307,9 +4307,9 @@  discard block
 block discarded – undo
4307 4307
 
4308 4308
 			if ($selected == $id) {
4309 4309
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4310
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4310
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4311 4311
 			} else {
4312
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4312
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4313 4313
 			}
4314 4314
 			$label = $arrayconditions['label'];
4315 4315
 
@@ -4327,21 +4327,21 @@  discard block
 block discarded – undo
4327 4327
 		$out .= ajax_combobox($htmlname);
4328 4328
 
4329 4329
 		if ($deposit_percent >= 0) {
4330
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4331
-			$out .= $langs->trans('DepositPercent') . ' : ';
4332
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4330
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4331
+			$out .= $langs->trans('DepositPercent').' : ';
4332
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4333 4333
 			$out .= '</span>';
4334 4334
 			$out .= '
4335
-				<script nonce="' . getNonce() . '">
4335
+				<script nonce="' . getNonce().'">
4336 4336
 					$(document).ready(function () {
4337
-						$("#' . $htmlname . '").change(function () {
4337
+						$("#' . $htmlname.'").change(function () {
4338 4338
 							let $selected = $(this).find("option:selected");
4339 4339
 							let depositPercent = $selected.attr("data-deposit_percent");
4340 4340
 
4341 4341
 							if (depositPercent.length > 0) {
4342
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4342
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4343 4343
 							} else {
4344
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4344
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4345 4345
 							}
4346 4346
 
4347 4347
 							return true;
@@ -4379,7 +4379,7 @@  discard block
 block discarded – undo
4379 4379
 
4380 4380
 		$out = '';
4381 4381
 
4382
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4382
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4383 4383
 
4384 4384
 		$filterarray = array();
4385 4385
 		if ($filtertype == 'CRDT') {
@@ -4394,11 +4394,11 @@  discard block
 block discarded – undo
4394 4394
 
4395 4395
 		// Set default value if not already set by caller
4396 4396
 		if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID)) {
4397
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4397
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4398 4398
 			$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID;
4399 4399
 		}
4400 4400
 
4401
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4401
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4402 4402
 		if ($empty) {
4403 4403
 			$out .= '<option value="">&nbsp;</option>';
4404 4404
 		}
@@ -4419,13 +4419,13 @@  discard block
 block discarded – undo
4419 4419
 			}
4420 4420
 
4421 4421
 			if ($format == 0) {
4422
-				$out .= '<option value="' . $id . '"';
4422
+				$out .= '<option value="'.$id.'"';
4423 4423
 			} elseif ($format == 1) {
4424
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4424
+				$out .= '<option value="'.$arraytypes['code'].'"';
4425 4425
 			} elseif ($format == 2) {
4426
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4426
+				$out .= '<option value="'.$arraytypes['code'].'"';
4427 4427
 			} elseif ($format == 3) {
4428
-				$out .= '<option value="' . $id . '"';
4428
+				$out .= '<option value="'.$id.'"';
4429 4429
 			}
4430 4430
 			// Print attribute selected or not
4431 4431
 			if ($format == 1 || $format == 2) {
@@ -4455,7 +4455,7 @@  discard block
 block discarded – undo
4455 4455
 		if ($user->admin && !$noadmininfo) {
4456 4456
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4457 4457
 		}
4458
-		$out .= ajax_combobox('select' . $htmlname);
4458
+		$out .= ajax_combobox('select'.$htmlname);
4459 4459
 
4460 4460
 		if (empty($nooutput)) {
4461 4461
 			print $out;
@@ -4477,22 +4477,22 @@  discard block
 block discarded – undo
4477 4477
 	{
4478 4478
 		global $langs;
4479 4479
 
4480
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4480
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4481 4481
 		$options = array(
4482 4482
 			'HT' => $langs->trans("HT"),
4483 4483
 			'TTC' => $langs->trans("TTC")
4484 4484
 		);
4485 4485
 		foreach ($options as $id => $value) {
4486 4486
 			if ($selected == $id) {
4487
-				$return .= '<option value="' . $id . '" selected>' . $value;
4487
+				$return .= '<option value="'.$id.'" selected>'.$value;
4488 4488
 			} else {
4489
-				$return .= '<option value="' . $id . '">' . $value;
4489
+				$return .= '<option value="'.$id.'">'.$value;
4490 4490
 			}
4491 4491
 			$return .= '</option>';
4492 4492
 		}
4493 4493
 		$return .= '</select>';
4494 4494
 		if ($addjscombo) {
4495
-			$return .= ajax_combobox('select_' . $htmlname);
4495
+			$return .= ajax_combobox('select_'.$htmlname);
4496 4496
 		}
4497 4497
 
4498 4498
 		return $return;
@@ -4510,7 +4510,7 @@  discard block
 block discarded – undo
4510 4510
 		// phpcs:enable
4511 4511
 		global $langs;
4512 4512
 
4513
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4513
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4514 4514
 		if ($num > 0) {
4515 4515
 			return $num; // Cache already loaded
4516 4516
 		}
@@ -4520,8 +4520,8 @@  discard block
 block discarded – undo
4520 4520
 		$this->cache_transport_mode = array();
4521 4521
 
4522 4522
 		$sql = "SELECT rowid, code, label, active";
4523
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4524
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4523
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4524
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4525 4525
 
4526 4526
 		$resql = $this->db->query($sql);
4527 4527
 		if ($resql) {
@@ -4531,7 +4531,7 @@  discard block
 block discarded – undo
4531 4531
 				$obj = $this->db->fetch_object($resql);
4532 4532
 
4533 4533
 				// If traduction exist, we use it else we take the default label
4534
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != ("PaymentTypeShort" . $obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4534
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != ("PaymentTypeShort".$obj->code) ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4535 4535
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4536 4536
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4537 4537
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4565,11 +4565,11 @@  discard block
 block discarded – undo
4565 4565
 	{
4566 4566
 		global $langs, $user;
4567 4567
 
4568
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4568
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4569 4569
 
4570 4570
 		$this->load_cache_transport_mode();
4571 4571
 
4572
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4572
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4573 4573
 		if ($empty) {
4574 4574
 			print '<option value="">&nbsp;</option>';
4575 4575
 		}
@@ -4585,13 +4585,13 @@  discard block
 block discarded – undo
4585 4585
 			}
4586 4586
 
4587 4587
 			if ($format == 0) {
4588
-				print '<option value="' . $id . '"';
4588
+				print '<option value="'.$id.'"';
4589 4589
 			} elseif ($format == 1) {
4590
-				print '<option value="' . $arraytypes['code'] . '"';
4590
+				print '<option value="'.$arraytypes['code'].'"';
4591 4591
 			} elseif ($format == 2) {
4592
-				print '<option value="' . $arraytypes['code'] . '"';
4592
+				print '<option value="'.$arraytypes['code'].'"';
4593 4593
 			} elseif ($format == 3) {
4594
-				print '<option value="' . $id . '"';
4594
+				print '<option value="'.$id.'"';
4595 4595
 			}
4596 4596
 			// If text is selected, we compare with code, else with id
4597 4597
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4639,31 +4639,31 @@  discard block
 block discarded – undo
4639 4639
 		$langs->load("deliveries");
4640 4640
 
4641 4641
 		$sql = "SELECT rowid, code, libelle as label";
4642
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4642
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4643 4643
 		$sql .= " WHERE active > 0";
4644 4644
 		if ($filtre) {
4645
-			$sql .= " AND " . $filtre;
4645
+			$sql .= " AND ".$filtre;
4646 4646
 		}
4647 4647
 		$sql .= " ORDER BY libelle ASC";
4648 4648
 
4649
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4649
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4650 4650
 		$result = $this->db->query($sql);
4651 4651
 		if ($result) {
4652 4652
 			$num = $this->db->num_rows($result);
4653 4653
 			$i = 0;
4654 4654
 			if ($num) {
4655
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4655
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4656 4656
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4657 4657
 					print '<option value="-1">&nbsp;</option>';
4658 4658
 				}
4659 4659
 				while ($i < $num) {
4660 4660
 					$obj = $this->db->fetch_object($result);
4661 4661
 					if ($selected == $obj->rowid) {
4662
-						print '<option value="' . $obj->rowid . '" selected>';
4662
+						print '<option value="'.$obj->rowid.'" selected>';
4663 4663
 					} else {
4664
-						print '<option value="' . $obj->rowid . '">';
4664
+						print '<option value="'.$obj->rowid.'">';
4665 4665
 					}
4666
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
4666
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
4667 4667
 					print '</option>';
4668 4668
 					$i++;
4669 4669
 				}
@@ -4672,7 +4672,7 @@  discard block
 block discarded – undo
4672 4672
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4673 4673
 				}
4674 4674
 
4675
-				print ajax_combobox('select' . $htmlname);
4675
+				print ajax_combobox('select'.$htmlname);
4676 4676
 			} else {
4677 4677
 				print $langs->trans("NoShippingMethodDefined");
4678 4678
 			}
@@ -4697,16 +4697,16 @@  discard block
 block discarded – undo
4697 4697
 		$langs->load("deliveries");
4698 4698
 
4699 4699
 		if ($htmlname != "none") {
4700
-			print '<form method="POST" action="' . $page . '">';
4700
+			print '<form method="POST" action="'.$page.'">';
4701 4701
 			print '<input type="hidden" name="action" value="setshippingmethod">';
4702
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
4702
+			print '<input type="hidden" name="token" value="'.newToken().'">';
4703 4703
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
4704
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4704
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4705 4705
 			print '</form>';
4706 4706
 		} else {
4707 4707
 			if ($selected) {
4708 4708
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
4709
-				print $langs->trans("SendingMethod" . strtoupper($code));
4709
+				print $langs->trans("SendingMethod".strtoupper($code));
4710 4710
 			} else {
4711 4711
 				print "&nbsp;";
4712 4712
 			}
@@ -4729,10 +4729,10 @@  discard block
 block discarded – undo
4729 4729
 
4730 4730
 		$opt = '<option value="" selected></option>';
4731 4731
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
4732
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
4733
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
4732
+		$sql .= ' FROM '.$this->db->prefix().'facture';
4733
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
4734 4734
 		$sql .= ' AND situation_counter >= 1';
4735
-		$sql .= ' AND fk_soc = ' . (int) $socid;
4735
+		$sql .= ' AND fk_soc = '.(int) $socid;
4736 4736
 		$sql .= ' AND type <> 2';
4737 4737
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
4738 4738
 		$resql = $this->db->query($sql);
@@ -4750,19 +4750,19 @@  discard block
 block discarded – undo
4750 4750
 						//Not prov?
4751 4751
 						if (substr($obj->ref, 1, 4) != 'PROV') {
4752 4752
 							if ($selected == $obj->rowid) {
4753
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
4753
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
4754 4754
 							} else {
4755
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
4755
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
4756 4756
 							}
4757 4757
 						}
4758 4758
 					}
4759 4759
 				}
4760 4760
 			}
4761 4761
 		} else {
4762
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
4762
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
4763 4763
 		}
4764 4764
 		if ($opt == '<option value ="" selected></option>') {
4765
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
4765
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
4766 4766
 		}
4767 4767
 		return $opt;
4768 4768
 	}
@@ -4782,12 +4782,12 @@  discard block
 block discarded – undo
4782 4782
 
4783 4783
 		$langs->load('products');
4784 4784
 
4785
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
4785
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
4786 4786
 
4787
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
4787
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
4788 4788
 		$sql .= ' WHERE active > 0';
4789 4789
 		if (!empty($unit_type)) {
4790
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
4790
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
4791 4791
 		}
4792 4792
 		$sql .= " ORDER BY sortorder";
4793 4793
 
@@ -4799,14 +4799,14 @@  discard block
 block discarded – undo
4799 4799
 
4800 4800
 			while ($res = $this->db->fetch_object($resql)) {
4801 4801
 				$unitLabel = $res->label;
4802
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
4803
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
4802
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
4803
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
4804 4804
 				}
4805 4805
 
4806 4806
 				if ($selected == $res->rowid) {
4807
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
4807
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
4808 4808
 				} else {
4809
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
4809
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
4810 4810
 				}
4811 4811
 			}
4812 4812
 			$return .= '</select>';
@@ -4841,23 +4841,23 @@  discard block
 block discarded – undo
4841 4841
 		$num = 0;
4842 4842
 
4843 4843
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
4844
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
4845
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
4844
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
4845
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
4846 4846
 		if ($status != 2) {
4847
-			$sql .= " AND clos = " . (int) $status;
4847
+			$sql .= " AND clos = ".(int) $status;
4848 4848
 		}
4849 4849
 		if ($filtre) {
4850
-			$sql .= " AND " . $filtre;
4850
+			$sql .= " AND ".$filtre;
4851 4851
 		}
4852 4852
 		$sql .= " ORDER BY label";
4853 4853
 
4854
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
4854
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
4855 4855
 		$result = $this->db->query($sql);
4856 4856
 		if ($result) {
4857 4857
 			$num = $this->db->num_rows($result);
4858 4858
 			$i = 0;
4859 4859
 			if ($num) {
4860
-				$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4860
+				$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4861 4861
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4862 4862
 					$out .= '<option value="-1">&nbsp;</option>';
4863 4863
 				}
@@ -4865,27 +4865,27 @@  discard block
 block discarded – undo
4865 4865
 				while ($i < $num) {
4866 4866
 					$obj = $this->db->fetch_object($result);
4867 4867
 					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
4868
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';
4868
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';
4869 4869
 					} else {
4870
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';
4870
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';
4871 4871
 					}
4872 4872
 					$out .= trim($obj->label);
4873 4873
 					if ($showcurrency) {
4874
-						$out .= ' (' . $obj->currency_code . ')';
4874
+						$out .= ' ('.$obj->currency_code.')';
4875 4875
 					}
4876 4876
 					if ($status == 2 && $obj->status == 1) {
4877
-						$out .= ' (' . $langs->trans("Closed") . ')';
4877
+						$out .= ' ('.$langs->trans("Closed").')';
4878 4878
 					}
4879 4879
 					$out .= '</option>';
4880 4880
 					$i++;
4881 4881
 				}
4882 4882
 				$out .= "</select>";
4883
-				$out .= ajax_combobox('select' . $htmlname);
4883
+				$out .= ajax_combobox('select'.$htmlname);
4884 4884
 			} else {
4885 4885
 				if ($status == 0) {
4886
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
4886
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
4887 4887
 				} else {
4888
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
4888
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
4889 4889
 				}
4890 4890
 			}
4891 4891
 		} else {
@@ -4921,23 +4921,23 @@  discard block
 block discarded – undo
4921 4921
 		$num = 0;
4922 4922
 
4923 4923
 		$sql = "SELECT rowid, name, fk_country, status, entity";
4924
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
4924
+		$sql .= " FROM ".$this->db->prefix()."establishment";
4925 4925
 		$sql .= " WHERE 1=1";
4926 4926
 		if ($status != 2) {
4927
-			$sql .= " AND status = " . (int) $status;
4927
+			$sql .= " AND status = ".(int) $status;
4928 4928
 		}
4929 4929
 		if ($filtre) {
4930
-			$sql .= " AND " . $filtre;
4930
+			$sql .= " AND ".$filtre;
4931 4931
 		}
4932 4932
 		$sql .= " ORDER BY name";
4933 4933
 
4934
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
4934
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
4935 4935
 		$result = $this->db->query($sql);
4936 4936
 		if ($result) {
4937 4937
 			$num = $this->db->num_rows($result);
4938 4938
 			$i = 0;
4939 4939
 			if ($num) {
4940
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4940
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4941 4941
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4942 4942
 					print '<option value="-1">&nbsp;</option>';
4943 4943
 				}
@@ -4945,13 +4945,13 @@  discard block
 block discarded – undo
4945 4945
 				while ($i < $num) {
4946 4946
 					$obj = $this->db->fetch_object($result);
4947 4947
 					if ($selected == $obj->rowid) {
4948
-						print '<option value="' . $obj->rowid . '" selected>';
4948
+						print '<option value="'.$obj->rowid.'" selected>';
4949 4949
 					} else {
4950
-						print '<option value="' . $obj->rowid . '">';
4950
+						print '<option value="'.$obj->rowid.'">';
4951 4951
 					}
4952 4952
 					print trim($obj->name);
4953 4953
 					if ($status == 2 && $obj->status == 1) {
4954
-						print ' (' . $langs->trans("Closed") . ')';
4954
+						print ' ('.$langs->trans("Closed").')';
4955 4955
 					}
4956 4956
 					print '</option>';
4957 4957
 					$i++;
@@ -4959,9 +4959,9 @@  discard block
 block discarded – undo
4959 4959
 				print "</select>";
4960 4960
 			} else {
4961 4961
 				if ($status == 0) {
4962
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
4962
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
4963 4963
 				} else {
4964
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
4964
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
4965 4965
 				}
4966 4966
 			}
4967 4967
 
@@ -4985,20 +4985,20 @@  discard block
 block discarded – undo
4985 4985
 	{
4986 4986
 		global $langs;
4987 4987
 		if ($htmlname != "none") {
4988
-			print '<form method="POST" action="' . $page . '">';
4988
+			print '<form method="POST" action="'.$page.'">';
4989 4989
 			print '<input type="hidden" name="action" value="setbankaccount">';
4990
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
4990
+			print '<input type="hidden" name="token" value="'.newToken().'">';
4991 4991
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
4992 4992
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
4993 4993
 			if ($nbaccountfound > 0) {
4994
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
4994
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
4995 4995
 			}
4996 4996
 			print '</form>';
4997 4997
 		} else {
4998 4998
 			$langs->load('banks');
4999 4999
 
5000 5000
 			if ($selected) {
5001
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5001
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5002 5002
 				$bankstatic = new Account($this->db);
5003 5003
 				$result = $bankstatic->fetch($selected);
5004 5004
 				if ($result) {
@@ -5036,19 +5036,19 @@  discard block
 block discarded – undo
5036 5036
 		global $conf, $langs;
5037 5037
 		$langs->load("categories");
5038 5038
 
5039
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5039
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5040 5040
 
5041 5041
 		// For backward compatibility
5042 5042
 		if (is_numeric($type)) {
5043
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5043
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5044 5044
 		}
5045 5045
 
5046 5046
 		if ($type === Categorie::TYPE_BANK_LINE) {
5047 5047
 			// TODO Move this into common category feature
5048 5048
 			$cate_arbo = array();
5049 5049
 			$sql = "SELECT c.label, c.rowid";
5050
-			$sql .= " FROM " . $this->db->prefix() . "bank_categ as c";
5051
-			$sql .= " WHERE entity = " . $conf->entity;
5050
+			$sql .= " FROM ".$this->db->prefix()."bank_categ as c";
5051
+			$sql .= " WHERE entity = ".$conf->entity;
5052 5052
 			$sql .= " ORDER BY c.label";
5053 5053
 			$result = $this->db->query($sql);
5054 5054
 			if ($result) {
@@ -5072,10 +5072,10 @@  discard block
 block discarded – undo
5072 5072
 
5073 5073
 		$outarray = array();
5074 5074
 
5075
-		$output = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5075
+		$output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5076 5076
 		if (is_array($cate_arbo)) {
5077 5077
 			if (!count($cate_arbo)) {
5078
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5078
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5079 5079
 			} else {
5080 5080
 				$output .= '<option value="-1">&nbsp;</option>';
5081 5081
 				foreach ($cate_arbo as $key => $value) {
@@ -5084,8 +5084,8 @@  discard block
 block discarded – undo
5084 5084
 					} else {
5085 5085
 						$add = '';
5086 5086
 					}
5087
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5088
-					$output .= ' data-html="' . dol_escape_htmltag(img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"') . dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle')) . '"';
5087
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5088
+					$output .= ' data-html="'.dol_escape_htmltag(img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"').dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle')).'"';
5089 5089
 					$output .= '>';
5090 5090
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5091 5091
 					$output .= '</option>';
@@ -5126,7 +5126,7 @@  discard block
 block discarded – undo
5126 5126
 	public function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5127 5127
 	{
5128 5128
 		// phpcs:enable
5129
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5129
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5130 5130
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5131 5131
 	}
5132 5132
 
@@ -5161,7 +5161,7 @@  discard block
 block discarded – undo
5161 5161
 	{
5162 5162
 		global $langs, $conf;
5163 5163
 
5164
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5164
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5165 5165
 		$formconfirm = '';
5166 5166
 		$inputok = array();
5167 5167
 		$inputko = array();
@@ -5185,27 +5185,27 @@  discard block
 block discarded – undo
5185 5185
 			foreach ($formquestion as $key => $input) {
5186 5186
 				if (is_array($input) && !empty($input)) {
5187 5187
 					if ($input['type'] == 'hidden') {
5188
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5189
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5188
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5189
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5190 5190
 
5191
-						$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";
5191
+						$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";
5192 5192
 					}
5193 5193
 				}
5194 5194
 			}
5195 5195
 
5196 5196
 			// Now add questions
5197 5197
 			$moreonecolumn = '';
5198
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5198
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5199 5199
 			foreach ($formquestion as $key => $input) {
5200 5200
 				if (is_array($input) && !empty($input)) {
5201
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5202
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5203
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5201
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5202
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5203
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5204 5204
 
5205 5205
 					if ($input['type'] == 'text') {
5206
-						$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";
5206
+						$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";
5207 5207
 					} elseif ($input['type'] == 'password') {
5208
-						$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";
5208
+						$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";
5209 5209
 					} elseif ($input['type'] == 'textarea') {
5210 5210
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5211 5211
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5213,8 +5213,8 @@  discard block
 block discarded – undo
5213 5213
 						$more .= '</textarea>';
5214 5214
 						$more .= '</div></div>'."\n";*/
5215 5215
 						$moreonecolumn .= '<div class="margintoponly">';
5216
-						$moreonecolumn .= $input['label'] . '<br>';
5217
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5216
+						$moreonecolumn .= $input['label'].'<br>';
5217
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5218 5218
 						$moreonecolumn .= $input['value'];
5219 5219
 						$moreonecolumn .= '</textarea>';
5220 5220
 						$moreonecolumn .= '</div>';
@@ -5231,20 +5231,20 @@  discard block
 block discarded – undo
5231 5231
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5232 5232
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5233 5233
 
5234
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5234
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5235 5235
 						if (!empty($input['label'])) {
5236
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5236
+							$more .= $input['label'].'</div><div class="tagtd left">';
5237 5237
 						}
5238 5238
 						if ($input['type'] == 'select') {
5239 5239
 							$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);
5240 5240
 						} else {
5241 5241
 							$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);
5242 5242
 						}
5243
-						$more .= '</div></div>' . "\n";
5243
+						$more .= '</div></div>'."\n";
5244 5244
 					} elseif ($input['type'] == 'checkbox') {
5245 5245
 						$more .= '<div class="tagtr">';
5246
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5247
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5246
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5247
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5248 5248
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5249 5249
 							$more .= ' checked';
5250 5250
 						}
@@ -5255,19 +5255,19 @@  discard block
 block discarded – undo
5255 5255
 							$more .= ' disabled';
5256 5256
 						}
5257 5257
 						$more .= ' /></div>';
5258
-						$more .= '</div>' . "\n";
5258
+						$more .= '</div>'."\n";
5259 5259
 					} elseif ($input['type'] == 'radio') {
5260 5260
 						$i = 0;
5261 5261
 						foreach ($input['values'] as $selkey => $selval) {
5262 5262
 							$more .= '<div class="tagtr">';
5263 5263
 							if (isset($input['label'])) {
5264 5264
 								if ($i == 0) {
5265
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5265
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5266 5266
 								} else {
5267
-									$more .= '<div clas="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5267
+									$more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5268 5268
 								}
5269 5269
 							}
5270
-							$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;
5270
+							$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;
5271 5271
 							if (!empty($input['disabled'])) {
5272 5272
 								$more .= ' disabled';
5273 5273
 							}
@@ -5275,12 +5275,12 @@  discard block
 block discarded – undo
5275 5275
 								$more .= ' checked="checked"';
5276 5276
 							}
5277 5277
 							$more .= ' /> ';
5278
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5279
-							$more .= '</div></div>' . "\n";
5278
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5279
+							$more .= '</div></div>'."\n";
5280 5280
 							$i++;
5281 5281
 						}
5282 5282
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5283
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5283
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5284 5284
 						$more .= '<div class="tagtd">';
5285 5285
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5286 5286
 						$h = $m = 0;
@@ -5298,24 +5298,24 @@  discard block
 block discarded – undo
5298 5298
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5299 5299
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5300 5300
 						if (!empty($input['label'])) {
5301
-							$more .= $input['label'] . '</div><div class="tagtd">';
5301
+							$more .= $input['label'].'</div><div class="tagtd">';
5302 5302
 						}
5303 5303
 						$more .= $input['value'];
5304
-						$more .= '</div></div>' . "\n";
5304
+						$more .= '</div></div>'."\n";
5305 5305
 					} elseif ($input['type'] == 'onecolumn') {
5306 5306
 						$moreonecolumn .= '<div class="margintoponly">';
5307 5307
 						$moreonecolumn .= $input['value'];
5308
-						$moreonecolumn .= '</div>' . "\n";
5308
+						$moreonecolumn .= '</div>'."\n";
5309 5309
 					} elseif ($input['type'] == 'hidden') {
5310 5310
 						// Do nothing more, already added by a previous loop
5311 5311
 					} elseif ($input['type'] == 'separator') {
5312 5312
 						$more .= '<br>';
5313 5313
 					} else {
5314
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5314
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5315 5315
 					}
5316 5316
 				}
5317 5317
 			}
5318
-			$more .= '</div>' . "\n";
5318
+			$more .= '</div>'."\n";
5319 5319
 			$more .= $moreonecolumn;
5320 5320
 		}
5321 5321
 
@@ -5337,10 +5337,10 @@  discard block
 block discarded – undo
5337 5337
 				$button = $useajax;
5338 5338
 				$useajax = 1;
5339 5339
 				$autoOpen = false;
5340
-				$dialogconfirm .= '-' . $button;
5340
+				$dialogconfirm .= '-'.$button;
5341 5341
 			}
5342
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5343
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5342
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5343
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5344 5344
 
5345 5345
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5346 5346
 			if (is_array($formquestion)) {
@@ -5362,24 +5362,24 @@  discard block
 block discarded – undo
5362 5362
 			}
5363 5363
 
5364 5364
 			// Show JQuery confirm box.
5365
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5365
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5366 5366
 			if (is_array($formquestion) && !empty($formquestion['text'])) {
5367
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5367
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5368 5368
 			}
5369 5369
 			if (!empty($more)) {
5370
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5370
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5371 5371
 			}
5372
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help('', '') . ' ' . $question . '</div>' : '');
5373
-			$formconfirm .= '</div>' . "\n";
5372
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help('', '').' '.$question.'</div>' : '');
5373
+			$formconfirm .= '</div>'."\n";
5374 5374
 
5375
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5376
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5375
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5376
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5377 5377
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5378 5378
 			$formconfirm .= 'jQuery(document).ready(function() {
5379 5379
             $(function() {
5380
-            	$( "#' . $dialogconfirm . '" ).dialog(
5380
+            	$( "#' . $dialogconfirm.'" ).dialog(
5381 5381
             	{
5382
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5382
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5383 5383
 			if ($newselectedchoice == 'no') {
5384 5384
 				$formconfirm .= '
5385 5385
 						open: function() {
@@ -5389,24 +5389,24 @@  discard block
 block discarded – undo
5389 5389
 
5390 5390
 			$jsforcursor = '';
5391 5391
 			if ($useajax == 1) {
5392
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5393
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5392
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5393
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5394 5394
 			}
5395 5395
 
5396 5396
 			$postconfirmas = 'GET';
5397 5397
 
5398 5398
 			$formconfirm .= '
5399 5399
                     resizable: false,
5400
-                    height: "' . $height . '",
5401
-                    width: "' . $width . '",
5400
+                    height: "' . $height.'",
5401
+                    width: "' . $width.'",
5402 5402
                     modal: true,
5403 5403
                     closeOnEscape: false,
5404 5404
                     buttons: {
5405
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5406
-							var options = "token=' . urlencode(newToken()) . '";
5407
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5408
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5409
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5405
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5406
+							var options = "token=' . urlencode(newToken()).'";
5407
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5408
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5409
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5410 5410
 
5411 5411
                          	if (inputok.length > 0) {
5412 5412
                          		$.each(inputok, function(i, inputname) {
@@ -5440,11 +5440,11 @@  discard block
 block discarded – undo
5440 5440
 							}
5441 5441
 	                        $(this).dialog("close");
5442 5442
                         },
5443
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5444
-                        	var options = "token=' . urlencode(newToken()) . '";
5445
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5446
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5447
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5443
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5444
+                        	var options = "token=' . urlencode(newToken()).'";
5445
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5446
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5447
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5448 5448
                          	if (inputko.length > 0) {
5449 5449
                          		$.each(inputko, function(i, inputname) {
5450 5450
                          			var more = "";
@@ -5476,10 +5476,10 @@  discard block
 block discarded – undo
5476 5476
                 }
5477 5477
                 );
5478 5478
 
5479
-            	var button = "' . $button . '";
5479
+            	var button = "' . $button.'";
5480 5480
             	if (button.length > 0) {
5481 5481
                 	$( "#" + button ).click(function() {
5482
-                		$("#' . $dialogconfirm . '").dialog("open");
5482
+                		$("#' . $dialogconfirm.'").dialog("open");
5483 5483
         			});
5484 5484
                 }
5485 5485
             });
@@ -5487,44 +5487,44 @@  discard block
 block discarded – undo
5487 5487
             </script>';
5488 5488
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5489 5489
 		} else {
5490
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5490
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5491 5491
 
5492 5492
 			if (empty($disableformtag)) {
5493
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
5493
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
5494 5494
 			}
5495 5495
 
5496
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5497
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5496
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5497
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5498 5498
 
5499
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5499
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5500 5500
 
5501 5501
 			// Line title
5502 5502
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5503
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5504
-			$formconfirm .= '</td></tr>' . "\n";
5503
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5504
+			$formconfirm .= '</td></tr>'."\n";
5505 5505
 
5506 5506
 			// Line text
5507 5507
 			if (is_array($formquestion) && !empty($formquestion['text'])) {
5508
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5508
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5509 5509
 			}
5510 5510
 
5511 5511
 			// Line form fields
5512 5512
 			if ($more) {
5513
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5513
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5514 5514
 				$formconfirm .= $more;
5515
-				$formconfirm .= '</td></tr>' . "\n";
5515
+				$formconfirm .= '</td></tr>'."\n";
5516 5516
 			}
5517 5517
 
5518 5518
 			// Line with question
5519 5519
 			$formconfirm .= '<tr class="valid">';
5520
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5520
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5521 5521
 			$formconfirm .= '<td class="valid center">';
5522 5522
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5523
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5523
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5524 5524
 			$formconfirm .= '</td>';
5525
-			$formconfirm .= '</tr>' . "\n";
5525
+			$formconfirm .= '</tr>'."\n";
5526 5526
 
5527
-			$formconfirm .= '</table>' . "\n";
5527
+			$formconfirm .= '</table>'."\n";
5528 5528
 
5529 5529
 			if (empty($disableformtag)) {
5530 5530
 				$formconfirm .= "</form>\n";
@@ -5533,7 +5533,7 @@  discard block
 block discarded – undo
5533 5533
 
5534 5534
 			if (!empty($conf->use_javascript_ajax)) {
5535 5535
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5536
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5536
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5537 5537
 				$formconfirm .= '
5538 5538
 				$(document).ready(function () {
5539 5539
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5545,7 +5545,7 @@  discard block
 block discarded – undo
5545 5545
 					});
5546 5546
 				});
5547 5547
 				';
5548
-				$formconfirm .= '</script>' . "\n";
5548
+				$formconfirm .= '</script>'."\n";
5549 5549
 			}
5550 5550
 
5551 5551
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -5577,8 +5577,8 @@  discard block
 block discarded – undo
5577 5577
 		// phpcs:enable
5578 5578
 		global $langs;
5579 5579
 
5580
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
5581
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
5580
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
5581
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
5582 5582
 
5583 5583
 		$out = '';
5584 5584
 
@@ -5586,11 +5586,11 @@  discard block
 block discarded – undo
5586 5586
 
5587 5587
 		$langs->load("project");
5588 5588
 		if ($htmlname != "none") {
5589
-			$out .= '<form method="post" action="' . $page . '">';
5589
+			$out .= '<form method="post" action="'.$page.'">';
5590 5590
 			$out .= '<input type="hidden" name="action" value="classin">';
5591
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5591
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5592 5592
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
5593
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5593
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5594 5594
 			$out .= '</form>';
5595 5595
 		} else {
5596 5596
 			$out .= '<span class="project_head_block">';
@@ -5599,7 +5599,7 @@  discard block
 block discarded – undo
5599 5599
 				$projet->fetch($selected);
5600 5600
 				$out .= $projet->getNomUrl(0, '', 1);
5601 5601
 			} else {
5602
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
5602
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
5603 5603
 			}
5604 5604
 			$out .= '</span>';
5605 5605
 		}
@@ -5636,14 +5636,14 @@  discard block
 block discarded – undo
5636 5636
 		$out = '';
5637 5637
 
5638 5638
 		if ($htmlname != "none") {
5639
-			$out .= '<form method="POST" action="' . $page . '">';
5639
+			$out .= '<form method="POST" action="'.$page.'">';
5640 5640
 			$out .= '<input type="hidden" name="action" value="setconditions">';
5641
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5641
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5642 5642
 			if ($type) {
5643
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5643
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5644 5644
 			}
5645 5645
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
5646
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5646
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
5647 5647
 			$out .= '</form>';
5648 5648
 		} else {
5649 5649
 			if ($selected) {
@@ -5688,12 +5688,12 @@  discard block
 block discarded – undo
5688 5688
 		// phpcs:enable
5689 5689
 		global $langs;
5690 5690
 		if ($htmlname != "none") {
5691
-			print '<form method="post" action="' . $page . '">';
5691
+			print '<form method="post" action="'.$page.'">';
5692 5692
 			print '<input type="hidden" name="action" value="setavailability">';
5693
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5693
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5694 5694
 			$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
5695
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5696
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
5695
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5696
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
5697 5697
 			print '</form>';
5698 5698
 		} else {
5699 5699
 			if ($selected) {
@@ -5719,11 +5719,11 @@  discard block
 block discarded – undo
5719 5719
 	{
5720 5720
 		global $langs;
5721 5721
 		if ($htmlname != "none") {
5722
-			print '<form method="post" action="' . $page . '">';
5722
+			print '<form method="post" action="'.$page.'">';
5723 5723
 			print '<input type="hidden" name="action" value="setdemandreason">';
5724
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5724
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5725 5725
 			$this->selectInputReason($selected, $htmlname, -1, $addempty);
5726
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5726
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5727 5727
 			print '</form>';
5728 5728
 		} else {
5729 5729
 			if ($selected) {
@@ -5763,17 +5763,17 @@  discard block
 block discarded – undo
5763 5763
 		$ret = '';
5764 5764
 
5765 5765
 		if ($htmlname != "none") {
5766
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
5767
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
5768
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
5766
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
5767
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
5768
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
5769 5769
 			if ($type) {
5770
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5770
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5771 5771
 			}
5772 5772
 			$ret .= '<table class="nobordernopadding">';
5773 5773
 			$ret .= '<tr><td>';
5774
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
5774
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
5775 5775
 			$ret .= '</td>';
5776
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
5776
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
5777 5777
 			$ret .= '</tr></table></form>';
5778 5778
 		} else {
5779 5779
 			if ($displayhour) {
@@ -5808,15 +5808,15 @@  discard block
 block discarded – undo
5808 5808
 		global $langs;
5809 5809
 
5810 5810
 		if ($htmlname != "none") {
5811
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
5812
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
5813
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5811
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
5812
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
5813
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5814 5814
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
5815
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5815
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5816 5816
 			print '</form>';
5817 5817
 		} else {
5818 5818
 			if ($selected) {
5819
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
5819
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
5820 5820
 				$theuser = new User($this->db);
5821 5821
 				$theuser->fetch($selected);
5822 5822
 				print $theuser->getNomUrl(1);
@@ -5849,14 +5849,14 @@  discard block
 block discarded – undo
5849 5849
 
5850 5850
 		$out = '';
5851 5851
 		if ($htmlname != "none") {
5852
-			$out .= '<form method="POST" action="' . $page . '">';
5852
+			$out .= '<form method="POST" action="'.$page.'">';
5853 5853
 			$out .= '<input type="hidden" name="action" value="setmode">';
5854
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5854
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5855 5855
 			if ($type) {
5856
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5856
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5857 5857
 			}
5858 5858
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
5859
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5859
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5860 5860
 			$out .= '</form>';
5861 5861
 		} else {
5862 5862
 			if ($selected) {
@@ -5889,11 +5889,11 @@  discard block
 block discarded – undo
5889 5889
 	{
5890 5890
 		global $langs;
5891 5891
 		if ($htmlname != "none") {
5892
-			print '<form method="POST" action="' . $page . '">';
5892
+			print '<form method="POST" action="'.$page.'">';
5893 5893
 			print '<input type="hidden" name="action" value="settransportmode">';
5894
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5894
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5895 5895
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
5896
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5896
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5897 5897
 			print '</form>';
5898 5898
 		} else {
5899 5899
 			if ($selected) {
@@ -5920,11 +5920,11 @@  discard block
 block discarded – undo
5920 5920
 		// phpcs:enable
5921 5921
 		global $langs;
5922 5922
 		if ($htmlname != "none") {
5923
-			print '<form method="POST" action="' . $page . '">';
5923
+			print '<form method="POST" action="'.$page.'">';
5924 5924
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
5925
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5925
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5926 5926
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
5927
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5927
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5928 5928
 			print '</form>';
5929 5929
 		} else {
5930 5930
 			dol_include_once('/core/lib/company.lib.php');
@@ -5949,21 +5949,21 @@  discard block
 block discarded – undo
5949 5949
 		global $langs, $mysoc, $conf;
5950 5950
 
5951 5951
 		if ($htmlname != "none") {
5952
-			print '<form method="POST" action="' . $page . '">';
5952
+			print '<form method="POST" action="'.$page.'">';
5953 5953
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
5954
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5955
-			print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
5954
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5955
+			print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
5956 5956
 			print '<select name="calculation_mode">';
5957
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
5958
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
5957
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
5958
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
5959 5959
 			print '</select> ';
5960
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5960
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5961 5961
 			print '</form>';
5962 5962
 		} else {
5963 5963
 			if (!empty($rate)) {
5964 5964
 				print price($rate, 1, $langs, 1, 0);
5965 5965
 				if ($currency && $rate != 1) {
5966
-					print ' &nbsp; (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
5966
+					print ' &nbsp; ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')';
5967 5967
 				}
5968 5968
 			} else {
5969 5969
 				print 1;
@@ -5994,9 +5994,9 @@  discard block
 block discarded – undo
5994 5994
 		// phpcs:enable
5995 5995
 		global $conf, $langs;
5996 5996
 		if ($htmlname != "none") {
5997
-			print '<form method="post" action="' . $page . '">';
5997
+			print '<form method="post" action="'.$page.'">';
5998 5998
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
5999
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5999
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6000 6000
 			print '<div class="inline-block">';
6001 6001
 			if (!empty($discount_type)) {
6002 6002
 				if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
@@ -6034,24 +6034,24 @@  discard block
 block discarded – undo
6034 6034
 			print '</div>';
6035 6035
 			if (empty($hidelist)) {
6036 6036
 				print '<div class="inline-block" style="padding-right: 10px">';
6037
-				$newfilter = 'discount_type=' . intval($discount_type);
6037
+				$newfilter = 'discount_type='.intval($discount_type);
6038 6038
 				if (!empty($discount_type)) {
6039 6039
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6040 6040
 				} else {
6041 6041
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6042 6042
 				}
6043 6043
 				if ($filter) {
6044
-					$newfilter .= ' AND (' . $filter . ')';
6044
+					$newfilter .= ' AND ('.$filter.')';
6045 6045
 				}
6046 6046
 				// output the combo of discounts
6047 6047
 				$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
6048 6048
 				if ($nbqualifiedlines > 0) {
6049
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6049
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6050 6050
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6051
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6051
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6052 6052
 					}
6053 6053
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6054
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6054
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6055 6055
 					}
6056 6056
 
6057 6057
 					print '>';
@@ -6091,23 +6091,23 @@  discard block
 block discarded – undo
6091 6091
 		global $langs, $conf;
6092 6092
 
6093 6093
 		if ($htmlname != "none") {
6094
-			print '<form method="post" action="' . $page . '">';
6094
+			print '<form method="post" action="'.$page.'">';
6095 6095
 			print '<input type="hidden" name="action" value="set_contact">';
6096
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6096
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6097 6097
 			print '<table class="nobordernopadding">';
6098 6098
 			print '<tr><td>';
6099 6099
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6100 6100
 			$num = $this->num;
6101 6101
 			if ($num == 0) {
6102 6102
 				$addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6103
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6103
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6104 6104
 			}
6105 6105
 			print '</td>';
6106
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6106
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6107 6107
 			print '</tr></table></form>';
6108 6108
 		} else {
6109 6109
 			if ($selected) {
6110
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6110
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6111 6111
 				$contact = new Contact($this->db);
6112 6112
 				$contact->fetch($selected);
6113 6113
 				print $contact->getFullName($langs);
@@ -6142,20 +6142,20 @@  discard block
 block discarded – undo
6142 6142
 
6143 6143
 		$out = '';
6144 6144
 		if ($htmlname != "none") {
6145
-			$out .= '<form method="post" action="' . $page . '">';
6145
+			$out .= '<form method="post" action="'.$page.'">';
6146 6146
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6147
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6147
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6148 6148
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6149
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6149
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6150 6150
 			$out .= '</form>';
6151 6151
 		} else {
6152 6152
 			if ($selected) {
6153
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6153
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6154 6154
 				$soc = new Societe($this->db);
6155 6155
 				$soc->fetch($selected);
6156 6156
 				$out .= $soc->getNomUrl(0, '');
6157 6157
 			} else {
6158
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6158
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6159 6159
 			}
6160 6160
 		}
6161 6161
 
@@ -6205,22 +6205,22 @@  discard block
 block discarded – undo
6205 6205
 			$selected = 'EUR'; // Pour compatibilite
6206 6206
 		}
6207 6207
 
6208
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6208
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6209 6209
 		if ($useempty) {
6210 6210
 			$out .= '<option value="-1" selected></option>';
6211 6211
 		}
6212 6212
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6213 6213
 			$labeltoshow = $currency['label'];
6214 6214
 			if ($mode == 1) {
6215
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6215
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6216 6216
 			} else {
6217
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6217
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6218 6218
 			}
6219 6219
 
6220 6220
 			if ($selected && $selected == $code_iso) {
6221
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6221
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6222 6222
 			} else {
6223
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6223
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6224 6224
 			}
6225 6225
 			$out .= $labeltoshow;
6226 6226
 			$out .= '</option>';
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
 		}
6232 6232
 
6233 6233
 		// Make select dynamic
6234
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6234
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6235 6235
 		$out .= ajax_combobox($htmlname);
6236 6236
 
6237 6237
 		return $out;
@@ -6257,10 +6257,10 @@  discard block
 block discarded – undo
6257 6257
 
6258 6258
 		$TCurrency = array();
6259 6259
 
6260
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6261
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6260
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6261
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6262 6262
 		if ($filter) {
6263
-			$sql .= " AND " . $filter;
6263
+			$sql .= " AND ".$filter;
6264 6264
 		}
6265 6265
 		$resql = $this->db->query($sql);
6266 6266
 		if ($resql) {
@@ -6270,7 +6270,7 @@  discard block
 block discarded – undo
6270 6270
 		}
6271 6271
 
6272 6272
 		$out = '';
6273
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6273
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6274 6274
 		if ($useempty) {
6275 6275
 			$out .= '<option value="">&nbsp;</option>';
6276 6276
 		}
@@ -6282,13 +6282,13 @@  discard block
 block discarded – undo
6282 6282
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6283 6283
 				if (isset($TCurrency[$code_iso])) {
6284 6284
 					if (!empty($selected) && $selected == $code_iso) {
6285
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6285
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6286 6286
 					} else {
6287
-						$out .= '<option value="' . $code_iso . '">';
6287
+						$out .= '<option value="'.$code_iso.'">';
6288 6288
 					}
6289 6289
 
6290 6290
 					$out .= $currency['label'];
6291
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6291
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6292 6292
 					$out .= '</option>';
6293 6293
 				}
6294 6294
 			}
@@ -6297,7 +6297,7 @@  discard block
 block discarded – undo
6297 6297
 		$out .= '</select>';
6298 6298
 
6299 6299
 		// Make select dynamic
6300
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6300
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6301 6301
 		$out .= ajax_combobox($htmlname);
6302 6302
 
6303 6303
 		return $out;
@@ -6324,11 +6324,11 @@  discard block
 block discarded – undo
6324 6324
 		dol_syslog(__METHOD__, LOG_DEBUG);
6325 6325
 
6326 6326
 		$sql = "SELECT DISTINCT t.rowid, t.code, t.taux, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.recuperableonly";
6327
-		$sql .= " FROM " . $this->db->prefix() . "c_tva as t, " . $this->db->prefix() . "c_country as c";
6327
+		$sql .= " FROM ".$this->db->prefix()."c_tva as t, ".$this->db->prefix()."c_country as c";
6328 6328
 		$sql .= " WHERE t.fk_pays = c.rowid";
6329 6329
 		$sql .= " AND t.active > 0";
6330 6330
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6331
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6331
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6332 6332
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6333 6333
 
6334 6334
 		$resql = $this->db->query($sql);
@@ -6346,22 +6346,22 @@  discard block
 block discarded – undo
6346 6346
 					$this->cache_vatrates[$i]['localtax2'] = $obj->localtax2;
6347 6347
 					$this->cache_vatrates[$i]['localtax2_type'] = $obj->localtax1_type;
6348 6348
 
6349
-					$this->cache_vatrates[$i]['label'] = $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6350
-					$this->cache_vatrates[$i]['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
6349
+					$this->cache_vatrates[$i]['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6350
+					$this->cache_vatrates[$i]['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
6351 6351
 					$positiverates = '';
6352 6352
 					if ($obj->taux) {
6353
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6353
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6354 6354
 					}
6355 6355
 					if ($obj->localtax1) {
6356
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6356
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6357 6357
 					}
6358 6358
 					if ($obj->localtax2) {
6359
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6359
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6360 6360
 					}
6361 6361
 					if (empty($positiverates)) {
6362 6362
 						$positiverates = '0';
6363 6363
 					}
6364
-					$this->cache_vatrates[$i]['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6364
+					$this->cache_vatrates[$i]['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6365 6365
 				}
6366 6366
 
6367 6367
 				return $num;
@@ -6379,7 +6379,7 @@  discard block
 block discarded – undo
6379 6379
 				return -1;
6380 6380
 			}
6381 6381
 		} else {
6382
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6382
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6383 6383
 			return -2;
6384 6384
 		}
6385 6385
 	}
@@ -6431,9 +6431,9 @@  discard block
 block discarded – undo
6431 6431
 		// Check parameters
6432 6432
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6433 6433
 			if ($societe_vendeuse->id == $mysoc->id) {
6434
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6434
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6435 6435
 			} else {
6436
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6436
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6437 6437
 			}
6438 6438
 			return $return;
6439 6439
 		}
@@ -6445,25 +6445,25 @@  discard block
 block discarded – undo
6445 6445
 		// Define list of countries to use to search VAT rates to show
6446 6446
 		// First we defined code_country to use to find list
6447 6447
 		if (is_object($societe_vendeuse)) {
6448
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6448
+			$code_country = "'".$societe_vendeuse->country_code."'";
6449 6449
 		} else {
6450
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6450
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6451 6451
 		}
6452 6452
 		if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {    // If option to have vat for end customer for services is on
6453
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6453
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6454 6454
 			if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
6455 6455
 				// We also add the buyer country code
6456 6456
 				if (is_numeric($type)) {
6457 6457
 					if ($type == 1) { // We know product is a service
6458
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6458
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6459 6459
 					}
6460 6460
 				} elseif (!$idprod) {  // We don't know type of product
6461
-					$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6461
+					$code_country .= ",'".$societe_acheteuse->country_code."'";
6462 6462
 				} else {
6463 6463
 					$prodstatic = new Product($this->db);
6464 6464
 					$prodstatic->fetch($idprod);
6465 6465
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6466
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6466
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6467 6467
 					}
6468 6468
 				}
6469 6469
 			}
@@ -6515,13 +6515,13 @@  discard block
 block discarded – undo
6515 6515
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
6516 6516
 				// of using supplier invoices (this is a very bad idea !)
6517 6517
 				if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) {
6518
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
6518
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
6519 6519
 					$disabled = true;
6520 6520
 				}
6521 6521
 			}
6522 6522
 
6523 6523
 			if (!$options_only) {
6524
-				$return .= '<select class="flat minwidth50imp maxwidth100" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
6524
+				$return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
6525 6525
 			}
6526 6526
 
6527 6527
 			$selectedfound = false;
@@ -6535,13 +6535,13 @@  discard block
 block discarded – undo
6535 6535
 				$key = $rate['txtva'];
6536 6536
 				$key .= $rate['nprtva'] ? '*' : '';
6537 6537
 				if ($mode > 0 && $rate['code']) {
6538
-					$key .= ' (' . $rate['code'] . ')';
6538
+					$key .= ' ('.$rate['code'].')';
6539 6539
 				}
6540 6540
 				if ($mode < 0) {
6541 6541
 					$key = $rate['rowid'];
6542 6542
 				}
6543 6543
 
6544
-				$return .= '<option value="' . $key . '"';
6544
+				$return .= '<option value="'.$key.'"';
6545 6545
 				if (!$selectedfound) {
6546 6546
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
6547 6547
 						if ($defaultcode == $rate['code']) {
@@ -6640,11 +6640,11 @@  discard block
 block discarded – undo
6640 6640
 	{
6641 6641
 		global $langs;
6642 6642
 
6643
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6643
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6644 6644
 		if ($forcenewline) {
6645 6645
 			$ret .= '<br>';
6646 6646
 		}
6647
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6647
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6648 6648
 		return $ret;
6649 6649
 	}
6650 6650
 
@@ -6710,7 +6710,7 @@  discard block
 block discarded – undo
6710 6710
 		$orig_set_time = $set_time;
6711 6711
 
6712 6712
 		if ($set_time === '' && $emptydate == 0) {
6713
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
6713
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
6714 6714
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
6715 6715
 				$set_time = dol_now($gm);
6716 6716
 			} else {
@@ -6778,38 +6778,38 @@  discard block
 block discarded – undo
6778 6778
 				// Calendrier popup version eldy
6779 6779
 				if ($usecalendar == "eldy") {
6780 6780
 					// Input area to enter date manually
6781
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';
6781
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
6782 6782
 					$retstring .= ($disabled ? ' disabled' : '');
6783
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6783
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6784 6784
 					$retstring .= '>';
6785 6785
 
6786 6786
 					// Icon calendar
6787 6787
 					$retstringbuttom = '';
6788 6788
 					if (!$disabled) {
6789
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
6790
-						$base = DOL_URL_ROOT . '/core/';
6791
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
6792
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
6789
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
6790
+						$base = DOL_URL_ROOT.'/core/';
6791
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
6792
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
6793 6793
 					} else {
6794
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
6794
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
6795 6795
 					}
6796
-					$retstring = $retstringbuttom . $retstring;
6796
+					$retstring = $retstringbuttom.$retstring;
6797 6797
 
6798
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
6799
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
6800
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
6798
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
6799
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
6800
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
6801 6801
 				} elseif ($usecalendar == 'jquery') {
6802 6802
 					if (!$disabled) {
6803 6803
 						// Output javascript for datepicker
6804 6804
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (date('Y') - 100));
6805 6805
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (date('Y') + 100));
6806 6806
 
6807
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
6808
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
6809
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
6807
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
6808
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
6809
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
6810 6810
 							autoclose: true,
6811 6811
 							todayHighlight: true,
6812
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
6812
+							yearRange: '" . $minYear.":".$maxYear."',";
6813 6813
 						if (!empty($conf->dol_use_jmobile)) {
6814 6814
 							$retstring .= "
6815 6815
 								beforeShow: function (input, datePicker) {
@@ -6824,7 +6824,7 @@  discard block
 block discarded – undo
6824 6824
 						if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS)) {
6825 6825
 							$retstring .= "
6826 6826
 								showOn: 'button',	/* both has problem with autocompletion */
6827
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
6827
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
6828 6828
 								buttonImageOnly: true";
6829 6829
 						}
6830 6830
 						$retstring .= "
@@ -6836,8 +6836,8 @@  discard block
 block discarded – undo
6836 6836
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
6837 6837
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
6838 6838
 					$retstring .= ($disabled ? ' disabled' : '');
6839
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
6840
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6839
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
6840
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
6841 6841
 					$retstring .= '>';
6842 6842
 
6843 6843
 					// Icone calendrier
@@ -6852,40 +6852,40 @@  discard block
 block discarded – undo
6852 6852
 						$retstring.='});';
6853 6853
 						$retstring.="</script>";*/
6854 6854
 					} else {
6855
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
6856
-						$retsring = $retstringbutton . $retstring;
6855
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
6856
+						$retsring = $retstringbutton.$retstring;
6857 6857
 					}
6858 6858
 
6859 6859
 					$retstring .= '</div>';
6860
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
6861
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
6862
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
6860
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
6861
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
6862
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
6863 6863
 				} else {
6864 6864
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
6865 6865
 				}
6866 6866
 			} else {
6867 6867
 				// Show date with combo selects
6868 6868
 				// Day
6869
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
6869
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
6870 6870
 
6871 6871
 				if ($emptydate || $set_time == -1) {
6872 6872
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
6873 6873
 				}
6874 6874
 
6875 6875
 				for ($day = 1; $day <= 31; $day++) {
6876
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
6876
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
6877 6877
 				}
6878 6878
 
6879 6879
 				$retstring .= "</select>";
6880 6880
 
6881
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
6881
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
6882 6882
 				if ($emptydate || $set_time == -1) {
6883 6883
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
6884 6884
 				}
6885 6885
 
6886 6886
 				// Month
6887 6887
 				for ($month = 1; $month <= 12; $month++) {
6888
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
6888
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
6889 6889
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
6890 6890
 					$retstring .= "</option>";
6891 6891
 				}
@@ -6893,12 +6893,12 @@  discard block
 block discarded – undo
6893 6893
 
6894 6894
 				// Year
6895 6895
 				if ($emptydate || $set_time == -1) {
6896
-					$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 . '">';
6896
+					$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.'">';
6897 6897
 				} else {
6898
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
6898
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
6899 6899
 
6900 6900
 					for ($year = $syear - 10; $year < $syear + 10; $year++) {
6901
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
6901
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
6902 6902
 					}
6903 6903
 					$retstring .= "</select>\n";
6904 6904
 				}
@@ -6922,15 +6922,15 @@  discard block
 block discarded – undo
6922 6922
 				}
6923 6923
 			}
6924 6924
 			// Show hour
6925
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
6925
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
6926 6926
 			if ($emptyhours) {
6927 6927
 				$retstring .= '<option value="-1">&nbsp;</option>';
6928 6928
 			}
6929 6929
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
6930 6930
 				if (strlen($hour) < 2) {
6931
-					$hour = "0" . $hour;
6931
+					$hour = "0".$hour;
6932 6932
 				}
6933
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
6933
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
6934 6934
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
6935 6935
 				$retstring .= '</option>';
6936 6936
 			}
@@ -6943,19 +6943,19 @@  discard block
 block discarded – undo
6943 6943
 
6944 6944
 		if ($m) {
6945 6945
 			// Show minutes
6946
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
6946
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
6947 6947
 			if ($emptyhours) {
6948 6948
 				$retstring .= '<option value="-1">&nbsp;</option>';
6949 6949
 			}
6950 6950
 			for ($min = 0; $min < 60; $min += $stepminutes) {
6951 6951
 				if (strlen($min) < 2) {
6952
-					$min = "0" . $min;
6952
+					$min = "0".$min;
6953 6953
 				}
6954
-				$retstring .= '<option value="' . $min . '"' . (($min == $smin) ? ' selected' : '') . '>' . $min . (empty($conf->dol_optimize_smallscreen) ? '' : '') . '</option>';
6954
+				$retstring .= '<option value="'.$min.'"'.(($min == $smin) ? ' selected' : '').'>'.$min.(empty($conf->dol_optimize_smallscreen) ? '' : '').'</option>';
6955 6955
 			}
6956 6956
 			$retstring .= '</select>';
6957 6957
 
6958
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
6958
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
6959 6959
 		}
6960 6960
 
6961 6961
 		if ($d && $h) {
@@ -6978,10 +6978,10 @@  discard block
 block discarded – undo
6978 6978
 
6979 6979
 			// Generate the date part, depending on the use or not of the javascript calendar
6980 6980
 			if ($addnowlink == 1) { // server time expressed in user time setup
6981
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
6982
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
6983
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
6984
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
6981
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
6982
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
6983
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
6984
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
6985 6985
 			} elseif ($addnowlink == 2) {
6986 6986
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
6987 6987
 				 * This break application for foreign languages.
@@ -6990,10 +6990,10 @@  discard block
 block discarded – undo
6990 6990
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
6991 6991
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
6992 6992
 				*/
6993
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
6994
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
6995
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
6996
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
6993
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
6994
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
6995
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
6996
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
6997 6997
 			}
6998 6998
 			/*if ($usecalendar == "eldy")
6999 6999
 			{
@@ -7013,11 +7013,11 @@  discard block
 block discarded – undo
7013 7013
 				}
7014 7014
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7015 7015
 				if ($addnowlink == 1) {
7016
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7017
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7016
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7017
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7018 7018
 				} elseif ($addnowlink == 2) {
7019
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7020
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7019
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7020
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7021 7021
 				}
7022 7022
 
7023 7023
 				if ($fullday) {
@@ -7031,11 +7031,11 @@  discard block
 block discarded – undo
7031 7031
 				}
7032 7032
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7033 7033
 				if ($addnowlink == 1) {
7034
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7035
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7034
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7035
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7036 7036
 				} elseif ($addnowlink == 2) {
7037
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7038
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7037
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7038
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7039 7039
 				}
7040 7040
 				if ($fullday) {
7041 7041
 					$reset_scripts .= ' } ';
@@ -7043,7 +7043,7 @@  discard block
 block discarded – undo
7043 7043
 			}
7044 7044
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7045 7045
 			if ($reset_scripts && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
7046
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7046
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7047 7047
 				$retstring .= $langs->trans("Now");
7048 7048
 				$retstring .= '</button> ';
7049 7049
 			}
@@ -7055,16 +7055,16 @@  discard block
 block discarded – undo
7055 7055
 			$reset_scripts = "";
7056 7056
 
7057 7057
 			// Generate the date part, depending on the use or not of the javascript calendar
7058
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7059
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7060
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7061
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7058
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7059
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7060
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7061
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7062 7062
 			// Update the hour part
7063 7063
 			if ($h) {
7064 7064
 				if ($fullday) {
7065 7065
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7066 7066
 				}
7067
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7067
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7068 7068
 				if ($fullday) {
7069 7069
 					$reset_scripts .= ' } ';
7070 7070
 				}
@@ -7074,14 +7074,14 @@  discard block
 block discarded – undo
7074 7074
 				if ($fullday) {
7075 7075
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7076 7076
 				}
7077
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7077
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7078 7078
 				if ($fullday) {
7079 7079
 					$reset_scripts .= ' } ';
7080 7080
 				}
7081 7081
 			}
7082 7082
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7083 7083
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7084
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7084
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7085 7085
 				$retstring .= $langs->trans("DateStartPlusOne");
7086 7086
 				$retstring .= '</button> ';
7087 7087
 			}
@@ -7139,17 +7139,17 @@  discard block
 block discarded – undo
7139 7139
 			unset($TDurationTypes[$value]);
7140 7140
 		}
7141 7141
 
7142
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7142
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7143 7143
 		foreach ($TDurationTypes as $key => $typeduration) {
7144
-			$retstring .= '<option value="' . $key . '"';
7144
+			$retstring .= '<option value="'.$key.'"';
7145 7145
 			if ($key == $selected) {
7146 7146
 				$retstring .= " selected";
7147 7147
 			}
7148
-			$retstring .= ">" . $typeduration . "</option>";
7148
+			$retstring .= ">".$typeduration."</option>";
7149 7149
 		}
7150 7150
 		$retstring .= "</select>";
7151 7151
 
7152
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7152
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7153 7153
 
7154 7154
 		return $retstring;
7155 7155
 	}
@@ -7181,30 +7181,30 @@  discard block
 block discarded – undo
7181 7181
 
7182 7182
 		// Hours
7183 7183
 		if ($iSecond != '') {
7184
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7184
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7185 7185
 
7186 7186
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7187 7187
 			$minSelected = convertSecondToTime($iSecond, 'min');
7188 7188
 		}
7189 7189
 
7190 7190
 		if ($typehour == 'select') {
7191
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7191
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7192 7192
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7193
-				$retstring .= '<option value="' . $hour . '"';
7193
+				$retstring .= '<option value="'.$hour.'"';
7194 7194
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7195 7195
 					$retstring .= " selected";
7196 7196
 				}
7197
-				$retstring .= ">" . $hour . "</option>";
7197
+				$retstring .= ">".$hour."</option>";
7198 7198
 			}
7199 7199
 			$retstring .= "</select>";
7200 7200
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7201
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7201
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7202 7202
 		} else {
7203 7203
 			return 'BadValueForParameterTypeHour';
7204 7204
 		}
7205 7205
 
7206 7206
 		if ($typehour != 'text') {
7207
-			$retstring .= ' ' . $langs->trans('HourShort');
7207
+			$retstring .= ' '.$langs->trans('HourShort');
7208 7208
 		} else {
7209 7209
 			$retstring .= '<span class="">:</span>';
7210 7210
 		}
@@ -7219,21 +7219,21 @@  discard block
 block discarded – undo
7219 7219
 		}
7220 7220
 
7221 7221
 		if ($typehour == 'select' || $typehour == 'textselect') {
7222
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7222
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7223 7223
 			for ($min = 0; $min <= 55; $min = $min + 5) {
7224
-				$retstring .= '<option value="' . $min . '"';
7224
+				$retstring .= '<option value="'.$min.'"';
7225 7225
 				if (is_numeric($minSelected) && $minSelected == $min) {
7226 7226
 					$retstring .= ' selected';
7227 7227
 				}
7228
-				$retstring .= '>' . $min . '</option>';
7228
+				$retstring .= '>'.$min.'</option>';
7229 7229
 			}
7230 7230
 			$retstring .= "</select>";
7231 7231
 		} elseif ($typehour == 'text') {
7232
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7232
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7233 7233
 		}
7234 7234
 
7235 7235
 		if ($typehour != 'text') {
7236
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7236
+			$retstring .= ' '.$langs->trans('MinuteShort');
7237 7237
 		}
7238 7238
 
7239 7239
 		$retstring .= "</span>";
@@ -7279,7 +7279,7 @@  discard block
 block discarded – undo
7279 7279
 			$placeholder = '';
7280 7280
 
7281 7281
 			if ($selected && empty($selected_input_value)) {
7282
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7282
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7283 7283
 				$tickettmpselect = new Ticket($this->db);
7284 7284
 				$tickettmpselect->fetch($selected);
7285 7285
 				$selected_input_value = $tickettmpselect->ref;
@@ -7287,16 +7287,16 @@  discard block
 block discarded – undo
7287 7287
 			}
7288 7288
 
7289 7289
 			$urloption = '';
7290
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7290
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7291 7291
 
7292
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7292
+			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7293 7293
 			elseif ($hidelabel > 1) {
7294
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7294
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7295 7295
 				if ($hidelabel == 2) {
7296 7296
 					$out .= img_picto($langs->trans("Search"), 'search');
7297 7297
 				}
7298 7298
 			}
7299
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
7299
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
7300 7300
 			if ($hidelabel == 3) {
7301 7301
 				$out .= img_picto($langs->trans("Search"), 'search');
7302 7302
 			}
@@ -7340,8 +7340,8 @@  discard block
 block discarded – undo
7340 7340
 
7341 7341
 		$sql = "SELECT ";
7342 7342
 		$sql .= $selectFields;
7343
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7344
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7343
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7344
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7345 7345
 
7346 7346
 		// Add criteria on ref/label
7347 7347
 		if ($filterkey != '') {
@@ -7353,7 +7353,7 @@  discard block
 block discarded – undo
7353 7353
 			if (count($scrit) > 1) $sql .= "(";
7354 7354
 			foreach ($scrit as $crit) {
7355 7355
 				if ($i > 0) $sql .= " AND ";
7356
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7356
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7357 7357
 				$sql .= ")";
7358 7358
 				$i++;
7359 7359
 			}
@@ -7364,22 +7364,22 @@  discard block
 block discarded – undo
7364 7364
 		$sql .= $this->db->plimit($limit, 0);
7365 7365
 
7366 7366
 		// Build output string
7367
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7367
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7368 7368
 		$result = $this->db->query($sql);
7369 7369
 		if ($result) {
7370
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7371
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7370
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7371
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7372 7372
 
7373 7373
 			$num = $this->db->num_rows($result);
7374 7374
 
7375 7375
 			$events = null;
7376 7376
 
7377 7377
 			if (!$forcecombo) {
7378
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7378
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7379 7379
 				$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);
7380 7380
 			}
7381 7381
 
7382
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7382
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7383 7383
 
7384 7384
 			$textifempty = '';
7385 7385
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7390,7 +7390,7 @@  discard block
 block discarded – undo
7390 7390
 			} else {
7391 7391
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7392 7392
 			}
7393
-			if ($showempty) $out .= '<option value="0" selected>' . $textifempty . '</option>';
7393
+			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7394 7394
 
7395 7395
 			$i = 0;
7396 7396
 			while ($num && $i < $num) {
@@ -7444,12 +7444,12 @@  discard block
 block discarded – undo
7444 7444
 		$outref = $objp->ref;
7445 7445
 		$outtype = $objp->fk_product_type;
7446 7446
 
7447
-		$opt = '<option value="' . $objp->rowid . '"';
7447
+		$opt = '<option value="'.$objp->rowid.'"';
7448 7448
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7449 7449
 		$opt .= '>';
7450 7450
 		$opt .= $objp->ref;
7451 7451
 		$objRef = $objp->ref;
7452
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7452
+		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7453 7453
 
7454 7454
 		$opt .= "</option>\n";
7455 7455
 		$optJson = array('key' => $outkey, 'value' => $outref, 'type' => $outtype);
@@ -7487,7 +7487,7 @@  discard block
 block discarded – undo
7487 7487
 			$placeholder = '';
7488 7488
 
7489 7489
 			if ($selected && empty($selected_input_value)) {
7490
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7490
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7491 7491
 				$projecttmpselect = new Project($this->db);
7492 7492
 				$projecttmpselect->fetch($selected);
7493 7493
 				$selected_input_value = $projecttmpselect->ref;
@@ -7495,16 +7495,16 @@  discard block
 block discarded – undo
7495 7495
 			}
7496 7496
 
7497 7497
 			$urloption = '';
7498
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7498
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7499 7499
 
7500
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7500
+			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7501 7501
 			elseif ($hidelabel > 1) {
7502
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7502
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7503 7503
 				if ($hidelabel == 2) {
7504 7504
 					$out .= img_picto($langs->trans("Search"), 'search');
7505 7505
 				}
7506 7506
 			}
7507
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
7507
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
7508 7508
 			if ($hidelabel == 3) {
7509 7509
 				$out .= img_picto($langs->trans("Search"), 'search');
7510 7510
 			}
@@ -7547,8 +7547,8 @@  discard block
 block discarded – undo
7547 7547
 
7548 7548
 		$sql = "SELECT ";
7549 7549
 		$sql .= $selectFields;
7550
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
7551
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
7550
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
7551
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
7552 7552
 
7553 7553
 		// Add criteria on ref/label
7554 7554
 		if ($filterkey != '') {
@@ -7560,7 +7560,7 @@  discard block
 block discarded – undo
7560 7560
 			if (count($scrit) > 1) $sql .= "(";
7561 7561
 			foreach ($scrit as $crit) {
7562 7562
 				if ($i > 0) $sql .= " AND ";
7563
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7563
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7564 7564
 				$sql .= "";
7565 7565
 				$i++;
7566 7566
 			}
@@ -7571,22 +7571,22 @@  discard block
 block discarded – undo
7571 7571
 		$sql .= $this->db->plimit($limit, 0);
7572 7572
 
7573 7573
 		// Build output string
7574
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
7574
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
7575 7575
 		$result = $this->db->query($sql);
7576 7576
 		if ($result) {
7577
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7578
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
7577
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7578
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
7579 7579
 
7580 7580
 			$num = $this->db->num_rows($result);
7581 7581
 
7582 7582
 			$events = null;
7583 7583
 
7584 7584
 			if (!$forcecombo) {
7585
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7585
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7586 7586
 				$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
7587 7587
 			}
7588 7588
 
7589
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7589
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7590 7590
 
7591 7591
 			$textifempty = '';
7592 7592
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7597,7 +7597,7 @@  discard block
 block discarded – undo
7597 7597
 			} else {
7598 7598
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7599 7599
 			}
7600
-			if ($showempty) $out .= '<option value="0" selected>' . $textifempty . '</option>';
7600
+			if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
7601 7601
 
7602 7602
 			$i = 0;
7603 7603
 			while ($num && $i < $num) {
@@ -7654,12 +7654,12 @@  discard block
 block discarded – undo
7654 7654
 		$outlabel = $objp->label;
7655 7655
 		$outtype = $objp->fk_product_type;
7656 7656
 
7657
-		$opt = '<option value="' . $objp->rowid . '"';
7657
+		$opt = '<option value="'.$objp->rowid.'"';
7658 7658
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7659 7659
 		$opt .= '>';
7660 7660
 		$opt .= $objp->ref;
7661 7661
 		$objRef = $objp->ref;
7662
-		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7662
+		if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7663 7663
 
7664 7664
 		$opt .= "</option>\n";
7665 7665
 		$optJson = array('key' => $outkey, 'value' => $outref, 'type' => $outtype);
@@ -7699,7 +7699,7 @@  discard block
 block discarded – undo
7699 7699
 			$urloption = '';
7700 7700
 
7701 7701
 			if ($selected && empty($selected_input_value)) {
7702
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
7702
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
7703 7703
 				$adherenttmpselect = new Adherent($this->db);
7704 7704
 				$adherenttmpselect->fetch($selected);
7705 7705
 				$selected_input_value = $adherenttmpselect->ref;
@@ -7708,16 +7708,16 @@  discard block
 block discarded – undo
7708 7708
 
7709 7709
 			$urloption = '';
7710 7710
 
7711
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7711
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7712 7712
 
7713
-			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel") . ' : ';
7713
+			if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
7714 7714
 			elseif ($hidelabel > 1) {
7715
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7715
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7716 7716
 				if ($hidelabel == 2) {
7717 7717
 					$out .= img_picto($langs->trans("Search"), 'search');
7718 7718
 				}
7719 7719
 			}
7720
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
7720
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
7721 7721
 			if ($hidelabel == 3) {
7722 7722
 				$out .= img_picto($langs->trans("Search"), 'search');
7723 7723
 			}
@@ -7762,8 +7762,8 @@  discard block
 block discarded – undo
7762 7762
 
7763 7763
 		$sql = "SELECT ";
7764 7764
 		$sql .= $selectFields;
7765
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
7766
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
7765
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
7766
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
7767 7767
 
7768 7768
 		// Add criteria on ref/label
7769 7769
 		if ($filterkey != '') {
@@ -7775,35 +7775,35 @@  discard block
 block discarded – undo
7775 7775
 			if (count($scrit) > 1) $sql .= "(";
7776 7776
 			foreach ($scrit as $crit) {
7777 7777
 				if ($i > 0) $sql .= " AND ";
7778
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7779
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
7778
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
7779
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
7780 7780
 				$i++;
7781 7781
 			}
7782 7782
 			if (count($scrit) > 1) $sql .= ")";
7783 7783
 			$sql .= ')';
7784 7784
 		}
7785 7785
 		if ($status != -1) {
7786
-			$sql .= ' AND statut = ' . ((int) $status);
7786
+			$sql .= ' AND statut = '.((int) $status);
7787 7787
 		}
7788 7788
 		$sql .= $this->db->plimit($limit, 0);
7789 7789
 
7790 7790
 		// Build output string
7791
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
7791
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
7792 7792
 		$result = $this->db->query($sql);
7793 7793
 		if ($result) {
7794
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
7795
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
7794
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
7795
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
7796 7796
 
7797 7797
 			$num = $this->db->num_rows($result);
7798 7798
 
7799 7799
 			$events = null;
7800 7800
 
7801 7801
 			if (!$forcecombo) {
7802
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7802
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7803 7803
 				$out .= ajax_combobox($htmlname, $events, !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT) ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
7804 7804
 			}
7805 7805
 
7806
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7806
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7807 7807
 
7808 7808
 			$textifempty = '';
7809 7809
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7815,7 +7815,7 @@  discard block
 block discarded – undo
7815 7815
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
7816 7816
 			}
7817 7817
 			if ($showempty) {
7818
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
7818
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
7819 7819
 			}
7820 7820
 
7821 7821
 			$i = 0;
@@ -7871,11 +7871,11 @@  discard block
 block discarded – undo
7871 7871
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
7872 7872
 		$outtype = $objp->fk_adherent_type;
7873 7873
 
7874
-		$opt = '<option value="' . $objp->rowid . '"';
7874
+		$opt = '<option value="'.$objp->rowid.'"';
7875 7875
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7876 7876
 		$opt .= '>';
7877 7877
 		if (!empty($filterkey) && $filterkey != '') {
7878
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
7878
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
7879 7879
 		}
7880 7880
 		$opt .= $outlabel;
7881 7881
 		$opt .= "</option>\n";
@@ -7916,9 +7916,9 @@  discard block
 block discarded – undo
7916 7916
 		$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
7917 7917
 		$reg = array();
7918 7918
 		if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
7919
-			$InfoFieldList[4] = $reg[1];    // take the sort field
7919
+			$InfoFieldList[4] = $reg[1]; // take the sort field
7920 7920
 		}
7921
-		$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
7921
+		$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
7922 7922
 
7923 7923
 		$classname = $InfoFieldList[0];
7924 7924
 		$classpath = $InfoFieldList[1];
@@ -7942,8 +7942,8 @@  discard block
 block discarded – undo
7942 7942
 			}
7943 7943
 		}
7944 7944
 		if (!is_object($objecttmp)) {
7945
-			dol_syslog('Error bad setup of type for field ' . join(',', $InfoFieldList), LOG_WARNING);
7946
-			return 'Error bad setup of type for field ' . join(',', $InfoFieldList);
7945
+			dol_syslog('Error bad setup of type for field '.join(',', $InfoFieldList), LOG_WARNING);
7946
+			return 'Error bad setup of type for field '.join(',', $InfoFieldList);
7947 7947
 		}
7948 7948
 
7949 7949
 		//var_dump($filter);
@@ -7954,9 +7954,9 @@  discard block
 block discarded – undo
7954 7954
 		if ($prefixforautocompletemode == 'product') {
7955 7955
 			$prefixforautocompletemode = 'produit';
7956 7956
 		}
7957
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
7957
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
7958 7958
 
7959
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
7959
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
7960 7960
 		$out = '';
7961 7961
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString($confkeyforautocompletemode) && !$forcecombo) {
7962 7962
 			// No immediate load of all database
@@ -7967,15 +7967,15 @@  discard block
 block discarded – undo
7967 7967
 				//unset($objecttmp);
7968 7968
 			}
7969 7969
 
7970
-			$objectdesc = $classname . ':' . $classpath . ':' . $addcreatebuttonornot . ':' . $filter;
7971
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
7970
+			$objectdesc = $classname.':'.$classpath.':'.$addcreatebuttonornot.':'.$filter;
7971
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
7972 7972
 
7973 7973
 			// No immediate load of all database
7974
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdesc) . '&filter=' . urlencode($filter) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
7974
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdesc).'&filter='.urlencode($filter).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
7975 7975
 			// Activate the auto complete using ajax call.
7976 7976
 			$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
7977 7977
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
7978
-			$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) . '"' : '') . ' />';
7978
+			$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).'"' : '').' />';
7979 7979
 		} else {
7980 7980
 			// Immediate load of table record.
7981 7981
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8015,7 +8015,7 @@  discard block
 block discarded – undo
8015 8015
 		if ($prefixforautocompletemode == 'societe') {
8016 8016
 			$prefixforautocompletemode = 'company';
8017 8017
 		}
8018
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8018
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8019 8019
 
8020 8020
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8021 8021
 			$tmpfieldstoshow = '';
@@ -8024,7 +8024,7 @@  discard block
 block discarded – undo
8024 8024
 					continue;
8025 8025
 				}
8026 8026
 				if (!empty($val['showoncombobox'])) {
8027
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8027
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8028 8028
 				}
8029 8029
 			}
8030 8030
 			if ($tmpfieldstoshow) {
@@ -8052,15 +8052,15 @@  discard block
 block discarded – undo
8052 8052
 		$num = 0;
8053 8053
 
8054 8054
 		// Search data
8055
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";
8055
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";
8056 8056
 		if (isset($objecttmp->ismultientitymanaged)) {
8057 8057
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8058 8058
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8059
-				$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];
8059
+				$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
8060 8060
 			}
8061 8061
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8062 8062
 				if (empty($user->rights->societe->client->voir) && !$user->socid) {
8063
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8063
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8064 8064
 				}
8065 8065
 			}
8066 8066
 		}
@@ -8080,21 +8080,21 @@  discard block
 block discarded – undo
8080 8080
 			$sql .= " WHERE 1=1";
8081 8081
 			if (isset($objecttmp->ismultientitymanaged)) {
8082 8082
 				if ($objecttmp->ismultientitymanaged == 1) {
8083
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8083
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8084 8084
 				}
8085 8085
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8086
-					$sql .= " AND parenttable.entity = t." . $tmparray[0];
8086
+					$sql .= " AND parenttable.entity = t.".$tmparray[0];
8087 8087
 				}
8088 8088
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8089 8089
 					if ($objecttmp->element == 'societe') {
8090
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8090
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8091 8091
 					} else {
8092
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8092
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8093 8093
 					}
8094 8094
 				}
8095 8095
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8096 8096
 					if (empty($user->rights->societe->client->voir) && !$user->socid) {
8097
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8097
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8098 8098
 					}
8099 8099
 				}
8100 8100
 			}
@@ -8106,7 +8106,7 @@  discard block
 block discarded – undo
8106 8106
 				$errormessage = '';
8107 8107
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8108 8108
 				if ($errormessage) {
8109
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8109
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8110 8110
 				}
8111 8111
 			}
8112 8112
 		}
@@ -8118,7 +8118,7 @@  discard block
 block discarded – undo
8118 8118
 		$resql = $this->db->query($sql);
8119 8119
 		if ($resql) {
8120 8120
 			// Construct $out and $outarray
8121
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8121
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8122 8122
 
8123 8123
 			// 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
8124 8124
 			$textifempty = '&nbsp;';
@@ -8132,7 +8132,7 @@  discard block
 block discarded – undo
8132 8132
 				}
8133 8133
 			}
8134 8134
 			if ($showempty) {
8135
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8135
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8136 8136
 			}
8137 8137
 
8138 8138
 			$num = $this->db->num_rows($resql);
@@ -8155,9 +8155,9 @@  discard block
 block discarded – undo
8155 8155
 					}
8156 8156
 					if (empty($outputmode)) {
8157 8157
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8158
-							$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>';
8158
+							$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>';
8159 8159
 						} else {
8160
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8160
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8161 8161
 						}
8162 8162
 					} else {
8163 8163
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8170,10 +8170,10 @@  discard block
 block discarded – undo
8170 8170
 				}
8171 8171
 			}
8172 8172
 
8173
-			$out .= '</select>' . "\n";
8173
+			$out .= '</select>'."\n";
8174 8174
 
8175 8175
 			if (!$forcecombo) {
8176
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8176
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8177 8177
 				$out .= ajax_combobox($htmlname, null, (!empty($conf->global->$confkeyforautocompletemode) ? $conf->global->$confkeyforautocompletemode : 0));
8178 8178
 			}
8179 8179
 		} else {
@@ -8236,8 +8236,8 @@  discard block
 block discarded – undo
8236 8236
 		}
8237 8237
 
8238 8238
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8239
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . '"';
8240
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8239
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').'"';
8240
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8241 8241
 		$out .= '>'."\n";
8242 8242
 
8243 8243
 		if ($show_empty) {
@@ -8248,7 +8248,7 @@  discard block
 block discarded – undo
8248 8248
 			if (!is_numeric($show_empty)) {
8249 8249
 				$textforempty = $show_empty;
8250 8250
 			}
8251
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8251
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8252 8252
 		}
8253 8253
 
8254 8254
 		if (is_array($array)) {
@@ -8274,7 +8274,7 @@  discard block
 block discarded – undo
8274 8274
 				if (is_array($tmpvalue)) {
8275 8275
 					$value = $tmpvalue['label'];
8276 8276
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8277
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8277
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8278 8278
 				} else {
8279 8279
 					$value = $tmpvalue;
8280 8280
 					$disabled = '';
@@ -8290,9 +8290,9 @@  discard block
 block discarded – undo
8290 8290
 
8291 8291
 				if ($key_in_label) {
8292 8292
 					if (empty($nohtmlescape)) {
8293
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8293
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8294 8294
 					} else {
8295
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8295
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8296 8296
 					}
8297 8297
 				} else {
8298 8298
 					if (empty($nohtmlescape)) {
@@ -8305,8 +8305,8 @@  discard block
 block discarded – undo
8305 8305
 					}
8306 8306
 				}
8307 8307
 
8308
-				$out .= '<option value="' . $key . '"';
8309
-				$out .= $style . $disabled;
8308
+				$out .= '<option value="'.$key.'"';
8309
+				$out .= $style.$disabled;
8310 8310
 				if (is_array($id)) {
8311 8311
 					if (in_array($key, $id) && !$disabled) {
8312 8312
 						$out .= ' selected'; // To preselect a value
@@ -8318,7 +8318,7 @@  discard block
 block discarded – undo
8318 8318
 					}
8319 8319
 				}
8320 8320
 				if ($nohtmlescape) {
8321
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8321
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8322 8322
 				}
8323 8323
 				if (is_array($tmpvalue)) {
8324 8324
 					foreach ($tmpvalue as $keyforvalue => $valueforvalue) {
@@ -8339,7 +8339,7 @@  discard block
 block discarded – undo
8339 8339
 		// Add code for jquery to use multiselect
8340 8340
 		if ($addjscombo && $jsbeautify) {
8341 8341
 			// Enhance with select2
8342
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8342
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8343 8343
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', ($show_empty < 0 ? (string) $show_empty : '-1'), $morecss);
8344 8344
 		}
8345 8345
 
@@ -8368,28 +8368,28 @@  discard block
 block discarded – undo
8368 8368
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8369 8369
 	{
8370 8370
 		global $conf, $langs;
8371
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8371
+		global $delayedhtmlcontent; // Will be used later outside of this function
8372 8372
 
8373 8373
 		// TODO Use an internal dolibarr component instead of select2
8374 8374
 		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8375 8375
 			return '';
8376 8376
 		}
8377 8377
 
8378
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
8378
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
8379 8379
 
8380 8380
 		$outdelayed = '';
8381 8381
 		if (!empty($conf->use_javascript_ajax)) {
8382 8382
 			$tmpplugin = 'select2';
8383
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8384
-		    	<script nonce="' . getNonce() . '">
8383
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8384
+		    	<script nonce="' . getNonce().'">
8385 8385
 		    	$(document).ready(function () {
8386 8386
 
8387
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
8387
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
8388 8388
 
8389
-	                $(".' . $htmlname . '").select2({
8389
+	                $(".' . $htmlname.'").select2({
8390 8390
 				    	ajax: {
8391 8391
 					    	dir: "ltr",
8392
-					    	url: "' . $url . '",
8392
+					    	url: "' . $url.'",
8393 8393
 					    	dataType: \'json\',
8394 8394
 					    	delay: 250,
8395 8395
 					    	data: function (params) {
@@ -8416,9 +8416,9 @@  discard block
 block discarded – undo
8416 8416
 				    	},
8417 8417
 		 				language: select2arrayoflanguage,
8418 8418
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8419
-					    placeholder: "' . dol_escape_js($placeholder) . '",
8419
+					    placeholder: "' . dol_escape_js($placeholder).'",
8420 8420
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8421
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
8421
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
8422 8422
 				        formatResult: function (result, container, query, escapeMarkup) {
8423 8423
 	                        return escapeMarkup(result.text);
8424 8424
 	                    },
@@ -8426,10 +8426,10 @@  discard block
 block discarded – undo
8426 8426
 
8427 8427
 	                ' . ($callurlonselect ? '
8428 8428
 	                /* Code to execute a GET when we select a value */
8429
-	                $(".' . $htmlname . '").change(function() {
8430
-				    	var selected = $(".' . $htmlname . '").val();
8429
+	                $(".' . $htmlname.'").change(function() {
8430
+				    	var selected = $(".' . $htmlname.'").val();
8431 8431
 	                	console.log("We select in selectArrayAjax the entry "+selected)
8432
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
8432
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
8433 8433
 	    			    $.each( saveRemoteData, function( key, value ) {
8434 8434
 	    				        if (key == selected)
8435 8435
 	    			            {
@@ -8437,7 +8437,7 @@  discard block
 block discarded – undo
8437 8437
 	    			                 location.assign(value.url);
8438 8438
 	    			            }
8439 8439
 	                    });
8440
-	    			});' : '') . '
8440
+	    			});' : '').'
8441 8441
 
8442 8442
 	    	   });
8443 8443
 		       </script>';
@@ -8473,14 +8473,14 @@  discard block
 block discarded – undo
8473 8473
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
8474 8474
 	{
8475 8475
 		global $conf, $langs;
8476
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8476
+		global $delayedhtmlcontent; // Will be used later outside of this function
8477 8477
 
8478 8478
 		// TODO Use an internal dolibarr component instead of select2
8479 8479
 		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8480 8480
 			return '';
8481 8481
 		}
8482 8482
 
8483
-		$out = '<select type="text"'.($textfortitle? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8483
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8484 8484
 
8485 8485
 		$formattedarrayresult = array();
8486 8486
 
@@ -8495,20 +8495,20 @@  discard block
 block discarded – undo
8495 8495
 		$outdelayed = '';
8496 8496
 		if (!empty($conf->use_javascript_ajax)) {
8497 8497
 			$tmpplugin = 'select2';
8498
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8499
-				<script nonce="' . getNonce() . '">
8498
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8499
+				<script nonce="' . getNonce().'">
8500 8500
 				$(document).ready(function () {
8501
-					var data = ' . json_encode($formattedarrayresult) . ';
8501
+					var data = ' . json_encode($formattedarrayresult).';
8502 8502
 
8503
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
8503
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
8504 8504
 
8505
-					$(".' . $htmlname . '").select2({
8505
+					$(".' . $htmlname.'").select2({
8506 8506
 						data: data,
8507 8507
 						language: select2arrayoflanguage,
8508 8508
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8509
-						placeholder: "' . dol_escape_js($placeholder) . '",
8509
+						placeholder: "' . dol_escape_js($placeholder).'",
8510 8510
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8511
-						minimumInputLength: ' . $minimumInputLength . ',
8511
+						minimumInputLength: ' . $minimumInputLength.',
8512 8512
 						formatResult: function (result, container, query, escapeMarkup) {
8513 8513
 							return escapeMarkup(result.text);
8514 8514
 						},
@@ -8547,11 +8547,11 @@  discard block
 block discarded – undo
8547 8547
 
8548 8548
 					' . ($callurlonselect ? '
8549 8549
 					/* Code to execute a GET when we select a value */
8550
-					$(".' . $htmlname . '").change(function() {
8551
-						var selected = $(".' . $htmlname . '").val();
8550
+					$(".' . $htmlname.'").change(function() {
8551
+						var selected = $(".' . $htmlname.'").val();
8552 8552
 						console.log("We select "+selected)
8553 8553
 
8554
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
8554
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
8555 8555
 						$.each( saveRemoteData, function( key, value ) {
8556 8556
 							if (key == selected)
8557 8557
 							{
@@ -8559,7 +8559,7 @@  discard block
 block discarded – undo
8559 8559
 								location.assign(value.url);
8560 8560
 							}
8561 8561
 						});
8562
-					});' : '') . '
8562
+					});' : '').'
8563 8563
 
8564 8564
 				});
8565 8565
 				</script>';
@@ -8611,7 +8611,7 @@  discard block
 block discarded – undo
8611 8611
 		}
8612 8612
 
8613 8613
 		// Output select component
8614
-		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
8614
+		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\n";
8615 8615
 		if (is_array($array) && !empty($array)) {
8616 8616
 			if ($value_as_key) {
8617 8617
 				$array = array_combine($array, $array);
@@ -8632,57 +8632,57 @@  discard block
 block discarded – undo
8632 8632
 						$tmplabelhtml = !empty($value['labelhtml']) ? $value['labelhtml'] : '';
8633 8633
 					}
8634 8634
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
8635
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
8635
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
8636 8636
 
8637
-					$out .= '<option value="' . $tmpkey . '"';
8637
+					$out .= '<option value="'.$tmpkey.'"';
8638 8638
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
8639 8639
 						$out .= ' selected';
8640 8640
 					}
8641 8641
 					if (!empty($tmplabelhtml)) {
8642
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
8642
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
8643 8643
 					} else {
8644
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
8645
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
8644
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
8645
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
8646 8646
 					}
8647 8647
 					$out .= '>';
8648 8648
 					$out .= dol_htmlentitiesbr($newval);
8649
-					$out .= '</option>' . "\n";
8649
+					$out .= '</option>'."\n";
8650 8650
 				}
8651 8651
 			}
8652 8652
 		}
8653
-		$out .= '</select>' . "\n";
8653
+		$out .= '</select>'."\n";
8654 8654
 
8655 8655
 		// Add code for jquery to use multiselect
8656 8656
 		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
8657
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
8658
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
8657
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
8658
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
8659 8659
 			if ($addjscombo == 1) {
8660 8660
 				$tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
8661
-				$out .= 'function formatResult(record, container) {' . "\n";
8661
+				$out .= 'function formatResult(record, container) {'."\n";
8662 8662
 				// If property html set, we decode html entities and use this.
8663 8663
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
8664 8664
 				$out .= '	if ($(record.element).attr("data-html") != undefined) { return htmlEntityDecodeJs($(record.element).attr("data-html")); }'."\n";
8665 8665
 				$out .= '	return record.text;';
8666
-				$out .= '}' . "\n";
8667
-				$out .= 'function formatSelection(record) {' . "\n";
8666
+				$out .= '}'."\n";
8667
+				$out .= 'function formatSelection(record) {'."\n";
8668 8668
 				if ($elemtype == 'category') {
8669
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
8669
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
8670 8670
 				} else {
8671 8671
 					$out .= 'return record.text;';
8672 8672
 				}
8673
-				$out .= '}' . "\n";
8673
+				$out .= '}'."\n";
8674 8674
 				$out .= '$(document).ready(function () {
8675
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
8675
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
8676 8676
 				if ($placeholder) {
8677 8677
 					$out .= '
8678 8678
 								placeholder: {
8679 8679
 								    id: \'-1\',
8680
-								    text: \'' . dol_escape_js($placeholder) . '\'
8680
+								    text: \'' . dol_escape_js($placeholder).'\'
8681 8681
 								  },';
8682 8682
 				}
8683 8683
 				$out .= '		dir: \'ltr\',
8684 8684
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
8685
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */
8685
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect) */
8686 8686
 								// Specify format function for dropdown item
8687 8687
 								formatResult: formatResult,
8688 8688
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -8694,21 +8694,21 @@  discard block
 block discarded – undo
8694 8694
 
8695 8695
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
8696 8696
 								 the size only if component is not hidden by default on load */
8697
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
8697
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
8698 8698
 						});' . "\n";
8699 8699
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
8700 8700
 				// Add other js lib
8701 8701
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
8702 8702
 				// ...
8703
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
8703
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
8704 8704
 				$out .= '$(document).ready(function () {
8705
-							$(\'#' . $htmlname . '\').multiSelect({
8705
+							$(\'#' . $htmlname.'\').multiSelect({
8706 8706
 								containerHTML: \'<div class="multi-select-container">\',
8707 8707
 								menuHTML: \'<div class="multi-select-menu">\',
8708
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
8708
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
8709 8709
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
8710 8710
 								activeClass: \'multi-select-container--open\',
8711
-								noneText: \'' . $placeholder . '\'
8711
+								noneText: \'' . $placeholder.'\'
8712 8712
 							});
8713 8713
 						})';
8714 8714
 			}
@@ -8740,7 +8740,7 @@  discard block
 block discarded – undo
8740 8740
 			return '';
8741 8741
 		}
8742 8742
 
8743
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
8743
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
8744 8744
 
8745 8745
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
8746 8746
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -8783,19 +8783,19 @@  discard block
 block discarded – undo
8783 8783
 				}
8784 8784
 
8785 8785
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list
8786
-				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
8787
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
8786
+				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
8787
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
8788 8788
 			}
8789 8789
 		}
8790 8790
 
8791
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
8791
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
8792 8792
 
8793 8793
         <dl class="dropdown">
8794 8794
             <dt>
8795
-            <a href="#' . $htmlname . '">
8796
-              ' . img_picto('', 'list') . '
8795
+            <a href="#' . $htmlname.'">
8796
+              ' . img_picto('', 'list').'
8797 8797
             </a>
8798
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
8798
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
8799 8799
             </dt>
8800 8800
             <dd class="dropdowndd">
8801 8801
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -8807,19 +8807,19 @@  discard block
 block discarded – undo
8807 8807
             </dd>
8808 8808
         </dl>
8809 8809
 
8810
-        <script nonce="' . getNonce() . '" type="text/javascript">
8810
+        <script nonce="' . getNonce().'" type="text/javascript">
8811 8811
           jQuery(document).ready(function () {
8812
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
8812
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
8813 8813
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
8814 8814
 
8815 8815
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
8816 8816
 
8817 8817
                   var title = $(this).val() + ",";
8818 8818
                   if ($(this).is(\':checked\')) {
8819
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
8819
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
8820 8820
                   }
8821 8821
                   else {
8822
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
8822
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
8823 8823
                   }
8824 8824
                   // Now, we submit page
8825 8825
                   //$(this).parents(\'form:first\').submit();
@@ -8850,7 +8850,7 @@  discard block
 block discarded – undo
8850 8850
 	 */
8851 8851
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
8852 8852
 	{
8853
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8853
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8854 8854
 
8855 8855
 		$cat = new Categorie($this->db);
8856 8856
 		$categories = $cat->containing($id, $type);
@@ -8860,10 +8860,10 @@  discard block
 block discarded – undo
8860 8860
 			foreach ($categories as $c) {
8861 8861
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
8862 8862
 				foreach ($ways as $way) {
8863
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
8863
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
8864 8864
 				}
8865 8865
 			}
8866
-			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8866
+			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8867 8867
 		}
8868 8868
 
8869 8869
 		if ($rendermode == 0) {
@@ -8911,15 +8911,15 @@  discard block
 block discarded – undo
8911 8911
 
8912 8912
 
8913 8913
 			print '<div class="div-table-responsive-no-min">';
8914
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
8914
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
8915 8915
 
8916 8916
 			print '<tr class="liste_titre">';
8917
-			print '<td>' . $langs->trans("Type") . '</td>';
8918
-			print '<td>' . $langs->trans("Ref") . '</td>';
8917
+			print '<td>'.$langs->trans("Type").'</td>';
8918
+			print '<td>'.$langs->trans("Ref").'</td>';
8919 8919
 			print '<td class="center"></td>';
8920
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
8921
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
8922
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
8920
+			print '<td class="center">'.$langs->trans("Date").'</td>';
8921
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
8922
+			print '<td class="right">'.$langs->trans("Status").'</td>';
8923 8923
 			print '<td></td>';
8924 8924
 			print '</tr>';
8925 8925
 
@@ -8938,13 +8938,13 @@  discard block
 block discarded – undo
8938 8938
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
8939 8939
 					$element = $regs[1];
8940 8940
 					$subelement = $regs[2];
8941
-					$tplpath = $element . '/' . $subelement;
8941
+					$tplpath = $element.'/'.$subelement;
8942 8942
 				}
8943 8943
 				$tplname = 'linkedobjectblock';
8944 8944
 
8945 8945
 				// To work with non standard path
8946 8946
 				if ($objecttype == 'facture') {
8947
-					$tplpath = 'compta/' . $element;
8947
+					$tplpath = 'compta/'.$element;
8948 8948
 					if (!isModEnabled('facture')) {
8949 8949
 						continue; // Do not show if module disabled
8950 8950
 					}
@@ -8955,7 +8955,7 @@  discard block
 block discarded – undo
8955 8955
 						continue; // Do not show if module disabled
8956 8956
 					}
8957 8957
 				} elseif ($objecttype == 'propal') {
8958
-					$tplpath = 'comm/' . $element;
8958
+					$tplpath = 'comm/'.$element;
8959 8959
 					if (!isModEnabled('propal')) {
8960 8960
 						continue; // Do not show if module disabled
8961 8961
 					}
@@ -9006,14 +9006,14 @@  discard block
 block discarded – undo
9006 9006
 				$linkedObjectBlock = $objects;
9007 9007
 
9008 9008
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9009
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9009
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9010 9010
 				foreach ($dirtpls as $reldir) {
9011 9011
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
9012 9012
 						global $noMoreLinkedObjectBlockAfter;
9013 9013
 						$noMoreLinkedObjectBlockAfter = 1;
9014 9014
 					}
9015 9015
 
9016
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9016
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9017 9017
 					if ($res) {
9018 9018
 						$nboftypesoutput++;
9019 9019
 						break;
@@ -9022,7 +9022,7 @@  discard block
 block discarded – undo
9022 9022
 			}
9023 9023
 
9024 9024
 			if (!$nboftypesoutput) {
9025
-				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9025
+				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9026 9026
 			}
9027 9027
 
9028 9028
 			print '</table>';
@@ -9062,14 +9062,14 @@  discard block
 block discarded – undo
9062 9062
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9063 9063
 			$listofidcompanytoscan = $object->thirdparty->id;
9064 9064
 			if (($object->thirdparty->parent > 0) && !empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) {
9065
-				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
9065
+				$listofidcompanytoscan .= ','.$object->thirdparty->parent;
9066 9066
 			}
9067 9067
 			if (($object->fk_project > 0) && !empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) {
9068
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9068
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9069 9069
 				$tmpproject = new Project($this->db);
9070 9070
 				$tmpproject->fetch($object->fk_project);
9071 9071
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9072
-					$listofidcompanytoscan .= ',' . $tmpproject->socid;
9072
+					$listofidcompanytoscan .= ','.$tmpproject->socid;
9073 9073
 				}
9074 9074
 				unset($tmpproject);
9075 9075
 			}
@@ -9079,63 +9079,63 @@  discard block
 block discarded – undo
9079 9079
 					'enabled' => isModEnabled('propal'),
9080 9080
 					'perms' => 1,
9081 9081
 					'label' => 'LinkToProposal',
9082
-					'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') . ')'),
9082
+					'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').')'),
9083 9083
 				'shipping' => array(
9084 9084
 					'enabled' => isModEnabled('expedition'),
9085 9085
 					'perms' => 1,
9086 9086
 					'label' => 'LinkToExpedition',
9087
-					'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') . ')'),
9087
+					'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').')'),
9088 9088
 				'order' => array(
9089 9089
 					'enabled' => isModEnabled('commande'),
9090 9090
 					'perms' => 1,
9091 9091
 					'label' => 'LinkToOrder',
9092
-					'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') . ')'),
9092
+					'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').')'),
9093 9093
 				'invoice' => array(
9094 9094
 					'enabled' => isModEnabled('facture'),
9095 9095
 					'perms' => 1,
9096 9096
 					'label' => 'LinkToInvoice',
9097
-					'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') . ')'),
9097
+					'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').')'),
9098 9098
 				'invoice_template' => array(
9099 9099
 					'enabled' => isModEnabled('facture'),
9100 9100
 					'perms' => 1,
9101 9101
 					'label' => 'LinkToTemplateInvoice',
9102
-					'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') . ')'),
9102
+					'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').')'),
9103 9103
 				'contrat' => array(
9104 9104
 					'enabled' => isModEnabled('contrat'),
9105 9105
 					'perms' => 1,
9106 9106
 					'label' => 'LinkToContract',
9107 9107
 					'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
9108
-							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'
9108
+							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'
9109 9109
 				),
9110 9110
 				'fichinter' => array(
9111 9111
 					'enabled' => isModEnabled('ficheinter'),
9112 9112
 					'perms' => 1,
9113 9113
 					'label' => 'LinkToIntervention',
9114
-					'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') . ')'),
9114
+					'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').')'),
9115 9115
 				'supplier_proposal' => array(
9116 9116
 					'enabled' => (isModEnabled('supplier_proposal') ? $conf->supplier_proposal->enabled : 0),
9117 9117
 					'perms' => 1,
9118 9118
 					'label' => 'LinkToSupplierProposal',
9119
-					'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') . ')'),
9119
+					'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').')'),
9120 9120
 				'order_supplier' => array(
9121 9121
 					'enabled' => (isModEnabled("supplier_order") ? $conf->supplier_order->enabled : 0),
9122 9122
 					'perms' => 1,
9123 9123
 					'label' => 'LinkToSupplierOrder',
9124
-					'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') . ')'),
9124
+					'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').')'),
9125 9125
 				'invoice_supplier' => array(
9126 9126
 					'enabled' => (isModEnabled("supplier_invoice") ? $conf->supplier_invoice->enabled : 0),
9127 9127
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9128
-					'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') . ')'),
9128
+					'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').')'),
9129 9129
 				'ticket' => array(
9130 9130
 					'enabled' => isModEnabled('ticket'),
9131 9131
 					'perms' => 1,
9132 9132
 					'label' => 'LinkToTicket',
9133
-					'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') . ')'),
9133
+					'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').')'),
9134 9134
 				'mo' => array(
9135 9135
 					'enabled' => isModEnabled('mrp'),
9136 9136
 					'perms' => 1,
9137 9137
 					'label' => 'LinkToMo',
9138
-					'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') . ')')
9138
+					'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').')')
9139 9139
 			);
9140 9140
 		}
9141 9141
 
@@ -9170,22 +9170,22 @@  discard block
 block discarded – undo
9170 9170
 			}
9171 9171
 
9172 9172
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9173
-				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9173
+				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9174 9174
 
9175 9175
 				if (!empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
9176 9176
 					print '<br>'."\n";
9177 9177
 					print '<!-- form to add a link from anywhere -->'."\n";
9178
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9179
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9178
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9179
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9180 9180
 					print '<input type="hidden" name="action" value="addlinkbyref">';
9181
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9182
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9181
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9182
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9183 9183
 					print '<table class="noborder">';
9184 9184
 					print '<tr>';
9185 9185
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9186
-					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9187
-					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9188
-					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9186
+					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9187
+					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9188
+					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9189 9189
 					print '</tr>';
9190 9190
 					print '</table>';
9191 9191
 					print '</form>';
@@ -9200,48 +9200,48 @@  discard block
 block discarded – undo
9200 9200
 
9201 9201
 					print '<br>';
9202 9202
 					print '<!-- form to add a link from object to same thirdparty -->'."\n";
9203
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9203
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9204 9204
 					print '<input type="hidden" name="action" value="addlink">';
9205
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9206
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9207
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9205
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9206
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9207
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9208 9208
 					print '<table class="noborder">';
9209 9209
 					print '<tr class="liste_titre">';
9210 9210
 					print '<td class="nowrap"></td>';
9211
-					print '<td class="center">' . $langs->trans("Ref") . '</td>';
9212
-					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>';
9213
-					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9214
-					print '<td class="left">' . $langs->trans("Company") . '</td>';
9211
+					print '<td class="center">'.$langs->trans("Ref").'</td>';
9212
+					print '<td class="left">'.$langs->trans("RefCustomer").'</td>';
9213
+					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9214
+					print '<td class="left">'.$langs->trans("Company").'</td>';
9215 9215
 					print '</tr>';
9216 9216
 					while ($i < $num) {
9217 9217
 						$objp = $this->db->fetch_object($resqllist);
9218 9218
 
9219 9219
 						print '<tr class="oddeven">';
9220 9220
 						print '<td class="left">';
9221
-						print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9221
+						print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9222 9222
 						print '</td>';
9223
-						print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9224
-						print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9223
+						print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9224
+						print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9225 9225
 						print '<td class="right">';
9226 9226
 						if ($possiblelink['label'] == 'LinkToContract') {
9227 9227
 							$form = new Form($this->db);
9228
-							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9228
+							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9229 9229
 						}
9230
-						print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9230
+						print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9231 9231
 						print '</td>';
9232
-						print '<td>' . $objp->name . '</td>';
9232
+						print '<td>'.$objp->name.'</td>';
9233 9233
 						print '</tr>';
9234 9234
 						$i++;
9235 9235
 					}
9236 9236
 					print '</table>';
9237 9237
 					print '<div class="center">';
9238 9238
 					if ($num) {
9239
-						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">';
9239
+						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">';
9240 9240
 					}
9241 9241
 					if (empty($conf->use_javascript_ajax)) {
9242
-						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9242
+						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9243 9243
 					} else {
9244
-						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>';
9244
+						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>';
9245 9245
 					}
9246 9246
 					print '</form>';
9247 9247
 					$this->db->free($resqllist);
@@ -9252,10 +9252,10 @@  discard block
 block discarded – undo
9252 9252
 
9253 9253
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
9254 9254
 				if ($num > 0 || !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
9255
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9255
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9256 9256
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9257 9257
 				} else {
9258
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9258
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9259 9259
 				}
9260 9260
 			}
9261 9261
 		}
@@ -9265,11 +9265,11 @@  discard block
 block discarded – undo
9265 9265
     		<dl class="dropdown" id="linktoobjectname">
9266 9266
     		';
9267 9267
 			if (!empty($conf->use_javascript_ajax)) {
9268
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9268
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9269 9269
 			}
9270 9270
 			$linktoelem .= '<dd>
9271 9271
     		<div class="multiselectlinkto">
9272
-    		<ul class="ulselectedfields">' . $linktoelemlist . '
9272
+    		<ul class="ulselectedfields">' . $linktoelemlist.'
9273 9273
     		</ul>
9274 9274
     		</div>
9275 9275
     		</dd>
@@ -9280,7 +9280,7 @@  discard block
 block discarded – undo
9280 9280
 
9281 9281
 		if (!empty($conf->use_javascript_ajax)) {
9282 9282
 			print '<!-- Add js to show linkto box -->
9283
-				<script nonce="' . getNonce() . '">
9283
+				<script nonce="' . getNonce().'">
9284 9284
 				jQuery(document).ready(function() {
9285 9285
 					jQuery(".linkto").click(function() {
9286 9286
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -9321,19 +9321,19 @@  discard block
 block discarded – undo
9321 9321
 
9322 9322
 		$disabled = ($disabled ? ' disabled' : '');
9323 9323
 
9324
-		$resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
9324
+		$resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
9325 9325
 		if ($useempty) {
9326
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9326
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
9327 9327
 		}
9328 9328
 		if (("$value" == 'yes') || ($value == 1)) {
9329
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
9330
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
9329
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
9330
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
9331 9331
 		} else {
9332 9332
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
9333
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
9334
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
9333
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
9334
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
9335 9335
 		}
9336
-		$resultyesno .= '</select>' . "\n";
9336
+		$resultyesno .= '</select>'."\n";
9337 9337
 
9338 9338
 		if ($addjscombo) {
9339 9339
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -9357,12 +9357,12 @@  discard block
 block discarded – undo
9357 9357
 	{
9358 9358
 		// phpcs:enable
9359 9359
 		$sql = "SELECT rowid, label";
9360
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
9361
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
9360
+		$sql .= " FROM ".$this->db->prefix()."export_model";
9361
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
9362 9362
 		$sql .= " ORDER BY rowid";
9363 9363
 		$result = $this->db->query($sql);
9364 9364
 		if ($result) {
9365
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
9365
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
9366 9366
 			if ($useempty) {
9367 9367
 				print '<option value="-1">&nbsp;</option>';
9368 9368
 			}
@@ -9372,9 +9372,9 @@  discard block
 block discarded – undo
9372 9372
 			while ($i < $num) {
9373 9373
 				$obj = $this->db->fetch_object($result);
9374 9374
 				if ($selected == $obj->rowid) {
9375
-					print '<option value="' . $obj->rowid . '" selected>';
9375
+					print '<option value="'.$obj->rowid.'" selected>';
9376 9376
 				} else {
9377
-					print '<option value="' . $obj->rowid . '">';
9377
+					print '<option value="'.$obj->rowid.'">';
9378 9378
 				}
9379 9379
 				print $obj->label;
9380 9380
 				print '</option>';
@@ -9464,8 +9464,8 @@  discard block
 block discarded – undo
9464 9464
 				$stringforfirstkey .= ' CTL +';
9465 9465
 			}
9466 9466
 
9467
-			$previous_ref = $object->ref_previous ? '<a accesskey="p" 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>';
9468
-			$next_ref = $object->ref_next ? '<a accesskey="n" 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>';
9467
+			$previous_ref = $object->ref_previous ? '<a accesskey="p" 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>';
9468
+			$next_ref = $object->ref_next ? '<a accesskey="n" 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>';
9469 9469
 		}
9470 9470
 
9471 9471
 		//print "xx".$previous_ref."x".$next_ref;
@@ -9473,18 +9473,18 @@  discard block
 block discarded – undo
9473 9473
 
9474 9474
 		// Right part of banner
9475 9475
 		if ($morehtmlright) {
9476
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
9476
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
9477 9477
 		}
9478 9478
 
9479 9479
 		if ($previous_ref || $next_ref || $morehtml) {
9480 9480
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
9481 9481
 		}
9482 9482
 		if ($morehtml) {
9483
-			$ret .= '<li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
9483
+			$ret .= '<li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
9484 9484
 		}
9485 9485
 		if ($shownav && ($previous_ref || $next_ref)) {
9486
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
9487
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
9486
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
9487
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
9488 9488
 		}
9489 9489
 		if ($previous_ref || $next_ref || $morehtml) {
9490 9490
 			$ret .= '</ul></div>';
@@ -9499,7 +9499,7 @@  discard block
 block discarded – undo
9499 9499
 			$morehtmlstatus = $hookmanager->resPrint;
9500 9500
 		}
9501 9501
 		if ($morehtmlstatus) {
9502
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
9502
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
9503 9503
 		}
9504 9504
 
9505 9505
 		$parameters = array();
@@ -9513,14 +9513,14 @@  discard block
 block discarded – undo
9513 9513
 		// Left part of banner
9514 9514
 		if ($morehtmlleft) {
9515 9515
 			if ($conf->browser->layout == 'phone') {
9516
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
9516
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
9517 9517
 			} else {
9518
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
9518
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
9519 9519
 			}
9520 9520
 		}
9521 9521
 
9522 9522
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
9523
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
9523
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
9524 9524
 
9525 9525
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
9526 9526
 		if ($object->element == 'societe') {
@@ -9534,7 +9534,7 @@  discard block
 block discarded – undo
9534 9534
 
9535 9535
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
9536 9536
 				if (!is_object($extralanguages)) {
9537
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
9537
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
9538 9538
 					$extralanguages = new ExtraLanguages($this->db);
9539 9539
 				}
9540 9540
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -9549,27 +9549,27 @@  discard block
 block discarded – undo
9549 9549
 						if ($object->array_languages['name'][$extralangcode]) {
9550 9550
 							$htmltext .= $object->array_languages['name'][$extralangcode];
9551 9551
 						} else {
9552
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
9552
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
9553 9553
 						}
9554 9554
 					}
9555
-					$ret .= '<!-- Show translations of name -->' . "\n";
9555
+					$ret .= '<!-- Show translations of name -->'."\n";
9556 9556
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
9557 9557
 				}
9558 9558
 			}
9559 9559
 		} elseif ($object->element == 'member') {
9560
-			$ret .= $object->ref . '<br>';
9560
+			$ret .= $object->ref.'<br>';
9561 9561
 			$fullname = $object->getFullName($langs);
9562 9562
 			if ($object->morphy == 'mor' && $object->societe) {
9563
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
9563
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
9564 9564
 			} else {
9565
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
9565
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
9566 9566
 			}
9567 9567
 		} elseif (in_array($object->element, array('contact', 'user'))) {
9568
-			$ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;
9568
+			$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
9569 9569
 		} elseif ($object->element == 'usergroup') {
9570 9570
 			$ret .= dol_htmlentities($object->name);
9571 9571
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
9572
-			$ret .= $object->ref . '<br>' . $object->label;
9572
+			$ret .= $object->ref.'<br>'.$object->label;
9573 9573
 		} elseif (in_array($object->element, array('adherent_type'))) {
9574 9574
 			$ret .= $object->label;
9575 9575
 		} elseif ($object->element == 'ecm_directories') {
@@ -9621,9 +9621,9 @@  discard block
 block discarded – undo
9621 9621
 		}
9622 9622
 
9623 9623
 		// Barcode image
9624
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
9625
-		$out = '<!-- url barcode = ' . $url . ' -->';
9626
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
9624
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
9625
+		$out = '<!-- url barcode = '.$url.' -->';
9626
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
9627 9627
 
9628 9628
 		return $out;
9629 9629
 	}
@@ -9663,28 +9663,28 @@  discard block
 block discarded – undo
9663 9663
 			if (!empty($object->logo)) {
9664 9664
 				if (dolIsAllowedForPreview($object->logo)) {
9665 9665
 					if ((string) $imagesize == 'mini') {
9666
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
9666
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
9667 9667
 					} elseif ((string) $imagesize == 'small') {
9668
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
9668
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
9669 9669
 					} else {
9670
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
9670
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
9671 9671
 					}
9672
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
9672
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
9673 9673
 				}
9674 9674
 			}
9675 9675
 			$email = $object->email;
9676 9676
 		} elseif ($modulepart == 'contact') {
9677
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
9677
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
9678 9678
 			if (!empty($object->photo)) {
9679 9679
 				if (dolIsAllowedForPreview($object->photo)) {
9680 9680
 					if ((string) $imagesize == 'mini') {
9681
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9681
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9682 9682
 					} elseif ((string) $imagesize == 'small') {
9683
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9683
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
9684 9684
 					} else {
9685
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
9685
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
9686 9686
 					}
9687
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
9687
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
9688 9688
 				}
9689 9689
 			}
9690 9690
 			$email = $object->email;
@@ -9694,17 +9694,17 @@  discard block
 block discarded – undo
9694 9694
 			if (!empty($object->photo)) {
9695 9695
 				if (dolIsAllowedForPreview($object->photo)) {
9696 9696
 					if ((string) $imagesize == 'mini') {
9697
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9697
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9698 9698
 					} elseif ((string) $imagesize == 'small') {
9699
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9699
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
9700 9700
 					} else {
9701
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
9701
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
9702 9702
 					}
9703
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
9703
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
9704 9704
 				}
9705 9705
 			}
9706 9706
 			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
9707
-				$altfile = $object->id . ".jpg"; // For backward compatibility
9707
+				$altfile = $object->id.".jpg"; // For backward compatibility
9708 9708
 			}
9709 9709
 			$email = $object->email;
9710 9710
 			$capture = 'user';
@@ -9713,17 +9713,17 @@  discard block
 block discarded – undo
9713 9713
 			if (!empty($object->photo)) {
9714 9714
 				if (dolIsAllowedForPreview($object->photo)) {
9715 9715
 					if ((string) $imagesize == 'mini') {
9716
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9716
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
9717 9717
 					} elseif ((string) $imagesize == 'small') {
9718
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9718
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
9719 9719
 					} else {
9720
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
9720
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
9721 9721
 					}
9722
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
9722
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
9723 9723
 				}
9724 9724
 			}
9725 9725
 			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
9726
-				$altfile = $object->id . ".jpg"; // For backward compatibility
9726
+				$altfile = $object->id.".jpg"; // For backward compatibility
9727 9727
 			}
9728 9728
 			$email = $object->email;
9729 9729
 			$capture = 'user';
@@ -9733,17 +9733,17 @@  discard block
 block discarded – undo
9733 9733
 			if (!empty($object->photo)) {
9734 9734
 				if (dolIsAllowedForPreview($object->photo)) {
9735 9735
 					if ((string) $imagesize == 'mini') {
9736
-						$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
9736
+						$file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini');
9737 9737
 					} elseif ((string) $imagesize == 'small') {
9738
-						$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . getImageFileNameForSize($object->photo, '_small');
9738
+						$file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small');
9739 9739
 					} else {
9740
-						$file = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
9740
+						$file = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
9741 9741
 					}
9742
-					$originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
9742
+					$originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo;
9743 9743
 				}
9744 9744
 			}
9745 9745
 			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
9746
-				$altfile = $object->id . ".jpg"; // For backward compatibility
9746
+				$altfile = $object->id.".jpg"; // For backward compatibility
9747 9747
 			}
9748 9748
 			$email = $object->email;
9749 9749
 		}
@@ -9753,35 +9753,35 @@  discard block
 block discarded – undo
9753 9753
 		}
9754 9754
 
9755 9755
 		if ($dir) {
9756
-			if ($file && file_exists($dir . "/" . $file)) {
9756
+			if ($file && file_exists($dir."/".$file)) {
9757 9757
 				if ($addlinktofullsize) {
9758
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
9758
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
9759 9759
 					if ($urladvanced) {
9760
-						$ret .= '<a href="' . $urladvanced . '">';
9760
+						$ret .= '<a href="'.$urladvanced.'">';
9761 9761
 					} else {
9762
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
9762
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
9763 9763
 					}
9764 9764
 				}
9765
-				$ret .= '<img alt="Photo" 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 . '">';
9765
+				$ret .= '<img alt="Photo" 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.'">';
9766 9766
 				if ($addlinktofullsize) {
9767 9767
 					$ret .= '</a>';
9768 9768
 				}
9769
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
9769
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
9770 9770
 				if ($addlinktofullsize) {
9771
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
9771
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
9772 9772
 					if ($urladvanced) {
9773
-						$ret .= '<a href="' . $urladvanced . '">';
9773
+						$ret .= '<a href="'.$urladvanced.'">';
9774 9774
 					} else {
9775
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
9775
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
9776 9776
 					}
9777 9777
 				}
9778
-				$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 . '">';
9778
+				$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.'">';
9779 9779
 				if ($addlinktofullsize) {
9780 9780
 					$ret .= '</a>';
9781 9781
 				}
9782 9782
 			} else {
9783 9783
 				$nophoto = '/public/theme/common/nophoto.png';
9784
-				$defaultimg = 'identicon';        // For gravatar
9784
+				$defaultimg = 'identicon'; // For gravatar
9785 9785
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
9786 9786
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor')) !== false) {
9787 9787
 						$nophoto = 'company';
@@ -9799,13 +9799,13 @@  discard block
 block discarded – undo
9799 9799
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
9800 9800
 					// see https://gravatar.com/site/implement/images/php/
9801 9801
 					$ret .= '<!-- Put link to gravatar -->';
9802
-					$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
9802
+					$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.md5(strtolower(trim($email))).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
9803 9803
 				} else {
9804 9804
 					if ($nophoto == 'company') {
9805
-						$ret .= '<div class="divforspanimg photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
9805
+						$ret .= '<div class="divforspanimg photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
9806 9806
 						$ret .= '<div class="difforspanimgright"></div>';
9807 9807
 					} else {
9808
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
9808
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
9809 9809
 					}
9810 9810
 				}
9811 9811
 			}
@@ -9816,20 +9816,20 @@  discard block
 block discarded – undo
9816 9816
 				}
9817 9817
 				$ret .= '<table class="nobordernopadding centpercent">';
9818 9818
 				if ($object->photo) {
9819
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
9819
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
9820 9820
 				}
9821 9821
 				$ret .= '<tr><td class="tdoverflow">';
9822 9822
 				$maxfilesizearray = getMaxFileSizeArray();
9823 9823
 				$maxmin = $maxfilesizearray['maxmin'];
9824 9824
 				if ($maxmin > 0) {
9825
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
9825
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
9826 9826
 				}
9827
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
9827
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
9828 9828
 				$ret .= '</td></tr>';
9829 9829
 				$ret .= '</table>';
9830 9830
 			}
9831 9831
 		} else {
9832
-			dol_print_error('', 'Call of showphoto with wrong parameters modulepart=' . $modulepart);
9832
+			dol_print_error('', 'Call of showphoto with wrong parameters modulepart='.$modulepart);
9833 9833
 		}
9834 9834
 
9835 9835
 		return $ret;
@@ -9880,38 +9880,38 @@  discard block
 block discarded – undo
9880 9880
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
9881 9881
 			$sql .= ", e.label";
9882 9882
 		}
9883
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
9883
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
9884 9884
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
9885
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
9885
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
9886 9886
 			if ($force_entity) {
9887
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
9887
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
9888 9888
 			} else {
9889 9889
 				$sql .= " WHERE ug.entity IS NOT NULL";
9890 9890
 			}
9891 9891
 		} else {
9892
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
9892
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
9893 9893
 		}
9894 9894
 		if (is_array($exclude) && $excludeGroups) {
9895
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
9895
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
9896 9896
 		}
9897 9897
 		if (is_array($include) && $includeGroups) {
9898
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
9898
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
9899 9899
 		}
9900 9900
 		$sql .= " ORDER BY ug.nom ASC";
9901 9901
 
9902
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
9902
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
9903 9903
 		$resql = $this->db->query($sql);
9904 9904
 		if ($resql) {
9905 9905
 			// Enhance with select2
9906
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
9906
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
9907 9907
 
9908
-			$out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
9908
+			$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
9909 9909
 
9910 9910
 			$num = $this->db->num_rows($resql);
9911 9911
 			$i = 0;
9912 9912
 			if ($num) {
9913 9913
 				if ($show_empty && !$multiple) {
9914
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9914
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
9915 9915
 				}
9916 9916
 
9917 9917
 				while ($i < $num) {
@@ -9921,7 +9921,7 @@  discard block
 block discarded – undo
9921 9921
 						$disableline = 1;
9922 9922
 					}
9923 9923
 
9924
-					$out .= '<option value="' . $obj->rowid . '"';
9924
+					$out .= '<option value="'.$obj->rowid.'"';
9925 9925
 					if ($disableline) {
9926 9926
 						$out .= ' disabled';
9927 9927
 					}
@@ -9932,7 +9932,7 @@  discard block
 block discarded – undo
9932 9932
 
9933 9933
 					$out .= $obj->name;
9934 9934
 					if (isModEnabled('multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
9935
-						$out .= " (" . $obj->label . ")";
9935
+						$out .= " (".$obj->label.")";
9936 9936
 					}
9937 9937
 
9938 9938
 					$out .= '</option>';
@@ -9940,9 +9940,9 @@  discard block
 block discarded – undo
9940 9940
 				}
9941 9941
 			} else {
9942 9942
 				if ($show_empty) {
9943
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
9943
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
9944 9944
 				}
9945
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
9945
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
9946 9946
 			}
9947 9947
 			$out .= '</select>';
9948 9948
 
@@ -9991,25 +9991,25 @@  discard block
 block discarded – undo
9991 9991
 		$out = '';
9992 9992
 
9993 9993
 		if (!empty($conf->use_javascript_ajax)) {
9994
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
9994
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
9995 9995
 		}
9996
-		$out .= '<script nonce="' . getNonce() . '">
9996
+		$out .= '<script nonce="'.getNonce().'">
9997 9997
             $(document).ready(function() {
9998
-                $("#' . $cssclass . 's").click(function() {
9998
+                $("#' . $cssclass.'s").click(function() {
9999 9999
                     if($(this).is(\':checked\')){
10000
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10001
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10000
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10001
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10002 10002
                     }
10003 10003
                     else
10004 10004
                     {
10005 10005
                         console.log("We uncheck all");
10006
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10006
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10007 10007
                     }' . "\n";
10008 10008
 		if ($calljsfunction) {
10009
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10009
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10010 10010
 		}
10011 10011
 		$out .= '         });
10012
-        	        $(".' . $cssclass . '").change(function() {
10012
+        	        $(".' . $cssclass.'").change(function() {
10013 10013
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10014 10014
 				});
10015 10015
 		 	});
@@ -10054,67 +10054,67 @@  discard block
 block discarded – undo
10054 10054
 		global $langs, $user;
10055 10055
 
10056 10056
 		$out = '';
10057
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10058
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10057
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10058
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10059 10059
 		if (!empty($excludeid)) {
10060
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10060
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10061 10061
 		}
10062 10062
 		$sql .= " ORDER BY label";
10063 10063
 
10064 10064
 		$resql = $this->db->query($sql);
10065 10065
 		if ($resql) {
10066
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10066
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10067 10067
 			if ($useempty) {
10068 10068
 				$out .= '<option value="0">&nbsp;</option>';
10069 10069
 			}
10070 10070
 
10071 10071
 			while ($obj = $this->db->fetch_object($resql)) {
10072
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10072
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10073 10073
 			}
10074 10074
 			$out .= '</select>';
10075
-			$out .= ajax_combobox('select_' . $htmlname);
10075
+			$out .= ajax_combobox('select_'.$htmlname);
10076 10076
 
10077 10077
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10078
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10078
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10079 10079
 			}
10080 10080
 
10081 10081
 			if (!empty($target)) {
10082
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10082
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10083 10083
 				$resql = $this->db->query($sql);
10084 10084
 				if ($resql) {
10085 10085
 					if ($this->db->num_rows($resql) > 0) {
10086 10086
 						$obj = $this->db->fetch_object($resql);
10087
-						$out .= '<script nonce="' . getNonce() . '">
10087
+						$out .= '<script nonce="'.getNonce().'">
10088 10088
 							$(function() {
10089
-								$("select[name=' . $target . ']").on("change", function() {
10089
+								$("select[name=' . $target.']").on("change", function() {
10090 10090
 									var current_val = $(this).val();
10091
-									if (current_val == ' . $obj->id . ') {';
10091
+									if (current_val == ' . $obj->id.') {';
10092 10092
 						if (!empty($default_selected) || !empty($selected)) {
10093
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10093
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10094 10094
 						}
10095 10095
 
10096 10096
 						$out .= '
10097
-										$("select[name=' . $htmlname . ']").change();
10097
+										$("select[name=' . $htmlname.']").change();
10098 10098
 									}
10099 10099
 								});
10100 10100
 
10101
-								$("select[name=' . $htmlname . ']").change(function() {
10101
+								$("select[name=' . $htmlname.']").change(function() {
10102 10102
 
10103
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10103
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10104 10104
 										// get price of kilometer to fill the unit price
10105 10105
 										$.ajax({
10106 10106
 											method: "POST",
10107 10107
 											dataType: "json",
10108
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10109
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . join('&', $params)) . '",
10108
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10109
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.join('&', $params)).'",
10110 10110
 										}).done(function( data, textStatus, jqXHR ) {
10111 10111
 											console.log(data);
10112 10112
 											if (typeof data.up != "undefined") {
10113 10113
 												$("input[name=value_unit]").val(data.up);
10114
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10114
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10115 10115
 											} else {
10116 10116
 												$("input[name=value_unit]").val("");
10117
-												$("select[name=' . $htmlname . ']").attr("title", "");
10117
+												$("select[name=' . $htmlname.']").attr("title", "");
10118 10118
 											}
10119 10119
 										});
10120 10120
 									}
@@ -10144,18 +10144,18 @@  discard block
 block discarded – undo
10144 10144
 		global $conf, $langs;
10145 10145
 
10146 10146
 		$out = '';
10147
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10148
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10147
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10148
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10149 10149
 
10150 10150
 		$resql = $this->db->query($sql);
10151 10151
 		if ($resql) {
10152
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10152
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10153 10153
 			if ($useempty) {
10154 10154
 				$out .= '<option value="0"></option>';
10155 10155
 			}
10156 10156
 
10157 10157
 			while ($obj = $this->db->fetch_object($resql)) {
10158
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10158
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10159 10159
 			}
10160 10160
 			$out .= '</select>';
10161 10161
 		} else {
@@ -10180,17 +10180,17 @@  discard block
 block discarded – undo
10180 10180
 		global $langs;
10181 10181
 
10182 10182
 		$out = '';
10183
-		$sql = "SELECT id, code, label FROM " . $this->db->prefix() . "c_type_fees";
10183
+		$sql = "SELECT id, code, label FROM ".$this->db->prefix()."c_type_fees";
10184 10184
 		$sql .= " WHERE active = 1";
10185 10185
 
10186 10186
 		$resql = $this->db->query($sql);
10187 10187
 		if ($resql) {
10188
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10188
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10189 10189
 			if ($useempty) {
10190 10190
 				$out .= '<option value="0"></option>';
10191 10191
 			}
10192 10192
 			if ($allchoice) {
10193
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10193
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10194 10194
 			}
10195 10195
 
10196 10196
 			$field = 'code';
@@ -10200,7 +10200,7 @@  discard block
 block discarded – undo
10200 10200
 
10201 10201
 			while ($obj = $this->db->fetch_object($resql)) {
10202 10202
 				$key = $langs->trans($obj->code);
10203
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10203
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10204 10204
 			}
10205 10205
 			$out .= '</select>';
10206 10206
 		} else {
@@ -10232,7 +10232,7 @@  discard block
 block discarded – undo
10232 10232
 	{
10233 10233
 		global $user, $conf, $langs;
10234 10234
 
10235
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10235
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10236 10236
 
10237 10237
 		if (is_null($usertofilter)) {
10238 10238
 			$usertofilter = $user;
@@ -10256,10 +10256,10 @@  discard block
 block discarded – undo
10256 10256
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10257 10257
             p.title, p.fk_soc, p.fk_statut, p.public,";
10258 10258
 		$sql .= ' s.nom as name';
10259
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10260
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10261
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10262
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10259
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10260
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10261
+		$sql .= ' '.$this->db->prefix().'facture as f';
10262
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10263 10263
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10264 10264
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10265 10265
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10270,14 +10270,14 @@  discard block
 block discarded – undo
10270 10270
 		if ($resql) {
10271 10271
 			// Use select2 selector
10272 10272
 			if (!empty($conf->use_javascript_ajax)) {
10273
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10273
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10274 10274
 				$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
10275 10275
 				$out .= $comboenhancement;
10276 10276
 				$morecss = 'minwidth200imp maxwidth500';
10277 10277
 			}
10278 10278
 
10279 10279
 			if (empty($option_only)) {
10280
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10280
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10281 10281
 			}
10282 10282
 			if (!empty($show_empty)) {
10283 10283
 				$out .= '<option value="0" class="optiongrey">';
@@ -10307,33 +10307,33 @@  discard block
 block discarded – undo
10307 10307
 						if ($showproject == 'all') {
10308 10308
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
10309 10309
 							if ($obj->name) {
10310
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
10310
+								$labeltoshow .= ' - '.$obj->name; // Soc name
10311 10311
 							}
10312 10312
 
10313 10313
 							$disabled = 0;
10314 10314
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
10315 10315
 								$disabled = 1;
10316
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
10316
+								$labeltoshow .= ' - '.$langs->trans("Draft");
10317 10317
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
10318 10318
 								if ($discard_closed == 2) {
10319 10319
 									$disabled = 1;
10320 10320
 								}
10321
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
10321
+								$labeltoshow .= ' - '.$langs->trans("Closed");
10322 10322
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
10323 10323
 								$disabled = 1;
10324
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
10324
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
10325 10325
 							}
10326 10326
 						}
10327 10327
 
10328 10328
 						if (!empty($selected) && $selected == $obj->rowid) {
10329
-							$out .= '<option value="' . $obj->rowid . '" selected';
10329
+							$out .= '<option value="'.$obj->rowid.'" selected';
10330 10330
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10331
-							$out .= '>' . $labeltoshow . '</option>';
10331
+							$out .= '>'.$labeltoshow.'</option>';
10332 10332
 						} else {
10333 10333
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
10334 10334
 								$resultat = '';
10335 10335
 							} else {
10336
-								$resultat = '<option value="' . $obj->rowid . '"';
10336
+								$resultat = '<option value="'.$obj->rowid.'"';
10337 10337
 								if ($disabled) {
10338 10338
 									$resultat .= ' disabled';
10339 10339
 								}
@@ -10385,22 +10385,22 @@  discard block
 block discarded – undo
10385 10385
 
10386 10386
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
10387 10387
 		//$sql.= ', el.fk_source';
10388
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
10389
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
10388
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
10389
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
10390 10390
 		$sql .= " ORDER BY f.titre ASC";
10391 10391
 
10392 10392
 		$resql = $this->db->query($sql);
10393 10393
 		if ($resql) {
10394 10394
 			// Use select2 selector
10395 10395
 			if (!empty($conf->use_javascript_ajax)) {
10396
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10396
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10397 10397
 				$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
10398 10398
 				$out .= $comboenhancement;
10399 10399
 				$morecss = 'minwidth200imp maxwidth500';
10400 10400
 			}
10401 10401
 
10402 10402
 			if (empty($option_only)) {
10403
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10403
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10404 10404
 			}
10405 10405
 			if (!empty($show_empty)) {
10406 10406
 				$out .= '<option value="0" class="optiongrey">';
@@ -10419,19 +10419,19 @@  discard block
 block discarded – undo
10419 10419
 					$disabled = 0;
10420 10420
 					if (!empty($obj->suspended)) {
10421 10421
 						$disabled = 1;
10422
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
10422
+						$labeltoshow .= ' - '.$langs->trans("Closed");
10423 10423
 					}
10424 10424
 
10425 10425
 
10426 10426
 					if (!empty($selected) && $selected == $obj->rowid) {
10427
-						$out .= '<option value="' . $obj->rowid . '" selected';
10427
+						$out .= '<option value="'.$obj->rowid.'" selected';
10428 10428
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10429
-						$out .= '>' . $labeltoshow . '</option>';
10429
+						$out .= '>'.$labeltoshow.'</option>';
10430 10430
 					} else {
10431 10431
 						if ($disabled && ($selected != $obj->rowid)) {
10432 10432
 							$resultat = '';
10433 10433
 						} else {
10434
-							$resultat = '<option value="' . $obj->rowid . '"';
10434
+							$resultat = '<option value="'.$obj->rowid.'"';
10435 10435
 							if ($disabled) {
10436 10436
 								$resultat .= ' disabled';
10437 10437
 							}
@@ -10471,14 +10471,14 @@  discard block
 block discarded – undo
10471 10471
 		global $langs;
10472 10472
 
10473 10473
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
10474
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
10474
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
10475 10475
 		}
10476 10476
 
10477 10477
 		$ret = '';
10478 10478
 
10479 10479
 		$ret .= '<div class="divadvancedsearchfieldcomp inline-block">';
10480 10480
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
10481
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
10481
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
10482 10482
 		$ret .= '</a>';
10483 10483
 
10484 10484
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -10504,13 +10504,13 @@  discard block
 block discarded – undo
10504 10504
 				}
10505 10505
 
10506 10506
 				if ($countparenthesis == 0) {
10507
-					$char2 = dol_substr($search_component_params_hidden, $i+1, 1);
10508
-					$char3 = dol_substr($search_component_params_hidden, $i+2, 1);
10507
+					$char2 = dol_substr($search_component_params_hidden, $i + 1, 1);
10508
+					$char3 = dol_substr($search_component_params_hidden, $i + 2, 1);
10509 10509
 					if ($char == 'A' && $char2 == 'N' && $char3 == 'D') {
10510 10510
 						// We found a AND
10511 10511
 						$arrayofandtags[] = trim($s);
10512 10512
 						$s = '';
10513
-						$i+=2;
10513
+						$i += 2;
10514 10514
 					} else {
10515 10515
 						$s .= $char;
10516 10516
 					}
@@ -10534,8 +10534,8 @@  discard block
 block discarded – undo
10534 10534
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
10535 10535
 				$searchtags = removeGlobalParenthesis($searchtags);
10536 10536
 
10537
-				$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey+1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';
10538
-				$ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey+1).'">x</span> ';
10537
+				$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey + 1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';
10538
+				$ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey + 1).'">x</span> ';
10539 10539
 				$ret .= dol_escape_htmltag($searchtags);
10540 10540
 				$ret .= '</span>';
10541 10541
 			}
@@ -10552,29 +10552,29 @@  discard block
 block discarded – undo
10552 10552
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
10553 10553
 		}
10554 10554
 		$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%')) -->";
10555
-		$ret .= '<input type="hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
10555
+		$ret .= '<input type="hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
10556 10556
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
10557 10557
 
10558 10558
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
10559 10559
 		foreach ($arrayofcriterias as $criterias) {
10560 10560
 			foreach ($criterias as $criteriafamilykey => $criteriafamilyval) {
10561
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10561
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10562 10562
 					continue;
10563 10563
 				}
10564 10564
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
10565 10565
 					continue;
10566 10566
 				}
10567 10567
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
10568
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
10569
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
10570
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
10571
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
10572
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
10573
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
10574
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
10575
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
10568
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
10569
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
10570
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
10571
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
10572
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
10573
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
10574
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
10575
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
10576 10576
 				} else {
10577
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
10577
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
10578 10578
 				}
10579 10579
 			}
10580 10580
 		}
@@ -10582,7 +10582,7 @@  discard block
 block discarded – undo
10582 10582
 		$ret .= '</div>';
10583 10583
 
10584 10584
 		$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";
10585
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Search") . '" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10585
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Search").'" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10586 10586
 
10587 10587
 		$ret .= '</div>';
10588 10588
 		$ret .= '</div>';
@@ -10618,7 +10618,7 @@  discard block
 block discarded – undo
10618 10618
 
10619 10619
 		$TModels = array();
10620 10620
 
10621
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
10621
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
10622 10622
 		$formmail = new FormMail($this->db);
10623 10623
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
10624 10624
 
@@ -10631,17 +10631,17 @@  discard block
 block discarded – undo
10631 10631
 			}
10632 10632
 		}
10633 10633
 
10634
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
10634
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
10635 10635
 
10636 10636
 		foreach ($TModels as $id_model => $label_model) {
10637
-			$retstring .= '<option value="' . $id_model . '"';
10638
-			$retstring .= ">" . $label_model . "</option>";
10637
+			$retstring .= '<option value="'.$id_model.'"';
10638
+			$retstring .= ">".$label_model."</option>";
10639 10639
 		}
10640 10640
 
10641 10641
 		$retstring .= "</select>";
10642 10642
 
10643 10643
 		if ($addjscombo) {
10644
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
10644
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
10645 10645
 		}
10646 10646
 
10647 10647
 		return $retstring;
@@ -10692,16 +10692,16 @@  discard block
 block discarded – undo
10692 10692
 
10693 10693
 		foreach ($buttons as $button) {
10694 10694
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
10695
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
10695
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
10696 10696
 		}
10697 10697
 		$retstring .= $withoutdiv ? '' : '</div>';
10698 10698
 
10699 10699
 		if ($dol_openinpopup) {
10700
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";
10701
-			$retstring .= '<script nonce="' . getNonce() . '">';
10700
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
10701
+			$retstring .= '<script nonce="'.getNonce().'">';
10702 10702
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
10703
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');
10704
-				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');
10703
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');
10704
+				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');
10705 10705
 				 });';
10706 10706
 			$retstring .= '</script>';
10707 10707
 		}
Please login to merge, or discard this patch.
htdocs/core/class/CSMSFile.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,10 +140,10 @@
 block discarded – undo
140 140
 		if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) {
141 141
 			// Action according to the choosed sending method
142 142
 			if (getDolGlobalString('MAIN_SMS_SENDMODE')) {
143
-				$sendmode = getDolGlobalString('MAIN_SMS_SENDMODE');	// $conf->global->MAIN_SMS_SENDMODE looks like a value 'module'
144
-				$classmoduleofsender = getDolGlobalString('MAIN_MODULE_'.strtoupper($sendmode).'_SMS', $sendmode);	// $conf->global->MAIN_MODULE_XXX_SMS looks like a value 'class@module'
143
+				$sendmode = getDolGlobalString('MAIN_SMS_SENDMODE'); // $conf->global->MAIN_SMS_SENDMODE looks like a value 'module'
144
+				$classmoduleofsender = getDolGlobalString('MAIN_MODULE_'.strtoupper($sendmode).'_SMS', $sendmode); // $conf->global->MAIN_MODULE_XXX_SMS looks like a value 'class@module'
145 145
 				if ($classmoduleofsender == 'ovh') {
146
-					$classmoduleofsender = 'ovhsms@ovh';	// For backward compatibility
146
+					$classmoduleofsender = 'ovhsms@ovh'; // For backward compatibility
147 147
 				}
148 148
 
149 149
 				$tmp = explode('@', $classmoduleofsender);
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
 				}
826 826
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
827 827
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
828
-					$datas[$key]= '<br><b><u>'. $labelextra . '</u></b>';
828
+					$datas[$key] = '<br><b><u>'.$labelextra.'</u></b>';
829 829
 				} else {
830
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
831
-					$datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
830
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
831
+					$datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
832 832
 					$count++;
833 833
 				}
834 834
 			}
835 835
 		}
836 836
 
837
-		$hookmanager->initHooks(array($this->element . 'dao'));
837
+		$hookmanager->initHooks(array($this->element.'dao'));
838 838
 		$parameters = array(
839 839
 			'tooltipcontentarray' => &$datas,
840 840
 			'params' => $params,
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 		if ($source == 'external' || $source == 'thirdparty') {
1314 1314
 			$sql .= " AND tc.source = 'external'";
1315 1315
 			if ($status >= 0) {
1316
-				$sql .= " AND t.statut = ".((int) $status);	// t is llx_socpeople
1316
+				$sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople
1317 1317
 			}
1318 1318
 		}
1319 1319
 		$sql .= " AND tc.active = 1";
@@ -1672,8 +1672,8 @@  discard block
 block discarded – undo
1672 1672
 		if ($idtofetch) {
1673 1673
 			$thirdparty = new Societe($this->db);
1674 1674
 			$result = $thirdparty->fetch($idtofetch);
1675
-			if ($result<0) {
1676
-				$this->errors=array_merge($this->errors, $thirdparty->errors);
1675
+			if ($result < 0) {
1676
+				$this->errors = array_merge($this->errors, $thirdparty->errors);
1677 1677
 			}
1678 1678
 			$this->thirdparty = $thirdparty;
1679 1679
 
@@ -1975,9 +1975,9 @@  discard block
 block discarded – undo
1975 1975
 		if ($trigkey) {
1976 1976
 			$oldvalue = null;
1977 1977
 
1978
-			$sql = "SELECT " . $field;
1979
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
1980
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
1978
+			$sql = "SELECT ".$field;
1979
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
1980
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
1981 1981
 
1982 1982
 			$resql = $this->db->query($sql);
1983 1983
 			if ($resql) {
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 		}
2107 2107
 		$restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc;
2108 2108
 		$sql = "SELECT MAX(te.".$fieldid.")";
2109
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2109
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2110 2110
 		if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
2111 2111
 			$sql .= ",".$this->db->prefix()."usergroup_user as ug";
2112 2112
 		}
@@ -2180,7 +2180,7 @@  discard block
 block discarded – undo
2180 2180
 		$this->ref_previous = $row[0];
2181 2181
 
2182 2182
 		$sql = "SELECT MIN(te.".$fieldid.")";
2183
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2183
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2184 2184
 		if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
2185 2185
 			$sql .= ",".$this->db->prefix()."usergroup_user as ug";
2186 2186
 		}
@@ -2338,7 +2338,7 @@  discard block
 block discarded – undo
2338 2338
 		// Triggers
2339 2339
 		if (!$error && !$notrigger) {
2340 2340
 			// Call triggers
2341
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2341
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2342 2342
 			if ($result < 0) {
2343 2343
 				$error++;
2344 2344
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2703,7 +2703,7 @@  discard block
 block discarded – undo
2703 2703
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
2704 2704
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
2705 2705
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
2706
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2706
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2707 2707
 			}
2708 2708
 			$sql .= ' WHERE rowid='.((int) $this->id);
2709 2709
 
@@ -3053,10 +3053,10 @@  discard block
 block discarded – undo
3053 3053
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3054 3054
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3055 3055
 		if (!$renum) {
3056
-			$sql .= " AND " . $fieldposition . " = 0";
3056
+			$sql .= " AND ".$fieldposition." = 0";
3057 3057
 		}
3058 3058
 		if ($renum) {
3059
-			$sql .= " AND " . $fieldposition . " <> 0";
3059
+			$sql .= " AND ".$fieldposition." <> 0";
3060 3060
 		}
3061 3061
 
3062 3062
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 			if ($fk_parent_line) {
3078 3078
 				$sql .= ' AND fk_parent_line IS NULL';
3079 3079
 			}
3080
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3080
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3081 3081
 
3082 3082
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3083 3083
 			$resql = $this->db->query($sql);
@@ -3128,7 +3128,7 @@  discard block
 block discarded – undo
3128 3128
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3129 3129
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3130 3130
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3131
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3131
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3132 3132
 
3133 3133
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3134 3134
 		$resql = $this->db->query($sql);
@@ -3211,8 +3211,8 @@  discard block
 block discarded – undo
3211 3211
 			dol_print_error($this->db);
3212 3212
 			return -1;
3213 3213
 		} else {
3214
-			$parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3215
-			$action='';
3214
+			$parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3215
+			$action = '';
3216 3216
 			$reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action);
3217 3217
 			return 1;
3218 3218
 		}
@@ -3251,7 +3251,7 @@  discard block
 block discarded – undo
3251 3251
 
3252 3252
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3253 3253
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3254
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3254
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3255 3255
 			if ($this->db->query($sql)) {
3256 3256
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
3257 3257
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3282,7 +3282,7 @@  discard block
 block discarded – undo
3282 3282
 
3283 3283
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3284 3284
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3285
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3285
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3286 3286
 			if ($this->db->query($sql)) {
3287 3287
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
3288 3288
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3308,7 +3308,7 @@  discard block
 block discarded – undo
3308 3308
 			$fieldposition = 'position';
3309 3309
 		}
3310 3310
 
3311
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3311
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3312 3312
 		$sql .= " WHERE rowid = ".((int) $rowid);
3313 3313
 
3314 3314
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3336,7 +3336,7 @@  discard block
 block discarded – undo
3336 3336
 
3337 3337
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3338 3338
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3339
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3339
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3340 3340
 		$resql = $this->db->query($sql);
3341 3341
 		if ($resql) {
3342 3342
 			$row = $this->db->fetch_row($resql);
@@ -3453,7 +3453,7 @@  discard block
 block discarded – undo
3453 3453
 			$newsuffix = '';
3454 3454
 		}
3455 3455
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3456
-			$fieldusermod =  "fk_user_mod";
3456
+			$fieldusermod = "fk_user_mod";
3457 3457
 		} elseif ($this->table_element == 'ecm_files') {
3458 3458
 			$fieldusermod = "fk_user_m";
3459 3459
 		} else {
@@ -3825,7 +3825,7 @@  discard block
 block discarded – undo
3825 3825
 		// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
3826 3826
 		$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
3827 3827
 		// Add module part to target type if object has $module property and isn't in core modules.
3828
-		$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3828
+		$targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3829 3829
 
3830 3830
 		$parameters = array('targettype'=>$targettype);
3831 3831
 		// Hook for explicitly set the targettype if it must be differtent than $this->element
@@ -3837,19 +3837,19 @@  discard block
 block discarded – undo
3837 3837
 		$this->db->begin();
3838 3838
 		$error = 0;
3839 3839
 
3840
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
3840
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
3841 3841
 		$sql .= "fk_source";
3842 3842
 		$sql .= ", sourcetype";
3843 3843
 		$sql .= ", fk_target";
3844 3844
 		$sql .= ", targettype";
3845 3845
 		$sql .= ") VALUES (";
3846 3846
 		$sql .= ((int) $origin_id);
3847
-		$sql .= ", '" . $this->db->escape($origin) . "'";
3848
-		$sql .= ", " . ((int) $this->id);
3849
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
3847
+		$sql .= ", '".$this->db->escape($origin)."'";
3848
+		$sql .= ", ".((int) $this->id);
3849
+		$sql .= ", '".$this->db->escape($targettype)."'";
3850 3850
 		$sql .= ")";
3851 3851
 
3852
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
3852
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
3853 3853
 		if ($this->db->query($sql)) {
3854 3854
 			if (!$notrigger) {
3855 3855
 				// Call trigger
@@ -4156,20 +4156,20 @@  discard block
 block discarded – undo
4156 4156
 		$this->db->begin();
4157 4157
 		$error = 0;
4158 4158
 
4159
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4159
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4160 4160
 		if ($updatesource) {
4161
-			$sql .= "fk_source = " . ((int) $sourceid);
4162
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4163
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4164
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4161
+			$sql .= "fk_source = ".((int) $sourceid);
4162
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4163
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4164
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4165 4165
 		} elseif ($updatetarget) {
4166
-			$sql .= "fk_target = " . ((int) $targetid);
4167
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4168
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4169
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4166
+			$sql .= "fk_target = ".((int) $targetid);
4167
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4168
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4169
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4170 4170
 		}
4171 4171
 
4172
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4172
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4173 4173
 		if ($this->db->query($sql)) {
4174 4174
 			if (!$notrigger) {
4175 4175
 				// Call trigger
@@ -4245,25 +4245,25 @@  discard block
 block discarded – undo
4245 4245
 		}
4246 4246
 
4247 4247
 		if (!$error) {
4248
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4248
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4249 4249
 			$sql .= " WHERE";
4250 4250
 			if ($rowid > 0) {
4251
-				$sql .= " rowid = " . ((int) $rowid);
4251
+				$sql .= " rowid = ".((int) $rowid);
4252 4252
 			} else {
4253 4253
 				if ($deletesource) {
4254
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4255
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'";
4254
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4255
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'";
4256 4256
 				} elseif ($deletetarget) {
4257
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4258
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4257
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4258
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'";
4259 4259
 				} else {
4260
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')";
4260
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')";
4261 4261
 					$sql .= " OR";
4262
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')";
4262
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')";
4263 4263
 				}
4264 4264
 			}
4265 4265
 
4266
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4266
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4267 4267
 			if (!$this->db->query($sql)) {
4268 4268
 				$this->error = $this->db->lasterror();
4269 4269
 				$this->errors[] = $this->error;
@@ -4393,14 +4393,14 @@  discard block
 block discarded – undo
4393 4393
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4394 4394
 		}
4395 4395
 		$sql .= " WHERE rowid = ".((int) $elementId);
4396
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4396
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4397 4397
 
4398 4398
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4399 4399
 		$resql = $this->db->query($sql);
4400 4400
 		if ($resql) {
4401 4401
 			$error = 0;
4402 4402
 
4403
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4403
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4404 4404
 
4405 4405
 			if ($nb_rows_affected > 0) {
4406 4406
 				if (empty($trigkey)) {
@@ -4554,7 +4554,7 @@  discard block
 block discarded – undo
4554 4554
 			return -1;
4555 4555
 		}
4556 4556
 
4557
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4557
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4558 4558
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
4559 4559
 		$tmparray = array_keys($this->childtables);
4560 4560
 		if (is_numeric($tmparray[0])) {
@@ -4567,26 +4567,26 @@  discard block
 block discarded – undo
4567 4567
 			//print $id.'-'.$table.'-'.$elementname.'<br>';
4568 4568
 			// Check if element can be deleted
4569 4569
 			$sql = "SELECT COUNT(*) as nb";
4570
-			$sql.= " FROM ".$this->db->prefix().$table." as c";
4570
+			$sql .= " FROM ".$this->db->prefix().$table." as c";
4571 4571
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4572
-				$sql.= ", ".$this->db->prefix().$element['parent']." as p";
4572
+				$sql .= ", ".$this->db->prefix().$element['parent']." as p";
4573 4573
 			}
4574 4574
 			if (!empty($element['fk_element'])) {
4575
-				$sql.= " WHERE c.".$element['fk_element']." = ".((int) $id);
4575
+				$sql .= " WHERE c.".$element['fk_element']." = ".((int) $id);
4576 4576
 			} else {
4577
-				$sql.= " WHERE c.".$this->fk_element." = ".((int) $id);
4577
+				$sql .= " WHERE c.".$this->fk_element." = ".((int) $id);
4578 4578
 			}
4579 4579
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4580
-				$sql.= " AND c.".$element['parentkey']." = p.rowid";
4580
+				$sql .= " AND c.".$element['parentkey']." = p.rowid";
4581 4581
 			}
4582 4582
 			if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) {
4583
-				$sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4583
+				$sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4584 4584
 			}
4585 4585
 			if (!empty($entity)) {
4586 4586
 				if (!empty($element['parent']) && !empty($element['parentkey'])) {
4587
-					$sql.= " AND p.entity = ".((int) $entity);
4587
+					$sql .= " AND p.entity = ".((int) $entity);
4588 4588
 				} else {
4589
-					$sql.= " AND c.entity = ".((int) $entity);
4589
+					$sql .= " AND c.entity = ".((int) $entity);
4590 4590
 				}
4591 4591
 			}
4592 4592
 
@@ -4600,9 +4600,9 @@  discard block
 block discarded – undo
4600 4600
 					if (is_numeric($element)) {	// very old usage array('table1', 'table2', ...)
4601 4601
 						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table);
4602 4602
 					} elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...)
4603
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4603
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4604 4604
 					} else { // new usage: $element['name']=Translation key
4605
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4605
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4606 4606
 					}
4607 4607
 					break; // We found at least one, we stop here
4608 4608
 				}
@@ -4661,7 +4661,7 @@  discard block
 block discarded – undo
4661 4661
 	 */
4662 4662
 	public function getTotalDiscount()
4663 4663
 	{
4664
-		if (!empty($this->table_element_line) ) {
4664
+		if (!empty($this->table_element_line)) {
4665 4665
 			$total_discount = 0.00;
4666 4666
 
4667 4667
 			$sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht";
@@ -5608,7 +5608,7 @@  discard block
 block discarded – undo
5608 5608
 			$setsharekey = false;
5609 5609
 			if ($this->element == 'propal' || $this->element == 'proposal') {
5610 5610
 				if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) {
5611
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
5611
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
5612 5612
 				}
5613 5613
 				if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) {
5614 5614
 					$setsharekey = true;
@@ -5663,7 +5663,7 @@  discard block
 block discarded – undo
5663 5663
 				$ecmfile->gen_or_uploaded = 'generated';
5664 5664
 				$ecmfile->description = ''; // indexed content
5665 5665
 				$ecmfile->keywords = ''; // keyword content
5666
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
5666
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
5667 5667
 				$ecmfile->src_object_id   = $this->id;
5668 5668
 
5669 5669
 				$result = $ecmfile->create($user);
@@ -5715,7 +5715,7 @@  discard block
 block discarded – undo
5715 5715
 			$maxwidthmini = $tmparraysize['maxwidthmini'];
5716 5716
 			$maxheightmini = $tmparraysize['maxheightmini'];
5717 5717
 			//$quality = $tmparraysize['quality'];
5718
-			$quality = 50;	// For thumbs, we force quality to 50
5718
+			$quality = 50; // For thumbs, we force quality to 50
5719 5719
 
5720 5720
 			// Create small thumbs for company (Ratio is near 16/9)
5721 5721
 			// Used on logon for example
@@ -5816,8 +5816,8 @@  discard block
 block discarded – undo
5816 5816
 	{
5817 5817
 		// phpcs:enable
5818 5818
 		global $langs, $conf;
5819
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
5820
-			dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
5819
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
5820
+			dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
5821 5821
 			exit;
5822 5822
 		}
5823 5823
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6110,9 +6110,9 @@  discard block
 block discarded – undo
6110 6110
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6111 6111
 							//var_dump($conf->disable_compute);
6112 6112
 							if (empty($conf->disable_compute)) {
6113
-								global $objectoffield;        // We set a global variable to $objectoffield so
6114
-								$objectoffield = $this;        // we can use it inside computed formula
6115
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
6113
+								global $objectoffield; // We set a global variable to $objectoffield so
6114
+								$objectoffield = $this; // we can use it inside computed formula
6115
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
6116 6116
 							}
6117 6117
 						}
6118 6118
 					}
@@ -6126,7 +6126,7 @@  discard block
 block discarded – undo
6126 6126
 					return 0;
6127 6127
 				}
6128 6128
 			} else {
6129
-				$this->errors[]=$this->db->lasterror;
6129
+				$this->errors[] = $this->db->lasterror;
6130 6130
 				return -1;
6131 6131
 			}
6132 6132
 		}
@@ -6898,7 +6898,7 @@  discard block
 block discarded – undo
6898 6898
 		// Special case that force options and type ($type can be integer, varchar, ...)
6899 6899
 		if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) {
6900 6900
 			$param['options'] = $this->fields[$key]['arrayofkeyval'];
6901
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
6901
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
6902 6902
 		}
6903 6903
 
6904 6904
 		$label = $this->fields[$key]['label'];
@@ -6950,7 +6950,7 @@  discard block
 block discarded – undo
6950 6950
 
6951 6951
 		// Add validation state class
6952 6952
 		if (!empty($validationClass)) {
6953
-			$morecss.= $validationClass;
6953
+			$morecss .= $validationClass;
6954 6954
 		}
6955 6955
 
6956 6956
 		if (in_array($type, array('date'))) {
@@ -7094,8 +7094,8 @@  discard block
 block discarded – undo
7094 7094
 					}
7095 7095
 
7096 7096
 					$sqlwhere = '';
7097
-					$sql = "SELECT " . $keyList;
7098
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7097
+					$sql = "SELECT ".$keyList;
7098
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7099 7099
 					if (!empty($InfoFieldList[4])) {
7100 7100
 						// can use SELECT request
7101 7101
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7111,24 +7111,24 @@  discard block
 block discarded – undo
7111 7111
 
7112 7112
 						//We have to join on extrafield table
7113 7113
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7114
-							$sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra";
7115
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7114
+							$sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra";
7115
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7116 7116
 						} else {
7117
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7117
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7118 7118
 						}
7119 7119
 					} else {
7120 7120
 						$sqlwhere .= ' WHERE 1=1';
7121 7121
 					}
7122 7122
 					// Some tables may have field, some other not. For the moment we disable it.
7123 7123
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7124
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7124
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7125 7125
 					}
7126 7126
 					$sql .= $sqlwhere;
7127 7127
 					//print $sql;
7128 7128
 
7129
-					$sql .= ' ORDER BY ' . implode(', ', $fields_label);
7129
+					$sql .= ' ORDER BY '.implode(', ', $fields_label);
7130 7130
 
7131
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
7131
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
7132 7132
 					$resql = $this->db->query($sql);
7133 7133
 					if ($resql) {
7134 7134
 						$out .= '<option value="0">&nbsp;</option>';
@@ -7144,7 +7144,7 @@  discard block
 block discarded – undo
7144 7144
 							if (count($fields_label) > 1) {
7145 7145
 								$notrans = true;
7146 7146
 								foreach ($fields_label as $field_toshow) {
7147
-									$labeltoshow .= $obj->$field_toshow . ' ';
7147
+									$labeltoshow .= $obj->$field_toshow.' ';
7148 7148
 								}
7149 7149
 							} else {
7150 7150
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7155,12 +7155,12 @@  discard block
 block discarded – undo
7155 7155
 								foreach ($fields_label as $field_toshow) {
7156 7156
 									$translabel = $langs->trans($obj->$field_toshow);
7157 7157
 									if ($translabel != $obj->$field_toshow) {
7158
-										$labeltoshow = dol_trunc($translabel) . ' ';
7158
+										$labeltoshow = dol_trunc($translabel).' ';
7159 7159
 									} else {
7160
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
7160
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
7161 7161
 									}
7162 7162
 								}
7163
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7163
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7164 7164
 							} else {
7165 7165
 								if (!$notrans) {
7166 7166
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -7174,34 +7174,34 @@  discard block
 block discarded – undo
7174 7174
 									$labeltoshow = '(not defined)';
7175 7175
 								}
7176 7176
 								if ($value == $obj->rowid) {
7177
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7177
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7178 7178
 								}
7179 7179
 
7180 7180
 								if (!empty($InfoFieldList[3]) && $parentField) {
7181
-									$parent = $parentName . ':' . $obj->{$parentField};
7181
+									$parent = $parentName.':'.$obj->{$parentField};
7182 7182
 									$isDependList = 1;
7183 7183
 								}
7184 7184
 
7185
-								$out .= '<option value="' . $obj->rowid . '"';
7185
+								$out .= '<option value="'.$obj->rowid.'"';
7186 7186
 								$out .= ($value == $obj->rowid ? ' selected' : '');
7187
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
7188
-								$out .= '>' . $labeltoshow . '</option>';
7187
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
7188
+								$out .= '>'.$labeltoshow.'</option>';
7189 7189
 							}
7190 7190
 
7191 7191
 							$i++;
7192 7192
 						}
7193 7193
 						$this->db->free($resql);
7194 7194
 					} else {
7195
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7195
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7196 7196
 					}
7197 7197
 				} else {
7198 7198
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7199 7199
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7200 7200
 					$out .= '<option value="0">&nbsp;</option>';
7201 7201
 					foreach ($data as $data_key => $data_value) {
7202
-						$out .= '<option value="' . $data_key . '"';
7202
+						$out .= '<option value="'.$data_key.'"';
7203 7203
 						$out .= ($value == $data_key ? ' selected' : '');
7204
-						$out .= '>' . $data_value . '</option>';
7204
+						$out .= '>'.$data_value.'</option>';
7205 7205
 					}
7206 7206
 				}
7207 7207
 			}
@@ -7266,8 +7266,8 @@  discard block
 block discarded – undo
7266 7266
 					}
7267 7267
 
7268 7268
 					$sqlwhere = '';
7269
-					$sql = "SELECT " . $keyList;
7270
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
7269
+					$sql = "SELECT ".$keyList;
7270
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
7271 7271
 					if (!empty($InfoFieldList[4])) {
7272 7272
 						// can use SELECT request
7273 7273
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7283,23 +7283,23 @@  discard block
 block discarded – undo
7283 7283
 
7284 7284
 						// We have to join on extrafield table
7285 7285
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7286
-							$sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra';
7287
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7286
+							$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
7287
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7288 7288
 						} else {
7289
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7289
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7290 7290
 						}
7291 7291
 					} else {
7292 7292
 						$sqlwhere .= ' WHERE 1=1';
7293 7293
 					}
7294 7294
 					// Some tables may have field, some other not. For the moment we disable it.
7295 7295
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7296
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7296
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7297 7297
 					}
7298 7298
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
7299 7299
 					// print $sql;
7300 7300
 
7301 7301
 					$sql .= $sqlwhere;
7302
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
7302
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
7303 7303
 					$resql = $this->db->query($sql);
7304 7304
 					if ($resql) {
7305 7305
 						$num = $this->db->num_rows($resql);
@@ -7317,7 +7317,7 @@  discard block
 block discarded – undo
7317 7317
 							if (count($fields_label) > 1) {
7318 7318
 								$notrans = true;
7319 7319
 								foreach ($fields_label as $field_toshow) {
7320
-									$labeltoshow .= $obj->$field_toshow . ' ';
7320
+									$labeltoshow .= $obj->$field_toshow.' ';
7321 7321
 								}
7322 7322
 							} else {
7323 7323
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7328,9 +7328,9 @@  discard block
 block discarded – undo
7328 7328
 								foreach ($fields_label as $field_toshow) {
7329 7329
 									$translabel = $langs->trans($obj->$field_toshow);
7330 7330
 									if ($translabel != $obj->$field_toshow) {
7331
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
7331
+										$labeltoshow = dol_trunc($translabel, 18).' ';
7332 7332
 									} else {
7333
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
7333
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
7334 7334
 									}
7335 7335
 								}
7336 7336
 
@@ -7353,7 +7353,7 @@  discard block
 block discarded – undo
7353 7353
 								}
7354 7354
 
7355 7355
 								if (!empty($InfoFieldList[3]) && $parentField) {
7356
-									$parent = $parentName . ':' . $obj->{$parentField};
7356
+									$parent = $parentName.':'.$obj->{$parentField};
7357 7357
 									$isDependList = 1;
7358 7358
 								}
7359 7359
 
@@ -7364,14 +7364,14 @@  discard block
 block discarded – undo
7364 7364
 						}
7365 7365
 						$this->db->free($resql);
7366 7366
 
7367
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7367
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7368 7368
 					} else {
7369
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7369
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7370 7370
 					}
7371 7371
 				} else {
7372 7372
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7373 7373
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7374
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7374
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7375 7375
 				}
7376 7376
 			}
7377 7377
 		} elseif ($type == 'link') {
@@ -7452,7 +7452,7 @@  discard block
 block discarded – undo
7452 7452
 			$out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
7453 7453
 		}
7454 7454
 
7455
-		if ($isDependList==1) {
7455
+		if ($isDependList == 1) {
7456 7456
 			$out .= $this->getJSListDependancies('_common');
7457 7457
 		}
7458 7458
 		/* Add comments
@@ -7503,7 +7503,7 @@  discard block
 block discarded – undo
7503 7503
 			$type = 'varchar'; // convert varchar(xx) int varchar
7504 7504
 		}
7505 7505
 		if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
7506
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
7506
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
7507 7507
 		}
7508 7508
 		if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
7509 7509
 			$type = 'link';
@@ -7587,7 +7587,7 @@  discard block
 block discarded – undo
7587 7587
 			$value = $this->getLibStatut(3);
7588 7588
 		} elseif ($type == 'date') {
7589 7589
 			if (!empty($value)) {
7590
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
7590
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
7591 7591
 			} else {
7592 7592
 				$value = '';
7593 7593
 			}
@@ -7625,7 +7625,7 @@  discard block
 block discarded – undo
7625 7625
 				$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
7626 7626
 			}
7627 7627
 		} elseif ($type == 'select') {
7628
-			$value = isset($param['options'][$value])?$param['options'][$value]:'';
7628
+			$value = isset($param['options'][$value]) ? $param['options'][$value] : '';
7629 7629
 		} elseif ($type == 'sellist') {
7630 7630
 			$param_list = array_keys($param['options']);
7631 7631
 			$InfoFieldList = explode(":", $param_list[0]);
@@ -7685,9 +7685,9 @@  discard block
 block discarded – undo
7685 7685
 									$translabel = $langs->trans($obj->$field_toshow);
7686 7686
 								}
7687 7687
 								if ($translabel != $field_toshow) {
7688
-									$value .= dol_trunc($translabel, 18) . ' ';
7688
+									$value .= dol_trunc($translabel, 18).' ';
7689 7689
 								} else {
7690
-									$value .= $obj->$field_toshow . ' ';
7690
+									$value .= $obj->$field_toshow.' ';
7691 7691
 								}
7692 7692
 							}
7693 7693
 						} else {
@@ -7703,7 +7703,7 @@  discard block
 block discarded – undo
7703 7703
 						}
7704 7704
 					}
7705 7705
 				} else {
7706
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
7706
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7707 7707
 
7708 7708
 					$toprint = array();
7709 7709
 					$obj = $this->db->fetch_object($resql);
@@ -7711,7 +7711,7 @@  discard block
 block discarded – undo
7711 7711
 					$c->fetch($obj->rowid);
7712 7712
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
7713 7713
 					foreach ($ways as $way) {
7714
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
7714
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
7715 7715
 					}
7716 7716
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
7717 7717
 				}
@@ -7727,11 +7727,11 @@  discard block
 block discarded – undo
7727 7727
 				$toprint = array();
7728 7728
 				foreach ($value_arr as $keyval => $valueval) {
7729 7729
 					if (!empty($valueval)) {
7730
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
7730
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
7731 7731
 					}
7732 7732
 				}
7733 7733
 				if (!empty($toprint)) {
7734
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
7734
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
7735 7735
 				}
7736 7736
 			}
7737 7737
 		} elseif ($type == 'chkbxlst') {
@@ -7786,9 +7786,9 @@  discard block
 block discarded – undo
7786 7786
 										$translabel = $langs->trans($obj->$field_toshow);
7787 7787
 									}
7788 7788
 									if ($translabel != $field_toshow) {
7789
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
7789
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
7790 7790
 									} else {
7791
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
7791
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
7792 7792
 									}
7793 7793
 								}
7794 7794
 							} else {
@@ -7797,15 +7797,15 @@  discard block
 block discarded – undo
7797 7797
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
7798 7798
 								}
7799 7799
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
7800
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
7800
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
7801 7801
 								} else {
7802
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
7802
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
7803 7803
 								}
7804 7804
 							}
7805 7805
 						}
7806 7806
 					}
7807 7807
 				} else {
7808
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
7808
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7809 7809
 
7810 7810
 					$toprint = array();
7811 7811
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -7814,7 +7814,7 @@  discard block
 block discarded – undo
7814 7814
 							$c->fetch($obj->rowid);
7815 7815
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
7816 7816
 							foreach ($ways as $way) {
7817
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
7817
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
7818 7818
 							}
7819 7819
 						}
7820 7820
 					}
@@ -7948,7 +7948,7 @@  discard block
 block discarded – undo
7948 7948
 		global $langs;
7949 7949
 
7950 7950
 		if (!class_exists('Validate')) {
7951
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
7951
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
7952 7952
 		}
7953 7953
 
7954 7954
 		$this->clearFieldError($fieldKey);
@@ -8162,7 +8162,7 @@  discard block
 block discarded – undo
8162 8162
 				$out .= "\n";
8163 8163
 
8164 8164
 				$nbofextrafieldsshown = 0;
8165
-				$e = 0;	// var to manage the modulo (odd/even)
8165
+				$e = 0; // var to manage the modulo (odd/even)
8166 8166
 
8167 8167
 				$lastseparatorkeyfound = '';
8168 8168
 				$extrafields_collapse_num = '';
@@ -8213,7 +8213,7 @@  discard block
 block discarded – undo
8213 8213
 					}
8214 8214
 
8215 8215
 					$colspan = 0;
8216
-					if (is_array($params) && count($params) > 0 && $display_type=='card') {
8216
+					if (is_array($params) && count($params) > 0 && $display_type == 'card') {
8217 8217
 						if (array_key_exists('cols', $params)) {
8218 8218
 							$colspan = $params['cols'];
8219 8219
 						} elseif (array_key_exists('colspan', $params)) {	// For backward compatibility. Use cols instead now.
@@ -8300,7 +8300,7 @@  discard block
 block discarded – undo
8300 8300
 						$domData .= ' data-targetid="'.$this->id.'"';
8301 8301
 
8302 8302
 						$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
8303
-						if ($display_type=='card') {
8303
+						if ($display_type == 'card') {
8304 8304
 							if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) {
8305 8305
 								$colspan = 0;
8306 8306
 							}
@@ -8411,12 +8411,12 @@  discard block
 block discarded – undo
8411 8411
 								break;
8412 8412
 						}
8413 8413
 
8414
-						$out .= ($display_type=='card' ? '</td>' : '</div>');
8414
+						$out .= ($display_type == 'card' ? '</td>' : '</div>');
8415 8415
 
8416 8416
 						if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) {
8417
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8417
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8418 8418
 						} else {
8419
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8419
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8420 8420
 						}
8421 8421
 
8422 8422
 						$e++;
@@ -8798,7 +8798,7 @@  discard block
 block discarded – undo
8798 8798
 							if ($val['share']) {
8799 8799
 								if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
8800 8800
 									$return .= '<!-- Show original file (thumb not yet available with shared links) -->';
8801
-									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
8801
+									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
8802 8802
 								} else {
8803 8803
 									$return .= '<!-- Show original file -->';
8804 8804
 									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
@@ -8810,7 +8810,7 @@  discard block
 block discarded – undo
8810 8810
 						} else {
8811 8811
 							if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
8812 8812
 								$return .= '<!-- Show thumb -->';
8813
-								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
8813
+								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
8814 8814
 							} else {
8815 8815
 								$return .= '<!-- Show original file -->';
8816 8816
 								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
@@ -9219,7 +9219,7 @@  discard block
 block discarded – undo
9219 9219
 						continue;
9220 9220
 					}
9221 9221
 				}
9222
-				$keys_with_alias[] = $alias . '.' . $fieldname;
9222
+				$keys_with_alias[] = $alias.'.'.$fieldname;
9223 9223
 			}
9224 9224
 			return implode(',', $keys_with_alias);
9225 9225
 		} else {
@@ -9335,7 +9335,7 @@  discard block
 block discarded – undo
9335 9335
 		if (!$error) {
9336 9336
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
9337 9337
 			$sql .= " (".implode(", ", $keys).')';
9338
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
9338
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
9339 9339
 
9340 9340
 			$res = $this->db->query($sql);
9341 9341
 			if (!$res) {
@@ -10132,7 +10132,7 @@  discard block
 block discarded – undo
10132 10132
 		// Process
10133 10133
 		foreach ($to_del as $del) {
10134 10134
 			if ($c->fetch($del) > 0) {
10135
-				$result=$c->del_type($this, $type_categ);
10135
+				$result = $c->del_type($this, $type_categ);
10136 10136
 				if ($result < 0) {
10137 10137
 					$error++;
10138 10138
 					$this->error = $c->error;
Please login to merge, or discard this patch.
htdocs/core/class/commoninvoice.class.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
 	const STATUS_ABANDONED = 3;
104 104
 
105 105
 
106
-	public $totalpaid;			// duplicate with sumpayed
107
-	public $totaldeposits;		// duplicate with sumdeposit
108
-	public $totalcreditnotes;	// duplicate with sumcreditnote
106
+	public $totalpaid; // duplicate with sumpayed
107
+	public $totaldeposits; // duplicate with sumdeposit
108
+	public $totalcreditnotes; // duplicate with sumcreditnote
109 109
 
110 110
 	public $sumpayed;
111 111
 	public $sumpayed_multicurrency;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			$sharedentity = 'facture_fourn';
358 358
 		}
359 359
 
360
-		$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3 . $field4;
360
+		$sql = "SELECT p.ref, pf.amount, pf.multicurrency_amount, p.fk_paiement, p.datep, p.num_paiement as num, t.code".$field3.$field4;
361 361
 		$sql .= " FROM ".$this->db->prefix().$table." as pf, ".$this->db->prefix().$table2." as p, ".$this->db->prefix()."c_paiement as t";
362 362
 		$sql .= " WHERE pf.".$field." = ".((int) $this->id);
363 363
 		$sql .= " AND pf.".$field2." = p.rowid";
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 		if ($this->status > self::STATUS_DRAFT && $this->paye == 0) {
956 956
 			// Get the default payment mode for BAN payment of the third party
957 957
 			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
958
-			$bac = new CompanyBankAccount($this->db);	// table societe_rib
958
+			$bac = new CompanyBankAccount($this->db); // table societe_rib
959 959
 			$result = $bac->fetch(0, $this->socid, 1, 'ban');
960 960
 			if ($result <= 0 || empty($bac->id)) {
961 961
 				$this->error = $langs->trans("ThirdpartyHasNoDefaultBanAccount");
@@ -969,12 +969,12 @@  discard block
 block discarded – undo
969 969
 			$sql .= " FROM ".$this->db->prefix()."prelevement_demande";
970 970
 			$sql .= " WHERE rowid = ".((int) $did);
971 971
 			if ($type != 'bank-transfer' && $type != 'credit-transfer') {
972
-				$sql .= " AND fk_facture = ".((int) $this->id);		// Add a protection to not pay another invoice than current one
972
+				$sql .= " AND fk_facture = ".((int) $this->id); // Add a protection to not pay another invoice than current one
973 973
 			}
974 974
 			if ($type != 'direct-debit') {
975
-				$sql .= " AND fk_facture_fourn = ".((int) $this->id);		// Add a protection to not pay another invoice than current one
975
+				$sql .= " AND fk_facture_fourn = ".((int) $this->id); // Add a protection to not pay another invoice than current one
976 976
 			}
977
-			$sql .= " AND traite = 0";	// To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)
977
+			$sql .= " AND traite = 0"; // To not process payment request that were already converted into a direct debit or credit transfer order (Note: fk_prelevement_bons is also empty when traite = 0)
978 978
 
979 979
 			dol_syslog(get_class($this)."::makeStripeSepaRequest load requests to process", LOG_DEBUG);
980 980
 			$resql = $this->db->query($sql);
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
 				if (is_numeric($amount) && $amount != 0) {
992 992
 					require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php';
993
-					$companypaymentmode = new CompanyPaymentMode($this->db);	// table societe_rib
993
+					$companypaymentmode = new CompanyPaymentMode($this->db); // table societe_rib
994 994
 					$companypaymentmode->fetch($bac->id);
995 995
 
996 996
 					$this->stripechargedone = 0;
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 
1001 1001
 					$currency = $conf->currency;
1002 1002
 
1003
-					$errorforinvoice = 0;     // We reset the $errorforinvoice at each invoice loop
1003
+					$errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop
1004 1004
 
1005 1005
 					$this->fetch_thirdparty();
1006 1006
 
1007
-					dol_syslog("--- Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG);
1007
+					dol_syslog("--- Process payment request amount=".$amount." thirdparty_id=".$this->thirdparty->id.", thirdparty_name=".$this->thirdparty->name." ban id=".$bac->id, LOG_DEBUG);
1008 1008
 
1009 1009
 					//$alreadypayed = $this->getSommePaiement();
1010 1010
 					//$amount_credit_notes_included = $this->getSumCreditNotesUsed();
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 						$amountstripe = $amountstripe * 100;
1020 1020
 					}
1021 1021
 
1022
-					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');		// Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr.
1022
+					$fk_bank_account = getDolGlobalInt('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS'); // Bank account used for SEPA direct debit or credit transfer. Must be the Stripe account in Dolibarr.
1023 1023
 					if (!($fk_bank_account > 0)) {
1024 1024
 						$error++;
1025 1025
 						$errorforinvoice++;
@@ -1075,42 +1075,42 @@  discard block
 block discarded – undo
1075 1075
 								}
1076 1076
 
1077 1077
 								//var_dump($companypaymentmode);
1078
-								dol_syslog("We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG);
1078
+								dol_syslog("We will try to pay with companypaymentmodeid=".$companypaymentmode->id." stripe_card_ref=".$companypaymentmode->stripe_card_ref." mode=".$companypaymentmode->status, LOG_DEBUG);
1079 1079
 
1080 1080
 								$thirdparty = new Societe($this->db);
1081 1081
 								$resultthirdparty = $thirdparty->fetch($this->socid);
1082 1082
 
1083
-								include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php';        // This include the include of htdocs/stripe/config.php
1083
+								include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php
1084 1084
 								// So it inits or erases the $stripearrayofkeysbyenv
1085 1085
 								$stripe = new Stripe($this->db);
1086 1086
 
1087 1087
 								if (empty($savstripearrayofkeysbyenv)) $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1088
-								dol_syslog("makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1088
+								dol_syslog("makeStripeSepaRequest Current Stripe environment is ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1089 1089
 								dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']);
1090 1090
 
1091 1091
 								$foundalternativestripeaccount = '';
1092 1092
 
1093 1093
 								// Force stripe to another value (by default this value is empty)
1094
-								if (! empty($forcestripe)) {
1094
+								if (!empty($forcestripe)) {
1095 1095
 									dol_syslog("makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1096 1096
 
1097 1097
 									$tmparray = explode('@', $forcestripe);
1098
-									if (! empty($tmparray[1])) {
1098
+									if (!empty($tmparray[1])) {
1099 1099
 										$tmparray2 = explode(':', $tmparray[1]);
1100
-										if (! empty($tmparray2[1])) {
1100
+										if (!empty($tmparray2[1])) {
1101 1101
 											$stripearrayofkeysbyenv[$servicestatus]["publishable_key"] = $tmparray2[0];
1102 1102
 											$stripearrayofkeysbyenv[$servicestatus]["secret_key"] = $tmparray2[1];
1103 1103
 
1104 1104
 											$stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1105 1105
 											\Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']);
1106 1106
 
1107
-											$foundalternativestripeaccount = $tmparray[0];    // Store the customer id
1107
+											$foundalternativestripeaccount = $tmparray[0]; // Store the customer id
1108 1108
 
1109 1109
 											dol_syslog("makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount." publishable_key=".$stripearrayofkeys['publishable_key'], LOG_DEBUG);
1110 1110
 										}
1111 1111
 									}
1112 1112
 
1113
-									if (! $foundalternativestripeaccount) {
1113
+									if (!$foundalternativestripeaccount) {
1114 1114
 										$stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1115 1115
 
1116 1116
 										$stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 									dol_syslog("makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys['publishable_key'], LOG_DEBUG);
1126 1126
 								}
1127 1127
 
1128
-								$stripeacc = $stripe->getStripeAccount($service, $this->socid);								// Get Stripe OAuth connect account if it exists (no network access here)
1128
+								$stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here)
1129 1129
 
1130 1130
 								if ($foundalternativestripeaccount) {
1131 1131
 									if (empty($stripeacc)) {				// If the Stripe connect account not set, we use common API usage
@@ -1135,7 +1135,7 @@  discard block
 block discarded – undo
1135 1135
 									}
1136 1136
 								} else {
1137 1137
 									$customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1138
-									if (empty($customer) && ! empty($stripe->error)) {
1138
+									if (empty($customer) && !empty($stripe->error)) {
1139 1139
 										$this->errors[] = $stripe->error;
1140 1140
 									}
1141 1141
 									/*if (!empty($customer) && empty($customer->sources)) {
@@ -1162,15 +1162,15 @@  discard block
 block discarded – undo
1162 1162
 										}
1163 1163
 
1164 1164
 										if ($stripecard) {  // Can be src_... (for sepa) or pm_... (new card mode). Note that card_... (old card mode) should not happen here.
1165
-											$FULLTAG = 'DID='.$did.'-INV=' . $this->id . '-CUS=' . $thirdparty->id;
1166
-											$description = 'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG . ' did='.$did.' ref=' . $this->ref;
1165
+											$FULLTAG = 'DID='.$did.'-INV='.$this->id.'-CUS='.$thirdparty->id;
1166
+											$description = 'Stripe payment from makeStripeSepaRequest: '.$FULLTAG.' did='.$did.' ref='.$this->ref;
1167 1167
 
1168 1168
 											$stripefailurecode = '';
1169 1169
 											$stripefailuremessage = '';
1170 1170
 											$stripefailuredeclinecode = '';
1171 1171
 
1172 1172
 											// Using new SCA method
1173
-											dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1173
+											dol_syslog("* Create payment on SEPA ".$stripecard->id.", amounttopay=".$amounttopay.", amountstripe=".$amountstripe.", FULLTAG=".$FULLTAG, LOG_DEBUG);
1174 1174
 
1175 1175
 											// Create payment intent and charge payment (confirmnow = true)
1176 1176
 											$paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1, 1, $did);
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 												$charge->failure_message = $stripe->error;
1192 1192
 												$charge->failure_declinecode = $stripe->declinecode;
1193 1193
 												$stripefailurecode = $stripe->code;
1194
-												$stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
1194
+												$stripefailuremessage = 'Action required. Contact the support at '; // . $conf->global->SELLYOURSAAS_MAIN_EMAIL;
1195 1195
 												$stripefailuredeclinecode = $stripe->declinecode;
1196 1196
 											} else {
1197 1197
 												dol_syslog(var_export($paymentintent, true), LOG_DEBUG);
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 											// Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...)
1214 1214
 											if (empty($charge) || $charge->status == 'failed') {
1215
-												dol_syslog('Failed to charge payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1215
+												dol_syslog('Failed to charge payment mode '.$stripecard->id.' stripefailurecode='.$stripefailurecode.' stripefailuremessage='.$stripefailuremessage.' stripefailuredeclinecode='.$stripefailuredeclinecode, LOG_WARNING);
1216 1216
 
1217 1217
 												// Save a stripe payment was in error
1218 1218
 												$this->stripechargeerror++;
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
 														$errauthenticationmessage = $langs->trans("ErrSCAAuthentication");
1226 1226
 														$errmsg = $errauthenticationmessage;
1227 1227
 													} elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) {
1228
-														$errmsg .= ': ' . $charge->failure_code;
1229
-														$errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message;
1228
+														$errmsg .= ': '.$charge->failure_code;
1229
+														$errmsg .= ($charge->failure_message ? ' - ' : '').' '.$charge->failure_message;
1230 1230
 														if (empty($stripefailurecode)) {
1231 1231
 															$stripefailurecode = $charge->failure_code;
1232 1232
 														}
@@ -1234,8 +1234,8 @@  discard block
 block discarded – undo
1234 1234
 															$stripefailuremessage = $charge->failure_message;
1235 1235
 														}
1236 1236
 													} else {
1237
-														$errmsg .= ': failure_code=' . $charge->failure_code;
1238
-														$errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message;
1237
+														$errmsg .= ': failure_code='.$charge->failure_code;
1238
+														$errmsg .= ($charge->failure_message ? ' - ' : '').' failure_message='.$charge->failure_message;
1239 1239
 														if (empty($stripefailurecode)) {
1240 1240
 															$stripefailurecode = $charge->failure_code;
1241 1241
 														}
@@ -1244,24 +1244,24 @@  discard block
 block discarded – undo
1244 1244
 														}
1245 1245
 													}
1246 1246
 												} else {
1247
-													$errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage;
1248
-													$errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : '');
1247
+													$errmsg .= ': '.$stripefailurecode.' - '.$stripefailuremessage;
1248
+													$errmsg .= ($stripefailuredeclinecode ? ' - '.$stripefailuredeclinecode : '');
1249 1249
 												}
1250 1250
 
1251
-												$description = 'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1252
-												$postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')';
1251
+												$description = 'Stripe payment ERROR from makeStripeSepaRequest: '.$FULLTAG;
1252
+												$postactionmessages[] = $errmsg.' ('.$stripearrayofkeys['publishable_key'].')';
1253 1253
 												$this->errors[] = $errmsg;
1254 1254
 											} else {
1255 1255
 												dol_syslog('Successfuly request '.$type.' '.$stripecard->id);
1256 1256
 
1257
-												$postactionmessages[] = 'Success to request '.$type.' (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')';
1257
+												$postactionmessages[] = 'Success to request '.$type.' ('.$charge->id.' with '.$stripearrayofkeys['publishable_key'].')';
1258 1258
 
1259 1259
 												// Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments
1260 1260
 												// even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit.
1261 1261
 												$this->stripechargedone++;
1262 1262
 
1263 1263
 												// Default description used for label of event. Will be overwrite by another value later.
1264
-												$description = 'Stripe payment request OK (' . $charge->id . ') from makeStripeSepaRequest: ' . $FULLTAG;
1264
+												$description = 'Stripe payment request OK ('.$charge->id.') from makeStripeSepaRequest: '.$FULLTAG;
1265 1265
 											}
1266 1266
 
1267 1267
 											$object = $this;
@@ -1270,8 +1270,8 @@  discard block
 block discarded – undo
1270 1270
 											if (empty($charge) || $charge->status == 'failed') {
1271 1271
 												$actioncode = 'PAYMENT_STRIPE_KO';
1272 1272
 												$extraparams = $stripefailurecode;
1273
-												$extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage;
1274
-												$extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode;
1273
+												$extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '').$stripefailuremessage;
1274
+												$extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '').$stripefailuredeclinecode;
1275 1275
 											} else {
1276 1276
 												$actioncode = 'PAYMENT_STRIPE_OK';
1277 1277
 												$extraparams = '';
@@ -1279,13 +1279,13 @@  discard block
 block discarded – undo
1279 1279
 										} else {
1280 1280
 											$error++;
1281 1281
 											$errorforinvoice++;
1282
-											dol_syslog("No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1283
-											$this->errors[] = 'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1282
+											dol_syslog("No ban payment method found for this stripe customer ".$customer->id, LOG_WARNING);
1283
+											$this->errors[] = 'Failed to get direct debit payment method for stripe customer = '.$customer->id;
1284 1284
 
1285 1285
 											$description = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1286 1286
 											$stripefailurecode = 'BADPAYMENTMODE';
1287 1287
 											$stripefailuremessage = 'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1288
-											$postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')';
1288
+											$postactionmessages[] = $description.' ('.$stripearrayofkeys['publishable_key'].')';
1289 1289
 
1290 1290
 											$object = $this;
1291 1291
 
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 									}
1306 1306
 								} else {	// Else of the   if ($resultthirdparty > 0 && ! empty($customer)) {
1307 1307
 									if ($resultthirdparty <= 0) {
1308
-										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1309
-										$this->errors[] = 'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1308
+										dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = '.$thirdparty->id, LOG_WARNING);
1309
+										$this->errors[] = 'Failed to load Stripe account for thirdparty_id = '.$thirdparty->id;
1310 1310
 									} else { // $customer stripe not found
1311
-										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
1312
-										$this->errors[] = 'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
1311
+										dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING);
1312
+										$this->errors[] = 'Failed to get Stripe account id for thirdparty_id = '.$thirdparty->id." in mode ".$servicestatus." in Stripe env ".$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];
1313 1313
 									}
1314 1314
 									$error++;
1315 1315
 									$errorforinvoice++;
@@ -1326,24 +1326,24 @@  discard block
 block discarded – undo
1326 1326
 								}
1327 1327
 
1328 1328
 								if ($description) {
1329
-									dol_syslog("* Record event for credit transfer or direct debit request result - " . $description);
1329
+									dol_syslog("* Record event for credit transfer or direct debit request result - ".$description);
1330 1330
 									require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
1331 1331
 
1332 1332
 									// Insert record of payment (success or error)
1333 1333
 									$actioncomm = new ActionComm($this->db);
1334 1334
 
1335
-									$actioncomm->type_code = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
1336
-									$actioncomm->code = 'AC_' . $actioncode;
1335
+									$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
1336
+									$actioncomm->code = 'AC_'.$actioncode;
1337 1337
 									$actioncomm->label = $description;
1338 1338
 									$actioncomm->note_private = join(",\n", $postactionmessages);
1339 1339
 									$actioncomm->fk_project = $this->fk_project;
1340 1340
 									$actioncomm->datep = $now;
1341 1341
 									$actioncomm->datef = $now;
1342
-									$actioncomm->percentage = -1;   // Not applicable
1342
+									$actioncomm->percentage = -1; // Not applicable
1343 1343
 									$actioncomm->socid = $thirdparty->id;
1344 1344
 									$actioncomm->contactid = 0;
1345
-									$actioncomm->authorid = $user->id;   // User saving action
1346
-									$actioncomm->userownerid = $user->id;	// Owner of action
1345
+									$actioncomm->authorid = $user->id; // User saving action
1346
+									$actioncomm->userownerid = $user->id; // Owner of action
1347 1347
 									// Fields when action is a real email (content is already into note)
1348 1348
 									/*$actioncomm->email_msgid = $object->email_msgid;
1349 1349
 									 $actioncomm->email_from  = $object->email_from;
@@ -1365,14 +1365,14 @@  discard block
 block discarded – undo
1365 1365
 							} catch (Exception $e) {
1366 1366
 								$error++;
1367 1367
 								$errorforinvoice++;
1368
-								dol_syslog('Error ' . $e->getMessage(), LOG_ERR);
1369
-								$this->errors[] = 'Error ' . $e->getMessage();
1368
+								dol_syslog('Error '.$e->getMessage(), LOG_ERR);
1369
+								$this->errors[] = 'Error '.$e->getMessage();
1370 1370
 							}
1371 1371
 						} else {	// If remain to pay is null
1372 1372
 							$error++;
1373 1373
 							$errorforinvoice++;
1374
-							dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1375
-							$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
1374
+							dol_syslog("Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1375
+							$this->errors[] = "Remain to pay is null for the invoice ".$this->id." ".$this->ref.". Why is the invoice not classified 'Paid' ?";
1376 1376
 						}
1377 1377
 					}
1378 1378
 
@@ -1512,10 +1512,10 @@  discard block
 block discarded – undo
1512 1512
 		$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring;
1513 1513
 		$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
1514 1514
 		$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;
1515
-		$s .= '';					// Hash of xml invoice
1516
-		$s .= '';					// ecda signature
1517
-		$s .= '';					// ecda public key
1518
-		$s .= '';					// ecda signature of public key stamp
1515
+		$s .= ''; // Hash of xml invoice
1516
+		$s .= ''; // ecda signature
1517
+		$s .= ''; // ecda public key
1518
+		$s .= ''; // ecda signature of public key stamp
1519 1519
 
1520 1520
 		$s = base64_encode($s);
1521 1521
 
@@ -1583,8 +1583,8 @@  discard block
 block discarded – undo
1583 1583
 			$s .= "S\n";
1584 1584
 			$s .= dol_trunc($bankaccount->proprio, 70, 'right', 'UTF-8', 1)."\n";
1585 1585
 			$addresslinearray = explode("\n", $bankaccount->owner_address);
1586
-			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1587
-			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1586
+			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1587
+			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1588 1588
 			/*$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
1589 1589
 			$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
1590 1590
 			$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";*/
@@ -1592,8 +1592,8 @@  discard block
 block discarded – undo
1592 1592
 			$s .= "S\n";
1593 1593
 			$s .= dol_trunc($mysoc->name, 70, 'right', 'UTF-8', 1)."\n";
1594 1594
 			$addresslinearray = explode("\n", $mysoc->address);
1595
-			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1596
-			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1595
+			$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1596
+			$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1597 1597
 			$s .= dol_trunc($mysoc->zip, 16, 'right', 'UTF-8', 1)."\n";
1598 1598
 			$s .= dol_trunc($mysoc->town, 35, 'right', 'UTF-8', 1)."\n";
1599 1599
 			$s .= dol_trunc($mysoc->country_code, 2, 'right', 'UTF-8', 1)."\n";
@@ -1613,14 +1613,14 @@  discard block
 block discarded – undo
1613 1613
 		$s .= "S\n";
1614 1614
 		$s .= dol_trunc($this->thirdparty->name, 70, 'right', 'UTF-8', 1)."\n";
1615 1615
 		$addresslinearray = explode("\n", $this->thirdparty->address);
1616
-		$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n";		// address line 1
1617
-		$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n";		// address line 2
1616
+		$s .= dol_trunc(empty($addresslinearray[1]) ? '' : $addresslinearray[1], 70, 'right', 'UTF-8', 1)."\n"; // address line 1
1617
+		$s .= dol_trunc(empty($addresslinearray[2]) ? '' : $addresslinearray[2], 70, 'right', 'UTF-8', 1)."\n"; // address line 2
1618 1618
 		$s .= dol_trunc($this->thirdparty->zip, 16, 'right', 'UTF-8', 1)."\n";
1619 1619
 		$s .= dol_trunc($this->thirdparty->town, 35, 'right', 'UTF-8', 1)."\n";
1620 1620
 		$s .= dol_trunc($this->thirdparty->country_code, 2, 'right', 'UTF-8', 1)."\n";
1621 1621
 		// ID of payment
1622
-		$s .= "NON\n";			// NON or QRR
1623
-		$s .= "\n";				// QR Code reference if previous field is QRR
1622
+		$s .= "NON\n"; // NON or QRR
1623
+		$s .= "\n"; // QR Code reference if previous field is QRR
1624 1624
 		// Free text
1625 1625
 		if ($complementaryinfo) {
1626 1626
 			$s .= $complementaryinfo."\n";
Please login to merge, or discard this patch.
htdocs/core/class/html.formsms.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -186,10 +186,10 @@
 block discarded – undo
186 186
 			} else {
187 187
 				print '<tr><td class="'.$morecss.'">'.$langs->trans("SmsFrom")."</td><td>";
188 188
 				if (getDolGlobalString('MAIN_SMS_SENDMODE')) {
189
-					$sendmode = getDolGlobalString('MAIN_SMS_SENDMODE');	// $conf->global->MAIN_SMS_SENDMODE looks like a value 'module'
190
-					$classmoduleofsender = getDolGlobalString('MAIN_MODULE_'.strtoupper($sendmode).'_SMS', $sendmode);	// $conf->global->MAIN_MODULE_XXX_SMS looks like a value 'class@module'
189
+					$sendmode = getDolGlobalString('MAIN_SMS_SENDMODE'); // $conf->global->MAIN_SMS_SENDMODE looks like a value 'module'
190
+					$classmoduleofsender = getDolGlobalString('MAIN_MODULE_'.strtoupper($sendmode).'_SMS', $sendmode); // $conf->global->MAIN_MODULE_XXX_SMS looks like a value 'class@module'
191 191
 					if ($classmoduleofsender == 'ovh') {
192
-						$classmoduleofsender = 'ovhsms@ovh';	// For backward compatibility
192
+						$classmoduleofsender = 'ovhsms@ovh'; // For backward compatibility
193 193
 					}
194 194
 
195 195
 					$tmp = explode('@', $classmoduleofsender);
Please login to merge, or discard this patch.
htdocs/mrp/class/mo.class.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
119 119
 		'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
120 120
 		'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')),
121
-		'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1,'showoncombobox'=>0),
121
+		'fk_parent_line' => array('type'=>'integer:MoLine:mrp/class/mo.class.php', 'label'=>'ParentMo', 'enabled'=>1, 'visible'=>0, 'position'=>1020, 'default'=>0, 'notnull'=>0, 'index'=>1, 'showoncombobox'=>0),
122 122
 	);
123 123
 	public $rowid;
124 124
 	public $entity;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 		}
333 333
 
334 334
 		if (!$error) {
335
-			$result = $this->createProduction($user, $notrigger);	// Insert lines from BOM
335
+			$result = $this->createProduction($user, $notrigger); // Insert lines from BOM
336 336
 			if ($result <= 0) {
337 337
 				$error++;
338 338
 			}
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 							if ($line->qty_frozen) {
738 738
 								$moline->qty = $line->qty; // Qty to consume does not depends on quantity to produce
739 739
 							} else {
740
-								$moline->qty = price2num(($line->qty / ( !empty($bom->qty) ? $bom->qty : 1 ) ) * $this->qty / ( !empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and  more presition
740
+								$moline->qty = price2num(($line->qty / (!empty($bom->qty) ? $bom->qty : 1)) * $this->qty / (!empty($line->efficiency) ? $line->efficiency : 1), 'MS'); // Calculate with Qty to produce and  more presition
741 741
 							}
742 742
 							if ($moline->qty <= 0) {
743 743
 								$error++;
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 		$oldQty = $this->oldQty;
794 794
 		$newQty = $this->qty;
795 795
 		if ($newQty != $oldQty && !empty($this->oldQty)) {
796
-			$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "mrp_production WHERE fk_mo = " . (int) $this->id;
796
+			$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production WHERE fk_mo = ".(int) $this->id;
797 797
 			$resql = $this->db->query($sql);
798 798
 			if ($resql) {
799 799
 				while ($obj = $this->db->fetch_object($resql)) {
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 					if ($moLine->role == 'toconsume' || $moLine->role == 'toproduce') {
805 805
 						if (empty($moLine->qty_frozen)) {
806 806
 							$qty = $newQty * $moLine->qty / $oldQty;
807
-							$moLine->qty = price2num($qty * (!empty($line->efficiency) ? $line->efficiency : 1 ), 'MS'); // Calculate with Qty to produce and efficiency
807
+							$moLine->qty = price2num($qty * (!empty($line->efficiency) ? $line->efficiency : 1), 'MS'); // Calculate with Qty to produce and efficiency
808 808
 							$res = $moLine->update($user);
809 809
 							if (!$res) $error++;
810 810
 						}
@@ -1192,13 +1192,13 @@  discard block
 block discarded – undo
1192 1192
 			$datas['qty'] = '<br><b>'.$langs->trans('QtyToProduce').':</b> '.$this->qty;
1193 1193
 		}
1194 1194
 		if (!$nofetch && isset($this->fk_product)) {
1195
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
1195
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
1196 1196
 			$product = new Product($this->db);
1197 1197
 			$product->fetch($this->fk_product);
1198 1198
 			$datas['product'] = '<br><b>'.$langs->trans('Product').':</b> '.$product->getNomUrl(1, '', 0, -1, 1);
1199 1199
 		}
1200 1200
 		if (!$nofetch && isset($this->fk_warehouse)) {
1201
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
1201
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
1202 1202
 			$warehouse = new Entrepot($this->db);
1203 1203
 			$warehouse->fetch($this->fk_warehouse);
1204 1204
 			$datas['warehouse'] = '<br><b>'.$langs->trans('WarehouseForProduction').':</b> '.$warehouse->getNomUrl(1, '', 0, 1);
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 				$label = $langs->trans("ShowMo");
1265 1265
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1266 1266
 			}
1267
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
1267
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
1268 1268
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
1269 1269
 		} else {
1270 1270
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@@ -1633,9 +1633,9 @@  discard block
 block discarded – undo
1633 1633
 		$error = 0;
1634 1634
 
1635 1635
 		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_mo as mo_child";
1636
-		$sql.= " WHERE fk_parent_line IN ";
1637
-		$sql.= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent";
1638
-		$sql.= " WHERE fk_mo=".((int) $this->id).")";
1636
+		$sql .= " WHERE fk_parent_line IN ";
1637
+		$sql .= " (SELECT rowid FROM ".MAIN_DB_PREFIX."mrp_production as line_parent";
1638
+		$sql .= " WHERE fk_mo=".((int) $this->id).")";
1639 1639
 
1640 1640
 		$resql = $this->db->query($sql);
1641 1641
 
@@ -1670,8 +1670,8 @@  discard block
 block discarded – undo
1670 1670
 		$error = 0;
1671 1671
 
1672 1672
 		$sql = "SELECT lineparent.fk_mo as id_moparent FROM ".MAIN_DB_PREFIX."mrp_mo as mo";
1673
-		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid";
1674
-		$sql.= " WHERE mo.rowid = ".((int) $this->id);
1673
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mrp_production lineparent ON mo.fk_parent_line = lineparent.rowid";
1674
+		$sql .= " WHERE mo.rowid = ".((int) $this->id);
1675 1675
 
1676 1676
 		$resql = $this->db->query($sql);
1677 1677
 
Please login to merge, or discard this patch.
htdocs/hrm/position.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
 
28 28
 // Load Dolibarr environment
29 29
 require '../main.inc.php';
30
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
31
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
37
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
38
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
37
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39 39
 
40 40
 
41 41
 // Load translation files required by the page
42 42
 $langs->loadLangs(array("hrm", "other", 'products'));
43 43
 
44
-$action 	 = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
44
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
45 45
 $massaction  = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
46 46
 $show_files  = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
47
-$confirm 	 = GETPOST('confirm', 'alpha'); // Result of a confirmation
48
-$cancel 	 = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49
-$toselect 	 = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
47
+$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
48
+$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
50 50
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobpositionlist'; // To manage different context of search
51 51
 $optioncss 	 = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
52 52
 $backtopage  = GETPOST('backtopage', 'alpha');
53 53
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
54 54
 
55
-$id		 = GETPOST('id', 'int');
56
-$ref 	 = GETPOST('ref', 'alpha');
55
+$id = GETPOST('id', 'int');
56
+$ref = GETPOST('ref', 'alpha');
57 57
 $fk_job  = GETPOST('fk_job', 'int');
58 58
 $fk_user = GETPOST('fk_user', 'int');
59 59
 //$start_date = date('Y-m-d', GETPOST('date_startyear', 'int').'-'.GETPOST('date_startmonth', 'int').'-'.GETPOST('date_startday', 'int'));
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 $limit 	     = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
65 65
 $sortfield   = GETPOST('sortfield', 'aZ09comma');
66 66
 $sortorder   = GETPOST('sortorder', 'aZ09comma');
67
-$page 	     = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
67
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
68 68
 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
69 69
 	// If $page is not defined, or '' or -1 or if we click on clear filters
70 70
 	$page = 0;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 $object = new Job($db);
79 79
 $objectposition = new Position($db);
80 80
 $extrafields = new ExtraFields($db);
81
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
81
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
82 82
 $hookmanager->initHooks(array('jobpositioncard', 'globalcard')); // Note that conf->hooks_modules contains array
83 83
 
84 84
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
 // Default sort order (if not yet defined by previous GETPOST)
92 92
 if (!$sortfield) {
93
-	reset($objectposition->fields);                    // Reset is required to avoid key() to return null.
94
-	$sortfield = "t." . key($objectposition->fields); // Set here default search field. By default 1st field in definition.
93
+	reset($objectposition->fields); // Reset is required to avoid key() to return null.
94
+	$sortfield = "t.".key($objectposition->fields); // Set here default search field. By default 1st field in definition.
95 95
 }
96 96
 if (!$sortorder) {
97 97
 	$sortorder = "ASC";
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
102 102
 $search = array();
103 103
 foreach ($objectposition->fields as $key => $val) {
104
-	if (GETPOST('search_' . $key, 'alpha') !== '') {
105
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
104
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
105
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
106 106
 	}
107 107
 	if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
108
-		$search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
109
-		$search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
108
+		$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
109
+		$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
110 110
 	}
111 111
 }
112 112
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 $fieldstosearchall = array();
115 115
 foreach ($objectposition->fields as $key => $val) {
116 116
 	if (!empty($val['searchall'])) {
117
-		$fieldstosearchall['t.' . $key] = $val['label'];
117
+		$fieldstosearchall['t.'.$key] = $val['label'];
118 118
 	}
119 119
 }
120 120
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	// If $val['visible']==0, then we never show the field
125 125
 	if (!empty($val['visible'])) {
126 126
 		$visible = (int) dol_eval($val['visible'], 1, 1, '1');
127
-		$arrayfields['t.' . $key] = array(
127
+		$arrayfields['t.'.$key] = array(
128 128
 			'label' => $val['label'],
129 129
 			'checked' => (($visible < 0) ? 0 : 1),
130 130
 			'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 }
136 136
 // Extra fields
137
-include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
137
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
138 138
 
139 139
 $objectposition->fields = dol_sort_array($objectposition->fields, 'position');
140 140
 $arrayfields = dol_sort_array($arrayfields, 'position');
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 
144 144
 
145 145
 // Load object
146
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
146
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
147 147
 
148 148
 // Permissions
149 149
 $permissiontoread = $user->rights->hrm->all->read;
150 150
 $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
151 151
 $permissiontodelete = $user->rights->hrm->all->delete;
152
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position';
152
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position';
153 153
 
154 154
 // Security check (enable the most restrictive one)
155 155
 //if ($user->socid > 0) accessforbidden();
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 				$backtopage = $backurlforlist;
186 186
 			} else {
187 187
 				if ($fk_job > 0) {
188
-					$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__');
188
+					$backtopage = dol_buildpath('/hrm/position.php', 1).'?fk_job='.($fk_job > 0 ? $fk_job : '__ID__');
189 189
 				} else {
190
-					$backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=__ID__';
190
+					$backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id=__ID__';
191 191
 				}
192 192
 			}
193 193
 		}
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
 	$object = new Position($db);
201 201
 
202 202
 	// Selection of new fields
203
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
203
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
204 204
 
205 205
 	// Purge search criteria
206 206
 	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
207 207
 		foreach ($object->fields as $key => $val) {
208 208
 			$search[$key] = '';
209 209
 			if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
210
-				$search[$key . '_dtstart'] = '';
211
-				$search[$key . '_dtend'] = '';
210
+				$search[$key.'_dtstart'] = '';
211
+				$search[$key.'_dtend'] = '';
212 212
 			}
213 213
 		}
214 214
 		$toselect = array();
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	$objectclass = 'Position';
224 224
 	$objectlabel = 'Position';
225 225
 	$uploaddir = $conf->hrm->dir_output;
226
-	include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php';
226
+	include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
227 227
 
228
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
228
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
229 229
 
230 230
 	$object = $job;
231 231
 }
@@ -245,30 +245,30 @@  discard block
 block discarded – undo
245 245
 	$object = new Position($db);
246 246
 	// Fetch optionals attributes and labels
247 247
 	$extrafields->fetch_name_optionals_label($object->table_element);
248
-	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto);
248
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_'.$object->picto);
249 249
 
250
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
251
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
250
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
251
+	print '<input type="hidden" name="token" value="'.newToken().'">';
252 252
 	print '<input type="hidden" name="action" value="add">';
253 253
 	if ($backtopage) {
254
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
254
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
255 255
 	}
256 256
 
257 257
 	if ($backtopageforcancel) {
258
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
258
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
259 259
 	}
260 260
 
261 261
 	print dol_get_fiche_head(array(), '');
262 262
 
263
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
263
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
264 264
 
265 265
 	// Common attributes
266
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
266
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
267 267
 
268 268
 	// Other attributes
269
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
269
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
270 270
 
271
-	print '</table>' . "\n";
271
+	print '</table>'."\n";
272 272
 
273 273
 	print dol_get_fiche_end();
274 274
 
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 
282 282
 if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
283 283
 	if ($backtopage) {
284
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
284
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
285 285
 	}
286 286
 	if ($backtopageforcancel) {
287
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
287
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
288 288
 	}
289 289
 
290 290
 	// Part to show record
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 
298 298
 	// Object card
299 299
 	// ------------------------------------------------------------
300
-	$linkback = '<a href="' . dol_buildpath('/hrm/position_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($fk_job) ? '&fk_job=' . $fk_job : '') . '">' . $langs->trans("BackToList") . '</a>';
300
+	$linkback = '<a href="'.dol_buildpath('/hrm/position_list.php', 1).'?restore_lastsearch_values=1'.(!empty($fk_job) ? '&fk_job='.$fk_job : '').'">'.$langs->trans("BackToList").'</a>';
301 301
 
302 302
 	$morehtmlref = '<div class="refid">';
303
-	$morehtmlref.= $object->label;
303
+	$morehtmlref .= $object->label;
304 304
 	$morehtmlref .= '</div>';
305 305
 
306 306
 	dol_banner_tab($object, 'fk_job', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
@@ -309,17 +309,17 @@  discard block
 block discarded – undo
309 309
 	print '<div class="fichecenter">';
310 310
 	print '<div class="fichehalfleft">';
311 311
 	print '<div class="underbanner clearboth"></div>';
312
-	print '<table class="border centpercent tableforfield">' . "\n";
312
+	print '<table class="border centpercent tableforfield">'."\n";
313 313
 
314 314
 	// Common attributes
315 315
 	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
316 316
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
317 317
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
318
-	$object->fields['label']['visible']=0; // Already in banner
319
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
318
+	$object->fields['label']['visible'] = 0; // Already in banner
319
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
320 320
 
321 321
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
322
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
322
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
323 323
 
324 324
 	print '</table>';
325 325
 	print '</div>';
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	// Add fields from extrafields
350 350
 	if (!empty($extrafields->attributes[$object->table_element]['label'])) {
351 351
 		foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
352
-			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : '');
352
+			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
353 353
 		}
354 354
 	}
355 355
 	// Add fields from hooks
@@ -357,20 +357,20 @@  discard block
 block discarded – undo
357 357
 	$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
358 358
 	$sql .= $hookmanager->resPrint;
359 359
 	$sql = preg_replace('/,\s*$/', '', $sql);
360
-	$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
360
+	$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
361 361
 	if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
362
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
362
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
363 363
 	}
364 364
 	// Add table from hooks
365 365
 	$parameters = array();
366 366
 	$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
367 367
 	$sql .= $hookmanager->resPrint;
368 368
 	if ($object->ismultientitymanaged == 1) {
369
-		$sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")";
369
+		$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
370 370
 	} else {
371 371
 		$sql .= " WHERE 1 = 1";
372 372
 	}
373
-	$sql .= " AND t.fk_job =  " . ((int) $fk_job) . " ";
373
+	$sql .= " AND t.fk_job =  ".((int) $fk_job)." ";
374 374
 
375 375
 	foreach ($search as $key => $val) {
376 376
 		if (array_key_exists($key, $object->fields)) {
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 				$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
393 393
 				if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
394 394
 					if (preg_match('/_dtstart$/', $key)) {
395
-						$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
395
+						$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
396 396
 					}
397 397
 					if (preg_match('/_dtend$/', $key)) {
398
-						$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
398
+						$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
399 399
 					}
400 400
 				}
401 401
 			}
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	}
407 407
 	//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
408 408
 	// Add where from extra fields
409
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
409
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
410 410
 	// Add where from hooks
411 411
 	$parameters = array();
412 412
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -445,15 +445,15 @@  discard block
 block discarded – undo
445 445
 	if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
446 446
 		$obj = $db->fetch_object($resql);
447 447
 		$id = $obj->rowid;
448
-		header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id);
448
+		header("Location: ".dol_buildpath('/hrm/position.php', 1).'?id='.$id);
449 449
 		exit;
450 450
 	}
451 451
 
452 452
 	$arrayofselected = is_array($toselect) ? $toselect : array();
453 453
 
454
-	$param = 'fk_job=' . $fk_job;
454
+	$param = 'fk_job='.$fk_job;
455 455
 	if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
456
-		$param .= '&contextpage=' . urlencode($contextpage);
456
+		$param .= '&contextpage='.urlencode($contextpage);
457 457
 	}
458 458
 	if ($limit > 0 && $limit != $conf->liste_limit) {
459 459
 		$param .= '&limit='.((int) $limit);
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
 	foreach ($search as $key => $val) {
462 462
 		if (is_array($search[$key]) && count($search[$key])) {
463 463
 			foreach ($search[$key] as $skey) {
464
-				$param .= '&search_' . $key . '[]=' . urlencode($skey);
464
+				$param .= '&search_'.$key.'[]='.urlencode($skey);
465 465
 			}
466 466
 		} else {
467
-			$param .= '&search_' . $key . '=' . urlencode($search[$key]);
467
+			$param .= '&search_'.$key.'='.urlencode($search[$key]);
468 468
 		}
469 469
 	}
470 470
 	if ($optioncss != '') {
471
-		$param .= '&optioncss=' . urlencode($optioncss);
471
+		$param .= '&optioncss='.urlencode($optioncss);
472 472
 	}
473 473
 	// Add $param from extra fields
474
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
474
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
475 475
 	// Add $param from hooks
476 476
 	$parameters = array();
477 477
 	$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -485,42 +485,42 @@  discard block
 block discarded – undo
485 485
 		//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
486 486
 	);
487 487
 	if ($permissiontodelete) {
488
-		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
488
+		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
489 489
 	}
490 490
 	if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
491 491
 		$arrayofmassactions = array();
492 492
 	}
493 493
 	$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
494 494
 
495
-	print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n";
495
+	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?fk_job='.$fk_job.'">'."\n";
496 496
 	if ($optioncss != '') {
497
-		print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
497
+		print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
498 498
 	}
499
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
499
+	print '<input type="hidden" name="token" value="'.newToken().'">';
500 500
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
501 501
 	print '<input type="hidden" name="action" value="list">';
502
-	print '<input type="hidden" name="massaction" value="' . $massaction . '">';
503
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
504
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
505
-	print '<input type="hidden" name="page" value="' . $page . '">';
506
-	print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
502
+	print '<input type="hidden" name="massaction" value="'.$massaction.'">';
503
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
504
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
505
+	print '<input type="hidden" name="page" value="'.$page.'">';
506
+	print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
507 507
 
508 508
 	$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'&fk_job='.((int) $fk_job), '', $permissiontoadd);
509 509
 
510
-	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
510
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
511 511
 
512 512
 	// Add code for pre mass action (confirmation or email presend form)
513 513
 	$topicmail = "SendPositionRef";
514 514
 	$modelmail = "position";
515 515
 	$objecttmp = new Position($db);
516
-	$trackid = 'xxxx' . $object->id;
517
-	include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
516
+	$trackid = 'xxxx'.$object->id;
517
+	include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
518 518
 
519 519
 	if ($search_all) {
520 520
 		foreach ($fieldstosearchall as $key => $val) {
521 521
 			$fieldstosearchall[$key] = $langs->trans($val);
522 522
 		}
523
-		print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>';
523
+		print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
524 524
 	}
525 525
 
526 526
 	$moreforfilter = '';
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
548 548
 
549 549
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
550
-	print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
550
+	print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
551 551
 
552 552
 	// Fields title search
553 553
 	// --------------------------------------------------------------------
@@ -555,35 +555,35 @@  discard block
 block discarded – undo
555 555
 	foreach ($object->fields as $key => $val) {
556 556
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
557 557
 		if ($key == 'status') {
558
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
558
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
559 559
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
560
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
560
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
561 561
 		} elseif (in_array($val['type'], array('timestamp'))) {
562
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
562
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
563 563
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
564
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
564
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
565 565
 		}
566
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
567
-			print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
566
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
567
+			print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
568 568
 			if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
569
-				print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
569
+				print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
570 570
 			} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
571 571
 				print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
572 572
 			} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
573
-				print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
573
+				print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
574 574
 			} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
575 575
 				print '<div class="nowrap">';
576
-				print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
576
+				print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
577 577
 				print '</div>';
578 578
 				print '<div class="nowrap">';
579
-				print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
579
+				print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
580 580
 				print '</div>';
581 581
 			}
582 582
 			print '</td>';
583 583
 		}
584 584
 	}
585 585
 	// Extra fields
586
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
586
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
587 587
 
588 588
 	// Fields from hook
589 589
 	$parameters = array('arrayfields' => $arrayfields);
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 	$searchpicto = $form->showFilterButtons();
595 595
 	print $searchpicto;
596 596
 	print '</td>';
597
-	print '</tr>' . "\n";
597
+	print '</tr>'."\n";
598 598
 
599 599
 
600 600
 	// Fields title label
@@ -603,27 +603,27 @@  discard block
 block discarded – undo
603 603
 	foreach ($object->fields as $key => $val) {
604 604
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
605 605
 		if ($key == 'status') {
606
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
606
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
607 607
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
608
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
608
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
609 609
 		} elseif (in_array($val['type'], array('timestamp'))) {
610
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
610
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
611 611
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
612
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
612
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
613 613
 		}
614
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
615
-			print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
614
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
615
+			print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
616 616
 		}
617 617
 	}
618 618
 	// Extra fields
619
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
619
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
620 620
 	// Hook fields
621 621
 	$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
622 622
 	$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
623 623
 	print $hookmanager->resPrint;
624 624
 	// Action column
625
-	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
626
-	print '</tr>' . "\n";
625
+	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
626
+	print '</tr>'."\n";
627 627
 
628 628
 	// Detect if we need a fetch on each output line
629 629
 	$needToFetchEachLine = 0;
@@ -655,24 +655,24 @@  discard block
 block discarded – undo
655 655
 		foreach ($object->fields as $key => $val) {
656 656
 			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
657 657
 			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
658
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
658
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
659 659
 			} elseif ($key == 'status') {
660
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
660
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
661 661
 			}
662 662
 
663 663
 			if (in_array($val['type'], array('timestamp'))) {
664
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
664
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
665 665
 			} elseif ($key == 'ref') {
666
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
666
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
667 667
 			}
668 668
 
669 669
 			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
670
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
670
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
671 671
 			}
672 672
 			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
673 673
 
674
-			if (!empty($arrayfields['t.' . $key]['checked'])) {
675
-				print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>';
674
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
675
+				print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
676 676
 				if ($key == 'status') {
677 677
 					print $object->getLibStatut(5);
678 678
 				} elseif ($key == 'rowid') {
@@ -686,20 +686,20 @@  discard block
 block discarded – undo
686 686
 				}
687 687
 				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
688 688
 					if (!$i) {
689
-						$totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
689
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
690 690
 					}
691 691
 					if (!isset($totalarray['val'])) {
692 692
 						$totalarray['val'] = array();
693 693
 					}
694
-					if (!isset($totalarray['val']['t.' . $key])) {
695
-						$totalarray['val']['t.' . $key] = 0;
694
+					if (!isset($totalarray['val']['t.'.$key])) {
695
+						$totalarray['val']['t.'.$key] = 0;
696 696
 					}
697
-					$totalarray['val']['t.' . $key] += $object->$key;
697
+					$totalarray['val']['t.'.$key] += $object->$key;
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 		// Extra fields
702
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
702
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
703 703
 		// Fields from hook
704 704
 		$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
705 705
 		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -711,20 +711,20 @@  discard block
 block discarded – undo
711 711
 			if (in_array($object->id, $arrayofselected)) {
712 712
 				$selected = 1;
713 713
 			}
714
-			print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
714
+			print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
715 715
 		}
716 716
 		print '</td>';
717 717
 		if (!$i) {
718 718
 			$totalarray['nbfield']++;
719 719
 		}
720 720
 
721
-		print '</tr>' . "\n";
721
+		print '</tr>'."\n";
722 722
 
723 723
 		$i++;
724 724
 	}
725 725
 
726 726
 	// Show total line
727
-	include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
727
+	include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
728 728
 
729 729
 	// If no record found
730 730
 	if ($num == 0) {
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 				$colspan++;
735 735
 			}
736 736
 		}
737
-		print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
737
+		print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
738 738
 	}
739 739
 
740 740
 
@@ -744,10 +744,10 @@  discard block
 block discarded – undo
744 744
 	$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
745 745
 	print $hookmanager->resPrint;
746 746
 
747
-	print '</table>' . "\n";
748
-	print '</div>' . "\n";
747
+	print '</table>'."\n";
748
+	print '</div>'."\n";
749 749
 
750
-	print '</form>' . "\n";
750
+	print '</form>'."\n";
751 751
 
752 752
 	if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
753 753
 		$hidegeneratedfilelistifempty = 1;
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 			$hidegeneratedfilelistifempty = 0;
756 756
 		}
757 757
 
758
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
758
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
759 759
 		$formfile = new FormFile($db);
760 760
 
761 761
 		// Show list of available documents
762
-		$urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
762
+		$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
763 763
 		$urlsource .= str_replace('&amp;', '&', $param);
764 764
 
765 765
 		$filedir = $diroutputmassaction;
@@ -782,22 +782,22 @@  discard block
 block discarded – undo
782 782
 {
783 783
 	global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
784 784
 
785
-	$action 	 = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
785
+	$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
786 786
 	$massaction  = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
787 787
 	$show_files  = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
788
-	$confirm 	 = GETPOST('confirm', 'alpha'); // Result of a confirmation
789
-	$cancel 	 = GETPOST('cancel', 'alpha'); // We click on a Cancel button
790
-	$toselect 	 = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
788
+	$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
789
+	$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
790
+	$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
791 791
 	$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positionlist'; // To manage different context of search
792 792
 	$optioncss 	 = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
793
-	$id 		 = GETPOST('id', 'int');
794
-	$fk_job 	 = GETPOST('fk_job', 'int');
793
+	$id = GETPOST('id', 'int');
794
+	$fk_job = GETPOST('fk_job', 'int');
795 795
 
796 796
 	// Load variable for pagination
797 797
 	$limit 	     = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
798 798
 	$sortfield   = GETPOST('sortfield', 'aZ09comma');
799 799
 	$sortorder   = GETPOST('sortorder', 'aZ09comma');
800
-	$page 	     = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
800
+	$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
801 801
 	if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
802 802
 		// If $page is not defined, or '' or -1 or if we click on clear filters
803 803
 		$page = 0;
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 	$object = new Position($db);
811 811
 
812 812
 	$extrafields = new ExtraFields($db);
813
-	$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
813
+	$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
814 814
 	$hookmanager->initHooks(array('positiontablist')); // Note that conf->hooks_modules contains array
815 815
 
816 816
 	// Fetch optionals attributes and labels
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 
822 822
 	// Default sort order (if not yet defined by previous GETPOST)
823 823
 	if (!$sortfield) {
824
-		reset($object->fields);                    // Reset is required to avoid key() to return null.
825
-		$sortfield = "t." . key($object->fields); // Set here default search field. By default 1st field in definition.
824
+		reset($object->fields); // Reset is required to avoid key() to return null.
825
+		$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
826 826
 	}
827 827
 	if (!$sortorder) {
828 828
 		$sortorder = "ASC";
@@ -832,12 +832,12 @@  discard block
 block discarded – undo
832 832
 	$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
833 833
 	$search = array();
834 834
 	foreach ($object->fields as $key => $val) {
835
-		if (GETPOST('search_' . $key, 'alpha') !== '') {
836
-			$search[$key] = GETPOST('search_' . $key, 'alpha');
835
+		if (GETPOST('search_'.$key, 'alpha') !== '') {
836
+			$search[$key] = GETPOST('search_'.$key, 'alpha');
837 837
 		}
838 838
 		if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
839
-			$search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
840
-			$search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
839
+			$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
840
+			$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
841 841
 		}
842 842
 	}
843 843
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	$fieldstosearchall = array();
846 846
 	foreach ($object->fields as $key => $val) {
847 847
 		if (!empty($val['searchall'])) {
848
-			$fieldstosearchall['t.' . $key] = $val['label'];
848
+			$fieldstosearchall['t.'.$key] = $val['label'];
849 849
 		}
850 850
 	}
851 851
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 		// If $val['visible']==0, then we never show the field
856 856
 		if (!empty($val['visible'])) {
857 857
 			$visible = (int) dol_eval($val['visible'], 1, 1, '1');
858
-			$arrayfields['t.' . $key] = array(
858
+			$arrayfields['t.'.$key] = array(
859 859
 				'label' => $val['label'],
860 860
 				'checked' => (($visible < 0) ? 0 : 1),
861 861
 				'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 		}
866 866
 	}
867 867
 	// Extra fields
868
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
868
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
869 869
 
870 870
 	$object->fields = dol_sort_array($object->fields, 'position');
871 871
 	$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	// Add fields from extrafields
893 893
 	if (!empty($extrafields->attributes[$object->table_element]['label'])) {
894 894
 		foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
895
-			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : '');
895
+			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
896 896
 		}
897 897
 	}
898 898
 	// Add fields from hooks
@@ -900,20 +900,20 @@  discard block
 block discarded – undo
900 900
 	$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
901 901
 	$sql .= $hookmanager->resPrint;
902 902
 	$sql = preg_replace('/,\s*$/', '', $sql);
903
-	$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
903
+	$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
904 904
 	if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
905
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
905
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
906 906
 	}
907 907
 	// Add table from hooks
908 908
 	$parameters = array();
909 909
 	$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
910 910
 	$sql .= $hookmanager->resPrint;
911 911
 	if ($object->ismultientitymanaged == 1) {
912
-		$sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")";
912
+		$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
913 913
 	} else {
914 914
 		$sql .= " WHERE 1 = 1";
915 915
 	}
916
-	$sql .= " AND t.fk_job =  " . ((int) $fk_job) . " ";
916
+	$sql .= " AND t.fk_job =  ".((int) $fk_job)." ";
917 917
 
918 918
 	foreach ($search as $key => $val) {
919 919
 		if (array_key_exists($key, $object->fields)) {
@@ -935,10 +935,10 @@  discard block
 block discarded – undo
935 935
 				$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
936 936
 				if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
937 937
 					if (preg_match('/_dtstart$/', $key)) {
938
-						$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
938
+						$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
939 939
 					}
940 940
 					if (preg_match('/_dtend$/', $key)) {
941
-						$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
941
+						$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
942 942
 					}
943 943
 				}
944 944
 			}
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 	}
950 950
 	//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
951 951
 	// Add where from extra fields
952
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
952
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
953 953
 	// Add where from hooks
954 954
 	$parameters = array();
955 955
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 	if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
1007 1007
 		$obj = $db->fetch_object($resql);
1008 1008
 		$id = $obj->rowid;
1009
-		header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id);
1009
+		header("Location: ".dol_buildpath('/hrm/position.php', 1).'?id='.$id);
1010 1010
 		exit;
1011 1011
 	}
1012 1012
 
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 		$param .= '&optioncss='.urlencode($optioncss);
1033 1033
 	}
1034 1034
 	// Add $param from extra fields
1035
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
1035
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1036 1036
 	// Add $param from hooks
1037 1037
 	$parameters = array();
1038 1038
 	$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1046,42 +1046,42 @@  discard block
 block discarded – undo
1046 1046
 		//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1047 1047
 	);
1048 1048
 	if ($permissiontodelete) {
1049
-		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
1049
+		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
1050 1050
 	}
1051 1051
 	if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
1052 1052
 		$arrayofmassactions = array();
1053 1053
 	}
1054 1054
 	$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1055 1055
 
1056
-	print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n";
1056
+	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?fk_job='.$fk_job.'">'."\n";
1057 1057
 	if ($optioncss != '') {
1058
-		print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
1058
+		print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1059 1059
 	}
1060
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
1060
+	print '<input type="hidden" name="token" value="'.newToken().'">';
1061 1061
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1062 1062
 	print '<input type="hidden" name="action" value="list">';
1063
-	print '<input type="hidden" name="massaction" value="' . $massaction . '">';
1064
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
1065
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
1066
-	print '<input type="hidden" name="page" value="' . $page . '">';
1067
-	print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
1063
+	print '<input type="hidden" name="massaction" value="'.$massaction.'">';
1064
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1065
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1066
+	print '<input type="hidden" name="page" value="'.$page.'">';
1067
+	print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
1068 1068
 
1069 1069
 	$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'&fk_job='.((int) $fk_job), '', $permissiontoadd);
1070 1070
 
1071
-	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
1071
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
1072 1072
 
1073 1073
 	// Add code for pre mass action (confirmation or email presend form)
1074 1074
 	$topicmail = "SendPositionRef";
1075 1075
 	$modelmail = "position";
1076 1076
 	$objecttmp = new Position($db);
1077
-	$trackid = 'xxxx' . $object->id;
1078
-	include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
1077
+	$trackid = 'xxxx'.$object->id;
1078
+	include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1079 1079
 
1080 1080
 	if ($search_all) {
1081 1081
 		foreach ($fieldstosearchall as $key => $val) {
1082 1082
 			$fieldstosearchall[$key] = $langs->trans($val);
1083 1083
 		}
1084
-		print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>';
1084
+		print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
1085 1085
 	}
1086 1086
 
1087 1087
 	$moreforfilter = '';
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 	$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1109 1109
 
1110 1110
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
1111
-	print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
1111
+	print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1112 1112
 
1113 1113
 
1114 1114
 	// Fields title search
@@ -1117,35 +1117,35 @@  discard block
 block discarded – undo
1117 1117
 	foreach ($object->fields as $key => $val) {
1118 1118
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1119 1119
 		if ($key == 'status') {
1120
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1120
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1121 1121
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1122
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1122
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1123 1123
 		} elseif (in_array($val['type'], array('timestamp'))) {
1124
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1124
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1125 1125
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
1126
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1126
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
1127 1127
 		}
1128
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
1129
-			print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
1128
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
1129
+			print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
1130 1130
 			if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
1131
-				print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
1131
+				print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
1132 1132
 			} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
1133 1133
 				print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
1134 1134
 			} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
1135
-				print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
1135
+				print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
1136 1136
 			} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
1137 1137
 				print '<div class="nowrap">';
1138
-				print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1138
+				print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1139 1139
 				print '</div>';
1140 1140
 				print '<div class="nowrap">';
1141
-				print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1141
+				print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1142 1142
 				print '</div>';
1143 1143
 			}
1144 1144
 			print '</td>';
1145 1145
 		}
1146 1146
 	}
1147 1147
 	// Extra fields
1148
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
1148
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1149 1149
 
1150 1150
 	// Fields from hook
1151 1151
 	$parameters = array('arrayfields' => $arrayfields);
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 	$searchpicto = $form->showFilterButtons();
1157 1157
 	print $searchpicto;
1158 1158
 	print '</td>';
1159
-	print '</tr>' . "\n";
1159
+	print '</tr>'."\n";
1160 1160
 
1161 1161
 
1162 1162
 	// Fields title label
@@ -1165,27 +1165,27 @@  discard block
 block discarded – undo
1165 1165
 	foreach ($object->fields as $key => $val) {
1166 1166
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1167 1167
 		if ($key == 'status') {
1168
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1168
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1169 1169
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1170
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1170
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1171 1171
 		} elseif (in_array($val['type'], array('timestamp'))) {
1172
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1172
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1173 1173
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
1174
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1174
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
1175 1175
 		}
1176
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
1177
-			print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
1176
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
1177
+			print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
1178 1178
 		}
1179 1179
 	}
1180 1180
 	// Extra fields
1181
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
1181
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1182 1182
 	// Hook fields
1183 1183
 	$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
1184 1184
 	$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1185 1185
 	print $hookmanager->resPrint;
1186 1186
 	// Action column
1187
-	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
1188
-	print '</tr>' . "\n";
1187
+	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1188
+	print '</tr>'."\n";
1189 1189
 
1190 1190
 	// Detect if we need a fetch on each output line
1191 1191
 	$needToFetchEachLine = 0;
@@ -1217,24 +1217,24 @@  discard block
 block discarded – undo
1217 1217
 		foreach ($object->fields as $key => $val) {
1218 1218
 			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1219 1219
 			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1220
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1220
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
1221 1221
 			} elseif ($key == 'status') {
1222
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1222
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
1223 1223
 			}
1224 1224
 
1225 1225
 			if (in_array($val['type'], array('timestamp'))) {
1226
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1226
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1227 1227
 			} elseif ($key == 'ref') {
1228
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1228
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1229 1229
 			}
1230 1230
 
1231 1231
 			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
1232
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1232
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
1233 1233
 			}
1234 1234
 			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
1235 1235
 
1236
-			if (!empty($arrayfields['t.' . $key]['checked'])) {
1237
-				print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>';
1236
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
1237
+				print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
1238 1238
 				if ($key == 'status') {
1239 1239
 					print $object->getLibStatut(5);
1240 1240
 				} elseif ($key == 'rowid') {
@@ -1248,20 +1248,20 @@  discard block
 block discarded – undo
1248 1248
 				}
1249 1249
 				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1250 1250
 					if (!$i) {
1251
-						$totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
1251
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1252 1252
 					}
1253 1253
 					if (!isset($totalarray['val'])) {
1254 1254
 						$totalarray['val'] = array();
1255 1255
 					}
1256
-					if (!isset($totalarray['val']['t.' . $key])) {
1257
-						$totalarray['val']['t.' . $key] = 0;
1256
+					if (!isset($totalarray['val']['t.'.$key])) {
1257
+						$totalarray['val']['t.'.$key] = 0;
1258 1258
 					}
1259
-					$totalarray['val']['t.' . $key] += $object->$key;
1259
+					$totalarray['val']['t.'.$key] += $object->$key;
1260 1260
 				}
1261 1261
 			}
1262 1262
 		}
1263 1263
 		// Extra fields
1264
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
1264
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1265 1265
 		// Fields from hook
1266 1266
 		$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1267 1267
 		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1273,20 +1273,20 @@  discard block
 block discarded – undo
1273 1273
 			if (in_array($object->id, $arrayofselected)) {
1274 1274
 				$selected = 1;
1275 1275
 			}
1276
-			print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
1276
+			print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1277 1277
 		}
1278 1278
 		print '</td>';
1279 1279
 		if (!$i) {
1280 1280
 			$totalarray['nbfield']++;
1281 1281
 		}
1282 1282
 
1283
-		print '</tr>' . "\n";
1283
+		print '</tr>'."\n";
1284 1284
 
1285 1285
 		$i++;
1286 1286
 	}
1287 1287
 
1288 1288
 	// Show total line
1289
-	include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
1289
+	include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1290 1290
 
1291 1291
 	// If no record found
1292 1292
 	if ($num == 0) {
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 				$colspan++;
1297 1297
 			}
1298 1298
 		}
1299
-		print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
1299
+		print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1300 1300
 	}
1301 1301
 
1302 1302
 
@@ -1306,10 +1306,10 @@  discard block
 block discarded – undo
1306 1306
 	$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
1307 1307
 	print $hookmanager->resPrint;
1308 1308
 
1309
-	print '</table>' . "\n";
1310
-	print '</div>' . "\n";
1309
+	print '</table>'."\n";
1310
+	print '</div>'."\n";
1311 1311
 
1312
-	print '</form>' . "\n";
1312
+	print '</form>'."\n";
1313 1313
 
1314 1314
 	if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1315 1315
 		$hidegeneratedfilelistifempty = 1;
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
 			$hidegeneratedfilelistifempty = 0;
1318 1318
 		}
1319 1319
 
1320
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
1320
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1321 1321
 		$formfile = new FormFile($db);
1322 1322
 
1323 1323
 		// Show list of available documents
1324
-		$urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
1324
+		$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1325 1325
 		$urlsource .= str_replace('&amp;', '&', $param);
1326 1326
 
1327 1327
 		$filedir = $diroutputmassaction;
Please login to merge, or discard this patch.
htdocs/hrm/job_card.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
37 37
 
38 38
 // Load translation files required by the page
39
-$langs->loadLangs(array('hrm', 'other', 'products'));   // why products?
39
+$langs->loadLangs(array('hrm', 'other', 'products')); // why products?
40 40
 
41 41
 // Get parameters
42 42
 $id = GETPOST('id', 'int');
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search
48 48
 $backtopage = GETPOST('backtopage', 'alpha');
49 49
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
50
-$lineid   = GETPOST('lineid', 'int');
50
+$lineid = GETPOST('lineid', 'int');
51 51
 
52 52
 // Initialize technical objects
53 53
 $object = new Job($db);
54 54
 $extrafields = new ExtraFields($db);
55
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
55
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
56 56
 $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array
57 57
 
58 58
 // Fetch optionals attributes and labels
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 $search_all = GETPOST("search_all", 'alpha');
65 65
 $search = array();
66 66
 foreach ($object->fields as $key => $val) {
67
-	if (GETPOST('search_' . $key, 'alpha')) {
68
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
67
+	if (GETPOST('search_'.$key, 'alpha')) {
68
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
69 69
 	}
70 70
 }
71 71
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 }
75 75
 
76 76
 // Load object
77
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
77
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
78 78
 
79 79
 // Permissions
80 80
 $permissiontoread = $user->rights->hrm->all->read;
81 81
 $permissiontoadd  = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
82 82
 $permissiontodelete = $user->rights->hrm->all->delete;
83
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job';
83
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job';
84 84
 
85 85
 // Security check (enable the most restrictive one)
86 86
 //if ($user->socid > 0) accessforbidden();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
112 112
 				$backtopage = $backurlforlist;
113 113
 			} else {
114
-				$backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__');
114
+				$backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
115 115
 			}
116 116
 		}
117 117
 	}
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
123
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
123
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
124 124
 
125 125
 	// Actions when linking object each other
126
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
126
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
127 127
 
128 128
 	// Actions when printing a doc from card
129
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
129
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
130 130
 
131 131
 	// Action to move up and down lines of object
132 132
 	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
133 133
 
134 134
 	// Action to build doc
135
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
135
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
136 136
 
137 137
 	if ($action == 'set_thirdparty' && $permissiontoadd) {
138 138
 		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	// Actions to send emails
145 145
 	$triggersendname = 'hrm_JOB_SENTBYMAIL';
146 146
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO';
147
-	$trackid = 'job' . $object->id;
148
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
147
+	$trackid = 'job'.$object->id;
148
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
149 149
 }
150 150
 
151 151
 
@@ -181,36 +181,36 @@  discard block
 block discarded – undo
181 181
 
182 182
 // Part to create
183 183
 if ($action == 'create') {
184
-	print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_' . $object->picto);
184
+	print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_'.$object->picto);
185 185
 
186
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
187
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
186
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
187
+	print '<input type="hidden" name="token" value="'.newToken().'">';
188 188
 	print '<input type="hidden" name="action" value="add">';
189 189
 	if ($backtopage) {
190
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
190
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
191 191
 	}
192 192
 	if ($backtopageforcancel) {
193
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
193
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
194 194
 	}
195 195
 
196 196
 	print dol_get_fiche_head(array(), '');
197 197
 
198
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
198
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
199 199
 
200 200
 	// Common attributes
201
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
201
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
202 202
 
203 203
 	// Other attributes
204
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
204
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
205 205
 
206
-	print '</table>' . "\n";
206
+	print '</table>'."\n";
207 207
 
208 208
 	print dol_get_fiche_end();
209 209
 
210 210
 	print '<div class="center">';
211
-	print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">';
211
+	print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
212 212
 	print '&nbsp; ';
213
-	print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage
213
+	print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
214 214
 	print '</div>';
215 215
 
216 216
 	print '</form>';
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 
221 221
 // Part to edit record
222 222
 if (($id || $ref) && $action == 'edit') {
223
-	print load_fiche_titre($langs->trans("JobProfile"), '', 'object_' . $object->picto);
223
+	print load_fiche_titre($langs->trans("JobProfile"), '', 'object_'.$object->picto);
224 224
 
225
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
226
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
225
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
+	print '<input type="hidden" name="token" value="'.newToken().'">';
227 227
 	print '<input type="hidden" name="action" value="update">';
228
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
228
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
229 229
 	if ($backtopage) {
230
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
230
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
231 231
 	}
232 232
 	if ($backtopageforcancel) {
233
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
233
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
234 234
 	}
235 235
 
236 236
 	print dol_get_fiche_head();
237 237
 
238
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
238
+	print '<table class="border centpercent tableforfieldedit">'."\n";
239 239
 
240 240
 	// Common attributes
241
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
241
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
242 242
 
243 243
 	// Other attributes
244
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
244
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
245 245
 
246 246
 	print '</table>';
247 247
 
248 248
 	print dol_get_fiche_end();
249 249
 
250
-	print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">';
251
-	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
250
+	print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
251
+	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
252 252
 	print '</div>';
253 253
 
254 254
 	print '</form>';
@@ -266,17 +266,17 @@  discard block
 block discarded – undo
266 266
 
267 267
 	// Confirmation to delete
268 268
 	if ($action == 'delete') {
269
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
269
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
270 270
 	}
271 271
 	// Confirmation to delete line
272 272
 	if ($action == 'deleteline') {
273
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
273
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
274 274
 	}
275 275
 	// Clone confirmation
276 276
 	if ($action == 'clone') {
277 277
 		// Create an array for form
278 278
 		$formquestion = array();
279
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
279
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
280 280
 	}
281 281
 
282 282
 	// Confirmation of action xxxx
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 			// array('type' => 'other',    'name' => 'idwarehouse',   'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
293 293
 		);
294 294
 		*/
295
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
295
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
296 296
 	}
297 297
 
298 298
 	// Call Hook formConfirm
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 
311 311
 	// Object card
312 312
 	// ------------------------------------------------------------
313
-	$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
313
+	$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
314 314
 
315 315
 	$morehtmlref = '<div class="refid">';
316
-	$morehtmlref.= $object->label;
316
+	$morehtmlref .= $object->label;
317 317
 	$morehtmlref .= '</div>';
318 318
 
319 319
 
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
330 330
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
331 331
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
332
-	$object->fields['label']['visible']=0; // Already in banner
333
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
332
+	$object->fields['label']['visible'] = 0; // Already in banner
333
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
334 334
 
335 335
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
336
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
336
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
337 337
 
338 338
 	print '</table>';
339 339
 	print '</div>';
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 		// Show object lines
353 353
 		$result = $object->getLinesArray();
354 354
 
355
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
356
-		<input type="hidden" name="token" value="' . newToken() . '">
357
-		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
355
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
356
+		<input type="hidden" name="token" value="' . newToken().'">
357
+		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
358 358
 		<input type="hidden" name="mode" value="">
359 359
 		<input type="hidden" name="page_y" value="">
360
-		<input type="hidden" name="id" value="' . $object->id . '">
360
+		<input type="hidden" name="id" value="' . $object->id.'">
361 361
 		';
362 362
 
363 363
 		if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
364
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
364
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
365 365
 		}
366 366
 
367 367
 		print '<div class="div-table-responsive-no-min">';
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	// Buttons for actions
399 399
 
400 400
 	if ($action != 'presend' && $action != 'editline') {
401
-		print '<div class="tabsAction">' . "\n";
401
+		print '<div class="tabsAction">'."\n";
402 402
 		$parameters = array();
403 403
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
404 404
 		if ($reshook < 0) {
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		if (empty($reshook)) {
409 409
 			// Back to draft
410 410
 			if ($object->status == $object::STATUS_VALIDATED) {
411
-				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd);
411
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
412 412
 			}
413 413
 
414
-			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
414
+			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
415 415
 
416 416
 			// Delete (need delete permission, or if draft, just need create/modify permission)
417
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
417
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
418 418
 		}
419
-		print '</div>' . "\n";
419
+		print '</div>'."\n";
420 420
 	}
421 421
 
422 422
 
@@ -434,12 +434,12 @@  discard block
 block discarded – undo
434 434
 		// Documents
435 435
 		if ($includedocgeneration) {
436 436
 			$objref = dol_sanitizeFileName($object->ref);
437
-			$relativepath = $objref . '/' . $objref . '.pdf';
438
-			$filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref;
439
-			$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
437
+			$relativepath = $objref.'/'.$objref.'.pdf';
438
+			$filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref;
439
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
440 440
 			$genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content
441 441
 			$delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card
442
-			print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
442
+			print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
443 443
 		}
444 444
 
445 445
 		// Show links to link elements
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
 		$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id);
455 455
 
456 456
 		// List of actions on element
457
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
457
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
458 458
 		$formactions = new FormActions($db);
459
-		$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
459
+		$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
460 460
 
461 461
 		print '</div></div>';
462 462
 	}
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	$modelmail = 'job';
466 466
 	$defaulttopic = 'InformationMessage';
467 467
 	$diroutput = $conf->hrm->dir_output;
468
-	$trackid = 'job' . $object->id;
468
+	$trackid = 'job'.$object->id;
469 469
 
470
-	include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
470
+	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
471 471
 }
472 472
 
473 473
 // End of page
Please login to merge, or discard this patch.