Completed
Branch develop (e956c0)
by
unknown
15:59
created
htdocs/product/stock/replenish.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 
31 31
 // Load Dolibarr environment
32 32
 require '../../main.inc.php';
33
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
38 38
 require_once './lib/replenishment.lib.php';
39 39
 
40 40
 // Load translation files required by the page
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $fk_entrepot = GETPOSTINT('fk_entrepot');
69 69
 
70 70
 // List all visible warehouses
71
-$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) . ")");
71
+$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")");
72 72
 $listofqualifiedwarehousesid = "";
73 73
 $count = 0;
74 74
 while ($tmpobj = $db->fetch_object($resWar)) {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		$db->begin();
162 162
 
163 163
 		$suppliers = array();
164
-		require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
164
+		require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
165 165
 		$productsupplier = new ProductFournisseur($db);
166 166
 		for ($i = 0; $i < $linecount; $i++) {
167 167
 			if (GETPOST('choose'.$i) === 'on' && GETPOSTINT('fourn'.$i) > 0) {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 					dol_print_error($db);
216 216
 				}
217 217
 
218
-				unset($_POST['fourn' . $i]);
218
+				unset($_POST['fourn'.$i]);
219 219
 			}
220 220
 			unset($_POST[$i]);
221 221
 		}
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 		$i = 0;
225 225
 		$fail = 0;
226 226
 		$orders = array();
227
-		$suppliersid = array_keys($suppliers);	// array of ids of suppliers
227
+		$suppliersid = array_keys($suppliers); // array of ids of suppliers
228 228
 		foreach ($suppliers as $supplier) {
229 229
 			$order = new CommandeFournisseur($db);
230 230
 
231 231
 			// Check if an order for the supplier exists
232
-			$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "commande_fournisseur";
233
-			$sql .= " WHERE fk_soc = " . ((int) $suppliersid[$i]);
234
-			$sql .= " AND source = " . ((int) $order::SOURCE_ID_REPLENISHMENT) . " AND fk_statut = " . ((int) $order::STATUS_DRAFT);
235
-			$sql .= " AND entity IN (" . getEntity('commande_fournisseur') . ")";
232
+			$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur";
233
+			$sql .= " WHERE fk_soc = ".((int) $suppliersid[$i]);
234
+			$sql .= " AND source = ".((int) $order::SOURCE_ID_REPLENISHMENT)." AND fk_statut = ".((int) $order::STATUS_DRAFT);
235
+			$sql .= " AND entity IN (".getEntity('commande_fournisseur').")";
236 236
 			$sql .= " ORDER BY date_creation DESC";
237 237
 			$resql = $db->query($sql);
238 238
 			if ($resql && $db->num_rows($resql) > 0) {
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				}
270 270
 				if ($result < 0) {
271 271
 					$fail++;
272
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
272
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
273 273
 					$msg .= $order->error;
274 274
 					setEventMessages($msg, null, 'errors');
275 275
 				} else {
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 				$id = $order->create($user);
296 296
 				if ($id < 0) {
297 297
 					$fail++;
298
-					$msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
298
+					$msg = $langs->trans('OrderFail')."&nbsp;:&nbsp;";
299 299
 					$msg .= $order->error;
300 300
 					setEventMessages($msg, null, 'errors');
301 301
 				}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
349 349
 	$sql .= ' pse.desiredstock as desiredstockpse, pse.seuil_stock_alerte as seuil_stock_alertepse,';
350 350
 }
351
-$sql .= " " . $sqldesiredtock . " as desiredstockcombined, " . $sqlalertstock . " as seuil_stock_alertecombined,";
351
+$sql .= " ".$sqldesiredtock." as desiredstockcombined, ".$sqlalertstock." as seuil_stock_alertecombined,";
352 352
 $sql .= ' s.fk_product,';
353 353
 $sql .= " SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
354 354
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 
363 363
 $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid);
364 364
 
365
-$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
366
-$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product';
367
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse) . ')';
365
+$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
366
+$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
367
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse).')';
368 368
 
369 369
 $list_warehouse_selected = ($fk_entrepot < 0 || empty($fk_entrepot)) ? $list_warehouse : $fk_entrepot;
370
-$sql .= ' AND s.fk_entrepot  IN (' . $db->sanitize($list_warehouse_selected) . ')';
370
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse_selected).')';
371 371
 
372 372
 
373 373
 //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 $reshook = $hookmanager->executeHooks('printFieldListJoin', $parameters); // Note that $action and $object may have been modified by hook
380 380
 $sql .= $hookmanager->resPrint;
381 381
 
382
-$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
382
+$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
383 383
 if ($sall) {
384 384
 	$sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
385 385
 }
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	$sql .= ' AND p.rowid NOT IN (SELECT pac.fk_product_parent FROM '.MAIN_DB_PREFIX.'product_attribute_combination as pac WHERE pac.entity IN ('.getEntity('product').'))';
403 403
 }
404 404
 if ($fk_supplier > 0) {
405
-	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = ' . ((int) $fk_supplier) . ' AND pfp.entity IN (' . getEntity('product_fournisseur_price') . '))';
405
+	$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))';
406 406
 }
407 407
 // Add where from hooks
408 408
 $parameters = array();
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 	}
448 448
 
449 449
 	if (isModEnabled("supplier_order")) {
450
-		$sqlCommandesFourn = "(SELECT " . $db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)") . " as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
451
-		$sqlCommandesFourn .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd3,";
452
-		$sqlCommandesFourn .= " " . MAIN_DB_PREFIX . "commande_fournisseur as c3";
450
+		$sqlCommandesFourn = "(SELECT ".$db->ifsql("SUM(cd3.qty) IS NULL", "0", "SUM(cd3.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL
451
+		$sqlCommandesFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd3,";
452
+		$sqlCommandesFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur as c3";
453 453
 		$sqlCommandesFourn .= " WHERE c3.rowid = cd3.fk_commande";
454 454
 		$sqlCommandesFourn .= " AND c3.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")";
455 455
 		$sqlCommandesFourn .= " AND cd3.fk_product = p.rowid";
@@ -488,15 +488,15 @@  discard block
 block discarded – undo
488 488
 	}
489 489
 
490 490
 	$sql .= ' HAVING (';
491
-	$sql .= " (" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
492
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
491
+	$sql .= " (".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
492
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
493 493
 	$sql .= ' OR';
494 494
 	if ($includeproductswithoutdesiredqty == 'on') {
495
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
495
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
496 496
 	} else {
497
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')';
497
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')';
498 498
 	}
499
-	$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ") + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . ")))";
499
+	$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.") + (".$sqlProductionToProduce." - ".$sqlProductionToConsume.")))";
500 500
 	$sql .= ")";
501 501
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
502 502
 		$sql .= " AND (";
@@ -506,22 +506,22 @@  discard block
 block discarded – undo
506 506
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
507 507
 		$sql .= ' AND (';
508 508
 		if ($includeproductswithoutdesiredqty == 'on') {
509
-			$sql .= "(" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
509
+			$sql .= "(".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
510 510
 		} else {
511
-			$sql .= $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")";
511
+			$sql .= $sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")";
512 512
 		}
513
-		$sql .= " - (" . $sqlCommandesCli . " - " . $sqlExpeditionsCli . ") + (" . $sqlCommandesFourn . " - " . $sqlReceptionFourn . ")  + (" . $sqlProductionToProduce . " - " . $sqlProductionToConsume . "))";
513
+		$sql .= " - (".$sqlCommandesCli." - ".$sqlExpeditionsCli.") + (".$sqlCommandesFourn." - ".$sqlReceptionFourn.")  + (".$sqlProductionToProduce." - ".$sqlProductionToConsume."))";
514 514
 		$sql .= ")";
515 515
 		$alertchecked = 'checked';
516 516
 	}
517 517
 } else {
518 518
 	$sql .= ' HAVING (';
519
-	$sql .= "(" . $sqldesiredtock . " >= 0 AND (" . $sqldesiredtock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ")))";
519
+	$sql .= "(".$sqldesiredtock." >= 0 AND (".$sqldesiredtock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").")))";
520 520
 	$sql .= ' OR';
521 521
 	if ($includeproductswithoutdesiredqty == 'on') {
522
-		$sql .= " ((" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
522
+		$sql .= " ((".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
523 523
 	} else {
524
-		$sql .= " (" . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . ')))';
524
+		$sql .= " (".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").')))';
525 525
 	}
526 526
 	$sql .= ')';
527 527
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -532,9 +532,9 @@  discard block
 block discarded – undo
532 532
 	if ($salert == 'on') {    // Option to see when stock is lower than alert
533 533
 		$sql .= " AND (";
534 534
 		if ($includeproductswithoutdesiredqty == 'on') {
535
-			$sql .= " (" . $sqlalertstock . " >= 0 OR " . $sqlalertstock . " IS NULL) AND (" . $db->ifsql($sqlalertstock . " IS NULL", "0", $sqlalertstock) . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . "))";
535
+			$sql .= " (".$sqlalertstock." >= 0 OR ".$sqlalertstock." IS NULL) AND (".$db->ifsql($sqlalertstock." IS NULL", "0", $sqlalertstock)." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel")."))";
536 536
 		} else {
537
-			$sql .= " " . $sqlalertstock . " >= 0 AND (" . $sqlalertstock . " > SUM(" . $db->ifsql("s.reel IS NULL", "0", "s.reel") . '))';
537
+			$sql .= " ".$sqlalertstock." >= 0 AND (".$sqlalertstock." > SUM(".$db->ifsql("s.reel IS NULL", "0", "s.reel").'))';
538 538
 		}
539 539
 		$sql .= ')';
540 540
 		$alertchecked = 'checked';
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 
577 577
 $head = array();
578 578
 
579
-$head[0][0] = DOL_URL_ROOT . '/product/stock/replenish.php';
579
+$head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php';
580 580
 $head[0][1] = $title;
581 581
 $head[0][2] = 'replenish';
582 582
 
583
-$head[1][0] = DOL_URL_ROOT . '/product/stock/replenishorders.php';
583
+$head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php';
584 584
 $head[1][1] = $langs->trans("ReplenishmentOrders");
585 585
 $head[1][2] = 'replenishorders';
586 586
 
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
 print dol_get_fiche_head($head, 'replenish', '', -1, '');
591 591
 
592
-print '<span class="opacitymedium">' . $langs->trans("ReplenishmentStatusDesc") . '</span>' . "\n";
592
+print '<span class="opacitymedium">'.$langs->trans("ReplenishmentStatusDesc").'</span>'."\n";
593 593
 
594 594
 //$link = '<a title=' .$langs->trans("MenuNewWarehouse"). ' href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("MenuNewWarehouse").'</a>';
595 595
 
@@ -598,39 +598,39 @@  discard block
 block discarded – undo
598 598
 }
599 599
 print '<br><br>';
600 600
 if ($usevirtualstock == 1) {
601
-	print $langs->trans("CurentSelectionMode") . ': ';
602
-	print '<span class="a-mesure">' . $langs->trans("UseVirtualStock") . '</span>';
603
-	print ' <a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=physical' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UsePhysicalStock") . '</a>';
601
+	print $langs->trans("CurentSelectionMode").': ';
602
+	print '<span class="a-mesure">'.$langs->trans("UseVirtualStock").'</span>';
603
+	print ' <a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=physical'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UsePhysicalStock").'</a>';
604 604
 	print '<br>';
605 605
 }
606 606
 if ($usevirtualstock == 0) {
607
-	print $langs->trans("CurentSelectionMode") . ': ';
608
-	print '<a class="a-mesure-disabled" href="' . $_SERVER["PHP_SELF"] . '?mode=virtual' . ($fk_supplier > 0 ? '&fk_supplier=' . $fk_supplier : '') . ($fk_entrepot > 0 ? '&fk_entrepot=' . $fk_entrepot : '') . '">' . $langs->trans("UseVirtualStock") . '</a>';
609
-	print ' <span class="a-mesure">' . $langs->trans("UsePhysicalStock") . '</span>';
607
+	print $langs->trans("CurentSelectionMode").': ';
608
+	print '<a class="a-mesure-disabled" href="'.$_SERVER["PHP_SELF"].'?mode=virtual'.($fk_supplier > 0 ? '&fk_supplier='.$fk_supplier : '').($fk_entrepot > 0 ? '&fk_entrepot='.$fk_entrepot : '').'">'.$langs->trans("UseVirtualStock").'</a>';
609
+	print ' <span class="a-mesure">'.$langs->trans("UsePhysicalStock").'</span>';
610 610
 	print '<br>';
611 611
 }
612
-print '<br>' . "\n";
612
+print '<br>'."\n";
613 613
 
614
-print '<form name="formFilterWarehouse" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
615
-print '<input type="hidden" name="token" value="' . newToken() . '">';
614
+print '<form name="formFilterWarehouse" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
615
+print '<input type="hidden" name="token" value="'.newToken().'">';
616 616
 print '<input type="hidden" name="action" value="filter">';
617
-print '<input type="hidden" name="search_ref" value="' . $search_ref . '">';
618
-print '<input type="hidden" name="search_label" value="' . $search_label . '">';
619
-print '<input type="hidden" name="salert" value="' . $salert . '">';
620
-print '<input type="hidden" name="includeproductswithoutdesiredqty" value="' . $includeproductswithoutdesiredqty . '">';
621
-print '<input type="hidden" name="draftorder" value="' . $draftorder . '">';
622
-print '<input type="hidden" name="mode" value="' . $mode . '">';
617
+print '<input type="hidden" name="search_ref" value="'.$search_ref.'">';
618
+print '<input type="hidden" name="search_label" value="'.$search_label.'">';
619
+print '<input type="hidden" name="salert" value="'.$salert.'">';
620
+print '<input type="hidden" name="includeproductswithoutdesiredqty" value="'.$includeproductswithoutdesiredqty.'">';
621
+print '<input type="hidden" name="draftorder" value="'.$draftorder.'">';
622
+print '<input type="hidden" name="mode" value="'.$mode.'">';
623 623
 if ($limit > 0 && $limit != $conf->liste_limit) {
624
-	print '<input type="hidden" name="limit" value="' . $limit . '">';
624
+	print '<input type="hidden" name="limit" value="'.$limit.'">';
625 625
 }
626 626
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE')) {
627 627
 	print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
628
-	print $langs->trans('Warehouse') . ' ' . $formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
628
+	print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
629 629
 	print '</div>';
630 630
 }
631 631
 print '<div class="inline-block valignmiddle" style="padding-right: 20px;">';
632 632
 $filter = '(fournisseur:=:1)';
633
-print $langs->trans('Supplier') . ' ' . $form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
633
+print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', $filter, 1);
634 634
 print '</div>';
635 635
 
636 636
 $parameters = array();
@@ -640,29 +640,29 @@  discard block
 block discarded – undo
640 640
 }
641 641
 
642 642
 print '<div class="inline-block valignmiddle">';
643
-print '<input type="submit" class="button smallpaddingimp" name="valid" value="' . $langs->trans('ToFilter') . '">';
643
+print '<input type="submit" class="button smallpaddingimp" name="valid" value="'.$langs->trans('ToFilter').'">';
644 644
 print '</div>';
645 645
 
646 646
 print '</form>';
647 647
 
648
-print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formulaire">';
649
-print '<input type="hidden" name="token" value="' . newToken() . '">';
650
-print '<input type="hidden" name="fk_supplier" value="' . $fk_supplier . '">';
651
-print '<input type="hidden" name="fk_entrepot" value="' . $fk_entrepot . '">';
652
-print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
653
-print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
654
-print '<input type="hidden" name="type" value="' . $type . '">';
655
-print '<input type="hidden" name="linecount" value="' . $num . '">';
648
+print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">';
649
+print '<input type="hidden" name="token" value="'.newToken().'">';
650
+print '<input type="hidden" name="fk_supplier" value="'.$fk_supplier.'">';
651
+print '<input type="hidden" name="fk_entrepot" value="'.$fk_entrepot.'">';
652
+print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
653
+print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
654
+print '<input type="hidden" name="type" value="'.$type.'">';
655
+print '<input type="hidden" name="linecount" value="'.$num.'">';
656 656
 print '<input type="hidden" name="action" value="order">';
657
-print '<input type="hidden" name="mode" value="' . $mode . '">';
657
+print '<input type="hidden" name="mode" value="'.$mode.'">';
658 658
 
659 659
 
660 660
 if ($search_ref || $search_label || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) {
661
-	$filters = '&search_ref=' . urlencode($search_ref) . '&search_label=' . urlencode($search_label);
662
-	$filters .= '&sall=' . urlencode($sall);
663
-	$filters .= '&salert=' . urlencode($salert);
664
-	$filters .= '&draftorder=' . urlencode($draftorder);
665
-	$filters .= '&mode=' . urlencode($mode);
661
+	$filters = '&search_ref='.urlencode($search_ref).'&search_label='.urlencode($search_label);
662
+	$filters .= '&sall='.urlencode($sall);
663
+	$filters .= '&salert='.urlencode($salert);
664
+	$filters .= '&draftorder='.urlencode($draftorder);
665
+	$filters .= '&mode='.urlencode($mode);
666 666
 	if ($fk_supplier > 0) {
667 667
 		$filters .= '&fk_supplier='.urlencode((string) ($fk_supplier));
668 668
 	}
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	}
685 685
 }
686 686
 if ($limit > 0 && $limit != $conf->liste_limit) {
687
-	$filters .= '&limit=' . ((int) $limit);
687
+	$filters .= '&limit='.((int) $limit);
688 688
 }
689 689
 if (!empty($includeproductswithoutdesiredqty)) {
690 690
 	$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
 // Fields title search
765 765
 print '<tr class="liste_titre_filter">';
766 766
 print '<td class="liste_titre">&nbsp;</td>';
767
-print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="' . dol_escape_htmltag($search_ref) . '"></td>';
768
-print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="' . dol_escape_htmltag($search_label) . '"></td>';
767
+print '<td class="liste_titre"><input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'"></td>';
768
+print '<td class="liste_titre"><input class="flat" type="text" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'"></td>';
769 769
 if (isModEnabled("service") && $type == 1) {
770 770
 	print '<td class="liste_titre">&nbsp;</td>';
771 771
 }
772
-print '<td class="liste_titre right">' . $form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')) . '&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" ' . (!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '') . '></td>';
772
+print '<td class="liste_titre right">'.$form->textwithpicto($langs->trans('IncludeEmptyDesiredStock'), $langs->trans('IncludeProductWithUndefinedAlerts')).'&nbsp;<input type="checkbox" id="includeproductswithoutdesiredqty" name="includeproductswithoutdesiredqty" '.(!empty($includeproductswithoutdesiredqtychecked) ? $includeproductswithoutdesiredqtychecked : '').'></td>';
773 773
 print '<td class="liste_titre right"></td>';
774 774
 print '<td class="liste_titre right">'.$langs->trans('AlertOnly').'&nbsp;<input type="checkbox" id="salert" name="salert" '.(!empty($alertchecked) ? $alertchecked : '').'></td>';
775 775
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
 		// Multilangs
833 833
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
834 834
 			$sql = 'SELECT label,description';
835
-			$sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang';
836
-			$sql .= ' WHERE fk_product = ' . ((int) $objp->rowid);
837
-			$sql .= " AND lang = '" . $db->escape($langs->getDefaultLang()) . "'";
835
+			$sql .= ' FROM '.MAIN_DB_PREFIX.'product_lang';
836
+			$sql .= ' WHERE fk_product = '.((int) $objp->rowid);
837
+			$sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
838 838
 			$sql .= ' LIMIT 1';
839 839
 
840 840
 			$resqlm = $db->query($sql);
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
 
887 887
 		$warning = '';
888 888
 		if ($alertstock && ($stock < $alertstock)) {
889
-			$warning = img_warning($langs->trans('StockTooLow')) . ' ';
889
+			$warning = img_warning($langs->trans('StockTooLow')).' ';
890 890
 		}
891 891
 		$warningwarehouse = '';
892 892
 		if ($alertstockwarehouse && ($stockwarehouse < $alertstockwarehouse)) {
893
-			$warningwarehouse = img_warning($langs->trans('StockTooLow')) . ' ';
893
+			$warningwarehouse = img_warning($langs->trans('StockTooLow')).' ';
894 894
 		}
895 895
 
896 896
 		//depending on conf, use either physical stock or
@@ -923,38 +923,38 @@  discard block
 block discarded – undo
923 923
 		print '<tr class="oddeven">';
924 924
 
925 925
 		// Select field
926
-		print '<td><input type="checkbox" class="check" name="choose' . $i . '"></td>';
926
+		print '<td><input type="checkbox" class="check" name="choose'.$i.'"></td>';
927 927
 
928
-		print '<td class="nowrap">' . $prod->getNomUrl(1, 'stock') . '</td>';
928
+		print '<td class="nowrap">'.$prod->getNomUrl(1, 'stock').'</td>';
929 929
 
930
-		print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag($objp->label) . '">';
930
+		print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($objp->label).'">';
931 931
 		print dol_escape_htmltag($objp->label);
932
-		print '<input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp->description) . '">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
932
+		print '<input type="hidden" name="desc'.$i.'" value="'.dol_escape_htmltag($objp->description).'">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
933 933
 		print '</td>';
934 934
 
935 935
 		if (isModEnabled("service") && $type == 1) {
936 936
 			$regs = array();
937 937
 			if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
938
-				$duration = $regs[1] . ' ' . $langs->trans('DurationYear');
938
+				$duration = $regs[1].' '.$langs->trans('DurationYear');
939 939
 			} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
940
-				$duration = $regs[1] . ' ' . $langs->trans('DurationMonth');
940
+				$duration = $regs[1].' '.$langs->trans('DurationMonth');
941 941
 			} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
942
-				$duration = $regs[1] . ' ' . $langs->trans('DurationDay');
942
+				$duration = $regs[1].' '.$langs->trans('DurationDay');
943 943
 			} else {
944 944
 				$duration = $objp->duration;
945 945
 			}
946
-			print '<td class="center">' . $duration . '</td>';
946
+			print '<td class="center">'.$duration.'</td>';
947 947
 		}
948 948
 
949 949
 		// Desired stock
950
-		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->desiredstockpse ? $desiredstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')) . '0') : $desiredstock).'</td>';
950
+		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->desiredstockpse ? $desiredstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')).'0') : $desiredstock).'</td>';
951 951
 
952 952
 		// Limit stock for alert
953
-		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->seuil_stock_alertepse ? $alertstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')) . '0') : $alertstock).'</td>';
953
+		print '<td class="right">'.((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? ($objp->seuil_stock_alertepse ? $alertstockwarehouse : img_info($langs->trans('ProductValuesUsedBecauseNoValuesForThisWarehouse')).'0') : $alertstock).'</td>';
954 954
 
955 955
 		// Current stock (all warehouses)
956
-		print '<td class="right">' . $warning . $stock;
957
-		print '<!-- stock returned by main sql is ' . $objp->stock_physique . ' -->';
956
+		print '<td class="right">'.$warning.$stock;
957
+		print '<!-- stock returned by main sql is '.$objp->stock_physique.' -->';
958 958
 		print '</td>';
959 959
 
960 960
 		// Current stock (warehouse selected only)
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 		}
964 964
 
965 965
 		// Already ordered
966
-		print '<td class="right"><a href="replenishorders.php?search_product=' . $prod->id . '">' . $ordered . '</a> ' . $picto . '</td>';
966
+		print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
967 967
 
968 968
 		// To order
969 969
 		$tobuy = ((getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy);
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
 
972 972
 		// Supplier
973 973
 		print '<td class="right">';
974
-		print $form->select_product_fourn_price($prod->id, 'fourn' . $i, $fk_supplier);
974
+		print $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier);
975 975
 		print '</td>';
976 976
 
977 977
 		// Fields from hook
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 	if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
993 993
 		$colspan++;
994 994
 	}
995
-	print '<tr><td colspan="' . $colspan . '">';
995
+	print '<tr><td colspan="'.$colspan.'">';
996 996
 	print '<span class="opacitymedium">';
997 997
 	print $langs->trans("None");
998 998
 	print '</span>';
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 
1014 1014
 $value = $langs->trans("CreateOrders");
1015
-print '<div class="center"><input type="submit" class="button" name="valid" value="' . $value . '"></div>';
1015
+print '<div class="center"><input type="submit" class="button" name="valid" value="'.$value.'"></div>';
1016 1016
 
1017 1017
 
1018 1018
 print '</form>';
Please login to merge, or discard this patch.
htdocs/fourn/class/fournisseur.commande.class.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			$this->ref_supplier = $obj->ref_supplier;
514 514
 			$this->socid = $obj->fk_soc;
515 515
 			$this->fourn_id = $obj->fk_soc;
516
-			$this->statut = $obj->status;	// deprecated
516
+			$this->statut = $obj->status; // deprecated
517 517
 			$this->status = $obj->status;
518 518
 			$this->billed = $obj->billed;
519 519
 			$this->user_author_id = $obj->user_author_id;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 			$this->fk_project = $obj->fk_project;
545 545
 			$this->cond_reglement_id = $obj->fk_cond_reglement;
546 546
 			$this->cond_reglement_code = $obj->cond_reglement_code;
547
-			$this->cond_reglement = $obj->cond_reglement_label;			// deprecated
547
+			$this->cond_reglement = $obj->cond_reglement_label; // deprecated
548 548
 			$this->cond_reglement_label = $obj->cond_reglement_label;
549 549
 			$this->cond_reglement_doc = $obj->cond_reglement_doc;
550 550
 			$this->fk_account = $obj->fk_account;
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 					$sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")";
678 678
 					$sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product);
679 679
 					$sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'";
680
-					$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty);	// required to be qualified
681
-					$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")";	// required to be qualified
680
+					$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified
681
+					$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified
682 682
 					$sqlsearchpackage .= " AND fk_soc = ".((int) $this->socid);
683
-					$sqlsearchpackage .= " ORDER BY packaging ASC";		// Take the smaller package first
683
+					$sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first
684 684
 					$sqlsearchpackage .= " LIMIT 1";
685 685
 
686 686
 					$resqlsearchpackage = $this->db->query($sqlsearchpackage);
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 				$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
709 709
 				$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
710 710
 
711
-				$line->info_bits      	   = $objp->info_bits;
711
+				$line->info_bits = $objp->info_bits;
712 712
 				$line->special_code        = $objp->special_code;
713 713
 				$line->fk_parent_line      = $objp->fk_parent_line;
714 714
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 			if (!$error) {
836 836
 				$result = 1;
837 837
 				$this->status = self::STATUS_VALIDATED;
838
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
838
+				$this->statut = self::STATUS_VALIDATED; // deprecated
839 839
 				$this->ref = $num;
840 840
 			}
841 841
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 		}
1080 1080
 
1081 1081
 		global $action;
1082
-		$hookmanager->initHooks(array($this->element . 'dao'));
1082
+		$hookmanager->initHooks(array($this->element.'dao'));
1083 1083
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1084 1084
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1085 1085
 		if ($reshook > 0) {
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 			$this->multicurrency_tx = 1;
1530 1530
 		}
1531 1531
 
1532
-		$this->statut = self::STATUS_DRAFT;	// deprecated
1532
+		$this->statut = self::STATUS_DRAFT; // deprecated
1533 1533
 		$this->status = self::STATUS_DRAFT;
1534 1534
 
1535 1535
 		$sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur (";
@@ -1615,10 +1615,10 @@  discard block
 block discarded – undo
1615 1615
 						$line->date_end,
1616 1616
 						$line->array_options,
1617 1617
 						$line->fk_unit,
1618
-						$line->multicurrency_subprice,  // pu_ht_devise
1619
-						$line->origin,     // origin
1620
-						$line->origin_id,  // origin_id
1621
-						$line->rang,       // rang
1618
+						$line->multicurrency_subprice, // pu_ht_devise
1619
+						$line->origin, // origin
1620
+						$line->origin_id, // origin_id
1621
+						$line->rang, // rang
1622 1622
 						$line->special_code
1623 1623
 					);
1624 1624
 					if ($result < 0) {
@@ -1992,7 +1992,7 @@  discard block
 block discarded – undo
1992 1992
 			$this->db->begin();
1993 1993
 
1994 1994
 			$product_type = $type;
1995
-			$label = '';	// deprecated
1995
+			$label = ''; // deprecated
1996 1996
 
1997 1997
 			if ($fk_product > 0) {
1998 1998
 				if (getDolGlobalString('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY')) {	// Not the common case
@@ -2135,7 +2135,7 @@  discard block
 block discarded – undo
2135 2135
 			$this->line->total_localtax2 = $total_localtax2;
2136 2136
 			$this->line->total_ttc = $total_ttc;
2137 2137
 			$this->line->product_type = $type;
2138
-			$this->line->special_code   = (!empty($special_code) ? $special_code : 0);
2138
+			$this->line->special_code = (!empty($special_code) ? $special_code : 0);
2139 2139
 			$this->line->origin = $origin;
2140 2140
 			$this->line->origin_id = $origin_id;
2141 2141
 			$this->line->fk_unit = $fk_unit;
@@ -2146,8 +2146,8 @@  discard block
 block discarded – undo
2146 2146
 			// Multicurrency
2147 2147
 			$this->line->fk_multicurrency = $this->fk_multicurrency;
2148 2148
 			$this->line->multicurrency_code = $this->multicurrency_code;
2149
-			$this->line->multicurrency_subprice	= $pu_ht_devise;
2150
-			$this->line->multicurrency_total_ht 	= $multicurrency_total_ht;
2149
+			$this->line->multicurrency_subprice = $pu_ht_devise;
2150
+			$this->line->multicurrency_total_ht = $multicurrency_total_ht;
2151 2151
 			$this->line->multicurrency_total_tva 	= $multicurrency_total_tva;
2152 2152
 			$this->line->multicurrency_total_ttc 	= $multicurrency_total_ttc;
2153 2153
 
@@ -3342,7 +3342,7 @@  discard block
 block discarded – undo
3342 3342
 		global $conf, $langs;
3343 3343
 
3344 3344
 		if (!dol_strlen($modele)) {
3345
-			$modele = '';	// No doc template/generation by default
3345
+			$modele = ''; // No doc template/generation by default
3346 3346
 
3347 3347
 			if (!empty($this->model_pdf)) {
3348 3348
 				$modele = $this->model_pdf;
@@ -3884,10 +3884,10 @@  discard block
 block discarded – undo
3884 3884
 					$sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")";
3885 3885
 					$sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product);
3886 3886
 					$sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'";
3887
-					$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty);	// required to be qualified
3888
-					$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")";	// required to be qualified
3887
+					$sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified
3888
+					$sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified
3889 3889
 					$sqlsearchpackage .= " AND fk_soc = ".((int) $objp->socid);
3890
-					$sqlsearchpackage .= " ORDER BY packaging ASC";		// Take the smaller package first
3890
+					$sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first
3891 3891
 					$sqlsearchpackage .= " LIMIT 1";
3892 3892
 
3893 3893
 					$resqlsearchpackage = $this->db->query($sqlsearchpackage);
@@ -4016,7 +4016,7 @@  discard block
 block discarded – undo
4016 4016
 			$sql .= "null,";
4017 4017
 		}
4018 4018
 		$sql .= "'".$this->db->escape($this->product_type)."',";
4019
-		$sql .= (int) $this->special_code . ",";
4019
+		$sql .= (int) $this->special_code.",";
4020 4020
 		$sql .= "'".$this->db->escape($this->rang)."',";
4021 4021
 		$sql .= "'".$this->db->escape($this->qty)."', ";
4022 4022
 		$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
Please login to merge, or discard this patch.
htdocs/core/modules/modStock.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 			'd.code_departement' => 'List:c_departements:code_departement:code_departement:', 'c.code' => 'List:c_country:code:code:',
223 223
 			'e.phone' => 'Text', 'e.fax' => 'Text', 'e.statut' => 'Text', 'pe.rowid' => 'List:entrepot:ref:rowid:stock', 'pe.ref' => 'Text'
224 224
 		);
225
-		$this->export_entities_array[$r] = array();	// We define here only fields that use another icon that the one defined into export_icon
226
-		$this->export_aggregate_array[$r] = array();	// TODO Not used yet
225
+		$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon
226
+		$this->export_aggregate_array[$r] = array(); // TODO Not used yet
227 227
 		$keyforselect = 'warehouse';
228 228
 		$keyforelement = 'warehouse';
229 229
 		$keyforaliasextra = 'extra';
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product',
271 271
 			'ps.reel' => 'stock',
272 272
 			'p.seuil_stock_alerte' => 'product', 'p.barcode' => 'product', 'bt.libelle' => 'product',
273
-		);	// We define here only fields that use another icon that the one defined into export_icon
273
+		); // We define here only fields that use another icon that the one defined into export_icon
274 274
 		if (isModEnabled('barcode')) {
275 275
 			$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product'));
276 276
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 				'p.datec' => 'product', 'p.tms' => 'product', 'p.pmp' => 'product', 'p.cost_price' => 'product',
330 330
 				'pb.rowid' => 'batch', 'pb.batch' => 'batch', 'pb.qty' => 'batch',
331 331
 				'pl.eatby' => 'batch', 'pl.sellby' => 'batch'
332
-			);	// We define here only fields that use another icon that the one defined into export_icon
332
+			); // We define here only fields that use another icon that the one defined into export_icon
333 333
 			if (isModEnabled('barcode')) {
334 334
 				$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode' => 'product'));
335 335
 			}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 			'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse',
380 380
 			'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product",
381 381
 			'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product'
382
-		);	// We define here only fields that use another icon that the one defined into export_icon
382
+		); // We define here only fields that use another icon that the one defined into export_icon
383 383
 		if (isModEnabled('productbatch')) {
384 384
 			$this->export_fields_array[$r]['sm.batch'] = 'Batch';
385 385
 			$this->export_TypeFields_array[$r]['sm.batch'] = 'Text';
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			'e.rowid' => 'warehouse', 'e.ref' => 'warehouse', 'e.description' => 'warehouse', 'e.lieu' => 'warehouse', 'e.address' => 'warehouse', 'e.zip' => 'warehouse', 'e.town' => 'warehouse',
431 431
 			'p.rowid' => "product", 'p.ref' => "product", 'p.fk_product_type' => "product", 'p.label' => "product", 'p.description' => "product", 'p.note' => "product",
432 432
 			'p.price' => "product", 'p.tva_tx' => 'product', 'p.tosell' => "product", 'p.tobuy' => "product", 'p.duration' => "product", 'p.datec' => 'product', 'p.tms' => 'product'
433
-		);	// We define here only fields that use another icon that the one defined into export_icon
433
+		); // We define here only fields that use another icon that the one defined into export_icon
434 434
 		if (isModEnabled('productbatch')) {
435 435
 			$this->export_fields_array[$r]['id.batch'] = 'Batch';
436 436
 			$this->export_TypeFields_array[$r]['id.batch'] = 'Text';
Please login to merge, or discard this patch.
htdocs/core/modules/facture/doc/pdf_octopus.modules.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * Dolibarr version of the loaded document
77 77
 	 * @var string
78 78
 	 */
79
-	public $version = 'disabled';	// Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
79
+	public $version = 'disabled'; // Disabled by default. Enabled in constructor if option INVOICE_USE_SITUATION is 2.
80 80
 
81 81
 	/**
82 82
 	 * @var int height for info total
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			$outputlangsbis->loadLangs(array("main", "bills", "products", "dict", "companies"));
291 291
 		}
292 292
 
293
-		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE &&  !empty($object->situation_cycle_ref)))) {
293
+		if (empty($object) || ($object->type != Facture::TYPE_SITUATION && ($object->type != Facture::TYPE_CREDIT_NOTE && !empty($object->situation_cycle_ref)))) {
294 294
 			setEventMessage($langs->trans('WarningsObjectIsNotASituation'), 'warnings');
295 295
 			return 1;
296 296
 		}
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 				$pdf->SetAutoPageBreak(1, 0);
410 410
 
411 411
 				// compute height for situation invoices
412
-				$this->heightforinfotot = 45;	// Height reserved to output the info and total part and payment part
412
+				$this->heightforinfotot = 45; // Height reserved to output the info and total part and payment part
413 413
 				if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) {
414 414
 					$this->heightforinfotot += 4 * ($nbpayments + 3);
415 415
 				}
416 416
 				if ($nbprevsituation > 0) {
417 417
 					$this->heightforinfotot += 4 * ($nbprevsituation + 3);
418 418
 				}
419
-				$this->heightforfreetext= (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5));	// Height reserved to output the free text on last page
420
-				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22);	// Height reserved to output the footer (value include bottom margin)
419
+				$this->heightforfreetext = (getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5)); // Height reserved to output the free text on last page
420
+				$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin)
421 421
 
422 422
 				if (class_exists('TCPDF')) {
423 423
 					$pdf->setPrintHeader(false);
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 					if (!empty($conf->mycompany->multidir_output[$object->entity])) {
432 432
 						$logodir = $conf->mycompany->multidir_output[$object->entity];
433 433
 					}
434
-					$pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
434
+					$pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
435 435
 					$this->tplidx = $pdf->importPage(1);
436 436
 				}
437 437
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 				// $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher
524 524
 
525 525
 				// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks)
526
-				$this->tab_top = 90 + $top_shift + $shipp_shift;		// top_shift is an addition for linked objects or addons (0 in most cases)
526
+				$this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases)
527 527
 				$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
528 528
 
529 529
 				// You can add more thing under header here, if you increase $extra_under_address_shift too.
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
 				$this->_tableFirstPage($pdf, $tab_top, $this->page_hauteur - 100 - $this->heightforfreetext - $this->heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
580 580
 
581
-				$bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
581
+				$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
582 582
 
583 583
 				$this->_pagefoot($pdf, $object, $outputlangs, 1);
584 584
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 					if (!isset($this->tva[$vatrate])) {
1034 1034
 						$this->tva[$vatrate] = 0;
1035 1035
 					}
1036
-					$this->tva[$vatrate] += $tvaligne;	// ->tva is abandoned, we use now ->tva_array that is more complete
1036
+					$this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete
1037 1037
 					$vatcode = $object->lines[$i]->vat_src_code;
1038 1038
 					if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
1039 1039
 						$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 				}
1126 1126
 
1127 1127
 				$this->resumeLastPage($pdf, $object, 0, $tab_top, $outputlangs, $outputlangsbis);
1128
-				$bottomlasttab=$this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
1128
+				$bottomlasttab = $this->page_hauteur - $this->heightforinfotot - $this->heightforfreetext - $this->heightforfooter + 1;
1129 1129
 				$this->_pagefoot($pdf, $object, $outputlangs, 1);
1130 1130
 
1131 1131
 				$pdf->Close();
@@ -1333,8 +1333,8 @@  discard block
 block discarded – undo
1333 1333
 			$posy = $pdf->GetY() + 4;
1334 1334
 		}
1335 1335
 
1336
-		$posxval = 52;	// Position of values of properties shown on left side
1337
-		$posxend = 110;	// End of x for text on left side
1336
+		$posxval = 52; // Position of values of properties shown on left side
1337
+		$posxend = 110; // End of x for text on left side
1338 1338
 		if ($this->page_largeur < 210) { // To work with US executive format
1339 1339
 			$posxend -= 10;
1340 1340
 		}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 
1365 1365
 			$pdf->SetFont('', '', $default_font_size - 2);
1366 1366
 			$pdf->SetXY($posxval, $posy);
1367
-			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1367
+			$categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1368 1368
 			$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L');
1369 1369
 
1370 1370
 			$posy = $pdf->GetY() + 3; // for 2 lines
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 			$default_font_size--;
1563 1563
 		}
1564 1564
 
1565
-		$tab2_top = $posy-4;
1565
+		$tab2_top = $posy - 4;
1566 1566
 		$tab2_hl = 4;
1567 1567
 		$pdf->SetFont('', '', $default_font_size - 1);
1568 1568
 
@@ -1691,15 +1691,15 @@  discard block
 block discarded – undo
1691 1691
 				// VAT
1692 1692
 				$tvas = array();
1693 1693
 				$nblines = count($object->lines);
1694
-				for ($i=0; $i < $nblines; $i++) {
1694
+				for ($i = 0; $i < $nblines; $i++) {
1695 1695
 					$tvaligne = $object->lines[$i]->total_tva;
1696
-					$vatrate=(string) $object->lines[$i]->tva_tx;
1696
+					$vatrate = (string) $object->lines[$i]->tva_tx;
1697 1697
 
1698 1698
 					if (($object->lines[$i]->info_bits & 0x01) == 0x01) {
1699
-						$vatrate.='*';
1699
+						$vatrate .= '*';
1700 1700
 					}
1701
-					if (! isset($tvas[$vatrate])) {
1702
-						$tvas[$vatrate]=0;
1701
+					if (!isset($tvas[$vatrate])) {
1702
+						$tvas[$vatrate] = 0;
1703 1703
 					}
1704 1704
 					$tvas[$vatrate] += $tvaligne;
1705 1705
 				}
@@ -1953,8 +1953,8 @@  discard block
 block discarded – undo
1953 1953
 		global $conf;
1954 1954
 
1955 1955
 		// Force to disable hidetop and hidebottom
1956
-		$hidebottom=0;
1957
-		$hidetop=0;
1956
+		$hidebottom = 0;
1957
+		$hidetop = 0;
1958 1958
 
1959 1959
 		$currency = !empty($currency) ? $currency : $conf->currency;
1960 1960
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 		if (empty($hidetop)) {
1967 1967
 			// Show category of operations
1968 1968
 			if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) {
1969
-				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation);
1969
+				$categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation);
1970 1970
 				$pdf->SetXY($this->marge_gauche, $tab_top - 4);
1971 1971
 				$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations);
1972 1972
 			}
@@ -1977,16 +1977,16 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
 			// MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
1979 1979
 			if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
1980
-				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1980
+				$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
1981 1981
 			}
1982
-			$tab_top+=4;
1982
+			$tab_top += 4;
1983 1983
 		}
1984 1984
 
1985 1985
 		$pdf->SetDrawColor(128, 128, 128);
1986 1986
 		$pdf->SetFont('', '', $default_font_size - 1);
1987 1987
 
1988 1988
 		// Output Rect
1989
-		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
1989
+		$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
1990 1990
 
1991 1991
 		// situation invoice
1992 1992
 		$pdf->SetFont('', '', $default_font_size - 2);
@@ -2019,14 +2019,14 @@  discard block
 block discarded – undo
2019 2019
 			if (empty($hidetop)) {
2020 2020
 				$pdf->SetXY($xstartpos + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
2021 2021
 
2022
-				$textWidth = $colDef['width'] - $colDef['title']['padding'][3] -$colDef['title']['padding'][1];
2022
+				$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
2023 2023
 				$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
2024 2024
 			}
2025 2025
 		}
2026 2026
 		$pdf->SetFont('', '', $default_font_size - 1);
2027 2027
 
2028 2028
 		if (empty($hidetop)) {
2029
-			$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);	// line prend une position y en 2eme param et 4eme param
2029
+			$pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param
2030 2030
 		}
2031 2031
 	}
2032 2032
 
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 		$pdf->MultiCell($w, 3, $title, '', 'R');
2143 2143
 		if (!empty($subtitle)) {
2144 2144
 			$pdf->SetFont('', 'B', $default_font_size);
2145
-			$pdf->SetXY($posx, $posy+5);
2145
+			$pdf->SetXY($posx, $posy + 5);
2146 2146
 			$pdf->MultiCell($w, 6, $subtitle, '', 'R');
2147 2147
 			$posy += 2;
2148 2148
 		}
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
 			'overtitle' => array(
2597 2597
 				'textkey' => 'Chantier', // use lang key is useful in somme case with module
2598 2598
 				'align' => 'C',
2599
-				'padding' => array(0.5,0.5,0.5,0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2599
+				'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
2600 2600
 				'width' => 18
2601 2601
 			),
2602 2602
 		);
@@ -2621,13 +2621,13 @@  discard block
 block discarded – undo
2621 2621
 			),
2622 2622
 			'border-left' => true, // add left line separator
2623 2623
 			'overtitle' => array(
2624
-				'textkey' => 'S'.$derniere_situation->situation_counter . ' - ' . dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2624
+				'textkey' => 'S'.$derniere_situation->situation_counter.' - '.dol_print_date($derniere_situation->date, "%d/%m/%Y"),
2625 2625
 				'align' => 'C',
2626
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2627
-				'width' => 10+15 //current width + amount cell width
2626
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2627
+				'width' => 10 + 15 //current width + amount cell width
2628 2628
 			),
2629 2629
 		);
2630
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2630
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2631 2631
 			$this->cols['prev_progress']['status'] = true;
2632 2632
 		}
2633 2633
 
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
 			),
2643 2643
 			'border-left' => true, // add left line separator
2644 2644
 		);
2645
-		if ($this->situationinvoice && ! empty($this->TDataSituation['date_derniere_situation'])) {
2645
+		if ($this->situationinvoice && !empty($this->TDataSituation['date_derniere_situation'])) {
2646 2646
 			$this->cols['prev_progress_amount']['status'] = true;
2647 2647
 		}
2648 2648
 
@@ -2657,10 +2657,10 @@  discard block
 block discarded – undo
2657 2657
 			),
2658 2658
 			'border-left' => true, // add left line separator
2659 2659
 			'overtitle' => array(
2660
-				'textkey' => 'S'.$object->situation_counter . ' - ' . dol_print_date($object->date, "%d/%m/%Y"),
2660
+				'textkey' => 'S'.$object->situation_counter.' - '.dol_print_date($object->date, "%d/%m/%Y"),
2661 2661
 				'align' => 'C',
2662
-				'padding' => array(0.5,0.2,0.5,0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2663
-				'width' => 10+15
2662
+				'padding' => array(0.5, 0.2, 0.5, 0.2), // Like css 0 => top, 1 => right, 2 => bottom, 3 => left
2663
+				'width' => 10 + 15
2664 2664
 			),
2665 2665
 		);
2666 2666
 
@@ -2751,9 +2751,9 @@  discard block
 block discarded – undo
2751 2751
 
2752 2752
 
2753 2753
 		// Force to disable hidetop and hidebottom
2754
-		$hidebottom=0;
2754
+		$hidebottom = 0;
2755 2755
 		if ($hidetop) {
2756
-			$hidetop=-1;
2756
+			$hidetop = -1;
2757 2757
 		}
2758 2758
 
2759 2759
 		$currency = !empty($currency) ? $currency : $conf->currency;
@@ -2765,15 +2765,15 @@  discard block
 block discarded – undo
2765 2765
 
2766 2766
 		if (empty($hidetop)) {
2767 2767
 			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
2768
-			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-8);
2768
+			$pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 8);
2769 2769
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
2770 2770
 
2771
-			$width = $this->page_largeur-$this->marge_gauche-$this->marge_droite-83;
2771
+			$width = $this->page_largeur - $this->marge_gauche - $this->marge_droite - 83;
2772 2772
 
2773 2773
 			//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
2774 2774
 			if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
2775
-				$pdf->Rect($this->posx_cumul_anterieur-1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2776
-				$pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2775
+				$pdf->Rect($this->posx_cumul_anterieur - 1, $tab_top, $width, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2776
+				$pdf->Rect($this->marge_gauche, $tab_top + 92.5, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 5, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
2777 2777
 			}
2778 2778
 		}
2779 2779
 
@@ -2782,47 +2782,47 @@  discard block
 block discarded – undo
2782 2782
 
2783 2783
 		// Output Rect
2784 2784
 		// KEEPTHIS => Affiche les bords extérieurs
2785
-		$this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom);	// Rect prend une longueur en 3eme param et 4eme param
2785
+		$this->printRectBtp($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
2786 2786
 
2787
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top, $this->posx_cumul_anterieur-1, $tab_top + $tab_height);
2787
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top, $this->posx_cumul_anterieur - 1, $tab_top + $tab_height);
2788 2788
 		if (empty($hidetop)) {
2789
-			$pdf->SetXY($this->posx_cumul_anterieur-1, $tab_top+0.5);
2789
+			$pdf->SetXY($this->posx_cumul_anterieur - 1, $tab_top + 0.5);
2790 2790
 			$pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceOldCumulation"), '', 'C');
2791 2791
 		}
2792 2792
 
2793 2793
 		// PRINT COLUMNS TITLES
2794
-		$pdf->line($this->posx_new_cumul-1, $tab_top, $this->posx_new_cumul-1, $tab_top + $tab_height);
2794
+		$pdf->line($this->posx_new_cumul - 1, $tab_top, $this->posx_new_cumul - 1, $tab_top + $tab_height);
2795 2795
 		if (empty($hidetop)) {
2796
-			$pdf->SetXY($this->posx_new_cumul-1, $tab_top+0.5);
2796
+			$pdf->SetXY($this->posx_new_cumul - 1, $tab_top + 0.5);
2797 2797
 			$pdf->MultiCell(35, 2, $outputlangs->transnoentities("SituationInvoiceNewCumulation"), '', 'C');
2798 2798
 		}
2799 2799
 
2800
-		$pdf->line($this->posx_current-1, $tab_top, $this->posx_current-1, $tab_top + $tab_height);
2800
+		$pdf->line($this->posx_current - 1, $tab_top, $this->posx_current - 1, $tab_top + $tab_height);
2801 2801
 		if (empty($hidetop)) {
2802
-			$pdf->SetXY($this->posx_current-1, $tab_top+0.5);
2802
+			$pdf->SetXY($this->posx_current - 1, $tab_top + 0.5);
2803 2803
 			$pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", $object->situation_counter), '', 'C');
2804 2804
 		}
2805 2805
 
2806 2806
 		// ADD HORIZONTAL LINES
2807
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
2807
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
2808 2808
 
2809
-		$pdf->line($this->posx_cumul_anterieur-1, $tab_top+24, $this->page_largeur-$this->marge_droite, $tab_top+24);
2809
+		$pdf->line($this->posx_cumul_anterieur - 1, $tab_top + 24, $this->page_largeur - $this->marge_droite, $tab_top + 24);
2810 2810
 
2811
-		$pdf->line($this->marge_gauche, $tab_top+55, $this->page_largeur-$this->marge_droite, $tab_top+55);
2811
+		$pdf->line($this->marge_gauche, $tab_top + 55, $this->page_largeur - $this->marge_droite, $tab_top + 55);
2812 2812
 
2813 2813
 		$pdf->line($this->marge_gauche, $tab_top + 65, $this->page_largeur - $this->marge_droite, $tab_top + 65);
2814 2814
 
2815 2815
 		if ($displayWarranty) {
2816
-			$pdf->line($this->marge_gauche, $tab_top+85, $this->page_largeur-$this->marge_droite, $tab_top+85);
2816
+			$pdf->line($this->marge_gauche, $tab_top + 85, $this->page_largeur - $this->marge_droite, $tab_top + 85);
2817 2817
 		}
2818 2818
 
2819 2819
 
2820 2820
 		// ADD TEXT INTO CELL
2821 2821
 		/********************** Titles ******************************/
2822
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+8);
2822
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 8);
2823 2823
 		$pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceMainTask"), '', 'L');
2824 2824
 
2825
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+12);
2825
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 12);
2826 2826
 		$pdf->MultiCell(60, 2, $outputlangs->transnoentities("SituationInvoiceAdditionalTask"), '', 'L');
2827 2827
 
2828 2828
 		$form->load_cache_vatrates("'".$object->thirdparty->country_code."'");
@@ -2836,10 +2836,10 @@  discard block
 block discarded – undo
2836 2836
 			}
2837 2837
 			$i += 8;
2838 2838
 
2839
-			$pdf->SetXY($this->marge_gauche+10, $tab_top+24 + $i);
2839
+			$pdf->SetXY($this->marge_gauche + 10, $tab_top + 24 + $i);
2840 2840
 			$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalHT").' '.$TVatInfo['label'], '', 'L');
2841 2841
 
2842
-			if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2842
+			if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2843 2843
 				$pdf->SetXY($this->marge_gauche + 10, $tab_top + 28 + $i);
2844 2844
 				$pdf->MultiCell(80, 2, $outputlangs->transnoentities("VAT").' '.$TVatInfo['label'], '', 'L');
2845 2845
 			} else {
@@ -2847,25 +2847,25 @@  discard block
 block discarded – undo
2847 2847
 			}
2848 2848
 		}
2849 2849
 
2850
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+33+$i);
2850
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 33 + $i);
2851 2851
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalTTC"), '', 'L');
2852 2852
 
2853 2853
 
2854 2854
 		$pdf->SetFont('', 'B', $default_font_size - 1);
2855
-		$pdf->SetXY($this->marge_gauche+2, $tab_top+58);
2855
+		$pdf->SetXY($this->marge_gauche + 2, $tab_top + 58);
2856 2856
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("TotalSituationInvoice"), '', 'L');
2857 2857
 		$pdf->SetFont('', '', $default_font_size - 2);
2858 2858
 
2859 2859
 		if ($displayWarranty) {
2860 2860
 			$pdf->SetXY($this->marge_gauche + 2, $tab_top + 74);
2861 2861
 			$pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", $object->retained_warranty), '', 'L');
2862
-			$nextY = $tab_top+93;
2862
+			$nextY = $tab_top + 93;
2863 2863
 		} else {
2864
-			$nextY = $tab_top+74;
2864
+			$nextY = $tab_top + 74;
2865 2865
 		}
2866 2866
 
2867 2867
 		$pdf->SetFont('', 'B', $default_font_size - 1);
2868
-		$pdf->SetXY($this->marge_gauche+2, $nextY);
2868
+		$pdf->SetXY($this->marge_gauche + 2, $nextY);
2869 2869
 		$pdf->MultiCell(80, 2, $outputlangs->transnoentities("SituationTotalRayToRest"), '', 'L');
2870 2870
 		$pdf->SetFont('', '', $default_font_size - 2);
2871 2871
 		/***********************************************************/
@@ -2877,17 +2877,17 @@  discard block
 block discarded – undo
2877 2877
 			'current'
2878 2878
 		);
2879 2879
 
2880
-		$x = $this->marge_gauche+85;
2880
+		$x = $this->marge_gauche + 85;
2881 2881
 		// unset($this->TDataSituation['derniere_situation']);
2882 2882
 		// print json_encode($object->lines);exit;
2883 2883
 		// print json_encode($this->TDataSituation);exit;
2884 2884
 		foreach ($TToDisplay as $col) {
2885 2885
 			// Travaux principaux
2886
-			$pdf->SetXY($x, $tab_top+8);
2886
+			$pdf->SetXY($x, $tab_top + 8);
2887 2887
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['HT'], 0, '', 1, -1, 2), '', 'R');
2888 2888
 
2889 2889
 			// Travaux supplémentaires
2890
-			$pdf->SetXY($x, $tab_top+12);
2890
+			$pdf->SetXY($x, $tab_top + 12);
2891 2891
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['travaux_sup'], 0, '', 1, -1, 2), '', 'R');
2892 2892
 
2893 2893
 			$i = -8;
@@ -2899,11 +2899,11 @@  discard block
 block discarded – undo
2899 2899
 				$i += 8;
2900 2900
 
2901 2901
 				// Total HT
2902
-				$pdf->SetXY($x, $tab_top+24+$i);
2902
+				$pdf->SetXY($x, $tab_top + 24 + $i);
2903 2903
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['HT'], 0, '', 1, -1, 2), '', 'R');
2904 2904
 
2905 2905
 				// Total TVA
2906
-				if (! empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2906
+				if (!empty($this->TDataSituation['current'][$tva_tx_formated]['TVA'])) {
2907 2907
 					$pdf->SetXY($x, $tab_top + 28 + $i);
2908 2908
 					$pdf->MultiCell(32, 2, price($this->TDataSituation[$col][$tva_tx_formated]['TVA'], 0, '', 1, -1, 2), '', 'R');
2909 2909
 				} else {
@@ -2912,23 +2912,23 @@  discard block
 block discarded – undo
2912 2912
 			}
2913 2913
 
2914 2914
 			// Total TTC
2915
-			$pdf->SetXY($x, $tab_top+33+$i);
2915
+			$pdf->SetXY($x, $tab_top + 33 + $i);
2916 2916
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R');
2917 2917
 
2918 2918
 			// Total situation
2919 2919
 			$pdf->SetFont('', 'B', $default_font_size - 1);
2920
-			$pdf->SetXY($x, $tab_top+58);
2920
+			$pdf->SetXY($x, $tab_top + 58);
2921 2921
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['TTC'], 0, '', 1, -1, 2), '', 'R');
2922 2922
 			$pdf->SetFont('', '', $default_font_size - 2);
2923 2923
 
2924 2924
 
2925 2925
 			if ($displayWarranty) {
2926 2926
 				// Retained warranty
2927
-				$pdf->SetXY($x, $tab_top+74);
2927
+				$pdf->SetXY($x, $tab_top + 74);
2928 2928
 				$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['retenue_garantie'], 0, '', 1, -1, 2), '', 'R');
2929
-				$nextY = $tab_top+93;
2929
+				$nextY = $tab_top + 93;
2930 2930
 			} else {
2931
-				$nextY = $tab_top+74;
2931
+				$nextY = $tab_top + 74;
2932 2932
 			}
2933 2933
 
2934 2934
 			// Amount payable incl. VAT
@@ -2937,7 +2937,7 @@  discard block
 block discarded – undo
2937 2937
 			$pdf->MultiCell(32, 2, price($this->TDataSituation[$col]['total_a_payer'], 0, '', 1, -1, 2), '', 'R');
2938 2938
 			$pdf->SetFont('', '', $default_font_size - 2);
2939 2939
 
2940
-			$x+=36;
2940
+			$x += 36;
2941 2941
 		}
2942 2942
 		/************************************************************/
2943 2943
 	}
@@ -2983,7 +2983,7 @@  discard block
 block discarded – undo
2983 2983
 
2984 2984
 		$TDataSituation = array();
2985 2985
 
2986
-		if (! empty($facDerniereSituation)) {
2986
+		if (!empty($facDerniereSituation)) {
2987 2987
 			$TDataSituation['derniere_situation'] = $facDerniereSituation;
2988 2988
 			$TDataSituation['date_derniere_situation'] = $facDerniereSituation->date;
2989 2989
 		}
@@ -2992,9 +2992,9 @@  discard block
 block discarded – undo
2992 2992
 		$retenue_garantie_anterieure = 0;
2993 2993
 		// Init tous les champs à 0
2994 2994
 		$TDataSituation['cumul_anterieur'] = array(
2995
-			'HT' => 0,	//montant HT normal
2996
-			'TVA' => 0,   //montant de la TVA sur le HTnet
2997
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
2995
+			'HT' => 0, //montant HT normal
2996
+			'TVA' => 0, //montant de la TVA sur le HTnet
2997
+			'TTC' => 0, //montant TTC (HTnet + TVA)
2998 2998
 			'retenue_garantie' => 0,
2999 2999
 			'travaux_sup' => 0,
3000 3000
 			'HTnet' => 0, //montant HT
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 					$isFirstSituation = false;
3025 3025
 					if (!empty($l->fk_prev_id)) {
3026 3026
 						$prevSituationPercent = $l->get_prev_progress($previousInvoice->id, true);
3027
-					} elseif (! array_key_exists($i+1, $TPreviousInvoices)) {
3027
+					} elseif (!array_key_exists($i + 1, $TPreviousInvoices)) {
3028 3028
 						$isFirstSituation = true;
3029 3029
 					}
3030 3030
 
@@ -3033,8 +3033,8 @@  discard block
 block discarded – undo
3033 3033
 					$ltvatx = (float) sprintf("%01.3f", $l->tva_tx);
3034 3034
 
3035 3035
 					//1ere ligne
3036
-					$amounttva = $calc_ht * ($ltvatx/100);
3037
-					if (! isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3036
+					$amounttva = $calc_ht * ($ltvatx / 100);
3037
+					if (!isset($TDataSituation['cumul_anterieur'][$ltvatx])) {
3038 3038
 						$TDataSituation['cumul_anterieur'][$ltvatx]['HT'] = $calc_ht;
3039 3039
 						$TDataSituation['cumul_anterieur'][$ltvatx]['TVA'] = $amounttva;
3040 3040
 					} else {
@@ -3046,14 +3046,14 @@  discard block
 block discarded – undo
3046 3046
 					//le grand total de TVA
3047 3047
 					// $TDataSituation['cumul_anterieur']['TVA'] += $amounttva;
3048 3048
 
3049
-					if (empty($l->fk_prev_id) && ! $isFirstSituation) {
3049
+					if (empty($l->fk_prev_id) && !$isFirstSituation) {
3050 3050
 						// TODO: à clarifier, mais pour moi, un facture de situation précédente qui a des progressions à 0% c'est pas logique
3051 3051
 						$TDataSituation['cumul_anterieur']['travaux_sup'] += $calc_ht;
3052 3052
 					}
3053 3053
 				}
3054 3054
 			}
3055 3055
 
3056
-			if (! empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3056
+			if (!empty($previousInvoice->retained_warranty) && !getDolGlobalString('USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION_FINAL')) {
3057 3057
 				$retenue_garantie_anterieure += $previousInvoice->getRetainedWarrantyAmount();
3058 3058
 			}
3059 3059
 
@@ -3067,7 +3067,7 @@  discard block
 block discarded – undo
3067 3067
 		// print json_encode($facDerniereSituation->lines);exit;
3068 3068
 		$TDataSituation['current'] = $this->btpGetInvoiceAmounts($object->id);
3069 3069
 
3070
-		if (! empty($facDerniereSituation->lines)) {
3070
+		if (!empty($facDerniereSituation->lines)) {
3071 3071
 			$TFacLinesKey = array_keys($facDerniereSituation->lines);
3072 3072
 			$TObjectLinesKey = array_keys($object->lines);
3073 3073
 			$TDiffKey = array_diff($TObjectLinesKey, $TFacLinesKey);
@@ -3212,14 +3212,14 @@  discard block
 block discarded – undo
3212 3212
 	 */
3213 3213
 	public function printRectBtp(&$pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
3214 3214
 	{
3215
-		if (empty($hidetop) || $hidetop==-1) {
3216
-			$pdf->line($x, $y, $x+$l, $y);
3215
+		if (empty($hidetop) || $hidetop == -1) {
3216
+			$pdf->line($x, $y, $x + $l, $y);
3217 3217
 		}
3218
-		$pdf->line($x+$l, $y, $x+$l, $y+$h);
3218
+		$pdf->line($x + $l, $y, $x + $l, $y + $h);
3219 3219
 		if (empty($hidebottom)) {
3220
-			$pdf->line($x+$l, $y+$h, $x, $y+$h);
3220
+			$pdf->line($x + $l, $y + $h, $x, $y + $h);
3221 3221
 		}
3222
-		$pdf->line($x, $y+$h, $x, $y);
3222
+		$pdf->line($x, $y + $h, $x, $y);
3223 3223
 	}
3224 3224
 
3225 3225
 
@@ -3233,9 +3233,9 @@  discard block
 block discarded – undo
3233 3233
 	 */
3234 3234
 	public function btpGetInvoiceAmounts($id, $forceReadFromDB = false)
3235 3235
 	{
3236
-		global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes;
3236
+		global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes;
3237 3237
 
3238
-		$object=new Facture($db);
3238
+		$object = new Facture($db);
3239 3239
 		$object->fetch($id);
3240 3240
 
3241 3241
 		/* from dolibarr core
@@ -3251,16 +3251,16 @@  discard block
 block discarded – undo
3251 3251
 		$facDerniereSituation = $TPreviousInvoices[0];
3252 3252
 
3253 3253
 		$ret = array(
3254
-			'HT' => 0,	//montant HT normal
3254
+			'HT' => 0, //montant HT normal
3255 3255
 			'HTnet' => 0, //montant HT
3256
-			'TVA' => 0,   //montant de la TVA sur le HTnet
3257
-			'TTC' => 0,   //montant TTC (HTnet + TVA)
3256
+			'TVA' => 0, //montant de la TVA sur le HTnet
3257
+			'TTC' => 0, //montant TTC (HTnet + TVA)
3258 3258
 			'retenue_garantie' => 0,
3259 3259
 			'travaux_sup' => 0,
3260 3260
 			'total_a_payer' => 0 //montant "a payer" sur la facture
3261 3261
 		);
3262 3262
 
3263
-		if (! empty($facDerniereSituation)) {
3263
+		if (!empty($facDerniereSituation)) {
3264 3264
 			$ret['derniere_situation'] = $facDerniereSituation;
3265 3265
 			$ret['date_derniere_situation'] = $facDerniereSituation->date;
3266 3266
 		}
@@ -3390,16 +3390,16 @@  discard block
 block discarded – undo
3390 3390
 			$pdf->SetFont('', '', $default_font_size - 1);
3391 3391
 
3392 3392
 			$label = $outputlangs->transnoentities("SituationInvoiceTotalProposal");
3393
-			$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy+1);
3393
+			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0, 1, $posx, $posy + 1);
3394 3394
 
3395
-			$amount = price($sign * ($total_ht + (! empty($propal->remise)?$propal->remise:0)));
3396
-			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1);
3395
+			$amount = price($sign * ($total_ht + (!empty($propal->remise) ? $propal->remise : 0)));
3396
+			$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3397 3397
 
3398 3398
 			$pdf->SetFont('', '', $default_font_size - 1);
3399 3399
 
3400 3400
 			// Output Rect
3401 3401
 			$pdf->SetDrawColor(128, 128, 128);
3402
-			$this->printRect($pdf, $posx, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 6);	// Rect prend une longueur en 3eme param et 4eme param
3402
+			$this->printRect($pdf, $posx, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 6); // Rect prend une longueur en 3eme param et 4eme param
3403 3403
 
3404 3404
 			$posy += 4;
3405 3405
 		} elseif (count($orders)) {
@@ -3409,7 +3409,7 @@  discard block
 block discarded – undo
3409 3409
 			$remain_to_pay = $total_ht;
3410 3410
 		}
3411 3411
 
3412
-		$useborder=0;
3412
+		$useborder = 0;
3413 3413
 		$index = 0;
3414 3414
 
3415 3415
 		$height = 4;
@@ -3425,7 +3425,7 @@  discard block
 block discarded – undo
3425 3425
 		$pdf->SetXY($posx, $posy);
3426 3426
 
3427 3427
 
3428
-		$depositsamount=$object->getSumDepositsUsed();
3428
+		$depositsamount = $object->getSumDepositsUsed();
3429 3429
 		$deja_regle = $object->getSommePaiement();
3430 3430
 
3431 3431
 		$tot_deja_regle = ($depositsamount + $deja_regle);
@@ -3434,7 +3434,7 @@  discard block
 block discarded – undo
3434 3434
 
3435 3435
 		$force_to_zero = false;
3436 3436
 
3437
-		$idinv = 0;//count($previousinvoices);
3437
+		$idinv = 0; //count($previousinvoices);
3438 3438
 		while ($idinv < count($previousinvoices)) {
3439 3439
 			$invoice = $previousinvoices[$idinv];
3440 3440
 
@@ -3452,13 +3452,13 @@  discard block
 block discarded – undo
3452 3452
 			$ref = $outputlangs->transnoentities("InvoiceSituation").$outputlangs->convToOutputCharset(" n°".$invoice->situation_counter);
3453 3453
 
3454 3454
 			if ($invoice->situation_final) {
3455
-				$ref.= ' - DGD';
3455
+				$ref .= ' - DGD';
3456 3456
 				$force_to_zero = true;
3457 3457
 			}
3458 3458
 
3459
-			$ref.= ' - '. $invoice->ref;
3460
-			$ref.= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')';
3461
-			$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $ref, 0, 'L', 0);
3459
+			$ref .= ' - '.$invoice->ref;
3460
+			$ref .= ' ('.dol_print_date($invoice->date, "%d/%m/%Y", false, $outputlangs).')';
3461
+			$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $ref, 0, 'L', 0);
3462 3462
 
3463 3463
 			$pdf->SetFont('', '', $default_font_size - 1);
3464 3464
 
@@ -3474,20 +3474,20 @@  discard block
 block discarded – undo
3474 3474
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
3475 3475
 
3476 3476
 			$total_ht = ($conf->multicurrency->enabled && $invoice->mylticurrency_tx != 1 ? $invoice->multicurrency_total_ht : $invoice->total_ht);
3477
-			$pdf->SetXY($posx+$width, $posy);
3478
-			$pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise)?$invoice->remise:0)), 0, $outputlangs), 0, 'R', 1);
3477
+			$pdf->SetXY($posx + $width, $posy);
3478
+			$pdf->MultiCell($width2, $height, price($sign * ($total_ht + (!empty($invoice->remise) ? $invoice->remise : 0)), 0, $outputlangs), 0, 'R', 1);
3479 3479
 
3480 3480
 			$tvas = array();
3481 3481
 			$nblines = count($invoice->lines);
3482
-			for ($i=0; $i < $nblines; $i++) {
3482
+			for ($i = 0; $i < $nblines; $i++) {
3483 3483
 				$tvaligne = $invoice->lines[$i]->total_tva;
3484 3484
 				$vatrate = (string) $invoice->lines[$i]->tva_tx;
3485 3485
 
3486 3486
 				if (($invoice->lines[$i]->info_bits & 0x01) == 0x01) {
3487
-					$vatrate.='*';
3487
+					$vatrate .= '*';
3488 3488
 				}
3489
-				if (! isset($tvas[$vatrate])) {
3490
-					$tvas[$vatrate]=0;
3489
+				if (!isset($tvas[$vatrate])) {
3490
+					$tvas[$vatrate] = 0;
3491 3491
 				}
3492 3492
 				$tvas[$vatrate] += $tvaligne;
3493 3493
 			}
@@ -3505,10 +3505,10 @@  discard block
 block discarded – undo
3505 3505
 						$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
3506 3506
 					}
3507 3507
 					$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).' ';
3508
-					$totalvat.= vatrate($tvakey, 1).$tvacompl;
3508
+					$totalvat .= vatrate($tvakey, 1).$tvacompl;
3509 3509
 					$pdf->MultiCell($width, $height, $totalvat, 0, 'L', 1);
3510 3510
 
3511
-					$pdf->SetXY($posx+$width, $posy + $height * $index);
3511
+					$pdf->SetXY($posx + $width, $posy + $height * $index);
3512 3512
 					$pdf->MultiCell($width2, $height, price($tvaval, 0, $outputlangs), 0, 'R', 1);
3513 3513
 				}
3514 3514
 			}
@@ -3525,7 +3525,7 @@  discard block
 block discarded – undo
3525 3525
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
3526 3526
 
3527 3527
 
3528
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3528
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3529 3529
 			$pdf->MultiCell($width2, $height, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
3530 3530
 
3531 3531
 			$retainedWarrantyRate = (float) ($object->retained_warranty ? price2num($object->retained_warranty) : price2num(getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', 0)));
@@ -3541,10 +3541,10 @@  discard block
 block discarded – undo
3541 3541
 				$pdf->SetFillColor(241, 241, 241);
3542 3542
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", $retainedWarrantyRate), $useborder, 'L', 1);
3543 3543
 
3544
-				$total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate/100), 'MT');
3545
-				$total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate/100), 'MT');
3544
+				$total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate / 100), 'MT');
3545
+				$total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate / 100), 'MT');
3546 3546
 
3547
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3547
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3548 3548
 				$pdf->MultiCell($width2, $height, price(-$sign * $total_ht_rg, 0, $outputlangs), $useborder, 'R', 1);
3549 3549
 
3550 3550
 				$total_ht_with_rg = $total_ht - $total_ht_rg;
@@ -3558,7 +3558,7 @@  discard block
 block discarded – undo
3558 3558
 				$pdf->SetFillColor(224, 224, 224);
3559 3559
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("TotalSituationInvoiceWithRetainedWarranty"), $useborder, 'L', 1);
3560 3560
 
3561
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3561
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3562 3562
 				$pdf->MultiCell($width2, $height, price($sign * $total_ttc_with_rg, 0, $outputlangs), $useborder, 'R', 1);
3563 3563
 			}
3564 3564
 
@@ -3583,7 +3583,7 @@  discard block
 block discarded – undo
3583 3583
 
3584 3584
 			$pdf->SetXY($posx, $posy + $height * $index);
3585 3585
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("Paid"), 0, 'L', 0);
3586
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3586
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3587 3587
 			$pdf->MultiCell($width2, $height, price($deja_regle + $depositsamount, 0, $outputlangs), 0, 'R', 0);
3588 3588
 
3589 3589
 			// Credit note
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
 				$index++;
3592 3592
 				$pdf->SetXY($posx, $posy + $height * $index);
3593 3593
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
3594
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3594
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3595 3595
 				$pdf->MultiCell($width2, $height, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
3596 3596
 			}
3597 3597
 
@@ -3602,10 +3602,10 @@  discard block
 block discarded – undo
3602 3602
 
3603 3603
 				$pdf->SetXY($posx, $posy + $height * $index);
3604 3604
 				$pdf->MultiCell($width, $height, $outputlangs->transnoentities("EscompteOfferedShort"), $useborder, 'L', 1);
3605
-				$pdf->SetXY($posx+$width, $posy + $height * $index);
3605
+				$pdf->SetXY($posx + $width, $posy + $height * $index);
3606 3606
 				$pdf->MultiCell($width2, $height, price($invoice->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 0, $outputlangs), $useborder, 'R', 1);
3607 3607
 
3608
-				$resteapayer=0;
3608
+				$resteapayer = 0;
3609 3609
 			}
3610 3610
 
3611 3611
 			$index++;
@@ -3613,7 +3613,7 @@  discard block
 block discarded – undo
3613 3613
 			$pdf->SetFillColor(224, 224, 224);
3614 3614
 			$pdf->SetXY($posx, $posy + $height * $index);
3615 3615
 			$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1);
3616
-			$pdf->SetXY($posx+$width, $posy + $height * $index);
3616
+			$pdf->SetXY($posx + $width, $posy + $height * $index);
3617 3617
 			$pdf->MultiCell($width2, $height, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1);
3618 3618
 
3619 3619
 			$pdf->SetFont('', '', $default_font_size - 1);
@@ -3622,8 +3622,8 @@  discard block
 block discarded – undo
3622 3622
 			$index++;
3623 3623
 
3624 3624
 			if ($deja_regle > 0) {
3625
-				$title=$outputlangs->transnoentities("PaymentsAlreadyDone");
3626
-				if ($invoice->type == 2) $title=$outputlangs->transnoentities("PaymentsBackAlreadyDone");
3625
+				$title = $outputlangs->transnoentities("PaymentsAlreadyDone");
3626
+				if ($invoice->type == 2) $title = $outputlangs->transnoentities("PaymentsBackAlreadyDone");
3627 3627
 
3628 3628
 				$pdf->SetFont('', '', $default_font_size - 3);
3629 3629
 				$pdf->SetXY($posx, $posy + $height * $index);
@@ -3633,21 +3633,21 @@  discard block
 block discarded – undo
3633 3633
 
3634 3634
 				$index++;
3635 3635
 
3636
-				$width4 = ($this->page_largeur - $this->marge_droite - $posx)/4;
3636
+				$width4 = ($this->page_largeur - $this->marge_droite - $posx) / 4;
3637 3637
 
3638 3638
 				$pdf->SetFont('', '', $default_font_size - 4);
3639 3639
 				$pdf->SetXY($posx, $posy + $height * $index);
3640
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
3641
-				$pdf->SetXY($posx+$width4, $posy + $height * $index);
3642
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
3643
-				$pdf->SetXY($posx+$width4*2, $posy + $height * $index);
3644
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Type"), 0, 'L', 0);
3645
-				$pdf->SetXY($posx+$width4*3, $posy + $height * $index);
3646
-				$pdf->MultiCell($width4, $height-1, $outputlangs->transnoentities("Num"), 0, 'L', 0);
3640
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Payment"), 0, 'L', 0);
3641
+				$pdf->SetXY($posx + $width4, $posy + $height * $index);
3642
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Amount"), 0, 'L', 0);
3643
+				$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index);
3644
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Type"), 0, 'L', 0);
3645
+				$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index);
3646
+				$pdf->MultiCell($width4, $height - 1, $outputlangs->transnoentities("Num"), 0, 'L', 0);
3647 3647
 
3648 3648
 				//$pdf->line($tab3_posx, $tab3_top-1+$tab3_height, $tab3_posx+$tab3_width, $tab3_top-1+$tab3_height);
3649 3649
 
3650
-				$y=$height-1;
3650
+				$y = $height - 1;
3651 3651
 
3652 3652
 				$pdf->SetFont('', '', $default_font_size - 4);
3653 3653
 				/** @var Facture $invoice */
@@ -3656,15 +3656,15 @@  discard block
 block discarded – undo
3656 3656
 				if (count($payments)) {
3657 3657
 					foreach ($payments as $payment) {
3658 3658
 						$pdf->SetXY($posx, $posy + $height * $index + $y);
3659
-						$pdf->MultiCell($width4, $height-1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0);
3660
-						$pdf->SetXY($posx+$width4, $posy + $height * $index + $y);
3661
-						$pdf->MultiCell($width4, $height-1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3662
-						$pdf->SetXY($posx+$width4*2, $posy + $height * $index + $y);
3663
-						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort" . $payment['type']);
3659
+						$pdf->MultiCell($width4, $height - 1, dol_print_date($this->db->jdate($payment['date']), 'day', false, $outputlangs, true), 0, 'L', 0);
3660
+						$pdf->SetXY($posx + $width4, $posy + $height * $index + $y);
3661
+						$pdf->MultiCell($width4, $height - 1, price($sign * $payment['amount'], 0, $outputlangs), 0, 'L', 0);
3662
+						$pdf->SetXY($posx + $width4 * 2, $posy + $height * $index + $y);
3663
+						$oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$payment['type']);
3664 3664
 
3665
-						$pdf->MultiCell($width4, $height-1, $oper, 0, 'L', 0);
3666
-						$pdf->SetXY($posx+$width4*3, $posy + $height * $index + $y);
3667
-						$pdf->MultiCell($width4, $height-1, $payment['num'], 0, 'L', 0);
3665
+						$pdf->MultiCell($width4, $height - 1, $oper, 0, 'L', 0);
3666
+						$pdf->SetXY($posx + $width4 * 3, $posy + $height * $index + $y);
3667
+						$pdf->MultiCell($width4, $height - 1, $payment['num'], 0, 'L', 0);
3668 3668
 
3669 3669
 						//$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
3670 3670
 						$y += ($height - 1);
@@ -3674,21 +3674,21 @@  discard block
 block discarded – undo
3674 3674
 
3675 3675
 			// Output Rect
3676 3676
 			$pdf->SetDrawColor(128, 128, 128);
3677
-			$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height * $index + $y);
3677
+			$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height * $index + $y);
3678 3678
 			$posy += $height * $index + $y;
3679 3679
 
3680
-			$pageposafter=$pdf->getPage();
3680
+			$pageposafter = $pdf->getPage();
3681 3681
 			if ($pageposafter > $pageposbefore) {	// There is a pagebreak
3682 3682
 				$pdf->rollbackTransaction(true);
3683 3683
 
3684
-				$pageposafter=$pageposbefore;
3684
+				$pageposafter = $pageposbefore;
3685 3685
 				$pdf->AddPage('', '', true);
3686 3686
 				if (!empty($this->tplidx)) {
3687 3687
 					$pdf->useTemplate($this->tplidx);
3688 3688
 				}
3689 3689
 				if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs);
3690
-				$pdf->setPage($pageposafter+1);
3691
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3690
+				$pdf->setPage($pageposafter + 1);
3691
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3692 3692
 
3693 3693
 				$posy = $this->tab_top_newpage + 1;
3694 3694
 			} else {
@@ -3720,18 +3720,18 @@  discard block
 block discarded – undo
3720 3720
 
3721 3721
 		$posy += 10;
3722 3722
 
3723
-		$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
3723
+		$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
3724 3724
 
3725 3725
 		$pdf->SetTextColor(0, 0, 60);
3726 3726
 		$pdf->SetFont('', '', $default_font_size - 1);
3727 3727
 		$pdf->SetXY($this->marge_gauche, $posy + 1);
3728 3728
 		$label = $outputlangs->transnoentities("SituationTotalRayToRest");
3729
-		$pdf->MultiCell($this->page_largeur-($this->marge_droite+$this->marge_gauche), 3, $label, 0, 'L', 0);
3729
+		$pdf->MultiCell($this->page_largeur - ($this->marge_droite + $this->marge_gauche), 3, $label, 0, 'L', 0);
3730 3730
 
3731 3731
 		$amount = price($remain_to_pay);
3732
-		$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx+$width, $posy+1);
3732
+		$pdf->MultiCell($width2, 3, $amount, 0, 'R', 0, 1, $posx + $width, $posy + 1);
3733 3733
 
3734 3734
 		$pdf->SetDrawColor(128, 128, 128);
3735
-		$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 7);
3735
+		$this->printRect($pdf, $this->marge_gauche, $posy, $this->page_largeur - $this->marge_gauche - $this->marge_droite, 7);
3736 3736
 	}
3737 3737
 }
Please login to merge, or discard this patch.
htdocs/core/modules/import/import_xlsx.modules.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 use PhpOffice\PhpSpreadsheet\Style\Alignment;
33 33
 use PhpOffice\PhpSpreadsheet\Shared\Date;
34 34
 
35
-require_once DOL_DOCUMENT_ROOT . '/core/modules/import/modules_import.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php';
36 36
 
37 37
 
38 38
 /**
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 		// phpcs:enable
145 145
 		global $user, $conf, $langs, $file;
146 146
 		// create a temporary object, the final output will be generated in footer
147
-		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs) . ' - Dolibarr ' . DOL_VERSION);
148
-		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import") . ' - ' . $file);
149
-		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import") . ' - ' . $file);
150
-		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import") . ' - ' . $file);
147
+		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
148
+		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file);
149
+		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file);
150
+		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file);
151 151
 
152 152
 		$this->workbook->setActiveSheetIndex(0);
153 153
 		$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		global $langs;
241 241
 		$ret = 1;
242 242
 
243
-		dol_syslog(get_class($this) . "::open_file file=" . $file);
243
+		dol_syslog(get_class($this)."::open_file file=".$file);
244 244
 
245 245
 		$reader = new Xlsx();
246 246
 		$this->workbook = $reader->load($file);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 
406 406
 				// Define $tablewithentity_cache[$tablename] if not already defined
407 407
 				if (!isset($tablewithentity_cache[$tablename])) {	// keep this test with "isset"
408
-					dol_syslog("Check if table " . $tablename . " has an entity field");
408
+					dol_syslog("Check if table ".$tablename." has an entity field");
409 409
 					$resql = $this->db->DDLDescTable($tablename, 'entity');
410 410
 					if ($resql) {
411 411
 						$obj = $this->db->fetch_object($resql);
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 										$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
479 479
 										$class = $objimport->array_import_convertvalue[0][$val]['class'];
480 480
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
481
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] != '') {
482
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval];
481
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '') {
482
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval];
483 483
 										} else {
484 484
 											$resultload = dol_include_once($file);
485 485
 											if (empty($resultload)) {
486
-												dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
486
+												dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method);
487 487
 												break;
488 488
 											}
489 489
 											$classinstance = new $class($this->db);
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
 												$param_array = array('', '', $newval);
526 526
 												call_user_func_array(array($classinstance, $method), $param_array);
527 527
 											}
528
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id;
528
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id;
529 529
 
530 530
 											//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
531 531
 											if ($classinstance->id != '') {	// id may be 0, it is a found value
532 532
 												$newval = $classinstance->id;
533
-											} elseif (! $error) {
533
+											} elseif (!$error) {
534 534
 												if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
535 535
 													// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
536 536
 													$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
@@ -559,19 +559,19 @@  discard block
 block discarded – undo
559 559
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
560 560
 										$codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield'];
561 561
 										$code = $arrayrecord[$arrayfield[$codefromfield]]['val'];
562
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') {
563
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval];
562
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] != '') {
563
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval];
564 564
 										} else {
565 565
 											$resultload = dol_include_once($file);
566 566
 											if (empty($resultload)) {
567
-												dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code);
567
+												dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method.', code='.$code);
568 568
 												break;
569 569
 											}
570 570
 											$classinstance = new $class($this->db);
571 571
 											// Try the fetch from code and ref
572 572
 											$param_array = array('', $newval, $code);
573 573
 											call_user_func_array(array($classinstance, $method), $param_array);
574
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id;
574
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] = $classinstance->id;
575 575
 											if ($classinstance->id > 0) {    // we found record
576 576
 												$newval = $classinstance->id;
577 577
 											} else {
@@ -596,19 +596,19 @@  discard block
 block discarded – undo
596 596
 									$class = $objimport->array_import_convertvalue[0][$val]['class'];
597 597
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
598 598
 									$units = $objimport->array_import_convertvalue[0][$val]['units'];
599
-									if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] != '') {
600
-										$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval];
599
+									if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '') {
600
+										$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
601 601
 									} else {
602 602
 										$resultload = dol_include_once($file);
603 603
 										if (empty($resultload)) {
604
-											dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', units=' . $units);
604
+											dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
605 605
 											break;
606 606
 										}
607 607
 										$classinstance = new $class($this->db);
608 608
 										// Try the fetch from code or ref
609 609
 										call_user_func_array(array($classinstance, $method), array('', '', $newval, $units));
610 610
 										$scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale);
611
-										$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] = $scaleorid;
611
+										$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] = $scaleorid;
612 612
 										//print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit;
613 613
 										if ($classinstance->id > 0) {	// we found record
614 614
 											$newval = $scaleorid ? $scaleorid : 0;
@@ -701,13 +701,13 @@  discard block
 block discarded – undo
701 701
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
702 702
 									$resultload = dol_include_once($file);
703 703
 									if (empty($resultload)) {
704
-										dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
704
+										dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method);
705 705
 										break;
706 706
 									}
707 707
 									$classinstance = new $class($this->db);
708 708
 									$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key));
709 709
 									if (empty($classinstance->error) && empty($classinstance->errors)) {
710
-										$newval = $res; 	// We get new value computed.
710
+										$newval = $res; // We get new value computed.
711 711
 									} else {
712 712
 										$this->errors[$error]['type'] = 'CLASSERROR';
713 713
 										$this->errors[$error]['lib'] = implode(
@@ -739,16 +739,16 @@  discard block
 block discarded – undo
739 739
 									$table = $reg[2];
740 740
 									$filter = !empty($reg[3]) ? substr($reg[3], 1) : '';
741 741
 
742
-									$cachekey = $field . '@' . $table;
742
+									$cachekey = $field.'@'.$table;
743 743
 									if (!empty($filter)) {
744
-										$cachekey .= ':' . $filter;
744
+										$cachekey .= ':'.$filter;
745 745
 									}
746 746
 
747 747
 									// Load content of field@table into cache array
748 748
 									if (!is_array($this->cachefieldtable[$cachekey])) { // If content of field@table not already loaded into cache
749
-										$sql = "SELECT " . $field . " as aliasfield FROM " . $table;
749
+										$sql = "SELECT ".$field." as aliasfield FROM ".$table;
750 750
 										if (!empty($filter)) {
751
-											$sql .= ' WHERE ' . $filter;
751
+											$sql .= ' WHERE '.$filter;
752 752
 										}
753 753
 
754 754
 										$resql = $this->db->query($sql);
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 									if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey])) {
772 772
 										$tableforerror = $table;
773 773
 										if (!empty($filter)) {
774
-											$tableforerror .= ':' . $filter;
774
+											$tableforerror .= ':'.$filter;
775 775
 										}
776 776
 										// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
777 777
 										$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 										$errorforthistable++;
780 780
 										$error++;
781 781
 									}
782
-								} elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) {
782
+								} elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
783 783
 									// If test is just a static regex
784 784
 									//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
785 785
 									// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
@@ -808,11 +808,11 @@  discard block
 block discarded – undo
808 808
 						if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
809 809
 							if (!in_array("socialnetworks", $listfields)) {
810 810
 								$listfields[] = "socialnetworks";
811
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
811
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
812 812
 								$listvalues[$socialkey] = '';
813 813
 							}
814 814
 							if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) {
815
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
815
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
816 816
 								$socialnetwork = explode("_", $fieldname)[1];
817 817
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
818 818
 									$json = new stdClass();
@@ -847,10 +847,10 @@  discard block
 block discarded – undo
847 847
 				if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) {
848 848
 					// Loop on each hidden fields to add them into listfields/listvalues
849 849
 					foreach ($objimport->array_import_fieldshidden[0] as $key => $val) {
850
-						if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) {
850
+						if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) {
851 851
 							continue; // Not a field of current table
852 852
 						}
853
-						$keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
853
+						$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
854 854
 
855 855
 						if (in_array($keyfield, $listfields)) {	// avoid duplicates in insert
856 856
 							continue;
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 									$type = $objimport->array_import_convertvalue[0][$fieldname]['type'];
878 878
 									$resultload = dol_include_once($file);
879 879
 									if (empty($resultload)) {
880
-										dol_print_error(null, 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
880
+										dol_print_error(null, 'Error trying to call file='.$file.', class='.$class.', method='.$method);
881 881
 										break;
882 882
 									}
883 883
 									$classinstance = new $class($this->db);
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 								}
908 908
 							}
909 909
 						} else {
910
-							$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
910
+							$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
911 911
 							$this->errors[$error]['type'] = 'Import profile setup';
912 912
 							$error++;
913 913
 						}
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
 							// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
935 935
 
936 936
 							if (empty($lastinsertid)) {	// No insert done yet for a parent table
937
-								$sqlSelect = "SELECT ".$fname." FROM " . $tablename;
937
+								$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
938 938
 
939 939
 								$data = array_combine($listfields, $listvalues);
940 940
 
941
-								$where = array();	// filters to forge SQL request
941
+								$where = array(); // filters to forge SQL request
942 942
 								// @phpstan-ignore-next-line
943 943
 								'@phan-var string[] $where';
944
-								$filters = array();	// filters to forge output error message
944
+								$filters = array(); // filters to forge output error message
945 945
 								foreach ($updatekeys as $key) {
946 946
 									$col = $objimport->array_import_updatekeys[0][$key];
947 947
 									$key = preg_replace('/^.*\./i', '', $key);
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 									$where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
967 967
 									$filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
968 968
 								}
969
-								$sqlSelect .= " WHERE " . implode(' AND ', $where);
969
+								$sqlSelect .= " WHERE ".implode(' AND ', $where);
970 970
 
971 971
 								$resql = $this->db->query($sqlSelect);
972 972
 								if ($resql) {
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 								// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
998 998
 								// may already exists. So we rescan the extrafield table to know if record exists or not for the rowid.
999 999
 								// Note: For extrafield tablename, we have in importfieldshidden_array an entry 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object'
1000
-								$sqlSelect = "SELECT rowid FROM " . $tablename;
1000
+								$sqlSelect = "SELECT rowid FROM ".$tablename;
1001 1001
 
1002 1002
 
1003 1003
 								if (empty($keyfield)) {
@@ -1031,35 +1031,35 @@  discard block
 block discarded – undo
1031 1031
 								// We db escape social network field because he isn't in field creation
1032 1032
 								if (in_array("socialnetworks", $listfields)) {
1033 1033
 									$socialkey = array_search("socialnetworks", $listfields);
1034
-									$tmpsql =  $listvalues[$socialkey];
1034
+									$tmpsql = $listvalues[$socialkey];
1035 1035
 									$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
1036 1036
 								}
1037 1037
 
1038 1038
 								// Build SQL UPDATE request
1039
-								$sqlstart = "UPDATE " . $tablename;
1039
+								$sqlstart = "UPDATE ".$tablename;
1040 1040
 
1041 1041
 								$data = array_combine($listfields, $listvalues);
1042 1042
 								$set = array();
1043 1043
 								foreach ($data as $key => $val) {
1044
-									$set[] = $key." = ".$val;	// $val was escaped/sanitized previously
1044
+									$set[] = $key." = ".$val; // $val was escaped/sanitized previously
1045 1045
 								}
1046
-								$sqlstart .= " SET " . implode(', ', $set) . ", import_key = '" . $this->db->escape($importid) . "'";
1046
+								$sqlstart .= " SET ".implode(', ', $set).", import_key = '".$this->db->escape($importid)."'";
1047 1047
 
1048 1048
 								if (empty($keyfield)) {
1049 1049
 									$keyfield = 'rowid';
1050 1050
 								}
1051
-								$sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid);
1051
+								$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
1052 1052
 
1053 1053
 								if ($is_table_category_link) {
1054 1054
 									'@phan-var-force string[] $where';
1055
-									$sqlend = " WHERE " . implode(' AND ', $where);
1055
+									$sqlend = " WHERE ".implode(' AND ', $where);
1056 1056
 								}
1057 1057
 
1058 1058
 								if (!empty($tablewithentity_cache[$tablename])) {
1059 1059
 									$sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
1060 1060
 								}
1061 1061
 
1062
-								$sql = $sqlstart . $sqlend;
1062
+								$sql = $sqlstart.$sqlend;
1063 1063
 
1064 1064
 								// Run update request
1065 1065
 								$resql = $this->db->query($sql);
@@ -1080,22 +1080,22 @@  discard block
 block discarded – undo
1080 1080
 							// We db escape social network field because he isn't in field creation
1081 1081
 							if (in_array("socialnetworks", $listfields)) {
1082 1082
 								$socialkey = array_search("socialnetworks", $listfields);
1083
-								$tmpsql =  $listvalues[$socialkey];
1083
+								$tmpsql = $listvalues[$socialkey];
1084 1084
 								$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
1085 1085
 							}
1086 1086
 
1087 1087
 							// Build SQL INSERT request
1088
-							$sqlstart = "INSERT INTO " . $tablename . "(" . implode(", ", $listfields) . ", import_key";
1089
-							$sqlend = ") VALUES(" . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'";
1088
+							$sqlstart = "INSERT INTO ".$tablename."(".implode(", ", $listfields).", import_key";
1089
+							$sqlend = ") VALUES(".implode(', ', $listvalues).", '".$this->db->escape($importid)."'";
1090 1090
 							if (!empty($tablewithentity_cache[$tablename])) {
1091 1091
 								$sqlstart .= ", entity";
1092
-								$sqlend .= ", " . $conf->entity;
1092
+								$sqlend .= ", ".$conf->entity;
1093 1093
 							}
1094 1094
 							if (!empty($objimport->array_import_tables_creator[0][$alias])) {
1095
-								$sqlstart .= ", " . $objimport->array_import_tables_creator[0][$alias];
1096
-								$sqlend .= ", " . $user->id;
1095
+								$sqlstart .= ", ".$objimport->array_import_tables_creator[0][$alias];
1096
+								$sqlend .= ", ".$user->id;
1097 1097
 							}
1098
-							$sql = $sqlstart . $sqlend . ")";
1098
+							$sql = $sqlstart.$sqlend.")";
1099 1099
 							//dol_syslog("import_xlsx.modules", LOG_DEBUG);
1100 1100
 
1101 1101
 							// Run insert request
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1226 added lines, -1226 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
123 123
 			if (!empty($perm)) {
124 124
 				$tmp = explode(':', $typeofdata);
125
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
125
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
126 126
 				if ($fieldrequired) {
127 127
 					$ret .= '<span class="fieldrequired">';
128 128
 				}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 				if ($fieldrequired) {
135 135
 					$ret .= '</span>';
136 136
 				}
137
-				$ret .= '</div>' . "\n";
137
+				$ret .= '</div>'."\n";
138 138
 			} else {
139 139
 				if ($fieldrequired) {
140 140
 					$ret .= '<span class="fieldrequired">';
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 			if (empty($notabletag) && $perm) {
173 173
 				$ret .= '<td class="right">';
174 174
 			}
175
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
176
-				$ret .= '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=edit' . $htmlname . '&token=' . newToken() . '&' . $paramid . '=' . $object->id . $moreparam . '">' . img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)) . '</a>';
175
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
176
+				$ret .= '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&token='.newToken().'&'.$paramid.'='.$object->id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).'</a>';
177 177
 			}
178 178
 			if (!empty($notabletag) && $notabletag == 1) {
179 179
 				if ($text) {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			} elseif ($reg[1] == 'int') {
241 241
 				$typeofdata = 'numeric';
242 242
 			} else {
243
-				return 'ErrorBadParameter ' . $typeofdata;
243
+				return 'ErrorBadParameter '.$typeofdata;
244 244
 			}
245 245
 		}
246 246
 
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 			if ($editaction == '') {
252 252
 				$editaction = GETPOST('action', 'aZ09');
253 253
 			}
254
-			$editmode = ($editaction == 'edit' . $htmlname);
254
+			$editmode = ($editaction == 'edit'.$htmlname);
255 255
 			if ($editmode) {	// edit mode
256 256
 				$ret .= "\n";
257
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
258
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
259
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
260
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
257
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
258
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
259
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
260
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
261 261
 				if (empty($notabletag)) {
262 262
 					$ret .= '<table class="nobordernopadding centpercent">';
263 263
 				}
@@ -266,28 +266,28 @@  discard block
 block discarded – undo
266 266
 				}
267 267
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
268 268
 					$tmp = explode(':', $typeofdata);
269
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
269
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
270 270
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
271 271
 					$tmp = explode(':', $typeofdata);
272 272
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
273
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
273
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
274 274
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
275 275
 					$tmp = explode(':', $typeofdata);
276 276
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
277
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
277
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
278 278
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
279 279
 					$tmp = explode(':', $typeofdata);
280
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
280
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
281 281
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
282 282
 					$tmp = explode(':', $typeofdata);
283 283
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
284 284
 					$morealt = '';
285 285
 					if (preg_match('/%/', $cols)) {
286
-						$morealt = ' style="width: ' . $cols . '"';
286
+						$morealt = ' style="width: '.$cols.'"';
287 287
 						$cols = '';
288 288
 					}
289 289
 					$valuetoshow = ($editvalue ? $editvalue : $value);
290
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
290
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
291 291
 					// textarea convert automatically entities chars into simple chars.
292 292
 					// So we convert & into &amp; so a string like 'a &lt; <b>b</b><br>é<br>&lt;script&gt;alert('X');&lt;script&gt;' stay a correct html and is not converted by textarea component when wysiwyg is off.
293 293
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
298 298
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
299 299
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
300
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
300
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301 301
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
302 302
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
303 303
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
304 304
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
305
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
305
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306 306
 				} elseif (preg_match('/^select;/', $typeofdata)) {
307 307
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
308 308
 					$arraylist = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 					// TODO Not yet implemented. See code for extrafields
317 317
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
318 318
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
319
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
319
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
320 320
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? '100' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
321 321
 					$ret .= $doleditor->Create(1);
322 322
 				} elseif ($typeofdata == 'asis') {
@@ -331,19 +331,19 @@  discard block
 block discarded – undo
331 331
 					$ret .= '<td>';
332 332
 				}
333 333
 				//else $ret.='<div class="clearboth"></div>';
334
-				$ret .= '<input type="submit" class="smallpaddingimp button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
334
+				$ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
335 335
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
336
-					$ret .= '<br>' . "\n";
336
+					$ret .= '<br>'."\n";
337 337
 				}
338
-				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
338
+				$ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
339 339
 				if (empty($notabletag)) {
340 340
 					$ret .= '</td>';
341 341
 				}
342 342
 
343 343
 				if (empty($notabletag)) {
344
-					$ret .= '</tr></table>' . "\n";
344
+					$ret .= '</tr></table>'."\n";
345 345
 				}
346
-				$ret .= '</form>' . "\n";
346
+				$ret .= '</form>'."\n";
347 347
 			} else {		// view mode
348 348
 				if (preg_match('/^email/', $typeofdata)) {
349 349
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -355,15 +355,15 @@  discard block
 block discarded – undo
355 355
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
356 356
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
357 357
 					$tmp = explode(':', $typeofdata);
358
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
358
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
359 359
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
360 360
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
361 361
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
362 362
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
363 363
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
364
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
364
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
365 365
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
366
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
366
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
367 367
 				} elseif (preg_match('/^select;/', $typeofdata)) {
368 368
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
369 369
 					$arraylist = array();
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 					$ret .= $arraylist[$value];
375 375
 					if ($htmlname == 'fk_product_type') {
376 376
 						if ($value == 0) {
377
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
377
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
378 378
 						} else {
379
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
379
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
380 380
 						}
381 381
 					}
382 382
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
385 385
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
386 386
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
387
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
387
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388 388
 					}
389 389
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
390 390
 					// clean data from some dangerous html
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
394 394
 						$ret .= dol_escape_htmltag($value);
395 395
 					} else {
396
-						$ret .= $value;        // $value must be already html escaped.
396
+						$ret .= $value; // $value must be already html escaped.
397 397
 					}
398 398
 				}
399 399
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
433 433
 			if (!is_object($extralanguages)) {
434
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
434
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
435 435
 				$extralanguages = new ExtraLanguages($this->db);
436 436
 			}
437 437
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
 				return ''; // No extralang field to show
441 441
 			}
442 442
 
443
-			$result .= '<!-- Widget for translation -->' . "\n";
444
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
443
+			$result .= '<!-- Widget for translation -->'."\n";
444
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
445 445
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', false, 0, 0, '', 'fa-15 editfieldlang');
446 446
 			$result .= $s;
447 447
 			$result .= '</div>';
448 448
 
449
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
449
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
450 450
 
451 451
 			$resultforextrlang = '';
452 452
 			foreach ($arrayoflangcode as $langcode) {
453
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
453
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
454 454
 				if (empty($valuetoshow)) {
455 455
 					$object->fetchValuesForExtraLanguages();
456 456
 					//var_dump($object->array_languages);
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
 
463 463
 				// TODO Use the showInputField() method of ExtraLanguages object
464 464
 				if ($typeofdata == 'textarea') {
465
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
465
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
466 466
 					$resultforextrlang .= $valuetoshow;
467 467
 					$resultforextrlang .= '</textarea>';
468 468
 				} else {
469
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
469
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
470 470
 				}
471 471
 			}
472 472
 			$result .= $resultforextrlang;
473 473
 
474 474
 			$result .= '</div>';
475
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
475
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
476 476
 		}
477 477
 
478 478
 		return $result;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				if (!empty($tmp[2])) {
536 536
 					$savemethod = $tmp[2];
537 537
 				}
538
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
538
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
539 539
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
540 540
 				$tmp = explode(':', $inputType);
541 541
 				$inputType = $tmp[0];
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 					$savemethod = $tmp[2];
547 547
 				}
548 548
 
549
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
549
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
550 550
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
551 551
 				$tmp = explode(':', $inputType);
552 552
 				$inputType = $tmp[0];
@@ -577,40 +577,40 @@  discard block
 block discarded – undo
577 577
 				}
578 578
 
579 579
 				if (isModEnabled('fckeditor')) {
580
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
580
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
581 581
 				} else {
582 582
 					$inputType = 'textarea';
583 583
 				}
584 584
 			}
585 585
 
586
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
587
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
586
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
587
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
590 590
 			if (!empty($savemethod)) {
591
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
591
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
592 592
 			}
593 593
 			if (!empty($ext_element)) {
594
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
594
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
595 595
 			}
596 596
 			if (!empty($custommsg)) {
597 597
 				if (is_array($custommsg)) {
598 598
 					if (!empty($custommsg['success'])) {
599
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
599
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
600 600
 					}
601 601
 					if (!empty($custommsg['error'])) {
602
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
602
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
603 603
 					}
604 604
 				} else {
605
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
605
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
606 606
 				}
607 607
 			}
608 608
 			if ($inputType == 'textarea') {
609
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
610
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
609
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
611 611
 			}
612
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
613
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
612
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
613
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
614 614
 		} else {
615 615
 			$out = $value;
616 616
 		}
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
640 640
 	{
641 641
 		if ($incbefore) {
642
-			$text = $incbefore . $text;
642
+			$text = $incbefore.$text;
643 643
 		}
644 644
 		if (!$htmltext) {
645 645
 			return $text;
646 646
 		}
647
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
647
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
648 648
 
649 649
 		$tag = 'td';
650 650
 		if ($notabs == 2) {
@@ -658,11 +658,11 @@  discard block
 block discarded – undo
658 658
 
659 659
 		$extrastyle = '';
660 660
 		if ($direction < 0) {
661
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
661
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
662 662
 			$extrastyle = 'padding: 0px; padding-left: 2px;';
663 663
 		}
664 664
 		if ($direction > 0) {
665
-			$extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');
665
+			$extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');
666 666
 			$extrastyle = 'padding: 0px; padding-right: 2px;';
667 667
 		}
668 668
 
@@ -675,53 +675,53 @@  discard block
 block discarded – undo
675 675
 			$htmltext = str_replace('"', '&quot;', $htmltext);
676 676
 		} else {
677 677
 			$classfortooltip = 'classfortooltiponclick';
678
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
678
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
679 679
 		}
680 680
 		if ($tooltipon == 2 || $tooltipon == 3) {
681
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
681
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
682 682
 			if ($tooltiptrigger == '') {
683
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
683
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
684 684
 			} else {
685
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
685
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
686 686
 			}
687 687
 		} else {
688
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
688
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
689 689
 		}
690 690
 		if ($tooltipon == 1 || $tooltipon == 3) {
691
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
691
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
692 692
 			if ($tooltiptrigger == '') {
693
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
693
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
694 694
 			} else {
695
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
695
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
696 696
 			}
697 697
 		} else {
698
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
698
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
699 699
 		}
700 700
 		if (empty($notabs)) {
701 701
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
702 702
 		} elseif ($notabs == 2) {
703
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
703
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
704 704
 		}
705 705
 		// Define value if value is before
706 706
 		if ($direction < 0) {
707
-			$s .= '<' . $tag . $paramfortooltipimg;
707
+			$s .= '<'.$tag.$paramfortooltipimg;
708 708
 			if ($tag == 'td') {
709 709
 				$s .= ' class="valigntop" width="14"';
710 710
 			}
711
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
711
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
712 712
 		}
713 713
 		// Use another method to help avoid having a space in value in order to use this value with jquery
714 714
 		// Define label
715 715
 		if ((string) $text != '') {
716
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
716
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
717 717
 		}
718 718
 		// Define value if value is after
719 719
 		if ($direction > 0) {
720
-			$s .= '<' . $tag . $paramfortooltipimg;
720
+			$s .= '<'.$tag.$paramfortooltipimg;
721 721
 			if ($tag == 'td') {
722 722
 				$s .= ' class="valignmiddle" width="14"';
723 723
 			}
724
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
724
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
725 725
 		}
726 726
 		if (empty($notabs)) {
727 727
 			$s .= '</tr></table>';
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 
829 829
 		$disabled = 0;
830 830
 		$ret = '<div class="centpercent center">';
831
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
831
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
832 832
 
833 833
 		// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
834 834
 		$parameters = array();
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
 			return;
840 840
 		}
841 841
 		if (empty($reshook)) {
842
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
842
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
843 843
 			if (is_array($arrayofaction)) {
844 844
 				foreach ($arrayofaction as $code => $label) {
845
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
845
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
846 846
 				}
847 847
 			}
848 848
 		}
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 		$ret .= '</select>';
852 852
 
853 853
 		if (empty($conf->dol_optimize_smallscreen)) {
854
-			$ret .= ajax_combobox('.' . $name . 'select');
854
+			$ret .= ajax_combobox('.'.$name.'select');
855 855
 		}
856 856
 
857 857
 		// Warning: if you set submit button to disabled, post using 'Enter' will no more work if there is no another input submit. So we add a hidden button
858 858
 		$ret .= '<input type="submit" name="confirmmassactioninvisible" style="display: none" tabindex="-1">'; // Hidden button BEFORE so it is the one used when we submit with ENTER.
859
-		$ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">';
859
+		$ret .= '<input type="submit" disabled name="confirmmassaction"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display: none"').' class="reposition button smallpaddingimp'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'confirmed" value="'.dol_escape_htmltag($langs->trans("Confirm")).'">';
860 860
 		$ret .= '</div>';
861 861
 
862 862
 		if (!empty($conf->use_javascript_ajax)) {
863 863
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
864
-    		<script nonce="' . getNonce() . '">
864
+    		<script nonce="' . getNonce().'">
865 865
                         function initCheckForSelect(mode, name, cssclass)	/* mode is 0 during init of page or click all, 1 when we click on 1 checkboxi, "name" refers to the class of the massaction button, "cssclass" to the class of the checkfor select boxes */
866 866
         		{
867 867
         			atleastoneselected=0;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
874 874
 
875
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
875
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
876 876
     	  			{
877 877
                                     jQuery("."+name).show();
878
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
879
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
878
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
879
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
880 880
     	  			}
881 881
     	  			else
882 882
     	  			{
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
         		}
887 887
 
888 888
         	jQuery(document).ready(function () {
889
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
890
-                    jQuery(".' . $cssclass . '").click(function() {
891
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
889
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
890
+                    jQuery(".' . $cssclass.'").click(function() {
891
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
892 892
                     });
893
-                        jQuery(".' . $name . 'select").change(function() {
893
+                        jQuery(".' . $name.'select").change(function() {
894 894
         			var massaction = $( this ).val();
895 895
         			var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
896 896
         			if (massaction == "builddoc")
@@ -898,18 +898,18 @@  discard block
 block discarded – undo
898 898
                         urlform = urlform + "#show_files";
899 899
     	            }
900 900
         			$( this ).closest("form").attr("action", urlform);
901
-                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform);
901
+                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform);
902 902
         	        /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */
903 903
         			if ($(this).val() != \'0\')
904 904
     	  			{
905
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
906
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
907
-                                        jQuery(".' . $name . '"+massaction).show();
905
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
906
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
907
+                                        jQuery(".' . $name.'"+massaction).show();
908 908
     	  			}
909 909
     	  			else
910 910
     	  			{
911
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true);
912
-										jQuery(".' . $name . 'other").hide();	/* To disable any div open */
911
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true);
912
+										jQuery(".' . $name.'other").hide();	/* To disable any div open */
913 913
     	  			}
914 914
     	        });
915 915
         	});
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 		$atleastonefavorite = 0;
953 953
 
954 954
 		$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
955
-		$sql .= " FROM " . $this->db->prefix() . "c_country";
955
+		$sql .= " FROM ".$this->db->prefix()."c_country";
956 956
 		$sql .= " WHERE active > 0";
957 957
 		//$sql.= " ORDER BY code ASC";
958 958
 
959
-		dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);
959
+		dol_syslog(get_class($this)."::select_country", LOG_DEBUG);
960 960
 		$resql = $this->db->query($sql);
961 961
 		if ($resql) {
962
-			$out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';
962
+			$out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';
963 963
 			$num = $this->db->num_rows($resql);
964 964
 			$i = 0;
965 965
 			if ($num) {
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 					$countryArray[$i]['rowid'] = $obj->rowid;
970 970
 					$countryArray[$i]['code_iso'] = $obj->code_iso;
971 971
 					$countryArray[$i]['code_iso3'] = $obj->code_iso3;
972
-					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
972
+					$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
973 973
 					$countryArray[$i]['favorite'] = $obj->favorite;
974 974
 					$countryArray[$i]['eec'] = $obj->eec;
975 975
 					$favorite[$i] = $obj->favorite;
@@ -987,20 +987,20 @@  discard block
 block discarded – undo
987 987
 
988 988
 				if ($showempty) {
989 989
 					if (is_numeric($showempty)) {
990
-						$out .= '<option value="">&nbsp;</option>' . "\n";
990
+						$out .= '<option value="">&nbsp;</option>'."\n";
991 991
 					} else {
992
-						$out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";
992
+						$out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";
993 993
 					}
994 994
 				}
995 995
 
996 996
 				if ($addspecialentries) {    // Add dedicated entries for groups of countries
997 997
 					//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
998
-					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
999
-					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>';
998
+					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
999
+					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
1000 1000
 					if ($mysoc->isInEEC()) {
1001
-						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>';
1001
+						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
1002 1002
 					}
1003
-					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>';
1003
+					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
1004 1004
 					$out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';
1005 1005
 				}
1006 1006
 
@@ -1028,20 +1028,20 @@  discard block
 block discarded – undo
1028 1028
 						$labeltoshow .= '&nbsp;';
1029 1029
 					}
1030 1030
 					if ($row['code_iso']) {
1031
-						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>';
1031
+						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
1032 1032
 						if (empty($hideflags)) {
1033 1033
 							$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
1034
-							$labeltoshow = $tmpflag . ' ' . $labeltoshow;
1034
+							$labeltoshow = $tmpflag.' '.$labeltoshow;
1035 1035
 						}
1036 1036
 					}
1037 1037
 
1038 1038
 					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
1039
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1039
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1040 1040
 					} else {
1041
-						$out .= '<option value="' . ($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']) . '" data-html="' . dol_escape_htmltag($labeltoshow) . '" data-eec="' . ((int) $row['eec']) . '">';
1041
+						$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
1042 1042
 					}
1043 1043
 					$out .= $labeltoshow;
1044
-					$out .= '</option>' . "\n";
1044
+					$out .= '</option>'."\n";
1045 1045
 				}
1046 1046
 			}
1047 1047
 			$out .= '</select>';
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 		}
1051 1051
 
1052 1052
 		// Make select dynamic
1053
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1054
-		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve');
1053
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1054
+		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve');
1055 1055
 
1056 1056
 		return $out;
1057 1057
 	}
@@ -1083,25 +1083,25 @@  discard block
 block discarded – undo
1083 1083
 		$incotermArray = array();
1084 1084
 
1085 1085
 		$sql = "SELECT rowid, code";
1086
-		$sql .= " FROM " . $this->db->prefix() . "c_incoterms";
1086
+		$sql .= " FROM ".$this->db->prefix()."c_incoterms";
1087 1087
 		$sql .= " WHERE active > 0";
1088 1088
 		$sql .= " ORDER BY code ASC";
1089 1089
 
1090
-		dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);
1090
+		dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
1091 1091
 		$resql = $this->db->query($sql);
1092 1092
 		if ($resql) {
1093 1093
 			if ($conf->use_javascript_ajax && !$forcecombo) {
1094
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1094
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1095 1095
 				$out .= ajax_combobox($htmlname, $events);
1096 1096
 			}
1097 1097
 
1098 1098
 			if (!empty($page)) {
1099
-				$out .= '<form method="post" action="' . $page . '">';
1099
+				$out .= '<form method="post" action="'.$page.'">';
1100 1100
 				$out .= '<input type="hidden" name="action" value="set_incoterms">';
1101
-				$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1101
+				$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1102 1102
 			}
1103 1103
 
1104
-			$out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';
1104
+			$out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';
1105 1105
 			$out .= '<option value="0">&nbsp;</option>';
1106 1106
 			$num = $this->db->num_rows($resql);
1107 1107
 			$i = 0;
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
 				foreach ($incotermArray as $row) {
1117 1117
 					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) {
1118
-						$out .= '<option value="' . $row['rowid'] . '" selected>';
1118
+						$out .= '<option value="'.$row['rowid'].'" selected>';
1119 1119
 					} else {
1120
-						$out .= '<option value="' . $row['rowid'] . '">';
1120
+						$out .= '<option value="'.$row['rowid'].'">';
1121 1121
 					}
1122 1122
 
1123 1123
 					if ($row['code']) {
@@ -1130,13 +1130,13 @@  discard block
 block discarded – undo
1130 1130
 			$out .= '</select>';
1131 1131
 
1132 1132
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1133
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1133
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1134 1134
 				$moreattrib .= ' autocomplete="off"';
1135 1135
 			}
1136
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1136
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1137 1137
 
1138 1138
 			if (!empty($page)) {
1139
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1139
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1140 1140
 			}
1141 1141
 		} else {
1142 1142
 			dol_print_error($this->db);
@@ -1168,9 +1168,9 @@  discard block
 block discarded – undo
1168 1168
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1169 1169
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1170 1170
 			if (empty($hidetext)) {
1171
-				print $langs->trans("Type") . ': ';
1171
+				print $langs->trans("Type").': ';
1172 1172
 			}
1173
-			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1173
+			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1174 1174
 			if ($showempty) {
1175 1175
 				print '<option value="-1"';
1176 1176
 				if ($selected == -1) {
@@ -1189,28 +1189,28 @@  discard block
 block discarded – undo
1189 1189
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1190 1190
 				print ' selected';
1191 1191
 			}
1192
-			print '>' . $langs->trans("Product");
1192
+			print '>'.$langs->trans("Product");
1193 1193
 
1194 1194
 			print '<option value="1"';
1195 1195
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1196 1196
 				print ' selected';
1197 1197
 			}
1198
-			print '>' . $langs->trans("Service");
1198
+			print '>'.$langs->trans("Service");
1199 1199
 
1200 1200
 			print '</select>';
1201
-			print ajax_combobox('select_' . $htmlname);
1201
+			print ajax_combobox('select_'.$htmlname);
1202 1202
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1203 1203
 		}
1204 1204
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1205 1205
 			print $langs->trans("Service");
1206
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1206
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1207 1207
 		}
1208 1208
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1209 1209
 			print $langs->trans("Product");
1210
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1210
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1211 1211
 		}
1212 1212
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1213
-			print '<input type="hidden" name="' . $htmlname . '" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1213
+			print '<input type="hidden" name="'.$htmlname.'" value="1">'; // By default we set on service for contract. If CONTRACT_SUPPORT_PRODUCTS is set, forceall should be 1 not -1
1214 1214
 		}
1215 1215
 	}
1216 1216
 
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		$langs->load("trips");
1237 1237
 
1238 1238
 		$sql = "SELECT c.code, c.label";
1239
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1239
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1240 1240
 		$sql .= " WHERE active > 0";
1241 1241
 
1242 1242
 		$resql = $this->db->query($sql);
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 		// phpcs:enable
1278 1278
 		global $user, $langs;
1279 1279
 
1280
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1280
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1281 1281
 
1282 1282
 		$this->load_cache_types_fees();
1283 1283
 
1284
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1284
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1285 1285
 		if ($showempty) {
1286 1286
 			print '<option value="-1"';
1287 1287
 			if ($selected == -1) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 		}
1292 1292
 
1293 1293
 		foreach ($this->cache_types_fees as $key => $value) {
1294
-			print '<option value="' . $key . '"';
1294
+			print '<option value="'.$key.'"';
1295 1295
 			if ($key == $selected) {
1296 1296
 				print ' selected';
1297 1297
 			}
@@ -1343,12 +1343,12 @@  discard block
 block discarded – undo
1343 1343
 				$ajaxoptions = array();
1344 1344
 			}
1345 1345
 
1346
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1346
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1347 1347
 
1348 1348
 			// No immediate load of all database
1349 1349
 			$placeholder = '';
1350 1350
 			if ($selected && empty($selected_input_value)) {
1351
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1351
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1352 1352
 				$societetmp = new Societe($this->db);
1353 1353
 				$societetmp->fetch($selected);
1354 1354
 				$selected_input_value = $societetmp->name;
@@ -1356,18 +1356,18 @@  discard block
 block discarded – undo
1356 1356
 			}
1357 1357
 
1358 1358
 			// mode 1
1359
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : '');
1359
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : '');
1360 1360
 
1361 1361
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1362 1362
 			if (empty($hidelabel)) {
1363
-				print $langs->trans("RefOrLabel") . ' : ';
1363
+				print $langs->trans("RefOrLabel").' : ';
1364 1364
 			} elseif ($hidelabel > 1) {
1365 1365
 				$placeholder = $langs->trans("RefOrLabel");
1366 1366
 				if ($hidelabel == 2) {
1367 1367
 					$out .= img_picto($langs->trans("Search"), 'search');
1368 1368
 				}
1369 1369
 			}
1370
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1370
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1371 1371
 			if ($hidelabel == 3) {
1372 1372
 				$out .= img_picto($langs->trans("Search"), 'search');
1373 1373
 			}
@@ -1429,12 +1429,12 @@  discard block
 block discarded – undo
1429 1429
 				$events = array();
1430 1430
 			}
1431 1431
 
1432
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1432
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1433 1433
 
1434 1434
 			// No immediate load of all database
1435 1435
 			$placeholder = '';
1436 1436
 			if ($selected && empty($selected_input_value)) {
1437
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1437
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1438 1438
 				$contacttmp = new Contact($this->db);
1439 1439
 				$contacttmp->fetch($selected);
1440 1440
 				$selected_input_value = $contacttmp->getFullName($langs);
@@ -1445,11 +1445,11 @@  discard block
 block discarded – undo
1445 1445
 			}
1446 1446
 
1447 1447
 			// mode 1
1448
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : '');
1448
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : '');
1449 1449
 
1450 1450
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1451 1451
 
1452
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1452
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1453 1453
 
1454 1454
 			$out .= ajax_event($htmlname, $events);
1455 1455
 
@@ -1546,30 +1546,30 @@  discard block
 block discarded – undo
1546 1546
 			$sql .= ", s.address, s.zip, s.town";
1547 1547
 			$sql .= ", dictp.code as country_code";
1548 1548
 		}
1549
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1549
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1550 1550
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1551
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1551
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1552 1552
 		}
1553 1553
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1554
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1554
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1555 1555
 		}
1556
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1556
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1557 1557
 		if (!empty($user->socid)) {
1558
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1558
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1559 1559
 		}
1560 1560
 		if ($filter) {
1561 1561
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1562 1562
 			// if not, by testSqlAndScriptInject() only.
1563
-			$sql .= " AND (" . $filter . ")";
1563
+			$sql .= " AND (".$filter.")";
1564 1564
 		}
1565 1565
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1566
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1566
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1567 1567
 		}
1568 1568
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1569 1569
 			$sql .= " AND s.status <> 0";
1570 1570
 		}
1571 1571
 		if (!empty($excludeids)) {
1572
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1572
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1573 1573
 		}
1574 1574
 		// Add where from hooks
1575 1575
 		$parameters = array();
@@ -1589,17 +1589,17 @@  discard block
 block discarded – undo
1589 1589
 				if ($i > 0) {
1590 1590
 					$sql .= " AND ";
1591 1591
 				}
1592
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1592
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1593 1593
 				$i++;
1594 1594
 			}
1595 1595
 			if (count($search_crit) > 1) {
1596 1596
 				$sql .= ")";
1597 1597
 			}
1598 1598
 			if (isModEnabled('barcode')) {
1599
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1599
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1600 1600
 			}
1601
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1602
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1601
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1602
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1603 1603
 			$sql .= ")";
1604 1604
 		}
1605 1605
 		$sql .= $this->db->order("nom", "ASC");
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		$resql = $this->db->query($sql);
1611 1611
 		if ($resql) {
1612 1612
 			// Construct $out and $outarray
1613
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1613
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1614 1614
 
1615 1615
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1616 1616
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 				}
1624 1624
 			}
1625 1625
 			if ($showempty) {
1626
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1626
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1627 1627
 			}
1628 1628
 
1629 1629
 			$companytemp = new Societe($this->db);
@@ -1636,18 +1636,18 @@  discard block
 block discarded – undo
1636 1636
 					$label = '';
1637 1637
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1638 1638
 						if (($obj->client) && (!empty($obj->code_client))) {
1639
-							$label = $obj->code_client . ' - ';
1639
+							$label = $obj->code_client.' - ';
1640 1640
 						}
1641 1641
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1642
-							$label .= $obj->code_fournisseur . ' - ';
1642
+							$label .= $obj->code_fournisseur.' - ';
1643 1643
 						}
1644
-						$label .= ' ' . $obj->name;
1644
+						$label .= ' '.$obj->name;
1645 1645
 					} else {
1646 1646
 						$label = $obj->name;
1647 1647
 					}
1648 1648
 
1649 1649
 					if (!empty($obj->name_alias)) {
1650
-						$label .= ' (' . $obj->name_alias . ')';
1650
+						$label .= ' ('.$obj->name_alias.')';
1651 1651
 					}
1652 1652
 
1653 1653
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 						$companytemp->fournisseur = $obj->fournisseur;
1663 1663
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1664 1664
 						if ($tmptype) {
1665
-							$labelhtml .= ' ' . $tmptype;
1665
+							$labelhtml .= ' '.$tmptype;
1666 1666
 						}
1667 1667
 
1668 1668
 						if ($obj->client || $obj->fournisseur) {
@@ -1672,10 +1672,10 @@  discard block
 block discarded – undo
1672 1672
 							$label .= $langs->trans("Customer");
1673 1673
 						}
1674 1674
 						if ($obj->client == 2 || $obj->client == 3) {
1675
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1675
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1676 1676
 						}
1677 1677
 						if ($obj->fournisseur) {
1678
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1678
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1679 1679
 						}
1680 1680
 						if ($obj->client || $obj->fournisseur) {
1681 1681
 							$label .= ')';
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 					}
1684 1684
 
1685 1685
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1686
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1686
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1687 1687
 						if (!empty($obj->country_code)) {
1688
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1688
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1689 1689
 						}
1690 1690
 						$label .= $s;
1691 1691
 						$labelhtml .= $s;
@@ -1693,9 +1693,9 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 					if (empty($outputmode)) {
1695 1695
 						if (in_array($obj->rowid, $selected)) {
1696
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1696
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1697 1697
 						} else {
1698
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1698
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1699 1699
 						}
1700 1700
 					} else {
1701 1701
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1707,9 +1707,9 @@  discard block
 block discarded – undo
1707 1707
 					}
1708 1708
 				}
1709 1709
 			}
1710
-			$out .= '</select>' . "\n";
1710
+			$out .= '</select>'."\n";
1711 1711
 			if (!$forcecombo) {
1712
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1712
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1713 1713
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT"));
1714 1714
 			}
1715 1715
 		} else {
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
 		}
1800 1800
 
1801 1801
 		if (!is_object($hookmanager)) {
1802
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1802
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1803 1803
 			$hookmanager = new HookManager($this->db);
1804 1804
 		}
1805 1805
 
@@ -1808,13 +1808,13 @@  discard block
 block discarded – undo
1808 1808
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1809 1809
 			$sql .= ", s.nom as company, s.town AS company_town";
1810 1810
 		}
1811
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1811
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1812 1812
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1813
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1813
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1814 1814
 		}
1815
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1815
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1816 1816
 		if ($socid > 0 || $socid == -1) {
1817
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1817
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1818 1818
 		}
1819 1819
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1820 1820
 			$sql .= " AND sp.statut <> 0";
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		if ($filter) {
1823 1823
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1824 1824
 			// if not, by testSqlAndScriptInject() only.
1825
-			$sql .= " AND (" . $filter . ")";
1825
+			$sql .= " AND (".$filter.")";
1826 1826
 		}
1827 1827
 		// Add where from hooks
1828 1828
 		$parameters = array();
@@ -1830,30 +1830,30 @@  discard block
 block discarded – undo
1830 1830
 		$sql .= $hookmanager->resPrint;
1831 1831
 		$sql .= " ORDER BY sp.lastname ASC";
1832 1832
 
1833
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1833
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1834 1834
 		$resql = $this->db->query($sql);
1835 1835
 		if ($resql) {
1836 1836
 			$num = $this->db->num_rows($resql);
1837 1837
 
1838 1838
 			if ($htmlname != 'none' && !$options_only) {
1839
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1839
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1840 1840
 			}
1841 1841
 
1842 1842
 			if ($showempty && !is_numeric($showempty)) {
1843 1843
 				$textforempty = $showempty;
1844
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1844
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1845 1845
 			} else {
1846 1846
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1847
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1847
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1848 1848
 				}
1849 1849
 				if ($showempty == 2) {
1850
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1850
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1851 1851
 				}
1852 1852
 			}
1853 1853
 
1854 1854
 			$i = 0;
1855 1855
 			if ($num) {
1856
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1856
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1857 1857
 				$contactstatic = new Contact($this->db);
1858 1858
 
1859 1859
 				while ($i < $num) {
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 						}
1890 1890
 						$extendedInfos = implode(' - ', $extendedInfos);
1891 1891
 						if (!empty($extendedInfos)) {
1892
-							$extendedInfos = ' - ' . $extendedInfos;
1892
+							$extendedInfos = ' - '.$extendedInfos;
1893 1893
 						}
1894 1894
 					}
1895 1895
 
@@ -1907,35 +1907,35 @@  discard block
 block discarded – undo
1907 1907
 								$disabled = 1;
1908 1908
 							}
1909 1909
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1910
-								$out .= '<option value="' . $obj->rowid . '"';
1910
+								$out .= '<option value="'.$obj->rowid.'"';
1911 1911
 								if ($disabled) {
1912 1912
 									$out .= ' disabled';
1913 1913
 								}
1914 1914
 								$out .= ' selected>';
1915 1915
 
1916
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1916
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1917 1917
 								if ($showfunction && $obj->poste) {
1918
-									$tmplabel .= ' (' . $obj->poste . ')';
1918
+									$tmplabel .= ' ('.$obj->poste.')';
1919 1919
 								}
1920 1920
 								if (($showsoc > 0) && $obj->company) {
1921
-									$tmplabel .= ' - (' . $obj->company . ')';
1921
+									$tmplabel .= ' - ('.$obj->company.')';
1922 1922
 								}
1923 1923
 
1924 1924
 								$out .= $tmplabel;
1925 1925
 								$out .= '</option>';
1926 1926
 							} else {
1927
-								$out .= '<option value="' . $obj->rowid . '"';
1927
+								$out .= '<option value="'.$obj->rowid.'"';
1928 1928
 								if ($disabled) {
1929 1929
 									$out .= ' disabled';
1930 1930
 								}
1931 1931
 								$out .= '>';
1932 1932
 
1933
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1933
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1934 1934
 								if ($showfunction && $obj->poste) {
1935
-									$tmplabel .= ' (' . $obj->poste . ')';
1935
+									$tmplabel .= ' ('.$obj->poste.')';
1936 1936
 								}
1937 1937
 								if (($showsoc > 0) && $obj->company) {
1938
-									$tmplabel .= ' - (' . $obj->company . ')';
1938
+									$tmplabel .= ' - ('.$obj->company.')';
1939 1939
 								}
1940 1940
 
1941 1941
 								$out .= $tmplabel;
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
 							}
1944 1944
 						} else {
1945 1945
 							if (in_array($obj->rowid, $selected)) {
1946
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1946
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1947 1947
 								if ($showfunction && $obj->poste) {
1948
-									$tmplabel .= ' (' . $obj->poste . ')';
1948
+									$tmplabel .= ' ('.$obj->poste.')';
1949 1949
 								}
1950 1950
 								if (($showsoc > 0) && $obj->company) {
1951
-									$tmplabel .= ' - (' . $obj->company . ')';
1951
+									$tmplabel .= ' - ('.$obj->company.')';
1952 1952
 								}
1953 1953
 
1954 1954
 								$out .= $tmplabel;
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 				}
1964 1964
 			} else {
1965 1965
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1966
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1966
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1967 1967
 				$out .= $labeltoshow;
1968 1968
 				$out .= '</option>';
1969 1969
 			}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 			}
1985 1985
 
1986 1986
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1987
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1987
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1988 1988
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT"));
1989 1989
 			}
1990 1990
 
@@ -2023,18 +2023,18 @@  discard block
 block discarded – undo
2023 2023
 		// On recherche les remises
2024 2024
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
2025 2025
 		$sql .= " re.description, re.fk_facture_source";
2026
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
2027
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
2028
-		$sql .= " AND re.entity = " . $conf->entity;
2026
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
2027
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
2028
+		$sql .= " AND re.entity = ".$conf->entity;
2029 2029
 		if ($filter) {
2030
-			$sql .= " AND " . $filter;
2030
+			$sql .= " AND ".$filter;
2031 2031
 		}
2032 2032
 		$sql .= " ORDER BY re.description ASC";
2033 2033
 
2034
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
2034
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
2035 2035
 		$resql = $this->db->query($sql);
2036 2036
 		if ($resql) {
2037
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
2037
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
2038 2038
 			$num = $this->db->num_rows($resql);
2039 2039
 
2040 2040
 			$qualifiedlines = $num;
@@ -2072,16 +2072,16 @@  discard block
 block discarded – undo
2072 2072
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
2073 2073
 						$tmpfac = new Facture($this->db);
2074 2074
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
2075
-							$desc = $desc . ' - ' . $tmpfac->ref;
2075
+							$desc = $desc.' - '.$tmpfac->ref;
2076 2076
 						}
2077 2077
 					}
2078 2078
 
2079
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
2079
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
2080 2080
 					$i++;
2081 2081
 				}
2082 2082
 			}
2083 2083
 			print '</select>';
2084
-			print ajax_combobox('select_' . $htmlname);
2084
+			print ajax_combobox('select_'.$htmlname);
2085 2085
 
2086 2086
 			return $qualifiedlines;
2087 2087
 		} else {
@@ -2190,14 +2190,14 @@  discard block
 block discarded – undo
2190 2190
 		if ($showlabelofentity) {
2191 2191
 			$sql .= ", e.label";
2192 2192
 		}
2193
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2193
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2194 2194
 		if ($showlabelofentity) {
2195
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2195
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2196 2196
 		}
2197 2197
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2198 2198
 		if ($userissuperadminentityone && $force_entity != 'default') {
2199 2199
 			if (!empty($force_entity)) {
2200
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2200
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2201 2201
 			} else {
2202 2202
 				$sql .= " WHERE u.entity IS NOT NULL";
2203 2203
 			}
@@ -2205,18 +2205,18 @@  discard block
 block discarded – undo
2205 2205
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2206 2206
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2207 2207
 			} else {
2208
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2208
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2209 2209
 			}
2210 2210
 		}
2211 2211
 
2212 2212
 		if (!empty($user->socid)) {
2213
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2213
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2214 2214
 		}
2215 2215
 		if (is_array($exclude) && $excludeUsers) {
2216
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2216
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2217 2217
 		}
2218 2218
 		if ($includeUsers) {
2219
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2219
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2220 2220
 		}
2221 2221
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2222 2222
 			$sql .= " AND u.statut <> 0";
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
 			$sql .= " AND u.fk_soc IS NULL";
2229 2229
 		}
2230 2230
 		if (!empty($morefilter)) {
2231
-			$sql .= " " . $morefilter;
2231
+			$sql .= " ".$morefilter;
2232 2232
 		}
2233 2233
 
2234 2234
 		//Add hook to filter on user (for example on usergroup define in custom modules)
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2244 2244
 		}
2245 2245
 
2246
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2246
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2247 2247
 
2248 2248
 		$resql = $this->db->query($sql);
2249 2249
 		if ($resql) {
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 			$i = 0;
2252 2252
 			if ($num) {
2253 2253
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2254
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2254
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2255 2255
 				if ($show_empty && !$multiple) {
2256 2256
 					$textforempty = ' ';
2257 2257
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2260,10 +2260,10 @@  discard block
 block discarded – undo
2260 2260
 					if (!is_numeric($show_empty)) {
2261 2261
 						$textforempty = $show_empty;
2262 2262
 					}
2263
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2263
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2264 2264
 				}
2265 2265
 				if ($show_every) {
2266
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2266
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2267 2267
 				}
2268 2268
 
2269 2269
 				$userstatic = new User($this->db);
@@ -2311,21 +2311,21 @@  discard block
 block discarded – undo
2311 2311
 					}
2312 2312
 					if ($showstatus >= 0) {
2313 2313
 						if ($obj->status == 1 && $showstatus == 1) {
2314
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2315
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2314
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2315
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2316 2316
 						}
2317 2317
 						if ($obj->status == 0 && $showstatus == 1) {
2318
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2319
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2318
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2319
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2320 2320
 						}
2321 2321
 					}
2322 2322
 					if ($showlabelofentity) {
2323 2323
 						if (empty($obj->entity)) {
2324
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2325
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2324
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2325
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2326 2326
 						} else {
2327 2327
 							if ($obj->entity != $conf->entity) {
2328
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2328
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2329 2329
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2330 2330
 							}
2331 2331
 						}
@@ -2334,13 +2334,13 @@  discard block
 block discarded – undo
2334 2334
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2335 2335
 					if (!empty($disableline) && $disableline != '1') {
2336 2336
 						// Add text from $enableonlytext parameter
2337
-						$moreinfo .= ' - ' . $disableline;
2338
-						$moreinfohtml .= ' - ' . $disableline;
2337
+						$moreinfo .= ' - '.$disableline;
2338
+						$moreinfohtml .= ' - '.$disableline;
2339 2339
 					}
2340 2340
 					$labeltoshow .= $moreinfo;
2341 2341
 					$labeltoshowhtml .= $moreinfohtml;
2342 2342
 
2343
-					$out .= '<option value="' . $obj->rowid . '"';
2343
+					$out .= '<option value="'.$obj->rowid.'"';
2344 2344
 					if (!empty($disableline)) {
2345 2345
 						$out .= ' disabled';
2346 2346
 					}
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 					}
2350 2350
 					$out .= ' data-html="';
2351 2351
 
2352
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2352
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2353 2353
 					if ($showstatus >= 0 && $obj->status == 0) {
2354 2354
 						$outhtml .= '<strike class="opacitymediumxxx">';
2355 2355
 					}
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 					$out .= $labeltoshow;
2365 2365
 					$out .= '</option>';
2366 2366
 
2367
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2367
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2368 2368
 					$outarray2[$userstatic->id] = array(
2369 2369
 						'id' => $userstatic->id,
2370 2370
 						'label' => $labeltoshow,
@@ -2376,14 +2376,14 @@  discard block
 block discarded – undo
2376 2376
 					$i++;
2377 2377
 				}
2378 2378
 			} else {
2379
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2380
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2379
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2380
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2381 2381
 			}
2382 2382
 			$out .= '</select>';
2383 2383
 
2384 2384
 			if ($num && !$forcecombo) {
2385 2385
 				// Enhance with select2
2386
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2386
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2387 2387
 				$out .= ajax_combobox($htmlname);
2388 2388
 			}
2389 2389
 		} else {
@@ -2459,16 +2459,16 @@  discard block
 block discarded – undo
2459 2459
 			$out .= $userstatic->getNomUrl(-1);
2460 2460
 			if ($i == 0) {
2461 2461
 				$ownerid = $value['id'];
2462
-				$out .= ' (' . $langs->trans("Owner") . ')';
2462
+				$out .= ' ('.$langs->trans("Owner").')';
2463 2463
 			}
2464 2464
 			if ($nbassignetouser > 1 && $action != 'view') {
2465
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $userstatic->id . '" class="removedassigned reposition" id="removedassigned_' . $userstatic->id . '" name="removedassigned_' . $userstatic->id . '">';
2465
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned reposition" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
2466 2466
 			}
2467 2467
 			// Show my availability
2468 2468
 			if ($showproperties) {
2469 2469
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2470 2470
 					$out .= '<div class="myavailability inline-block">';
2471
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparency" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofuserid[$ownerid]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2471
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparency" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofuserid[$ownerid]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2472 2472
 					$out .= '</div>';
2473 2473
 				}
2474 2474
 			}
@@ -2485,15 +2485,15 @@  discard block
 block discarded – undo
2485 2485
 		// Method with no ajax
2486 2486
 		if ($action != 'view') {
2487 2487
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2488
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2488
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2489 2489
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2490 2490
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2491
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2492
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2491
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2492
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2493 2493
 			$out .= '});';
2494 2494
 			$out .= '})</script>';
2495 2495
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2496
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2496
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2497 2497
 			$out .= '<br>';
2498 2498
 		}
2499 2499
 
@@ -2552,13 +2552,13 @@  discard block
 block discarded – undo
2552 2552
 			$resourcestatic->fetch($value['id']);
2553 2553
 			$out .= $resourcestatic->getNomUrl(-1);
2554 2554
 			if ($nbassignetoresource > 1 && $action != 'view') {
2555
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassigned reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2555
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassigned reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2556 2556
 			}
2557 2557
 			// Show my availability
2558 2558
 			if ($showproperties) {
2559 2559
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2560 2560
 					$out .= '<div class="myavailability inline-block">';
2561
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">' . $langs->trans("Availability") . ':</span>  </span><input id="transparencyresource" class="paddingrightonly" ' . ($action == 'view' ? 'disabled' : '') . ' type="checkbox" name="transparency"' . ($listofresourceid[$value['id']]['transparency'] ? ' checked' : '') . '><label for="transparency">' . $langs->trans("Busy") . '</label>';
2561
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<span class="opacitymedium">'.$langs->trans("Availability").':</span>  </span><input id="transparencyresource" class="paddingrightonly" '.($action == 'view' ? 'disabled' : '').' type="checkbox" name="transparency"'.($listofresourceid[$value['id']]['transparency'] ? ' checked' : '').'><label for="transparency">'.$langs->trans("Busy").'</label>';
2562 2562
 					$out .= '</div>';
2563 2563
 				}
2564 2564
 			}
@@ -2575,11 +2575,11 @@  discard block
 block discarded – undo
2575 2575
 		// Method with no ajax
2576 2576
 		if ($action != 'view') {
2577 2577
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';
2578
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2578
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2579 2579
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2580 2580
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2581
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2582
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2581
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2582
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2583 2583
 			$out .= '});';
2584 2584
 			$out .= '})</script>';
2585 2585
 
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2588 2588
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2589 2589
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2590
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2590
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2591 2591
 			$out .= '<br>';
2592 2592
 		}
2593 2593
 
@@ -2649,7 +2649,7 @@  discard block
 block discarded – undo
2649 2649
 			$placeholder = '';
2650 2650
 
2651 2651
 			if ($selected && empty($selected_input_value)) {
2652
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2652
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2653 2653
 				$producttmpselect = new Product($this->db);
2654 2654
 				$producttmpselect->fetch($selected);
2655 2655
 				$selected_input_value = $producttmpselect->ref;
@@ -2664,17 +2664,17 @@  discard block
 block discarded – undo
2664 2664
 				}
2665 2665
 			}
2666 2666
 			// mode=1 means customers products
2667
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=1&status=' . $status . '&status_purchase=' . $status_purchase . '&finished=' . $finished . '&hidepriceinlabel=' . $hidepriceinlabel . '&warehousestatus=' . $warehouseStatus;
2668
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2667
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&status_purchase='.$status_purchase.'&finished='.$finished.'&hidepriceinlabel='.$hidepriceinlabel.'&warehousestatus='.$warehouseStatus;
2668
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
2669 2669
 
2670 2670
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2671 2671
 				// Code to automatically insert with javascript the select of attributes under the select of product
2672 2672
 				// when a parent of variant has been selected.
2673 2673
 				$out .= '
2674 2674
 				<!-- script to auto show attributes select tags if a variant was selected -->
2675
-				<script nonce="' . getNonce() . '">
2675
+				<script nonce="' . getNonce().'">
2676 2676
 					// auto show attributes fields
2677
-					selected = ' . json_encode($selected_combinations) . ';
2677
+					selected = ' . json_encode($selected_combinations).';
2678 2678
 					combvalues = {};
2679 2679
 
2680 2680
 					jQuery(document).ready(function () {
@@ -2685,7 +2685,7 @@  discard block
 block discarded – undo
2685 2685
 							}
2686 2686
 						});
2687 2687
 
2688
-						jQuery("input#' . $htmlname . '").change(function () {
2688
+						jQuery("input#' . $htmlname.'").change(function () {
2689 2689
 
2690 2690
 							if (!jQuery(this).val()) {
2691 2691
 								jQuery(\'div#attributes_box\').empty();
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
 
2695 2695
 							console.log("A change has started. We get variants fields to inject html select");
2696 2696
 
2697
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2697
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2698 2698
 								id: jQuery(this).val()
2699 2699
 							}, function (data) {
2700 2700
 								jQuery(\'div#attributes_box\').empty();
@@ -2737,21 +2737,21 @@  discard block
 block discarded – undo
2737 2737
 							})
2738 2738
 						});
2739 2739
 
2740
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2740
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2741 2741
 					});
2742 2742
 				</script>
2743 2743
                 ';
2744 2744
 			}
2745 2745
 
2746 2746
 			if (empty($hidelabel)) {
2747
-				$out .= $langs->trans("RefOrLabel") . ' : ';
2747
+				$out .= $langs->trans("RefOrLabel").' : ';
2748 2748
 			} elseif ($hidelabel > 1) {
2749
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2749
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2750 2750
 				if ($hidelabel == 2) {
2751 2751
 					$out .= img_picto($langs->trans("Search"), 'search');
2752 2752
 				}
2753 2753
 			}
2754
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2754
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2755 2755
 			if ($hidelabel == 3) {
2756 2756
 				$out .= img_picto($langs->trans("Search"), 'search');
2757 2757
 			}
@@ -2788,33 +2788,33 @@  discard block
 block discarded – undo
2788 2788
 		// phpcs:enable
2789 2789
 		global $db;
2790 2790
 
2791
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2791
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2792 2792
 
2793 2793
 		$error = 0;
2794 2794
 		$out = '';
2795 2795
 
2796 2796
 		if (!$forcecombo) {
2797
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2797
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2798 2798
 			$events = array();
2799 2799
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2800 2800
 		}
2801 2801
 
2802
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2802
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2803 2803
 
2804 2804
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2805
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2806
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2805
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2806
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2807 2807
 		if (!empty($status)) {
2808
-			$sql .= ' AND status = ' . (int) $status;
2808
+			$sql .= ' AND status = '.(int) $status;
2809 2809
 		}
2810 2810
 		if (!empty($type)) {
2811
-			$sql .= ' AND bomtype = ' . (int) $type;
2811
+			$sql .= ' AND bomtype = '.(int) $type;
2812 2812
 		}
2813 2813
 		if (!empty($TProducts)) {
2814
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2814
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2815 2815
 		}
2816 2816
 		if (!empty($limit)) {
2817
-			$sql .= ' LIMIT ' . (int) $limit;
2817
+			$sql .= ' LIMIT '.(int) $limit;
2818 2818
 		}
2819 2819
 		$resql = $db->query($sql);
2820 2820
 		if ($resql) {
@@ -2828,11 +2828,11 @@  discard block
 block discarded – undo
2828 2828
 			while ($obj = $db->fetch_object($resql)) {
2829 2829
 				$product = new Product($db);
2830 2830
 				$res = $product->fetch($obj->fk_product);
2831
-				$out .= '<option value="' . $obj->rowid . '"';
2831
+				$out .= '<option value="'.$obj->rowid.'"';
2832 2832
 				if ($obj->rowid == $selected) {
2833 2833
 					$out .= 'selected';
2834 2834
 				}
2835
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2835
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2836 2836
 			}
2837 2837
 		} else {
2838 2838
 			$error++;
@@ -2889,7 +2889,7 @@  discard block
 block discarded – undo
2889 2889
 
2890 2890
 		$warehouseStatusArray = array();
2891 2891
 		if (!empty($warehouseStatus)) {
2892
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2892
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2893 2893
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2894 2894
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2895 2895
 			}
@@ -2903,9 +2903,9 @@  discard block
 block discarded – undo
2903 2903
 
2904 2904
 		$selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.default_vat_code, p.duration, p.fk_price_expression";
2905 2905
 		if (count($warehouseStatusArray)) {
2906
-			$selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock
2906
+			$selectFieldsGrouped = ", sum(".$this->db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock
2907 2907
 		} else {
2908
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2908
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2909 2909
 		}
2910 2910
 
2911 2911
 		$sql = "SELECT ";
@@ -2921,9 +2921,9 @@  discard block
 block discarded – undo
2921 2921
 
2922 2922
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2923 2923
 			//Product category
2924
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2925
-						FROM " . $this->db->prefix() . "categorie_product
2926
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2924
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2925
+						FROM " . $this->db->prefix()."categorie_product
2926
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2927 2927
 						LIMIT 1
2928 2928
 				) AS categorie_product_id ";
2929 2929
 		}
@@ -2949,15 +2949,15 @@  discard block
 block discarded – undo
2949 2949
 		}
2950 2950
 		// Price by quantity
2951 2951
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2952
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2952
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2953 2953
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2954
-				$sql .= " AND price_level = " . ((int) $price_level);
2954
+				$sql .= " AND price_level = ".((int) $price_level);
2955 2955
 			}
2956 2956
 			$sql .= " ORDER BY date_price";
2957 2957
 			$sql .= " DESC LIMIT 1) as price_rowid";
2958
-			$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2958
+			$sql .= ", (SELECT pp.price_by_qty FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
2959 2959
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2960
-				$sql .= " AND price_level = " . ((int) $price_level);
2960
+				$sql .= " AND price_level = ".((int) $price_level);
2961 2961
 			}
2962 2962
 			$sql .= " ORDER BY date_price";
2963 2963
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2967,7 +2967,7 @@  discard block
 block discarded – undo
2967 2967
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2968 2968
 
2969 2969
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
2970
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
2970
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
2971 2971
 		}
2972 2972
 
2973 2973
 		// Add from (left join) from hooks
@@ -2976,53 +2976,53 @@  discard block
 block discarded – undo
2976 2976
 		$sql .= $hookmanager->resPrint;
2977 2977
 
2978 2978
 		if (count($warehouseStatusArray)) {
2979
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
2980
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
2981
-			$sql .= ' AND e.statut IN (' . $this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))) . ')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
2979
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
2980
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
2981
+			$sql .= ' AND e.statut IN ('.$this->db->sanitize($this->db->escape(implode(',', $warehouseStatusArray))).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0.
2982 2982
 		}
2983 2983
 
2984 2984
 		// include search in supplier ref
2985 2985
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
2986
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2986
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
2987 2987
 		}
2988 2988
 
2989 2989
 		//Price by customer
2990 2990
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
2991
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
2991
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
2992 2992
 		}
2993 2993
 		// Units
2994 2994
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
2995
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
2995
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
2996 2996
 		}
2997 2997
 		// Multilang : we add translation
2998 2998
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
2999
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
2999
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3000 3000
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3001
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3001
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3002 3002
 				$soc = new Societe($this->db);
3003 3003
 				$result = $soc->fetch($socid);
3004 3004
 				if ($result > 0 && !empty($soc->default_lang)) {
3005
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3005
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3006 3006
 				} else {
3007
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3007
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3008 3008
 				}
3009 3009
 			} else {
3010
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3010
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3011 3011
 			}
3012 3012
 		}
3013 3013
 
3014 3014
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3015
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3015
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3016 3016
 		}
3017 3017
 
3018
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3018
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3019 3019
 
3020 3020
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3021 3021
 			$sql .= " AND pac.rowid IS NULL";
3022 3022
 		}
3023 3023
 
3024 3024
 		if ($finished == 0) {
3025
-			$sql .= " AND p.finished = " . ((int) $finished);
3025
+			$sql .= " AND p.finished = ".((int) $finished);
3026 3026
 		} elseif ($finished == 1) {
3027 3027
 			$sql .= " AND p.finished = ".((int) $finished);
3028 3028
 		}
@@ -3030,11 +3030,11 @@  discard block
 block discarded – undo
3030 3030
 			$sql .= " AND p.tosell = ".((int) $status);
3031 3031
 		}
3032 3032
 		if ($status_purchase >= 0) {
3033
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3033
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3034 3034
 		}
3035 3035
 		// Filter by product type
3036 3036
 		if (strval($filtertype) != '') {
3037
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3037
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3038 3038
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3039 3039
 			$sql .= " AND p.fk_product_type = 1";
3040 3040
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3058,21 +3058,21 @@  discard block
 block discarded – undo
3058 3058
 				if ($i > 0) {
3059 3059
 					$sql .= " AND ";
3060 3060
 				}
3061
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3061
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3062 3062
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3063
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3063
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3064 3064
 				}
3065 3065
 				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
3066
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3066
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3067 3067
 				}
3068 3068
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3069
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3069
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3070 3070
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3071
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3071
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3072 3072
 					}
3073 3073
 				}
3074 3074
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3075
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3075
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3076 3076
 				}
3077 3077
 				$sql .= ")";
3078 3078
 				$i++;
@@ -3081,12 +3081,12 @@  discard block
 block discarded – undo
3081 3081
 				$sql .= ")";
3082 3082
 			}
3083 3083
 			if (isModEnabled('barcode')) {
3084
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3084
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3085 3085
 			}
3086 3086
 			$sql .= ')';
3087 3087
 		}
3088 3088
 		if (count($warehouseStatusArray)) {
3089
-			$sql .= " GROUP BY " . $selectFields;
3089
+			$sql .= " GROUP BY ".$selectFields;
3090 3090
 		}
3091 3091
 
3092 3092
 		//Sort by category
@@ -3101,23 +3101,23 @@  discard block
 block discarded – undo
3101 3101
 		$sql .= $this->db->plimit($limit, 0);
3102 3102
 
3103 3103
 		// Build output string
3104
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3104
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3105 3105
 		$result = $this->db->query($sql);
3106 3106
 		if ($result) {
3107
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3108
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3109
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3107
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3108
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3109
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3110 3110
 
3111 3111
 			$num = $this->db->num_rows($result);
3112 3112
 
3113 3113
 			$events = array();
3114 3114
 
3115 3115
 			if (!$forcecombo) {
3116
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3116
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3117 3117
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3118 3118
 			}
3119 3119
 
3120
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3120
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3121 3121
 
3122 3122
 			$textifempty = '';
3123 3123
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3134,7 +3134,7 @@  discard block
 block discarded – undo
3134 3134
 				}
3135 3135
 			}
3136 3136
 			if ($showempty) {
3137
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3137
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3138 3138
 			}
3139 3139
 
3140 3140
 			$i = 0;
@@ -3145,11 +3145,11 @@  discard block
 block discarded – undo
3145 3145
 
3146 3146
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
3147 3147
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3148
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3149
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3148
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3149
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3150 3150
 					$sql .= " ORDER BY quantity ASC";
3151 3151
 
3152
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3152
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3153 3153
 					$result2 = $this->db->query($sql);
3154 3154
 					if ($result2) {
3155 3155
 						$nb_prices = $this->db->num_rows($result2);
@@ -3187,7 +3187,7 @@  discard block
 block discarded – undo
3187 3187
 						$price_product = new Product($this->db);
3188 3188
 						$price_product->fetch($objp->rowid, '', '', 1);
3189 3189
 
3190
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3190
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3191 3191
 						$priceparser = new PriceParser($this->db);
3192 3192
 						$price_result = $priceparser->parseProduct($price_product);
3193 3193
 						if ($price_result >= 0) {
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
 			$label = $objp->label_translated;
3272 3272
 		}
3273 3273
 		if (!empty($filterkey) && $filterkey != '') {
3274
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3274
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3275 3275
 		}
3276 3276
 
3277 3277
 		$outkey = $objp->rowid;
@@ -3292,32 +3292,32 @@  discard block
 block discarded – undo
3292 3292
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3293 3293
 
3294 3294
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3295
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3295
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3296 3296
 		}
3297 3297
 
3298 3298
 		// Units
3299 3299
 		$outvalUnits = '';
3300 3300
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3301 3301
 			if (!empty($objp->unit_short)) {
3302
-				$outvalUnits .= ' - ' . $objp->unit_short;
3302
+				$outvalUnits .= ' - '.$objp->unit_short;
3303 3303
 			}
3304 3304
 		}
3305 3305
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3306 3306
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3307 3307
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3308
-				$outvalUnits .= ' - ' . $unitToShow;
3308
+				$outvalUnits .= ' - '.$unitToShow;
3309 3309
 			}
3310 3310
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3311
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3312
-				$outvalUnits .= ' - ' . $unitToShow;
3311
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3312
+				$outvalUnits .= ' - '.$unitToShow;
3313 3313
 			}
3314 3314
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3315 3315
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3316
-				$outvalUnits .= ' - ' . $unitToShow;
3316
+				$outvalUnits .= ' - '.$unitToShow;
3317 3317
 			}
3318 3318
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3319 3319
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3320
-				$outvalUnits .= ' - ' . $unitToShow;
3320
+				$outvalUnits .= ' - '.$unitToShow;
3321 3321
 			}
3322 3322
 		}
3323 3323
 		if ($outdurationvalue && $outdurationunit) {
@@ -3329,7 +3329,7 @@  discard block
 block discarded – undo
3329 3329
 				'y' => $langs->trans('Year')
3330 3330
 			);
3331 3331
 			if (isset($da[$outdurationunit])) {
3332
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3332
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3333 3333
 			}
3334 3334
 		}
3335 3335
 
@@ -3349,31 +3349,31 @@  discard block
 block discarded – undo
3349 3349
 		$labeltoshow = '';
3350 3350
 		$labeltoshow .= $objp->ref;
3351 3351
 		if (!empty($objp->custref)) {
3352
-			$labeltoshow .= ' (' . $objp->custref . ')';
3352
+			$labeltoshow .= ' ('.$objp->custref.')';
3353 3353
 		}
3354 3354
 		if ($outbarcode) {
3355
-			$labeltoshow .= ' (' . $outbarcode . ')';
3355
+			$labeltoshow .= ' ('.$outbarcode.')';
3356 3356
 		}
3357
-		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);
3357
+		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);
3358 3358
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3359
-			$labeltoshow .= ' (' . getCountry($outorigin, 1) . ')';
3359
+			$labeltoshow .= ' ('.getCountry($outorigin, 1).')';
3360 3360
 		}
3361 3361
 
3362 3362
 		// Set $labltoshowhtml
3363 3363
 		$labeltoshowhtml = '';
3364 3364
 		$labeltoshowhtml .= $objp->ref;
3365 3365
 		if (!empty($objp->custref)) {
3366
-			$labeltoshowhtml .= ' (' . $objp->custref . ')';
3366
+			$labeltoshowhtml .= ' ('.$objp->custref.')';
3367 3367
 		}
3368 3368
 		if (!empty($filterkey) && $filterkey != '') {
3369
-			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3369
+			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3370 3370
 		}
3371 3371
 		if ($outbarcode) {
3372
-			$labeltoshowhtml .= ' (' . $outbarcode . ')';
3372
+			$labeltoshowhtml .= ' ('.$outbarcode.')';
3373 3373
 		}
3374
-		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);
3374
+		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);
3375 3375
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3376
-			$labeltoshowhtml .= ' (' . getCountry($outorigin, 1) . ')';
3376
+			$labeltoshowhtml .= ' ('.getCountry($outorigin, 1).')';
3377 3377
 		}
3378 3378
 
3379 3379
 		// Stock
@@ -3381,14 +3381,14 @@  discard block
 block discarded – undo
3381 3381
 		$labeltoshowhtmlstock = '';
3382 3382
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3383 3383
 			if ($user->hasRight('stock', 'lire')) {
3384
-				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3384
+				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3385 3385
 
3386 3386
 				if ($objp->stock > 0) {
3387 3387
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
3388 3388
 				} elseif ($objp->stock <= 0) {
3389 3389
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
3390 3390
 				}
3391
-				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3391
+				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'));
3392 3392
 				$labeltoshowhtmlstock .= '</span>';
3393 3393
 
3394 3394
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
@@ -3399,9 +3399,9 @@  discard block
 block discarded – undo
3399 3399
 					$tmpproduct->load_virtual_stock();
3400 3400
 					$virtualstock = $tmpproduct->stock_theorique;
3401 3401
 
3402
-					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3402
+					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3403 3403
 
3404
-					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3404
+					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':';
3405 3405
 					if ($virtualstock > 0) {
3406 3406
 						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';
3407 3407
 					} elseif ($virtualstock <= 0) {
@@ -3422,35 +3422,35 @@  discard block
 block discarded – undo
3422 3422
 		// If we need a particular price level (from 1 to n)
3423 3423
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) {
3424 3424
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3425
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3426
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3427
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3428
-			$sql .= " AND price_level = " . ((int) $price_level);
3425
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3426
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3427
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3428
+			$sql .= " AND price_level = ".((int) $price_level);
3429 3429
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3430 3430
 			$sql .= " LIMIT 1";
3431 3431
 
3432
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3432
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3433 3433
 			$result2 = $this->db->query($sql);
3434 3434
 			if ($result2) {
3435 3435
 				$objp2 = $this->db->fetch_object($result2);
3436 3436
 				if ($objp2) {
3437 3437
 					$found = 1;
3438 3438
 					if ($objp2->price_base_type == 'HT') {
3439
-						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3440
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3439
+						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3440
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3441 3441
 					} else {
3442
-						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3443
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3442
+						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3443
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3444 3444
 					}
3445 3445
 					$outprice_ht = price($objp2->price);
3446 3446
 					$outprice_ttc = price($objp2->price_ttc);
3447 3447
 					$outpricebasetype = $objp2->price_base_type;
3448 3448
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3449
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3450
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3449
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3450
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3451 3451
 					} else {
3452
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3453
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3452
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3453
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3454 3454
 					}
3455 3455
 				}
3456 3456
 			} else {
@@ -3464,13 +3464,13 @@  discard block
 block discarded – undo
3464 3464
 			$outqty = $objp->quantity;
3465 3465
 			$outdiscount = $objp->remise_percent;
3466 3466
 			if ($objp->quantity == 1) {
3467
-				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3468
-				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3467
+				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3468
+				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3469 3469
 				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3470 3470
 				$labeltoshowhtmlprice .= $langs->transnoentities("Unit");
3471 3471
 			} else {
3472
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3473
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3472
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3473
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3474 3474
 				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3475 3475
 				$labeltoshowhtmlprice .= $langs->transnoentities("Units");
3476 3476
 			}
@@ -3478,16 +3478,16 @@  discard block
 block discarded – undo
3478 3478
 			$outprice_ht = price($objp->unitprice);
3479 3479
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3480 3480
 			$outpricebasetype = $objp->price_base_type;
3481
-			$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
3482
-			$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
3481
+			$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
3482
+			$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
3483 3483
 		}
3484 3484
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3485
-			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3486
-			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3485
+			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3486
+			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3487 3487
 		}
3488 3488
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3489
-			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3490
-			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3489
+			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3490
+			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3491 3491
 		}
3492 3492
 
3493 3493
 		// Price by customer
@@ -3496,11 +3496,11 @@  discard block
 block discarded – undo
3496 3496
 				$found = 1;
3497 3497
 
3498 3498
 				if ($objp->custprice_base_type == 'HT') {
3499
-					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3500
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3499
+					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3500
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3501 3501
 				} else {
3502
-					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3503
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3502
+					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3503
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3504 3504
 				}
3505 3505
 
3506 3506
 				$outprice_ht = price($objp->custprice);
@@ -3514,11 +3514,11 @@  discard block
 block discarded – undo
3514 3514
 		// If level no defined or multiprice not found, we used the default price
3515 3515
 		if (empty($hidepriceinlabel) && !$found) {
3516 3516
 			if ($objp->price_base_type == 'HT') {
3517
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3518
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3517
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3518
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3519 3519
 			} else {
3520
-				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3521
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3520
+				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3521
+				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3522 3522
 			}
3523 3523
 			$outprice_ht = price($objp->price);
3524 3524
 			$outprice_ttc = price($objp->price_ttc);
@@ -3529,14 +3529,14 @@  discard block
 block discarded – undo
3529 3529
 
3530 3530
 
3531 3531
 		// Build options
3532
-		$opt = '<option value="' . $objp->rowid . '"';
3532
+		$opt = '<option value="'.$objp->rowid.'"';
3533 3533
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3534 3534
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3535
-			$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 . '"';
3535
+			$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.'"';
3536 3536
 		}
3537 3537
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3538
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3539
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3538
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3539
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3540 3540
 		}
3541 3541
 
3542 3542
 		if ($stocktag == 1) {
@@ -3631,7 +3631,7 @@  discard block
 block discarded – undo
3631 3631
 		$selected_input_value = '';
3632 3632
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3633 3633
 			if ($selected > 0) {
3634
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3634
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3635 3635
 				$producttmpselect = new Product($this->db);
3636 3636
 				$producttmpselect->fetch($selected);
3637 3637
 				$selected_input_value = $producttmpselect->ref;
@@ -3639,10 +3639,10 @@  discard block
 block discarded – undo
3639 3639
 			}
3640 3640
 
3641 3641
 			// mode=2 means suppliers products
3642
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3643
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3642
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3643
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3644 3644
 
3645
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3645
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3646 3646
 		} else {
3647 3647
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3648 3648
 		}
@@ -3702,25 +3702,25 @@  discard block
 block discarded – undo
3702 3702
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3703 3703
 			$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
3704 3704
 		}
3705
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3706
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3705
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3706
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3707 3707
 		if ($socid > 0) {
3708
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3708
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3709 3709
 		}
3710
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3710
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3711 3711
 		// Units
3712 3712
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3713
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3713
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3714 3714
 		}
3715
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3715
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3716 3716
 		if ($statut != -1) {
3717
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3717
+			$sql .= " AND p.tobuy = ".((int) $statut);
3718 3718
 		}
3719 3719
 		if (strval($filtertype) != '') {
3720
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3720
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3721 3721
 		}
3722 3722
 		if (!empty($filtre)) {
3723
-			$sql .= " " . $filtre;
3723
+			$sql .= " ".$filtre;
3724 3724
 		}
3725 3725
 		// Add where from hooks
3726 3726
 		$parameters = array();
@@ -3740,9 +3740,9 @@  discard block
 block discarded – undo
3740 3740
 				if ($i > 0) {
3741 3741
 					$sql .= " AND ";
3742 3742
 				}
3743
-				$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) . "%'";
3743
+				$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)."%'";
3744 3744
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3745
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3745
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3746 3746
 				}
3747 3747
 				$sql .= ")";
3748 3748
 				$i++;
@@ -3751,8 +3751,8 @@  discard block
 block discarded – undo
3751 3751
 				$sql .= ")";
3752 3752
 			}
3753 3753
 			if (isModEnabled('barcode')) {
3754
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3755
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3754
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3755
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3756 3756
 			}
3757 3757
 			$sql .= ')';
3758 3758
 		}
@@ -3761,20 +3761,20 @@  discard block
 block discarded – undo
3761 3761
 
3762 3762
 		// Build output string
3763 3763
 
3764
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3764
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3765 3765
 		$result = $this->db->query($sql);
3766 3766
 		if ($result) {
3767
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3768
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3767
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3768
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3769 3769
 
3770 3770
 			$num = $this->db->num_rows($result);
3771 3771
 
3772 3772
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3773
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3773
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3774 3774
 			if (!$selected) {
3775
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3775
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3776 3776
 			} else {
3777
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3777
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3778 3778
 			}
3779 3779
 
3780 3780
 			$i = 0;
@@ -3789,7 +3789,7 @@  discard block
 block discarded – undo
3789 3789
 
3790 3790
 				$outkey = $objp->idprodfournprice; // id in table of price
3791 3791
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3792
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3792
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3793 3793
 				}
3794 3794
 
3795 3795
 				$outref = $objp->ref;
@@ -3804,23 +3804,23 @@  discard block
 block discarded – undo
3804 3804
 				$outvalUnits = '';
3805 3805
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3806 3806
 					if (!empty($objp->unit_short)) {
3807
-						$outvalUnits .= ' - ' . $objp->unit_short;
3807
+						$outvalUnits .= ' - '.$objp->unit_short;
3808 3808
 					}
3809 3809
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3810 3810
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3811
-						$outvalUnits .= ' - ' . $unitToShow;
3811
+						$outvalUnits .= ' - '.$unitToShow;
3812 3812
 					}
3813 3813
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3814
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3815
-						$outvalUnits .= ' - ' . $unitToShow;
3814
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3815
+						$outvalUnits .= ' - '.$unitToShow;
3816 3816
 					}
3817 3817
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3818 3818
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3819
-						$outvalUnits .= ' - ' . $unitToShow;
3819
+						$outvalUnits .= ' - '.$unitToShow;
3820 3820
 					}
3821 3821
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3822 3822
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3823
-						$outvalUnits .= ' - ' . $unitToShow;
3823
+						$outvalUnits .= ' - '.$unitToShow;
3824 3824
 					}
3825 3825
 					if ($outdurationvalue && $outdurationunit) {
3826 3826
 						$da = array(
@@ -3831,22 +3831,22 @@  discard block
 block discarded – undo
3831 3831
 							'y' => $langs->trans('Year')
3832 3832
 						);
3833 3833
 						if (isset($da[$outdurationunit])) {
3834
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3834
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3835 3835
 						}
3836 3836
 					}
3837 3837
 				}
3838 3838
 
3839 3839
 				$objRef = $objp->ref;
3840 3840
 				if ($filterkey && $filterkey != '') {
3841
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3841
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3842 3842
 				}
3843 3843
 				$objRefFourn = $objp->ref_fourn;
3844 3844
 				if ($filterkey && $filterkey != '') {
3845
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3845
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3846 3846
 				}
3847 3847
 				$label = $objp->label;
3848 3848
 				if ($filterkey && $filterkey != '') {
3849
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3849
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3850 3850
 				}
3851 3851
 
3852 3852
 				switch ($objp->fk_product_type) {
@@ -3869,21 +3869,21 @@  discard block
 block discarded – undo
3869 3869
 
3870 3870
 				$optlabel .= $objp->ref;
3871 3871
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3872
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3872
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3873 3873
 				}
3874 3874
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3875
-					$optlabel .= ' (' . $outbarcode . ')';
3875
+					$optlabel .= ' ('.$outbarcode.')';
3876 3876
 				}
3877
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3877
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3878 3878
 
3879 3879
 				$outvallabel = $objRef;
3880 3880
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3881
-					$outvallabel .= ' (' . $objRefFourn . ')';
3881
+					$outvallabel .= ' ('.$objRefFourn.')';
3882 3882
 				}
3883 3883
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3884
-					$outvallabel .= ' (' . $outbarcode . ')';
3884
+					$outvallabel .= ' ('.$outbarcode.')';
3885 3885
 				}
3886
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3886
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3887 3887
 
3888 3888
 				// Units
3889 3889
 				$optlabel .= $outvalUnits;
@@ -3900,7 +3900,7 @@  discard block
 block discarded – undo
3900 3900
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3901 3901
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3902 3902
 
3903
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3903
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3904 3904
 						$priceparser = new PriceParser($this->db);
3905 3905
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3906 3906
 						if ($price_result >= 0) {
@@ -3911,57 +3911,57 @@  discard block
 block discarded – undo
3911 3911
 						}
3912 3912
 					}
3913 3913
 					if ($objp->quantity == 1) {
3914
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3915
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3914
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3915
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3916 3916
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3917 3917
 						$outvallabel .= $langs->transnoentities("Unit");
3918 3918
 					} else {
3919
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3920
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3921
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3922
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3919
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3920
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3921
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3922
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3923 3923
 					}
3924 3924
 
3925 3925
 					if ($objp->quantity > 1) {
3926
-						$optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3927
-						$outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3926
+						$optlabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3927
+						$outvallabel .= " (".price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3928 3928
 					}
3929 3929
 					if ($objp->remise_percent >= 1) {
3930
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3931
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3930
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3931
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3932 3932
 					}
3933 3933
 					if ($objp->duration) {
3934
-						$optlabel .= " - " . $objp->duration;
3935
-						$outvallabel .= " - " . $objp->duration;
3934
+						$optlabel .= " - ".$objp->duration;
3935
+						$outvallabel .= " - ".$objp->duration;
3936 3936
 					}
3937 3937
 					if (!$socid) {
3938
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3939
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3938
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3939
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3940 3940
 					}
3941 3941
 					if ($objp->supplier_reputation) {
3942 3942
 						//TODO dictionary
3943 3943
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3944 3944
 
3945
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3946
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3945
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3946
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3947 3947
 					}
3948 3948
 				} else {
3949
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3950
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3949
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3950
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3951 3951
 				}
3952 3952
 
3953 3953
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3954 3954
 					$novirtualstock = ($showstockinlist == 2);
3955 3955
 
3956 3956
 					if ($user->hasRight('stock', 'lire')) {
3957
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
3957
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'));
3958 3958
 
3959 3959
 						if ($objp->stock > 0) {
3960 3960
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3961 3961
 						} elseif ($objp->stock <= 0) {
3962 3962
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3963 3963
 						}
3964
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3964
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3965 3965
 						$optlabel .= '</span>';
3966 3966
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3967 3967
 							$langs->load("stocks");
@@ -3971,9 +3971,9 @@  discard block
 block discarded – undo
3971 3971
 							$tmpproduct->load_virtual_stock();
3972 3972
 							$virtualstock = $tmpproduct->stock_theorique;
3973 3973
 
3974
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3974
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3975 3975
 
3976
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3976
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
3977 3977
 							if ($virtualstock > 0) {
3978 3978
 								$optlabel .= '<span class="product_line_stock_ok">';
3979 3979
 							} elseif ($virtualstock <= 0) {
@@ -3987,7 +3987,7 @@  discard block
 block discarded – undo
3987 3987
 					}
3988 3988
 				}
3989 3989
 
3990
-				$optstart = '<option value="' . $outkey . '"';
3990
+				$optstart = '<option value="'.$outkey.'"';
3991 3991
 				if ($selected && $selected == $objp->idprodfournprice) {
3992 3992
 					$optstart .= ' selected';
3993 3993
 				}
@@ -3996,31 +3996,31 @@  discard block
 block discarded – undo
3996 3996
 				}
3997 3997
 
3998 3998
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
3999
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
4000
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
4001
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
4002
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
4003
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
4004
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
4005
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
4006
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
4007
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
4008
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
3999
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
4000
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
4001
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
4002
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
4003
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
4004
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
4005
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
4006
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
4007
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
4008
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
4009 4009
 					if (isModEnabled('multicurrency')) {
4010
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
4011
-						$optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
4010
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
4011
+						$optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
4012 4012
 					}
4013 4013
 				}
4014
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
4014
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
4015 4015
 
4016 4016
 				$outarrayentry = array(
4017 4017
 					'key' => $outkey,
4018 4018
 					'value' => $outref,
4019 4019
 					'label' => $outvallabel,
4020 4020
 					'qty' => $outqty,
4021
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
4022
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4023
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4021
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4022
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4023
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4024 4024
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
4025 4025
 					'tva_tx' => price2num($objp->tva_tx),
4026 4026
 					'default_vat_code' => $objp->default_vat_code,
@@ -4050,17 +4050,17 @@  discard block
 block discarded – undo
4050 4050
 				// Add new entry
4051 4051
 				// "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
4052 4052
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4053
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4053
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4054 4054
 				$outarraypush = array(
4055 4055
 					'key' => $outkey,
4056 4056
 					'value' => $outref,
4057 4057
 					'label' => $outvallabel,
4058 4058
 					'qty' => $outqty,
4059
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4059
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4060 4060
 					'price_qty_ht_locale' => price($objp->fprice),
4061
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4061
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4062 4062
 					'price_unit_ht_locale' => price($objp->unitprice),
4063
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4063
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4064 4064
 					'tva_tx_formated' => price($objp->tva_tx),
4065 4065
 					'tva_tx' => price2num($objp->tva_tx),
4066 4066
 					'default_vat_code' => $objp->default_vat_code,
@@ -4093,7 +4093,7 @@  discard block
 block discarded – undo
4093 4093
 
4094 4094
 			$this->db->free($result);
4095 4095
 
4096
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4096
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4097 4097
 			$out .= ajax_combobox($htmlname);
4098 4098
 		} else {
4099 4099
 			dol_print_error($this->db);
@@ -4125,43 +4125,43 @@  discard block
 block discarded – undo
4125 4125
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4126 4126
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4127 4127
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4128
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4129
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4130
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4131
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4128
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4129
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4130
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4131
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4132 4132
 		$sql .= " AND p.tobuy = 1";
4133 4133
 		$sql .= " AND s.fournisseur = 1";
4134
-		$sql .= " AND p.rowid = " . ((int) $productid);
4134
+		$sql .= " AND p.rowid = ".((int) $productid);
4135 4135
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4136 4136
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4137 4137
 		} else {
4138 4138
 			$sql .= " ORDER BY pfp.unitprice ASC";
4139 4139
 		}
4140 4140
 
4141
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4141
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4142 4142
 		$result = $this->db->query($sql);
4143 4143
 
4144 4144
 		if ($result) {
4145 4145
 			$num = $this->db->num_rows($result);
4146 4146
 
4147
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4147
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4148 4148
 
4149 4149
 			if (!$num) {
4150
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4150
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4151 4151
 			} else {
4152
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4152
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4153 4153
 				$form .= '<option value="0">&nbsp;</option>';
4154 4154
 
4155 4155
 				$i = 0;
4156 4156
 				while ($i < $num) {
4157 4157
 					$objp = $this->db->fetch_object($result);
4158 4158
 
4159
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4159
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4160 4160
 					//if there is only one supplier, preselect it
4161 4161
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4162 4162
 						$opt .= ' selected';
4163 4163
 					}
4164
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4164
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4165 4165
 
4166 4166
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4167 4167
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4171,7 +4171,7 @@  discard block
 block discarded – undo
4171 4171
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4172 4172
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4173 4173
 
4174
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4174
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4175 4175
 						$priceparser = new PriceParser($this->db);
4176 4176
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4177 4177
 						if ($price_result >= 0) {
@@ -4182,10 +4182,10 @@  discard block
 block discarded – undo
4182 4182
 						}
4183 4183
 					}
4184 4184
 					if ($objp->quantity == 1) {
4185
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4185
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4186 4186
 					}
4187 4187
 
4188
-					$opt .= $objp->quantity . ' ';
4188
+					$opt .= $objp->quantity.' ';
4189 4189
 
4190 4190
 					if ($objp->quantity == 1) {
4191 4191
 						$opt .= $langs->trans("Unit");
@@ -4194,10 +4194,10 @@  discard block
 block discarded – undo
4194 4194
 					}
4195 4195
 					if ($objp->quantity > 1) {
4196 4196
 						$opt .= " - ";
4197
-						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
4197
+						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
4198 4198
 					}
4199 4199
 					if ($objp->duration) {
4200
-						$opt .= " - " . $objp->duration;
4200
+						$opt .= " - ".$objp->duration;
4201 4201
 					}
4202 4202
 					$opt .= "</option>\n";
4203 4203
 
@@ -4235,8 +4235,8 @@  discard block
 block discarded – undo
4235 4235
 		dol_syslog(__METHOD__, LOG_DEBUG);
4236 4236
 
4237 4237
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4238
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4239
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4238
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4239
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4240 4240
 		$sql .= " AND active > 0";
4241 4241
 		$sql .= " ORDER BY sortorder";
4242 4242
 
@@ -4248,7 +4248,7 @@  discard block
 block discarded – undo
4248 4248
 				$obj = $this->db->fetch_object($resql);
4249 4249
 
4250 4250
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4251
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4251
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4252 4252
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4253 4253
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4254 4254
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4276,7 +4276,7 @@  discard block
 block discarded – undo
4276 4276
 		// phpcs:enable
4277 4277
 		global $langs;
4278 4278
 
4279
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4279
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4280 4280
 		if ($num > 0) {
4281 4281
 			return 0; // Cache already loaded
4282 4282
 		}
@@ -4286,7 +4286,7 @@  discard block
 block discarded – undo
4286 4286
 		$langs->load('propal');
4287 4287
 
4288 4288
 		$sql = "SELECT rowid, code, label, position";
4289
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4289
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4290 4290
 		$sql .= " WHERE active > 0";
4291 4291
 
4292 4292
 		$resql = $this->db->query($sql);
@@ -4297,7 +4297,7 @@  discard block
 block discarded – undo
4297 4297
 				$obj = $this->db->fetch_object($resql);
4298 4298
 
4299 4299
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4300
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4300
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4301 4301
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4302 4302
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4303 4303
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4329,17 +4329,17 @@  discard block
 block discarded – undo
4329 4329
 
4330 4330
 		$this->load_cache_availability();
4331 4331
 
4332
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4332
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4333 4333
 
4334
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4334
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4335 4335
 		if ($addempty) {
4336 4336
 			print '<option value="0">&nbsp;</option>';
4337 4337
 		}
4338 4338
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4339 4339
 			if ($selected == $id) {
4340
-				print '<option value="' . $id . '" selected>';
4340
+				print '<option value="'.$id.'" selected>';
4341 4341
 			} else {
4342
-				print '<option value="' . $id . '">';
4342
+				print '<option value="'.$id.'">';
4343 4343
 			}
4344 4344
 			print dol_escape_htmltag($arrayavailability['label']);
4345 4345
 			print '</option>';
@@ -4360,13 +4360,13 @@  discard block
 block discarded – undo
4360 4360
 	{
4361 4361
 		global $langs;
4362 4362
 
4363
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4363
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4364 4364
 		if ($num > 0) {
4365 4365
 			return 0; // Cache already loaded
4366 4366
 		}
4367 4367
 
4368 4368
 		$sql = "SELECT rowid, code, label";
4369
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4369
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4370 4370
 		$sql .= " WHERE active > 0";
4371 4371
 
4372 4372
 		$resql = $this->db->query($sql);
@@ -4379,8 +4379,8 @@  discard block
 block discarded – undo
4379 4379
 
4380 4380
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4381 4381
 				$label = ($obj->label != '-' ? $obj->label : '');
4382
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4383
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4382
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4383
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4384 4384
 				}
4385 4385
 				if ($langs->trans($obj->code) != $obj->code) {
4386 4386
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4420,9 +4420,9 @@  discard block
 block discarded – undo
4420 4420
 
4421 4421
 		$this->loadCacheInputReason();
4422 4422
 
4423
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4423
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4424 4424
 		if ($addempty) {
4425
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4425
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4426 4426
 		}
4427 4427
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4428 4428
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4430,9 +4430,9 @@  discard block
 block discarded – undo
4430 4430
 			}
4431 4431
 
4432 4432
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4433
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4433
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4434 4434
 			} else {
4435
-				print '<option value="' . $arraydemandreason['id'] . '">';
4435
+				print '<option value="'.$arraydemandreason['id'].'">';
4436 4436
 			}
4437 4437
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4438 4438
 			print $langs->trans($label);
@@ -4442,7 +4442,7 @@  discard block
 block discarded – undo
4442 4442
 		if ($user->admin && empty($notooltip)) {
4443 4443
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4444 4444
 		}
4445
-		print ajax_combobox('select_' . $htmlname);
4445
+		print ajax_combobox('select_'.$htmlname);
4446 4446
 	}
4447 4447
 
4448 4448
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4457,7 +4457,7 @@  discard block
 block discarded – undo
4457 4457
 		// phpcs:enable
4458 4458
 		global $langs;
4459 4459
 
4460
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4460
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4461 4461
 		if ($num > 0) {
4462 4462
 			return $num; // Cache already loaded
4463 4463
 		}
@@ -4467,8 +4467,8 @@  discard block
 block discarded – undo
4467 4467
 		$this->cache_types_paiements = array();
4468 4468
 
4469 4469
 		$sql = "SELECT id, code, libelle as label, type, active";
4470
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4471
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4470
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4471
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4472 4472
 
4473 4473
 		$resql = $this->db->query($sql);
4474 4474
 		if ($resql) {
@@ -4478,7 +4478,7 @@  discard block
 block discarded – undo
4478 4478
 				$obj = $this->db->fetch_object($resql);
4479 4479
 
4480 4480
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4481
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4481
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4482 4482
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4483 4483
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4484 4484
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4550,17 +4550,17 @@  discard block
 block discarded – undo
4550 4550
 		global $langs, $user, $conf;
4551 4551
 
4552 4552
 		$out = '';
4553
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4553
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4554 4554
 
4555 4555
 		$this->load_cache_conditions_paiements();
4556 4556
 
4557 4557
 		// Set default value if not already set by caller
4558 4558
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4559
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4559
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4560 4560
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4561 4561
 		}
4562 4562
 
4563
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4563
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4564 4564
 		if ($addempty) {
4565 4565
 			$out .= '<option value="0">&nbsp;</option>';
4566 4566
 		}
@@ -4574,9 +4574,9 @@  discard block
 block discarded – undo
4574 4574
 
4575 4575
 			if ($selected == $id) {
4576 4576
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4577
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4577
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4578 4578
 			} else {
4579
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4579
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4580 4580
 			}
4581 4581
 			$label = $arrayconditions['label'];
4582 4582
 
@@ -4594,21 +4594,21 @@  discard block
 block discarded – undo
4594 4594
 		$out .= ajax_combobox($htmlname);
4595 4595
 
4596 4596
 		if ($deposit_percent >= 0) {
4597
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4598
-			$out .= $langs->trans('DepositPercent') . ' : ';
4599
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4597
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4598
+			$out .= $langs->trans('DepositPercent').' : ';
4599
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4600 4600
 			$out .= '</span>';
4601 4601
 			$out .= '
4602
-				<script nonce="' . getNonce() . '">
4602
+				<script nonce="' . getNonce().'">
4603 4603
 					$(document).ready(function () {
4604
-						$("#' . $htmlname . '").change(function () {
4604
+						$("#' . $htmlname.'").change(function () {
4605 4605
 							let $selected = $(this).find("option:selected");
4606 4606
 							let depositPercent = $selected.attr("data-deposit_percent");
4607 4607
 
4608 4608
 							if (depositPercent.length > 0) {
4609
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4609
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4610 4610
 							} else {
4611
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4611
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4612 4612
 							}
4613 4613
 
4614 4614
 							return true;
@@ -4646,7 +4646,7 @@  discard block
 block discarded – undo
4646 4646
 
4647 4647
 		$out = '';
4648 4648
 
4649
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4649
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4650 4650
 
4651 4651
 		$filterarray = array();
4652 4652
 		if ($filtertype == 'CRDT') {
@@ -4661,11 +4661,11 @@  discard block
 block discarded – undo
4661 4661
 
4662 4662
 		// Set default value if not already set by caller
4663 4663
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4664
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4664
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4665 4665
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4666 4666
 		}
4667 4667
 
4668
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4668
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4669 4669
 		if ($empty) {
4670 4670
 			$out .= '<option value="">&nbsp;</option>';
4671 4671
 		}
@@ -4686,13 +4686,13 @@  discard block
 block discarded – undo
4686 4686
 			}
4687 4687
 
4688 4688
 			if ($format == 0) {
4689
-				$out .= '<option value="' . $id . '"';
4689
+				$out .= '<option value="'.$id.'"';
4690 4690
 			} elseif ($format == 1) {
4691
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4691
+				$out .= '<option value="'.$arraytypes['code'].'"';
4692 4692
 			} elseif ($format == 2) {
4693
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4693
+				$out .= '<option value="'.$arraytypes['code'].'"';
4694 4694
 			} elseif ($format == 3) {
4695
-				$out .= '<option value="' . $id . '"';
4695
+				$out .= '<option value="'.$id.'"';
4696 4696
 			}
4697 4697
 			// Print attribute selected or not
4698 4698
 			if ($format == 1 || $format == 2) {
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
 		if ($user->admin && !$noadmininfo) {
4723 4723
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4724 4724
 		}
4725
-		$out .= ajax_combobox('select' . $htmlname);
4725
+		$out .= ajax_combobox('select'.$htmlname);
4726 4726
 
4727 4727
 		if (empty($nooutput)) {
4728 4728
 			print $out;
@@ -4744,22 +4744,22 @@  discard block
 block discarded – undo
4744 4744
 	{
4745 4745
 		global $langs;
4746 4746
 
4747
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4747
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4748 4748
 		$options = array(
4749 4749
 			'HT' => $langs->trans("HT"),
4750 4750
 			'TTC' => $langs->trans("TTC")
4751 4751
 		);
4752 4752
 		foreach ($options as $id => $value) {
4753 4753
 			if ($selected == $id) {
4754
-				$return .= '<option value="' . $id . '" selected>' . $value;
4754
+				$return .= '<option value="'.$id.'" selected>'.$value;
4755 4755
 			} else {
4756
-				$return .= '<option value="' . $id . '">' . $value;
4756
+				$return .= '<option value="'.$id.'">'.$value;
4757 4757
 			}
4758 4758
 			$return .= '</option>';
4759 4759
 		}
4760 4760
 		$return .= '</select>';
4761 4761
 		if ($addjscombo) {
4762
-			$return .= ajax_combobox('select_' . $htmlname);
4762
+			$return .= ajax_combobox('select_'.$htmlname);
4763 4763
 		}
4764 4764
 
4765 4765
 		return $return;
@@ -4777,7 +4777,7 @@  discard block
 block discarded – undo
4777 4777
 		// phpcs:enable
4778 4778
 		global $langs;
4779 4779
 
4780
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4780
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4781 4781
 		if ($num > 0) {
4782 4782
 			return $num; // Cache already loaded
4783 4783
 		}
@@ -4787,8 +4787,8 @@  discard block
 block discarded – undo
4787 4787
 		$this->cache_transport_mode = array();
4788 4788
 
4789 4789
 		$sql = "SELECT rowid, code, label, active";
4790
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4791
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4790
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4791
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4792 4792
 
4793 4793
 		$resql = $this->db->query($sql);
4794 4794
 		if ($resql) {
@@ -4798,7 +4798,7 @@  discard block
 block discarded – undo
4798 4798
 				$obj = $this->db->fetch_object($resql);
4799 4799
 
4800 4800
 				// If traduction exist, we use it else we take the default label
4801
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4801
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4802 4802
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4803 4803
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4804 4804
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4832,11 +4832,11 @@  discard block
 block discarded – undo
4832 4832
 	{
4833 4833
 		global $langs, $user;
4834 4834
 
4835
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4835
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4836 4836
 
4837 4837
 		$this->load_cache_transport_mode();
4838 4838
 
4839
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4839
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4840 4840
 		if ($empty) {
4841 4841
 			print '<option value="">&nbsp;</option>';
4842 4842
 		}
@@ -4852,13 +4852,13 @@  discard block
 block discarded – undo
4852 4852
 			}
4853 4853
 
4854 4854
 			if ($format == 0) {
4855
-				print '<option value="' . $id . '"';
4855
+				print '<option value="'.$id.'"';
4856 4856
 			} elseif ($format == 1) {
4857
-				print '<option value="' . $arraytypes['code'] . '"';
4857
+				print '<option value="'.$arraytypes['code'].'"';
4858 4858
 			} elseif ($format == 2) {
4859
-				print '<option value="' . $arraytypes['code'] . '"';
4859
+				print '<option value="'.$arraytypes['code'].'"';
4860 4860
 			} elseif ($format == 3) {
4861
-				print '<option value="' . $id . '"';
4861
+				print '<option value="'.$id.'"';
4862 4862
 			}
4863 4863
 			// If text is selected, we compare with code, else with id
4864 4864
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4906,31 +4906,31 @@  discard block
 block discarded – undo
4906 4906
 		$langs->load("deliveries");
4907 4907
 
4908 4908
 		$sql = "SELECT rowid, code, libelle as label";
4909
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4909
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4910 4910
 		$sql .= " WHERE active > 0";
4911 4911
 		if ($filtre) {
4912
-			$sql .= " AND " . $filtre;
4912
+			$sql .= " AND ".$filtre;
4913 4913
 		}
4914 4914
 		$sql .= " ORDER BY libelle ASC";
4915 4915
 
4916
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4916
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4917 4917
 		$result = $this->db->query($sql);
4918 4918
 		if ($result) {
4919 4919
 			$num = $this->db->num_rows($result);
4920 4920
 			$i = 0;
4921 4921
 			if ($num) {
4922
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4922
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4923 4923
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4924 4924
 					print '<option value="-1">&nbsp;</option>';
4925 4925
 				}
4926 4926
 				while ($i < $num) {
4927 4927
 					$obj = $this->db->fetch_object($result);
4928 4928
 					if ($selected == $obj->rowid) {
4929
-						print '<option value="' . $obj->rowid . '" selected>';
4929
+						print '<option value="'.$obj->rowid.'" selected>';
4930 4930
 					} else {
4931
-						print '<option value="' . $obj->rowid . '">';
4931
+						print '<option value="'.$obj->rowid.'">';
4932 4932
 					}
4933
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
4933
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
4934 4934
 					print '</option>';
4935 4935
 					$i++;
4936 4936
 				}
@@ -4939,7 +4939,7 @@  discard block
 block discarded – undo
4939 4939
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4940 4940
 				}
4941 4941
 
4942
-				print ajax_combobox('select' . $htmlname);
4942
+				print ajax_combobox('select'.$htmlname);
4943 4943
 			} else {
4944 4944
 				print $langs->trans("NoShippingMethodDefined");
4945 4945
 			}
@@ -4964,16 +4964,16 @@  discard block
 block discarded – undo
4964 4964
 		$langs->load("deliveries");
4965 4965
 
4966 4966
 		if ($htmlname != "none") {
4967
-			print '<form method="POST" action="' . $page . '">';
4967
+			print '<form method="POST" action="'.$page.'">';
4968 4968
 			print '<input type="hidden" name="action" value="setshippingmethod">';
4969
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
4969
+			print '<input type="hidden" name="token" value="'.newToken().'">';
4970 4970
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
4971
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
4971
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
4972 4972
 			print '</form>';
4973 4973
 		} else {
4974 4974
 			if ($selected) {
4975 4975
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
4976
-				print $langs->trans("SendingMethod" . strtoupper($code));
4976
+				print $langs->trans("SendingMethod".strtoupper($code));
4977 4977
 			} else {
4978 4978
 				print "&nbsp;";
4979 4979
 			}
@@ -4996,10 +4996,10 @@  discard block
 block discarded – undo
4996 4996
 
4997 4997
 		$opt = '<option value="" selected></option>';
4998 4998
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
4999
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
5000
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
4999
+		$sql .= ' FROM '.$this->db->prefix().'facture';
5000
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
5001 5001
 		$sql .= ' AND situation_counter >= 1';
5002
-		$sql .= ' AND fk_soc = ' . (int) $socid;
5002
+		$sql .= ' AND fk_soc = '.(int) $socid;
5003 5003
 		$sql .= ' AND type <> 2';
5004 5004
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
5005 5005
 		$resql = $this->db->query($sql);
@@ -5017,19 +5017,19 @@  discard block
 block discarded – undo
5017 5017
 						//Not prov?
5018 5018
 						if (substr($obj->ref, 1, 4) != 'PROV') {
5019 5019
 							if ($selected == $obj->rowid) {
5020
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
5020
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
5021 5021
 							} else {
5022
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
5022
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
5023 5023
 							}
5024 5024
 						}
5025 5025
 					}
5026 5026
 				}
5027 5027
 			}
5028 5028
 		} else {
5029
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
5029
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
5030 5030
 		}
5031 5031
 		if ($opt == '<option value ="" selected></option>') {
5032
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
5032
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
5033 5033
 		}
5034 5034
 		return $opt;
5035 5035
 	}
@@ -5049,12 +5049,12 @@  discard block
 block discarded – undo
5049 5049
 
5050 5050
 		$langs->load('products');
5051 5051
 
5052
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5052
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5053 5053
 
5054
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5054
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5055 5055
 		$sql .= ' WHERE active > 0';
5056 5056
 		if (!empty($unit_type)) {
5057
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5057
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5058 5058
 		}
5059 5059
 		$sql .= " ORDER BY sortorder";
5060 5060
 
@@ -5066,14 +5066,14 @@  discard block
 block discarded – undo
5066 5066
 
5067 5067
 			while ($res = $this->db->fetch_object($resql)) {
5068 5068
 				$unitLabel = $res->label;
5069
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5070
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5069
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5070
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5071 5071
 				}
5072 5072
 
5073 5073
 				if ($selected == $res->rowid) {
5074
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5074
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5075 5075
 				} else {
5076
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5076
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5077 5077
 				}
5078 5078
 			}
5079 5079
 			$return .= '</select>';
@@ -5108,23 +5108,23 @@  discard block
 block discarded – undo
5108 5108
 		$num = 0;
5109 5109
 
5110 5110
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5111
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5112
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5111
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5112
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5113 5113
 		if ($status != 2) {
5114
-			$sql .= " AND clos = " . (int) $status;
5114
+			$sql .= " AND clos = ".(int) $status;
5115 5115
 		}
5116 5116
 		if ($filtre) {	// TODO Support USF
5117
-			$sql .= " AND " . $filtre;
5117
+			$sql .= " AND ".$filtre;
5118 5118
 		}
5119 5119
 		$sql .= " ORDER BY label";
5120 5120
 
5121
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5121
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5122 5122
 		$result = $this->db->query($sql);
5123 5123
 		if ($result) {
5124 5124
 			$num = $this->db->num_rows($result);
5125 5125
 			$i = 0;
5126 5126
 			if ($num) {
5127
-				$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5127
+				$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5128 5128
 
5129 5129
 				if (!empty($useempty) && !is_numeric($useempty)) {
5130 5130
 					$out .= '<option value="-1">'.$langs->trans($useempty).'</option>';
@@ -5135,27 +5135,27 @@  discard block
 block discarded – undo
5135 5135
 				while ($i < $num) {
5136 5136
 					$obj = $this->db->fetch_object($result);
5137 5137
 					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5138
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';
5138
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';
5139 5139
 					} else {
5140
-						$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';
5140
+						$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';
5141 5141
 					}
5142 5142
 					$out .= trim($obj->label);
5143 5143
 					if ($showcurrency) {
5144
-						$out .= ' (' . $obj->currency_code . ')';
5144
+						$out .= ' ('.$obj->currency_code.')';
5145 5145
 					}
5146 5146
 					if ($status == 2 && $obj->status == 1) {
5147
-						$out .= ' (' . $langs->trans("Closed") . ')';
5147
+						$out .= ' ('.$langs->trans("Closed").')';
5148 5148
 					}
5149 5149
 					$out .= '</option>';
5150 5150
 					$i++;
5151 5151
 				}
5152 5152
 				$out .= "</select>";
5153
-				$out .= ajax_combobox('select' . $htmlname);
5153
+				$out .= ajax_combobox('select'.$htmlname);
5154 5154
 			} else {
5155 5155
 				if ($status == 0) {
5156
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5156
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5157 5157
 				} else {
5158
-					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>';
5158
+					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>';
5159 5159
 				}
5160 5160
 			}
5161 5161
 		} else {
@@ -5191,23 +5191,23 @@  discard block
 block discarded – undo
5191 5191
 		$num = 0;
5192 5192
 
5193 5193
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5194
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5194
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5195 5195
 		$sql .= " WHERE 1=1";
5196 5196
 		if ($status != 2) {
5197
-			$sql .= " AND status = " . (int) $status;
5197
+			$sql .= " AND status = ".(int) $status;
5198 5198
 		}
5199 5199
 		if ($filtre) {	// TODO Support USF
5200
-			$sql .= " AND " . $filtre;
5200
+			$sql .= " AND ".$filtre;
5201 5201
 		}
5202 5202
 		$sql .= " ORDER BY name";
5203 5203
 
5204
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5204
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5205 5205
 		$result = $this->db->query($sql);
5206 5206
 		if ($result) {
5207 5207
 			$num = $this->db->num_rows($result);
5208 5208
 			$i = 0;
5209 5209
 			if ($num) {
5210
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5210
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5211 5211
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5212 5212
 					print '<option value="-1">&nbsp;</option>';
5213 5213
 				}
@@ -5215,13 +5215,13 @@  discard block
 block discarded – undo
5215 5215
 				while ($i < $num) {
5216 5216
 					$obj = $this->db->fetch_object($result);
5217 5217
 					if ($selected == $obj->rowid) {
5218
-						print '<option value="' . $obj->rowid . '" selected>';
5218
+						print '<option value="'.$obj->rowid.'" selected>';
5219 5219
 					} else {
5220
-						print '<option value="' . $obj->rowid . '">';
5220
+						print '<option value="'.$obj->rowid.'">';
5221 5221
 					}
5222 5222
 					print trim($obj->name);
5223 5223
 					if ($status == 2 && $obj->status == 1) {
5224
-						print ' (' . $langs->trans("Closed") . ')';
5224
+						print ' ('.$langs->trans("Closed").')';
5225 5225
 					}
5226 5226
 					print '</option>';
5227 5227
 					$i++;
@@ -5229,9 +5229,9 @@  discard block
 block discarded – undo
5229 5229
 				print "</select>";
5230 5230
 			} else {
5231 5231
 				if ($status == 0) {
5232
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5232
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5233 5233
 				} else {
5234
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5234
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5235 5235
 				}
5236 5236
 			}
5237 5237
 
@@ -5255,20 +5255,20 @@  discard block
 block discarded – undo
5255 5255
 	{
5256 5256
 		global $langs;
5257 5257
 		if ($htmlname != "none") {
5258
-			print '<form method="POST" action="' . $page . '">';
5258
+			print '<form method="POST" action="'.$page.'">';
5259 5259
 			print '<input type="hidden" name="action" value="setbankaccount">';
5260
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5260
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5261 5261
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5262 5262
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5263 5263
 			if ($nbaccountfound > 0) {
5264
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5264
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5265 5265
 			}
5266 5266
 			print '</form>';
5267 5267
 		} else {
5268 5268
 			$langs->load('banks');
5269 5269
 
5270 5270
 			if ($selected) {
5271
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5271
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5272 5272
 				$bankstatic = new Account($this->db);
5273 5273
 				$result = $bankstatic->fetch($selected);
5274 5274
 				if ($result) {
@@ -5307,19 +5307,19 @@  discard block
 block discarded – undo
5307 5307
 		global $conf, $langs;
5308 5308
 		$langs->load("categories");
5309 5309
 
5310
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5310
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5311 5311
 
5312 5312
 		// For backward compatibility
5313 5313
 		if (is_numeric($type)) {
5314
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5314
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5315 5315
 		}
5316 5316
 
5317 5317
 		if ($type === Categorie::TYPE_BANK_LINE) {
5318 5318
 			// TODO Move this into common category feature
5319 5319
 			$cate_arbo = array();
5320 5320
 			$sql = "SELECT c.label, c.rowid";
5321
-			$sql .= " FROM " . $this->db->prefix() . "bank_categ as c";
5322
-			$sql .= " WHERE entity = " . $conf->entity;
5321
+			$sql .= " FROM ".$this->db->prefix()."bank_categ as c";
5322
+			$sql .= " WHERE entity = ".$conf->entity;
5323 5323
 			$sql .= " ORDER BY c.label";
5324 5324
 			$result = $this->db->query($sql);
5325 5325
 			if ($result) {
@@ -5345,12 +5345,12 @@  discard block
 block discarded – undo
5345 5345
 		$outarrayrichhtml = array();
5346 5346
 
5347 5347
 
5348
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5348
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5349 5349
 		if (is_array($cate_arbo)) {
5350 5350
 			$num = count($cate_arbo);
5351 5351
 
5352 5352
 			if (!$num) {
5353
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5353
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5354 5354
 			} else {
5355 5355
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5356 5356
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5362,15 +5362,15 @@  discard block
 block discarded – undo
5362 5362
 						$add = '';
5363 5363
 					}
5364 5364
 
5365
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5365
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5366 5366
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5367 5367
 
5368 5368
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5369 5369
 
5370 5370
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5371 5371
 
5372
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5373
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5372
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5373
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5374 5374
 					$output .= '>';
5375 5375
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5376 5376
 					$output .= '</option>';
@@ -5414,7 +5414,7 @@  discard block
 block discarded – undo
5414 5414
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5415 5415
 	{
5416 5416
 		// phpcs:enable
5417
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5417
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5418 5418
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5419 5419
 	}
5420 5420
 
@@ -5449,7 +5449,7 @@  discard block
 block discarded – undo
5449 5449
 	{
5450 5450
 		global $langs, $conf;
5451 5451
 
5452
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5452
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5453 5453
 		$formconfirm = '';
5454 5454
 		$inputok = array();
5455 5455
 		$inputko = array();
@@ -5473,27 +5473,27 @@  discard block
 block discarded – undo
5473 5473
 			foreach ($formquestion as $key => $input) {
5474 5474
 				if (is_array($input) && !empty($input)) {
5475 5475
 					if ($input['type'] == 'hidden') {
5476
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5477
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5476
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5477
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5478 5478
 
5479
-						$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";
5479
+						$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";
5480 5480
 					}
5481 5481
 				}
5482 5482
 			}
5483 5483
 
5484 5484
 			// Now add questions
5485 5485
 			$moreonecolumn = '';
5486
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5486
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5487 5487
 			foreach ($formquestion as $key => $input) {
5488 5488
 				if (is_array($input) && !empty($input)) {
5489
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5490
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5491
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5489
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5490
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5491
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5492 5492
 
5493 5493
 					if ($input['type'] == 'text') {
5494
-						$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";
5494
+						$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";
5495 5495
 					} elseif ($input['type'] == 'password') {
5496
-						$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";
5496
+						$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";
5497 5497
 					} elseif ($input['type'] == 'textarea') {
5498 5498
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5499 5499
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5501,8 +5501,8 @@  discard block
 block discarded – undo
5501 5501
 						$more .= '</textarea>';
5502 5502
 						$more .= '</div></div>'."\n";*/
5503 5503
 						$moreonecolumn .= '<div class="margintoponly">';
5504
-						$moreonecolumn .= $input['label'] . '<br>';
5505
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5504
+						$moreonecolumn .= $input['label'].'<br>';
5505
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5506 5506
 						$moreonecolumn .= $input['value'];
5507 5507
 						$moreonecolumn .= '</textarea>';
5508 5508
 						$moreonecolumn .= '</div>';
@@ -5519,20 +5519,20 @@  discard block
 block discarded – undo
5519 5519
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5520 5520
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5521 5521
 
5522
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5522
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5523 5523
 						if (!empty($input['label'])) {
5524
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5524
+							$more .= $input['label'].'</div><div class="tagtd left">';
5525 5525
 						}
5526 5526
 						if ($input['type'] == 'select') {
5527 5527
 							$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);
5528 5528
 						} else {
5529 5529
 							$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);
5530 5530
 						}
5531
-						$more .= '</div></div>' . "\n";
5531
+						$more .= '</div></div>'."\n";
5532 5532
 					} elseif ($input['type'] == 'checkbox') {
5533 5533
 						$more .= '<div class="tagtr">';
5534
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5535
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5534
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5535
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5536 5536
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5537 5537
 							$more .= ' checked';
5538 5538
 						}
@@ -5543,19 +5543,19 @@  discard block
 block discarded – undo
5543 5543
 							$more .= ' disabled';
5544 5544
 						}
5545 5545
 						$more .= ' /></div>';
5546
-						$more .= '</div>' . "\n";
5546
+						$more .= '</div>'."\n";
5547 5547
 					} elseif ($input['type'] == 'radio') {
5548 5548
 						$i = 0;
5549 5549
 						foreach ($input['values'] as $selkey => $selval) {
5550 5550
 							$more .= '<div class="tagtr">';
5551 5551
 							if (isset($input['label'])) {
5552 5552
 								if ($i == 0) {
5553
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5553
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5554 5554
 								} else {
5555
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5555
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5556 5556
 								}
5557 5557
 							}
5558
-							$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;
5558
+							$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;
5559 5559
 							if (!empty($input['disabled'])) {
5560 5560
 								$more .= ' disabled';
5561 5561
 							}
@@ -5563,12 +5563,12 @@  discard block
 block discarded – undo
5563 5563
 								$more .= ' checked="checked"';
5564 5564
 							}
5565 5565
 							$more .= ' /> ';
5566
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5567
-							$more .= '</div></div>' . "\n";
5566
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5567
+							$more .= '</div></div>'."\n";
5568 5568
 							$i++;
5569 5569
 						}
5570 5570
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5571
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5571
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5572 5572
 						$more .= '<div class="tagtd">';
5573 5573
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5574 5574
 						$h = $m = 0;
@@ -5586,24 +5586,24 @@  discard block
 block discarded – undo
5586 5586
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5587 5587
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5588 5588
 						if (!empty($input['label'])) {
5589
-							$more .= $input['label'] . '</div><div class="tagtd">';
5589
+							$more .= $input['label'].'</div><div class="tagtd">';
5590 5590
 						}
5591 5591
 						$more .= $input['value'];
5592
-						$more .= '</div></div>' . "\n";
5592
+						$more .= '</div></div>'."\n";
5593 5593
 					} elseif ($input['type'] == 'onecolumn') {
5594 5594
 						$moreonecolumn .= '<div class="margintoponly">';
5595 5595
 						$moreonecolumn .= $input['value'];
5596
-						$moreonecolumn .= '</div>' . "\n";
5596
+						$moreonecolumn .= '</div>'."\n";
5597 5597
 					} elseif ($input['type'] == 'hidden') {
5598 5598
 						// Do nothing more, already added by a previous loop
5599 5599
 					} elseif ($input['type'] == 'separator') {
5600 5600
 						$more .= '<br>';
5601 5601
 					} else {
5602
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5602
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5603 5603
 					}
5604 5604
 				}
5605 5605
 			}
5606
-			$more .= '</div>' . "\n";
5606
+			$more .= '</div>'."\n";
5607 5607
 			$more .= $moreonecolumn;
5608 5608
 		}
5609 5609
 
@@ -5625,10 +5625,10 @@  discard block
 block discarded – undo
5625 5625
 				$button = $useajax;
5626 5626
 				$useajax = 1;
5627 5627
 				$autoOpen = false;
5628
-				$dialogconfirm .= '-' . $button;
5628
+				$dialogconfirm .= '-'.$button;
5629 5629
 			}
5630
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5631
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5630
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5631
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5632 5632
 
5633 5633
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5634 5634
 			if (is_array($formquestion)) {
@@ -5651,24 +5651,24 @@  discard block
 block discarded – undo
5651 5651
 			}
5652 5652
 
5653 5653
 			// Show JQuery confirm box.
5654
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5654
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5655 5655
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5656
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5656
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5657 5657
 			}
5658 5658
 			if (!empty($more)) {
5659
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5659
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5660 5660
 			}
5661
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5662
-			$formconfirm .= '</div>' . "\n";
5661
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5662
+			$formconfirm .= '</div>'."\n";
5663 5663
 
5664
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5665
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5664
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5665
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5666 5666
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5667 5667
 			$formconfirm .= 'jQuery(document).ready(function() {
5668 5668
             $(function() {
5669
-            	$( "#' . $dialogconfirm . '" ).dialog(
5669
+            	$( "#' . $dialogconfirm.'" ).dialog(
5670 5670
             	{
5671
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5671
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5672 5672
 			if ($newselectedchoice == 'no') {
5673 5673
 				$formconfirm .= '
5674 5674
 						open: function() {
@@ -5678,24 +5678,24 @@  discard block
 block discarded – undo
5678 5678
 
5679 5679
 			$jsforcursor = '';
5680 5680
 			if ($useajax == 1) {
5681
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5682
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5681
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5682
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5683 5683
 			}
5684 5684
 
5685 5685
 			$postconfirmas = 'GET';
5686 5686
 
5687 5687
 			$formconfirm .= '
5688 5688
                     resizable: false,
5689
-                    height: "' . $height . '",
5690
-                    width: "' . $width . '",
5689
+                    height: "' . $height.'",
5690
+                    width: "' . $width.'",
5691 5691
                     modal: true,
5692 5692
                     closeOnEscape: false,
5693 5693
                     buttons: {
5694
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5695
-							var options = "token=' . urlencode(newToken()) . '";
5696
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5697
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5698
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5694
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5695
+							var options = "token=' . urlencode(newToken()).'";
5696
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5697
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5698
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5699 5699
 
5700 5700
                          	if (inputok.length > 0) {
5701 5701
                          		$.each(inputok, function(i, inputname) {
@@ -5729,11 +5729,11 @@  discard block
 block discarded – undo
5729 5729
 							}
5730 5730
 	                        $(this).dialog("close");
5731 5731
                         },
5732
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5733
-                        	var options = "token=' . urlencode(newToken()) . '";
5734
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5735
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5736
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5732
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5733
+                        	var options = "token=' . urlencode(newToken()).'";
5734
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5735
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5736
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5737 5737
                          	if (inputko.length > 0) {
5738 5738
                          		$.each(inputko, function(i, inputname) {
5739 5739
                          			var more = "";
@@ -5765,10 +5765,10 @@  discard block
 block discarded – undo
5765 5765
                 }
5766 5766
                 );
5767 5767
 
5768
-            	var button = "' . $button . '";
5768
+            	var button = "' . $button.'";
5769 5769
             	if (button.length > 0) {
5770 5770
                 	$( "#" + button ).click(function() {
5771
-                		$("#' . $dialogconfirm . '").dialog("open");
5771
+                		$("#' . $dialogconfirm.'").dialog("open");
5772 5772
         			});
5773 5773
                 }
5774 5774
             });
@@ -5776,44 +5776,44 @@  discard block
 block discarded – undo
5776 5776
             </script>';
5777 5777
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5778 5778
 		} else {
5779
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5779
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5780 5780
 
5781 5781
 			if (empty($disableformtag)) {
5782
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";
5782
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
5783 5783
 			}
5784 5784
 
5785
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5786
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5785
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5786
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5787 5787
 
5788
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5788
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5789 5789
 
5790 5790
 			// Line title
5791 5791
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5792
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5793
-			$formconfirm .= '</td></tr>' . "\n";
5792
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5793
+			$formconfirm .= '</td></tr>'."\n";
5794 5794
 
5795 5795
 			// Line text
5796 5796
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5797
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5797
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5798 5798
 			}
5799 5799
 
5800 5800
 			// Line form fields
5801 5801
 			if ($more) {
5802
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5802
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5803 5803
 				$formconfirm .= $more;
5804
-				$formconfirm .= '</td></tr>' . "\n";
5804
+				$formconfirm .= '</td></tr>'."\n";
5805 5805
 			}
5806 5806
 
5807 5807
 			// Line with question
5808 5808
 			$formconfirm .= '<tr class="valid">';
5809
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5809
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5810 5810
 			$formconfirm .= '<td class="valid center">';
5811 5811
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5812
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5812
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5813 5813
 			$formconfirm .= '</td>';
5814
-			$formconfirm .= '</tr>' . "\n";
5814
+			$formconfirm .= '</tr>'."\n";
5815 5815
 
5816
-			$formconfirm .= '</table>' . "\n";
5816
+			$formconfirm .= '</table>'."\n";
5817 5817
 
5818 5818
 			if (empty($disableformtag)) {
5819 5819
 				$formconfirm .= "</form>\n";
@@ -5822,7 +5822,7 @@  discard block
 block discarded – undo
5822 5822
 
5823 5823
 			if (!empty($conf->use_javascript_ajax)) {
5824 5824
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5825
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5825
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5826 5826
 				$formconfirm .= '
5827 5827
 				$(document).ready(function () {
5828 5828
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5834,7 +5834,7 @@  discard block
 block discarded – undo
5834 5834
 					});
5835 5835
 				});
5836 5836
 				';
5837
-				$formconfirm .= '</script>' . "\n";
5837
+				$formconfirm .= '</script>'."\n";
5838 5838
 			}
5839 5839
 
5840 5840
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -5866,8 +5866,8 @@  discard block
 block discarded – undo
5866 5866
 		// phpcs:enable
5867 5867
 		global $langs;
5868 5868
 
5869
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
5870
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
5869
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
5870
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
5871 5871
 
5872 5872
 		$out = '';
5873 5873
 
@@ -5875,11 +5875,11 @@  discard block
 block discarded – undo
5875 5875
 
5876 5876
 		$langs->load("project");
5877 5877
 		if ($htmlname != "none") {
5878
-			$out .= '<form method="post" action="' . $page . '">';
5878
+			$out .= '<form method="post" action="'.$page.'">';
5879 5879
 			$out .= '<input type="hidden" name="action" value="classin">';
5880
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5880
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5881 5881
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
5882
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5882
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5883 5883
 			$out .= '</form>';
5884 5884
 		} else {
5885 5885
 			$out .= '<span class="project_head_block">';
@@ -5888,7 +5888,7 @@  discard block
 block discarded – undo
5888 5888
 				$projet->fetch($selected);
5889 5889
 				$out .= $projet->getNomUrl(0, '', 1);
5890 5890
 			} else {
5891
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
5891
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
5892 5892
 			}
5893 5893
 			$out .= '</span>';
5894 5894
 		}
@@ -5925,14 +5925,14 @@  discard block
 block discarded – undo
5925 5925
 		$out = '';
5926 5926
 
5927 5927
 		if ($htmlname != "none") {
5928
-			$out .= '<form method="POST" action="' . $page . '">';
5928
+			$out .= '<form method="POST" action="'.$page.'">';
5929 5929
 			$out .= '<input type="hidden" name="action" value="setconditions">';
5930
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5930
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5931 5931
 			if ($type) {
5932
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
5932
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
5933 5933
 			}
5934 5934
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
5935
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5935
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
5936 5936
 			$out .= '</form>';
5937 5937
 		} else {
5938 5938
 			if ($selected) {
@@ -5977,12 +5977,12 @@  discard block
 block discarded – undo
5977 5977
 		// phpcs:enable
5978 5978
 		global $langs;
5979 5979
 		if ($htmlname != "none") {
5980
-			print '<form method="post" action="' . $page . '">';
5980
+			print '<form method="post" action="'.$page.'">';
5981 5981
 			print '<input type="hidden" name="action" value="setavailability">';
5982
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5982
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5983 5983
 			$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
5984
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5985
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
5984
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5985
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
5986 5986
 			print '</form>';
5987 5987
 		} else {
5988 5988
 			if ($selected) {
@@ -6008,11 +6008,11 @@  discard block
 block discarded – undo
6008 6008
 	{
6009 6009
 		global $langs;
6010 6010
 		if ($htmlname != "none") {
6011
-			print '<form method="post" action="' . $page . '">';
6011
+			print '<form method="post" action="'.$page.'">';
6012 6012
 			print '<input type="hidden" name="action" value="setdemandreason">';
6013
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6013
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6014 6014
 			$this->selectInputReason($selected, $htmlname, -1, $addempty);
6015
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6015
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6016 6016
 			print '</form>';
6017 6017
 		} else {
6018 6018
 			if ($selected) {
@@ -6052,17 +6052,17 @@  discard block
 block discarded – undo
6052 6052
 		$ret = '';
6053 6053
 
6054 6054
 		if ($htmlname != "none") {
6055
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6056
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6057
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6055
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6056
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6057
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6058 6058
 			if ($type) {
6059
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6059
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6060 6060
 			}
6061 6061
 			$ret .= '<table class="nobordernopadding">';
6062 6062
 			$ret .= '<tr><td>';
6063
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6063
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6064 6064
 			$ret .= '</td>';
6065
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6065
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6066 6066
 			$ret .= '</tr></table></form>';
6067 6067
 		} else {
6068 6068
 			if ($displayhour) {
@@ -6097,15 +6097,15 @@  discard block
 block discarded – undo
6097 6097
 		global $langs;
6098 6098
 
6099 6099
 		if ($htmlname != "none") {
6100
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6101
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6102
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6100
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6101
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6102
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6103 6103
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6104
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6104
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6105 6105
 			print '</form>';
6106 6106
 		} else {
6107 6107
 			if ($selected) {
6108
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6108
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6109 6109
 				$theuser = new User($this->db);
6110 6110
 				$theuser->fetch($selected);
6111 6111
 				print $theuser->getNomUrl(1);
@@ -6138,14 +6138,14 @@  discard block
 block discarded – undo
6138 6138
 
6139 6139
 		$out = '';
6140 6140
 		if ($htmlname != "none") {
6141
-			$out .= '<form method="POST" action="' . $page . '">';
6141
+			$out .= '<form method="POST" action="'.$page.'">';
6142 6142
 			$out .= '<input type="hidden" name="action" value="setmode">';
6143
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6143
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6144 6144
 			if ($type) {
6145
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6145
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6146 6146
 			}
6147 6147
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6148
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6148
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6149 6149
 			$out .= '</form>';
6150 6150
 		} else {
6151 6151
 			if ($selected) {
@@ -6178,11 +6178,11 @@  discard block
 block discarded – undo
6178 6178
 	{
6179 6179
 		global $langs;
6180 6180
 		if ($htmlname != "none") {
6181
-			print '<form method="POST" action="' . $page . '">';
6181
+			print '<form method="POST" action="'.$page.'">';
6182 6182
 			print '<input type="hidden" name="action" value="settransportmode">';
6183
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6183
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6184 6184
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6185
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6185
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6186 6186
 			print '</form>';
6187 6187
 		} else {
6188 6188
 			if ($selected) {
@@ -6209,14 +6209,14 @@  discard block
 block discarded – undo
6209 6209
 		// phpcs:enable
6210 6210
 		global $langs;
6211 6211
 		if ($htmlname != "none") {
6212
-			print '<form method="POST" action="' . $page . '">';
6212
+			print '<form method="POST" action="'.$page.'">';
6213 6213
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6214
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6214
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6215 6215
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6216
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6216
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6217 6217
 			print '</form>';
6218 6218
 		} else {
6219
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6219
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6220 6220
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6221 6221
 		}
6222 6222
 	}
@@ -6238,21 +6238,21 @@  discard block
 block discarded – undo
6238 6238
 		global $langs, $mysoc, $conf;
6239 6239
 
6240 6240
 		if ($htmlname != "none") {
6241
-			print '<form method="POST" action="' . $page . '">';
6241
+			print '<form method="POST" action="'.$page.'">';
6242 6242
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6243
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6244
-			print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6243
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6244
+			print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6245 6245
 			print '<select name="calculation_mode">';
6246
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6247
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6246
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6247
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6248 6248
 			print '</select> ';
6249
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6249
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6250 6250
 			print '</form>';
6251 6251
 		} else {
6252 6252
 			if (!empty($rate)) {
6253 6253
 				print price($rate, 1, $langs, 0, 0);
6254 6254
 				if ($currency && $rate != 1) {
6255
-					print ' &nbsp; (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
6255
+					print ' &nbsp; ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')';
6256 6256
 				}
6257 6257
 			} else {
6258 6258
 				print 1;
@@ -6283,9 +6283,9 @@  discard block
 block discarded – undo
6283 6283
 		// phpcs:enable
6284 6284
 		global $conf, $langs;
6285 6285
 		if ($htmlname != "none") {
6286
-			print '<form method="post" action="' . $page . '">';
6286
+			print '<form method="post" action="'.$page.'">';
6287 6287
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6288
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6288
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6289 6289
 			print '<div class="inline-block">';
6290 6290
 			if (!empty($discount_type)) {
6291 6291
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6323,24 +6323,24 @@  discard block
 block discarded – undo
6323 6323
 			print '</div>';
6324 6324
 			if (empty($hidelist)) {
6325 6325
 				print '<div class="inline-block" style="padding-right: 10px">';
6326
-				$newfilter = 'discount_type=' . intval($discount_type);
6326
+				$newfilter = 'discount_type='.intval($discount_type);
6327 6327
 				if (!empty($discount_type)) {
6328 6328
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6329 6329
 				} else {
6330 6330
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6331 6331
 				}
6332 6332
 				if ($filter) {
6333
-					$newfilter .= ' AND (' . $filter . ')';
6333
+					$newfilter .= ' AND ('.$filter.')';
6334 6334
 				}
6335 6335
 				// output the combo of discounts
6336 6336
 				$nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);
6337 6337
 				if ($nbqualifiedlines > 0) {
6338
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6338
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6339 6339
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6340
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6340
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6341 6341
 					}
6342 6342
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6343
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6343
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6344 6344
 					}
6345 6345
 
6346 6346
 					print '>';
@@ -6380,23 +6380,23 @@  discard block
 block discarded – undo
6380 6380
 		global $langs;
6381 6381
 
6382 6382
 		if ($htmlname != "none") {
6383
-			print '<form method="post" action="' . $page . '">';
6383
+			print '<form method="post" action="'.$page.'">';
6384 6384
 			print '<input type="hidden" name="action" value="set_contact">';
6385
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6385
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6386 6386
 			print '<table class="nobordernopadding">';
6387 6387
 			print '<tr><td>';
6388 6388
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6389 6389
 			$num = $this->num;
6390 6390
 			if ($num == 0) {
6391 6391
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6392
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6392
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6393 6393
 			}
6394 6394
 			print '</td>';
6395
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6395
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6396 6396
 			print '</tr></table></form>';
6397 6397
 		} else {
6398 6398
 			if ($selected) {
6399
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6399
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6400 6400
 				$contact = new Contact($this->db);
6401 6401
 				$contact->fetch($selected);
6402 6402
 				print $contact->getFullName($langs);
@@ -6431,20 +6431,20 @@  discard block
 block discarded – undo
6431 6431
 
6432 6432
 		$out = '';
6433 6433
 		if ($htmlname != "none") {
6434
-			$out .= '<form method="post" action="' . $page . '">';
6434
+			$out .= '<form method="post" action="'.$page.'">';
6435 6435
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6436
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6436
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6437 6437
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6438
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6438
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6439 6439
 			$out .= '</form>';
6440 6440
 		} else {
6441 6441
 			if ($selected) {
6442
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6442
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6443 6443
 				$soc = new Societe($this->db);
6444 6444
 				$soc->fetch($selected);
6445 6445
 				$out .= $soc->getNomUrl(0, '');
6446 6446
 			} else {
6447
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6447
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6448 6448
 			}
6449 6449
 		}
6450 6450
 
@@ -6494,22 +6494,22 @@  discard block
 block discarded – undo
6494 6494
 			$selected = 'EUR'; // Pour compatibilite
6495 6495
 		}
6496 6496
 
6497
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6497
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6498 6498
 		if ($useempty) {
6499 6499
 			$out .= '<option value="-1" selected></option>';
6500 6500
 		}
6501 6501
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6502 6502
 			$labeltoshow = $currency['label'];
6503 6503
 			if ($mode == 1) {
6504
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6504
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6505 6505
 			} else {
6506
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6506
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6507 6507
 			}
6508 6508
 
6509 6509
 			if ($selected && $selected == $code_iso) {
6510
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6510
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6511 6511
 			} else {
6512
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6512
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6513 6513
 			}
6514 6514
 			$out .= $labeltoshow;
6515 6515
 			$out .= '</option>';
@@ -6520,7 +6520,7 @@  discard block
 block discarded – undo
6520 6520
 		}
6521 6521
 
6522 6522
 		// Make select dynamic
6523
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6523
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6524 6524
 		$out .= ajax_combobox($htmlname);
6525 6525
 
6526 6526
 		return $out;
@@ -6546,10 +6546,10 @@  discard block
 block discarded – undo
6546 6546
 
6547 6547
 		$TCurrency = array();
6548 6548
 
6549
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6550
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6549
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6550
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6551 6551
 		if ($filter) {
6552
-			$sql .= " AND " . $filter;
6552
+			$sql .= " AND ".$filter;
6553 6553
 		}
6554 6554
 		$resql = $this->db->query($sql);
6555 6555
 		if ($resql) {
@@ -6559,7 +6559,7 @@  discard block
 block discarded – undo
6559 6559
 		}
6560 6560
 
6561 6561
 		$out = '';
6562
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6562
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6563 6563
 		if ($useempty) {
6564 6564
 			$out .= '<option value="">&nbsp;</option>';
6565 6565
 		}
@@ -6571,13 +6571,13 @@  discard block
 block discarded – undo
6571 6571
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6572 6572
 				if (isset($TCurrency[$code_iso])) {
6573 6573
 					if (!empty($selected) && $selected == $code_iso) {
6574
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6574
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6575 6575
 					} else {
6576
-						$out .= '<option value="' . $code_iso . '">';
6576
+						$out .= '<option value="'.$code_iso.'">';
6577 6577
 					}
6578 6578
 
6579 6579
 					$out .= $currency['label'];
6580
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6580
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6581 6581
 					$out .= '</option>';
6582 6582
 				}
6583 6583
 			}
@@ -6586,7 +6586,7 @@  discard block
 block discarded – undo
6586 6586
 		$out .= '</select>';
6587 6587
 
6588 6588
 		// Make select dynamic
6589
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6589
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6590 6590
 		$out .= ajax_combobox($htmlname);
6591 6591
 
6592 6592
 		return $out;
@@ -6617,7 +6617,7 @@  discard block
 block discarded – undo
6617 6617
 		$sql .= " WHERE t.fk_pays = c.rowid";
6618 6618
 		$sql .= " AND t.active > 0";
6619 6619
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6620
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6620
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6621 6621
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6622 6622
 
6623 6623
 		$resql = $this->db->query($sql);
@@ -6629,30 +6629,30 @@  discard block
 block discarded – undo
6629 6629
 
6630 6630
 					$tmparray = array();
6631 6631
 					$tmparray['rowid']			= $obj->rowid;
6632
-					$tmparray['type_vat']		= $obj->type_vat;
6633
-					$tmparray['code']			= $obj->code;
6632
+					$tmparray['type_vat'] = $obj->type_vat;
6633
+					$tmparray['code'] = $obj->code;
6634 6634
 					$tmparray['txtva']			= $obj->taux;
6635
-					$tmparray['nprtva']			= $obj->recuperableonly;
6635
+					$tmparray['nprtva'] = $obj->recuperableonly;
6636 6636
 					$tmparray['localtax1']	    = $obj->localtax1;
6637 6637
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6638 6638
 					$tmparray['localtax2']	    = $obj->localtax2;
6639 6639
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6640
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6641
-					$tmparray['labelallrates']	= $obj->taux . '/' . ($obj->localtax1 ? $obj->localtax1 : '0') . '/' . ($obj->localtax2 ? $obj->localtax2 : '0') . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6640
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6641
+					$tmparray['labelallrates']	= $obj->taux.'/'.($obj->localtax1 ? $obj->localtax1 : '0').'/'.($obj->localtax2 ? $obj->localtax2 : '0').($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6642 6642
 					$positiverates = '';
6643 6643
 					if ($obj->taux) {
6644
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6644
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6645 6645
 					}
6646 6646
 					if ($obj->localtax1) {
6647
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6647
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6648 6648
 					}
6649 6649
 					if ($obj->localtax2) {
6650
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6650
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6651 6651
 					}
6652 6652
 					if (empty($positiverates)) {
6653 6653
 						$positiverates = '0';
6654 6654
 					}
6655
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6655
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6656 6656
 
6657 6657
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6658 6658
 				}
@@ -6672,7 +6672,7 @@  discard block
 block discarded – undo
6672 6672
 				return -1;
6673 6673
 			}
6674 6674
 		} else {
6675
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6675
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6676 6676
 			return -2;
6677 6677
 		}
6678 6678
 	}
@@ -6725,9 +6725,9 @@  discard block
 block discarded – undo
6725 6725
 		// Check parameters
6726 6726
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6727 6727
 			if ($societe_vendeuse->id == $mysoc->id) {
6728
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6728
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6729 6729
 			} else {
6730
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6730
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6731 6731
 			}
6732 6732
 			return $return;
6733 6733
 		}
@@ -6739,12 +6739,12 @@  discard block
 block discarded – undo
6739 6739
 		// Define list of countries to use to search VAT rates to show
6740 6740
 		// First we defined code_country to use to find list
6741 6741
 		if (is_object($societe_vendeuse)) {
6742
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6742
+			$code_country = "'".$societe_vendeuse->country_code."'";
6743 6743
 		} else {
6744
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6744
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6745 6745
 		}
6746 6746
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6747
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6747
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6748 6748
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6749 6749
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6750 6750
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6754,27 +6754,27 @@  discard block
 block discarded – undo
6754 6754
 					if ($type == 1) { // We know product is a service
6755 6755
 						switch ($selectVatComboMode) {
6756 6756
 							case '1':
6757
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6757
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6758 6758
 								break;
6759 6759
 							case '2':
6760
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6760
+								$code_country = "'".$societe_acheteuse->country_code."'";
6761 6761
 								break;
6762 6762
 						}
6763 6763
 					}
6764 6764
 				} elseif (!$idprod) {  // We don't know type of product
6765 6765
 					switch ($selectVatComboMode) {
6766 6766
 						case '1':
6767
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6767
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6768 6768
 							break;
6769 6769
 						case '2':
6770
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6770
+							$code_country = "'".$societe_acheteuse->country_code."'";
6771 6771
 							break;
6772 6772
 					}
6773 6773
 				} else {
6774 6774
 					$prodstatic = new Product($this->db);
6775 6775
 					$prodstatic->fetch($idprod);
6776 6776
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6777
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6777
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6778 6778
 					}
6779 6779
 				}
6780 6780
 			}
@@ -6836,13 +6836,13 @@  discard block
 block discarded – undo
6836 6836
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
6837 6837
 				// of using supplier invoices (this is a very bad idea !)
6838 6838
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
6839
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
6839
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
6840 6840
 					$disabled = true;
6841 6841
 				}
6842 6842
 			}
6843 6843
 
6844 6844
 			if (!$options_only) {
6845
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
6845
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
6846 6846
 			}
6847 6847
 
6848 6848
 			$selectedfound = false;
@@ -6856,13 +6856,13 @@  discard block
 block discarded – undo
6856 6856
 				$key = $rate['txtva'];
6857 6857
 				$key .= $rate['nprtva'] ? '*' : '';
6858 6858
 				if ($mode > 0 && $rate['code']) {
6859
-					$key .= ' (' . $rate['code'] . ')';
6859
+					$key .= ' ('.$rate['code'].')';
6860 6860
 				}
6861 6861
 				if ($mode < 0) {
6862 6862
 					$key = $rate['rowid'];
6863 6863
 				}
6864 6864
 
6865
-				$return .= '<option value="' . $key . '"';
6865
+				$return .= '<option value="'.$key.'"';
6866 6866
 				if (!$selectedfound) {
6867 6867
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
6868 6868
 						if ($defaultcode == $rate['code']) {
@@ -6933,7 +6933,7 @@  discard block
 block discarded – undo
6933 6933
 	public function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = 0, $addplusone = '', $adddateof = '')
6934 6934
 	{
6935 6935
 		// phpcs:enable
6936
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6936
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
6937 6937
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
6938 6938
 		if (!empty($nooutput)) {
6939 6939
 			return $retstring;
@@ -6962,11 +6962,11 @@  discard block
 block discarded – undo
6962 6962
 	{
6963 6963
 		global $langs;
6964 6964
 
6965
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6965
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
6966 6966
 		if ($forcenewline) {
6967 6967
 			$ret .= '<br>';
6968 6968
 		}
6969
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6969
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
6970 6970
 		return $ret;
6971 6971
 	}
6972 6972
 
@@ -7032,7 +7032,7 @@  discard block
 block discarded – undo
7032 7032
 		$orig_set_time = $set_time;
7033 7033
 
7034 7034
 		if ($set_time === '' && $emptydate == 0) {
7035
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7035
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7036 7036
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7037 7037
 				$set_time = dol_now($gm);
7038 7038
 			} else {
@@ -7104,38 +7104,38 @@  discard block
 block discarded – undo
7104 7104
 				// Calendrier popup version eldy
7105 7105
 				if ($usecalendar == "eldy") {
7106 7106
 					// Input area to enter date manually
7107
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7107
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7108 7108
 					$retstring .= ($disabled ? ' disabled' : '');
7109
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7109
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7110 7110
 					$retstring .= ' autocomplete="off">';
7111 7111
 
7112 7112
 					// Icon calendar
7113 7113
 					$retstringbuttom = '';
7114 7114
 					if (!$disabled) {
7115
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7116
-						$base = DOL_URL_ROOT . '/core/';
7117
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7118
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7115
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7116
+						$base = DOL_URL_ROOT.'/core/';
7117
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7118
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7119 7119
 					} else {
7120
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7120
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7121 7121
 					}
7122
-					$retstring = $retstringbuttom . $retstring;
7122
+					$retstring = $retstringbuttom.$retstring;
7123 7123
 
7124
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7125
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7126
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7124
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7125
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7126
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7127 7127
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7128 7128
 					if (!$disabled && $usecalendar != 'html') {
7129 7129
 						// Output javascript for datepicker
7130 7130
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7131 7131
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7132 7132
 
7133
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7134
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7135
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7133
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7134
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7135
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7136 7136
 							autoclose: true,
7137 7137
 							todayHighlight: true,
7138
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7138
+							yearRange: '" . $minYear.":".$maxYear."',";
7139 7139
 						if (!empty($conf->dol_use_jmobile)) {
7140 7140
 							$retstring .= "
7141 7141
 								beforeShow: function (input, datePicker) {
@@ -7150,7 +7150,7 @@  discard block
 block discarded – undo
7150 7150
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7151 7151
 							$retstring .= "
7152 7152
 								showOn: 'button',	/* both has problem with autocompletion */
7153
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
7153
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
7154 7154
 								buttonImageOnly: true";
7155 7155
 						}
7156 7156
 						$retstring .= "
@@ -7162,46 +7162,46 @@  discard block
 block discarded – undo
7162 7162
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7163 7163
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7164 7164
 					$retstring .= ($disabled ? ' disabled' : '');
7165
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7166
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7165
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7166
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7167 7167
 					$retstring .= ' autocomplete="off">';
7168 7168
 
7169 7169
 					// Icone calendrier
7170 7170
 					if ($disabled) {
7171
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7172
-						$retstring = $retstringbutton . $retstring;
7171
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7172
+						$retstring = $retstringbutton.$retstring;
7173 7173
 					}
7174 7174
 
7175 7175
 					$retstring .= '</div>';
7176
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7177
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7178
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7176
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7177
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7178
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7179 7179
 				} else {
7180 7180
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7181 7181
 				}
7182 7182
 			} else {
7183 7183
 				// Show date with combo selects
7184 7184
 				// Day
7185
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7185
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7186 7186
 
7187 7187
 				if ($emptydate || $set_time == -1) {
7188 7188
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7189 7189
 				}
7190 7190
 
7191 7191
 				for ($day = 1; $day <= 31; $day++) {
7192
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7192
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7193 7193
 				}
7194 7194
 
7195 7195
 				$retstring .= "</select>";
7196 7196
 
7197
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7197
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7198 7198
 				if ($emptydate || $set_time == -1) {
7199 7199
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7200 7200
 				}
7201 7201
 
7202 7202
 				// Month
7203 7203
 				for ($month = 1; $month <= 12; $month++) {
7204
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7204
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7205 7205
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7206 7206
 					$retstring .= "</option>";
7207 7207
 				}
@@ -7209,13 +7209,13 @@  discard block
 block discarded – undo
7209 7209
 
7210 7210
 				// Year
7211 7211
 				if ($emptydate || $set_time == -1) {
7212
-					$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 . '">';
7212
+					$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.'">';
7213 7213
 				} else {
7214
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7214
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7215 7215
 
7216 7216
 					$syear = (int) $syear;
7217 7217
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7218
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7218
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7219 7219
 					}
7220 7220
 					$retstring .= "</select>\n";
7221 7221
 				}
@@ -7239,15 +7239,15 @@  discard block
 block discarded – undo
7239 7239
 				}
7240 7240
 			}
7241 7241
 			// Show hour
7242
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7242
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7243 7243
 			if ($emptyhours) {
7244 7244
 				$retstring .= '<option value="-1">&nbsp;</option>';
7245 7245
 			}
7246 7246
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7247 7247
 				if (strlen($hour) < 2) {
7248
-					$hour = "0" . $hour;
7248
+					$hour = "0".$hour;
7249 7249
 				}
7250
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7250
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7251 7251
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7252 7252
 				$retstring .= '</option>';
7253 7253
 			}
@@ -7260,17 +7260,17 @@  discard block
 block discarded – undo
7260 7260
 
7261 7261
 		if ($m) {
7262 7262
 			// Show minutes
7263
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7263
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7264 7264
 			if ($emptyhours) {
7265 7265
 				$retstring .= '<option value="-1">&nbsp;</option>';
7266 7266
 			}
7267 7267
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7268 7268
 				$min_str = sprintf("%02d", $min);
7269
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7269
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7270 7270
 			}
7271 7271
 			$retstring .= '</select>';
7272 7272
 
7273
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7273
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7274 7274
 		}
7275 7275
 
7276 7276
 		if ($d && $h) {
@@ -7293,10 +7293,10 @@  discard block
 block discarded – undo
7293 7293
 
7294 7294
 			// Generate the date part, depending on the use or not of the javascript calendar
7295 7295
 			if ($addnowlink == 1) { // server time expressed in user time setup
7296
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7297
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7298
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7299
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7296
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7297
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7298
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7299
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7300 7300
 			} elseif ($addnowlink == 2) {
7301 7301
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7302 7302
 				 * This break application for foreign languages.
@@ -7305,10 +7305,10 @@  discard block
 block discarded – undo
7305 7305
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7306 7306
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7307 7307
 				*/
7308
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7309
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7310
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7311
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7308
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7309
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7310
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7311
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7312 7312
 			}
7313 7313
 			/*if ($usecalendar == "eldy")
7314 7314
 			{
@@ -7328,11 +7328,11 @@  discard block
 block discarded – undo
7328 7328
 				}
7329 7329
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7330 7330
 				if ($addnowlink == 1) {
7331
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7332
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7331
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7332
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7333 7333
 				} elseif ($addnowlink == 2) {
7334
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7335
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7334
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7335
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7336 7336
 				}
7337 7337
 
7338 7338
 				if ($fullday) {
@@ -7346,11 +7346,11 @@  discard block
 block discarded – undo
7346 7346
 				}
7347 7347
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7348 7348
 				if ($addnowlink == 1) {
7349
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7350
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7349
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7350
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7351 7351
 				} elseif ($addnowlink == 2) {
7352
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7353
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7352
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7353
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7354 7354
 				}
7355 7355
 				if ($fullday) {
7356 7356
 					$reset_scripts .= ' } ';
@@ -7358,7 +7358,7 @@  discard block
 block discarded – undo
7358 7358
 			}
7359 7359
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7360 7360
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7361
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7361
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7362 7362
 				$retstring .= $langs->trans("Now");
7363 7363
 				$retstring .= '</button> ';
7364 7364
 			}
@@ -7370,16 +7370,16 @@  discard block
 block discarded – undo
7370 7370
 			$reset_scripts = "";
7371 7371
 
7372 7372
 			// Generate the date part, depending on the use or not of the javascript calendar
7373
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7374
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7375
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7376
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7373
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7374
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7375
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7376
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7377 7377
 			// Update the hour part
7378 7378
 			if ($h) {
7379 7379
 				if ($fullday) {
7380 7380
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7381 7381
 				}
7382
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7382
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7383 7383
 				if ($fullday) {
7384 7384
 					$reset_scripts .= ' } ';
7385 7385
 				}
@@ -7389,14 +7389,14 @@  discard block
 block discarded – undo
7389 7389
 				if ($fullday) {
7390 7390
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7391 7391
 				}
7392
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7392
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7393 7393
 				if ($fullday) {
7394 7394
 					$reset_scripts .= ' } ';
7395 7395
 				}
7396 7396
 			}
7397 7397
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7398 7398
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7399
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7399
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7400 7400
 				$retstring .= $langs->trans("DateStartPlusOne");
7401 7401
 				$retstring .= '</button> ';
7402 7402
 			}
@@ -7454,17 +7454,17 @@  discard block
 block discarded – undo
7454 7454
 			unset($TDurationTypes[$value]);
7455 7455
 		}
7456 7456
 
7457
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7457
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7458 7458
 		foreach ($TDurationTypes as $key => $typeduration) {
7459
-			$retstring .= '<option value="' . $key . '"';
7459
+			$retstring .= '<option value="'.$key.'"';
7460 7460
 			if ($key == $selected) {
7461 7461
 				$retstring .= " selected";
7462 7462
 			}
7463
-			$retstring .= ">" . $typeduration . "</option>";
7463
+			$retstring .= ">".$typeduration."</option>";
7464 7464
 		}
7465 7465
 		$retstring .= "</select>";
7466 7466
 
7467
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7467
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7468 7468
 
7469 7469
 		return $retstring;
7470 7470
 	}
@@ -7496,30 +7496,30 @@  discard block
 block discarded – undo
7496 7496
 
7497 7497
 		// Hours
7498 7498
 		if ($iSecond != '') {
7499
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7499
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7500 7500
 
7501 7501
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7502 7502
 			$minSelected = convertSecondToTime($iSecond, 'min');
7503 7503
 		}
7504 7504
 
7505 7505
 		if ($typehour == 'select') {
7506
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7506
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7507 7507
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7508
-				$retstring .= '<option value="' . $hour . '"';
7508
+				$retstring .= '<option value="'.$hour.'"';
7509 7509
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7510 7510
 					$retstring .= " selected";
7511 7511
 				}
7512
-				$retstring .= ">" . $hour . "</option>";
7512
+				$retstring .= ">".$hour."</option>";
7513 7513
 			}
7514 7514
 			$retstring .= "</select>";
7515 7515
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7516
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7516
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7517 7517
 		} else {
7518 7518
 			return 'BadValueForParameterTypeHour';
7519 7519
 		}
7520 7520
 
7521 7521
 		if ($typehour != 'text') {
7522
-			$retstring .= ' ' . $langs->trans('HourShort');
7522
+			$retstring .= ' '.$langs->trans('HourShort');
7523 7523
 		} else {
7524 7524
 			$retstring .= '<span class="">:</span>';
7525 7525
 		}
@@ -7534,21 +7534,21 @@  discard block
 block discarded – undo
7534 7534
 		}
7535 7535
 
7536 7536
 		if ($typehour == 'select' || $typehour == 'textselect') {
7537
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7537
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7538 7538
 			for ($min = 0; $min <= 55; $min += 5) {
7539
-				$retstring .= '<option value="' . $min . '"';
7539
+				$retstring .= '<option value="'.$min.'"';
7540 7540
 				if (is_numeric($minSelected) && $minSelected == $min) {
7541 7541
 					$retstring .= ' selected';
7542 7542
 				}
7543
-				$retstring .= '>' . $min . '</option>';
7543
+				$retstring .= '>'.$min.'</option>';
7544 7544
 			}
7545 7545
 			$retstring .= "</select>";
7546 7546
 		} elseif ($typehour == 'text') {
7547
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7547
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7548 7548
 		}
7549 7549
 
7550 7550
 		if ($typehour != 'text') {
7551
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7551
+			$retstring .= ' '.$langs->trans('MinuteShort');
7552 7552
 		}
7553 7553
 
7554 7554
 		$retstring .= "</span>";
@@ -7596,7 +7596,7 @@  discard block
 block discarded – undo
7596 7596
 			$placeholder = '';
7597 7597
 
7598 7598
 			if ($selected && empty($selected_input_value)) {
7599
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7599
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7600 7600
 				$tickettmpselect = new Ticket($this->db);
7601 7601
 				$tickettmpselect->fetch($selected);
7602 7602
 				$selected_input_value = $tickettmpselect->ref;
@@ -7604,17 +7604,17 @@  discard block
 block discarded – undo
7604 7604
 			}
7605 7605
 
7606 7606
 			$urloption = '';
7607
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7607
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7608 7608
 
7609 7609
 			if (empty($hidelabel)) {
7610
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7610
+				$out .= $langs->trans("RefOrLabel").' : ';
7611 7611
 			} elseif ($hidelabel > 1) {
7612
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7612
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7613 7613
 				if ($hidelabel == 2) {
7614 7614
 					$out .= img_picto($langs->trans("Search"), 'search');
7615 7615
 				}
7616 7616
 			}
7617
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7617
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7618 7618
 			if ($hidelabel == 3) {
7619 7619
 				$out .= img_picto($langs->trans("Search"), 'search');
7620 7620
 			}
@@ -7658,8 +7658,8 @@  discard block
 block discarded – undo
7658 7658
 
7659 7659
 		$sql = "SELECT ";
7660 7660
 		$sql .= $selectFields;
7661
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7662
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7661
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7662
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7663 7663
 
7664 7664
 		// Add criteria on ref/label
7665 7665
 		if ($filterkey != '') {
@@ -7675,7 +7675,7 @@  discard block
 block discarded – undo
7675 7675
 				if ($i > 0) {
7676 7676
 					$sql .= " AND ";
7677 7677
 				}
7678
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7678
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7679 7679
 				$sql .= ")";
7680 7680
 				$i++;
7681 7681
 			}
@@ -7688,22 +7688,22 @@  discard block
 block discarded – undo
7688 7688
 		$sql .= $this->db->plimit($limit, 0);
7689 7689
 
7690 7690
 		// Build output string
7691
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7691
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7692 7692
 		$result = $this->db->query($sql);
7693 7693
 		if ($result) {
7694
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7695
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7694
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7695
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7696 7696
 
7697 7697
 			$num = $this->db->num_rows($result);
7698 7698
 
7699 7699
 			$events = array();
7700 7700
 
7701 7701
 			if (!$forcecombo) {
7702
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7702
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7703 7703
 				$out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);
7704 7704
 			}
7705 7705
 
7706
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7706
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7707 7707
 
7708 7708
 			$textifempty = '';
7709 7709
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7720,7 +7720,7 @@  discard block
 block discarded – undo
7720 7720
 				}
7721 7721
 			}
7722 7722
 			if ($showempty) {
7723
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7723
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7724 7724
 			}
7725 7725
 
7726 7726
 			$i = 0;
@@ -7775,13 +7775,13 @@  discard block
 block discarded – undo
7775 7775
 		$outref = $objp->ref;
7776 7776
 		$outtype = $objp->fk_product_type;
7777 7777
 
7778
-		$opt = '<option value="' . $objp->rowid . '"';
7778
+		$opt = '<option value="'.$objp->rowid.'"';
7779 7779
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7780 7780
 		$opt .= '>';
7781 7781
 		$opt .= $objp->ref;
7782 7782
 		$objRef = $objp->ref;
7783 7783
 		if (!empty($filterkey) && $filterkey != '') {
7784
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7784
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7785 7785
 		}
7786 7786
 
7787 7787
 		$opt .= "</option>\n";
@@ -7822,7 +7822,7 @@  discard block
 block discarded – undo
7822 7822
 			$placeholder = '';
7823 7823
 
7824 7824
 			if ($selected && empty($selected_input_value)) {
7825
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7825
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7826 7826
 				$projecttmpselect = new Project($this->db);
7827 7827
 				$projecttmpselect->fetch($selected);
7828 7828
 				$selected_input_value = $projecttmpselect->ref;
@@ -7830,17 +7830,17 @@  discard block
 block discarded – undo
7830 7830
 			}
7831 7831
 
7832 7832
 			$urloption = '';
7833
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7833
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7834 7834
 
7835 7835
 			if (empty($hidelabel)) {
7836
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7836
+				$out .= $langs->trans("RefOrLabel").' : ';
7837 7837
 			} elseif ($hidelabel > 1) {
7838
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7838
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7839 7839
 				if ($hidelabel == 2) {
7840 7840
 					$out .= img_picto($langs->trans("Search"), 'search');
7841 7841
 				}
7842 7842
 			}
7843
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7843
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7844 7844
 			if ($hidelabel == 3) {
7845 7845
 				$out .= img_picto($langs->trans("Search"), 'search');
7846 7846
 			}
@@ -7883,8 +7883,8 @@  discard block
 block discarded – undo
7883 7883
 
7884 7884
 		$sql = "SELECT ";
7885 7885
 		$sql .= $selectFields;
7886
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
7887
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
7886
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
7887
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
7888 7888
 
7889 7889
 		// Add criteria on ref/label
7890 7890
 		if ($filterkey != '') {
@@ -7900,7 +7900,7 @@  discard block
 block discarded – undo
7900 7900
 				if ($i > 0) {
7901 7901
 					$sql .= " AND ";
7902 7902
 				}
7903
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7903
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
7904 7904
 				$sql .= "";
7905 7905
 				$i++;
7906 7906
 			}
@@ -7913,22 +7913,22 @@  discard block
 block discarded – undo
7913 7913
 		$sql .= $this->db->plimit($limit, 0);
7914 7914
 
7915 7915
 		// Build output string
7916
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
7916
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
7917 7917
 		$result = $this->db->query($sql);
7918 7918
 		if ($result) {
7919
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7920
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
7919
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7920
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
7921 7921
 
7922 7922
 			$num = $this->db->num_rows($result);
7923 7923
 
7924 7924
 			$events = array();
7925 7925
 
7926 7926
 			if (!$forcecombo) {
7927
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7927
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7928 7928
 				$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
7929 7929
 			}
7930 7930
 
7931
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7931
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7932 7932
 
7933 7933
 			$textifempty = '';
7934 7934
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
 				}
7946 7946
 			}
7947 7947
 			if ($showempty) {
7948
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7948
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7949 7949
 			}
7950 7950
 
7951 7951
 			$i = 0;
@@ -8003,13 +8003,13 @@  discard block
 block discarded – undo
8003 8003
 		$outlabel = $objp->label;
8004 8004
 		$outtype = $objp->fk_product_type;
8005 8005
 
8006
-		$opt = '<option value="' . $objp->rowid . '"';
8006
+		$opt = '<option value="'.$objp->rowid.'"';
8007 8007
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8008 8008
 		$opt .= '>';
8009 8009
 		$opt .= $objp->ref;
8010 8010
 		$objRef = $objp->ref;
8011 8011
 		if (!empty($filterkey) && $filterkey != '') {
8012
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
8012
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
8013 8013
 		}
8014 8014
 
8015 8015
 		$opt .= "</option>\n";
@@ -8051,7 +8051,7 @@  discard block
 block discarded – undo
8051 8051
 			$placeholder = '';
8052 8052
 
8053 8053
 			if ($selected && empty($selected_input_value)) {
8054
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8054
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8055 8055
 				$adherenttmpselect = new Adherent($this->db);
8056 8056
 				$adherenttmpselect->fetch($selected);
8057 8057
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8060,17 +8060,17 @@  discard block
 block discarded – undo
8060 8060
 
8061 8061
 			$urloption = '';
8062 8062
 
8063
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8063
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8064 8064
 
8065 8065
 			if (empty($hidelabel)) {
8066
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8066
+				$out .= $langs->trans("RefOrLabel").' : ';
8067 8067
 			} elseif ($hidelabel > 1) {
8068
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8068
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8069 8069
 				if ($hidelabel == 2) {
8070 8070
 					$out .= img_picto($langs->trans("Search"), 'search');
8071 8071
 				}
8072 8072
 			}
8073
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8073
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8074 8074
 			if ($hidelabel == 3) {
8075 8075
 				$out .= img_picto($langs->trans("Search"), 'search');
8076 8076
 			}
@@ -8115,8 +8115,8 @@  discard block
 block discarded – undo
8115 8115
 
8116 8116
 		$sql = "SELECT ";
8117 8117
 		$sql .= $selectFields;
8118
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8119
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8118
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8119
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8120 8120
 
8121 8121
 		// Add criteria on ref/label
8122 8122
 		if ($filterkey != '') {
@@ -8132,8 +8132,8 @@  discard block
 block discarded – undo
8132 8132
 				if ($i > 0) {
8133 8133
 					$sql .= " AND ";
8134 8134
 				}
8135
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8136
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8135
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8136
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8137 8137
 				$i++;
8138 8138
 			}
8139 8139
 			if (count($search_crit) > 1) {
@@ -8142,27 +8142,27 @@  discard block
 block discarded – undo
8142 8142
 			$sql .= ')';
8143 8143
 		}
8144 8144
 		if ($status != -1) {
8145
-			$sql .= ' AND statut = ' . ((int) $status);
8145
+			$sql .= ' AND statut = '.((int) $status);
8146 8146
 		}
8147 8147
 		$sql .= $this->db->plimit($limit, 0);
8148 8148
 
8149 8149
 		// Build output string
8150
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8150
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8151 8151
 		$result = $this->db->query($sql);
8152 8152
 		if ($result) {
8153
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8154
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8153
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8154
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8155 8155
 
8156 8156
 			$num = $this->db->num_rows($result);
8157 8157
 
8158 8158
 			$events = array();
8159 8159
 
8160 8160
 			if (!$forcecombo) {
8161
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8161
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8162 8162
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8163 8163
 			}
8164 8164
 
8165
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8165
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8166 8166
 
8167 8167
 			$textifempty = '';
8168 8168
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8179,7 +8179,7 @@  discard block
 block discarded – undo
8179 8179
 				}
8180 8180
 			}
8181 8181
 			if ($showempty) {
8182
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8182
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8183 8183
 			}
8184 8184
 
8185 8185
 			$i = 0;
@@ -8235,11 +8235,11 @@  discard block
 block discarded – undo
8235 8235
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8236 8236
 		$outtype = $objp->fk_adherent_type;
8237 8237
 
8238
-		$opt = '<option value="' . $objp->rowid . '"';
8238
+		$opt = '<option value="'.$objp->rowid.'"';
8239 8239
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8240 8240
 		$opt .= '>';
8241 8241
 		if (!empty($filterkey) && $filterkey != '') {
8242
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8242
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8243 8243
 		}
8244 8244
 		$opt .= $outlabel;
8245 8245
 		$opt .= "</option>\n";
@@ -8277,8 +8277,8 @@  discard block
 block discarded – undo
8277 8277
 		$objecttmp = null;
8278 8278
 		$InfoFieldList = array();
8279 8279
 		$classname = '';
8280
-		$filter = '';  // Ensure filter has value (for static analysis)
8281
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8280
+		$filter = ''; // Ensure filter has value (for static analysis)
8281
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8282 8282
 
8283 8283
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8284 8284
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8322,9 +8322,9 @@  discard block
 block discarded – undo
8322 8322
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8323 8323
 			$reg = array();
8324 8324
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8325
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8325
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8326 8326
 			}
8327
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8327
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8328 8328
 
8329 8329
 			$classname = $InfoFieldList[0];
8330 8330
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8355,8 +8355,8 @@  discard block
 block discarded – undo
8355 8355
 		);
8356 8356
 
8357 8357
 		if (!is_object($objecttmp)) {
8358
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8359
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8358
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8359
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8360 8360
 		}
8361 8361
 		'@phan-var-force CommonObject $objecttmp';
8362 8362
 
@@ -8368,9 +8368,9 @@  discard block
 block discarded – undo
8368 8368
 		if ($prefixforautocompletemode == 'product') {
8369 8369
 			$prefixforautocompletemode = 'produit';
8370 8370
 		}
8371
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8371
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8372 8372
 
8373
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8373
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8374 8374
 
8375 8375
 		// Generate the combo HTML component
8376 8376
 		$out = '';
@@ -8399,13 +8399,13 @@  discard block
 block discarded – undo
8399 8399
 			}
8400 8400
 
8401 8401
 			// Set url and param to call to get json of the search results
8402
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8403
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8402
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8403
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8404 8404
 
8405 8405
 			// Activate the auto complete using ajax call.
8406 8406
 			$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);
8407 8407
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8408
-			$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) . '"' : '') . ' />';
8408
+			$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).'"' : '').' />';
8409 8409
 		} else {
8410 8410
 			// Immediate load of table record.
8411 8411
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8445,16 +8445,16 @@  discard block
 block discarded – undo
8445 8445
 		if ($prefixforautocompletemode == 'societe') {
8446 8446
 			$prefixforautocompletemode = 'company';
8447 8447
 		}
8448
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8448
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8449 8449
 
8450 8450
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8451 8451
 			$tmpfieldstoshow = '';
8452 8452
 			foreach ($objecttmp->fields as $key => $val) {
8453
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8453
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8454 8454
 					continue;
8455 8455
 				}
8456 8456
 				if (!empty($val['showoncombobox'])) {
8457
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8457
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8458 8458
 				}
8459 8459
 			}
8460 8460
 			if ($tmpfieldstoshow) {
@@ -8482,18 +8482,18 @@  discard block
 block discarded – undo
8482 8482
 		$num = 0;
8483 8483
 
8484 8484
 		// Search data
8485
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";
8485
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";
8486 8486
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8487
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";
8487
+			$sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";
8488 8488
 		}
8489 8489
 		if (isset($objecttmp->ismultientitymanaged)) {
8490 8490
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8491 8491
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8492
-				$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];
8492
+				$sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];
8493 8493
 			}
8494 8494
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8495 8495
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8496
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8496
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8497 8497
 				}
8498 8498
 			}
8499 8499
 		}
@@ -8513,21 +8513,21 @@  discard block
 block discarded – undo
8513 8513
 			$sql .= " WHERE 1=1";
8514 8514
 			if (isset($objecttmp->ismultientitymanaged)) {
8515 8515
 				if ($objecttmp->ismultientitymanaged == 1) {
8516
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8516
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8517 8517
 				}
8518 8518
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8519
-					$sql .= " AND parenttable.entity = t." . $tmparray[0];
8519
+					$sql .= " AND parenttable.entity = t.".$tmparray[0];
8520 8520
 				}
8521 8521
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8522 8522
 					if ($objecttmp->element == 'societe') {
8523
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8523
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8524 8524
 					} else {
8525
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8525
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8526 8526
 					}
8527 8527
 				}
8528 8528
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8529 8529
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8530
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8530
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8531 8531
 					}
8532 8532
 				}
8533 8533
 			}
@@ -8539,7 +8539,7 @@  discard block
 block discarded – undo
8539 8539
 				$errormessage = '';
8540 8540
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8541 8541
 				if ($errormessage) {
8542
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8542
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8543 8543
 				}
8544 8544
 			}
8545 8545
 		}
@@ -8551,7 +8551,7 @@  discard block
 block discarded – undo
8551 8551
 		$resql = $this->db->query($sql);
8552 8552
 		if ($resql) {
8553 8553
 			// Construct $out and $outarray
8554
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8554
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8555 8555
 
8556 8556
 			// 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
8557 8557
 			$textifempty = '&nbsp;';
@@ -8565,7 +8565,7 @@  discard block
 block discarded – undo
8565 8565
 				}
8566 8566
 			}
8567 8567
 			if ($showempty) {
8568
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8568
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8569 8569
 			}
8570 8570
 
8571 8571
 			$num = $this->db->num_rows($resql);
@@ -8588,9 +8588,9 @@  discard block
 block discarded – undo
8588 8588
 					}
8589 8589
 					if (empty($outputmode)) {
8590 8590
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8591
-							$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>';
8591
+							$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>';
8592 8592
 						} else {
8593
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8593
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8594 8594
 						}
8595 8595
 					} else {
8596 8596
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8603,10 +8603,10 @@  discard block
 block discarded – undo
8603 8603
 				}
8604 8604
 			}
8605 8605
 
8606
-			$out .= '</select>' . "\n";
8606
+			$out .= '</select>'."\n";
8607 8607
 
8608 8608
 			if (!$forcecombo) {
8609
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8609
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8610 8610
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8611 8611
 			}
8612 8612
 		} else {
@@ -8670,8 +8670,8 @@  discard block
 block discarded – undo
8670 8670
 			}
8671 8671
 		}
8672 8672
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8673
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8674
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8673
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8674
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8675 8675
 		$out .= '>'."\n";
8676 8676
 
8677 8677
 		if ($show_empty) {
@@ -8682,7 +8682,7 @@  discard block
 block discarded – undo
8682 8682
 			if (!is_numeric($show_empty)) {
8683 8683
 				$textforempty = $show_empty;
8684 8684
 			}
8685
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8685
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8686 8686
 		}
8687 8687
 		if (is_array($array)) {
8688 8688
 			// Translate
@@ -8707,7 +8707,7 @@  discard block
 block discarded – undo
8707 8707
 					$value = $tmpvalue['label'];
8708 8708
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8709 8709
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8710
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8710
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8711 8711
 				} else {
8712 8712
 					$value = $tmpvalue;
8713 8713
 					//$valuehtml = $tmpvalue;
@@ -8723,9 +8723,9 @@  discard block
 block discarded – undo
8723 8723
 				}
8724 8724
 				if ($key_in_label) {
8725 8725
 					if (empty($nohtmlescape)) {
8726
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8726
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8727 8727
 					} else {
8728
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8728
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8729 8729
 					}
8730 8730
 				} else {
8731 8731
 					if (empty($nohtmlescape)) {
@@ -8737,8 +8737,8 @@  discard block
 block discarded – undo
8737 8737
 						$selectOptionValue = '&nbsp;';
8738 8738
 					}
8739 8739
 				}
8740
-				$out .= '<option value="' . $key . '"';
8741
-				$out .= $style . $disabled;
8740
+				$out .= '<option value="'.$key.'"';
8741
+				$out .= $style.$disabled;
8742 8742
 				if (is_array($id)) {
8743 8743
 					if (in_array($key, $id) && !$disabled) {
8744 8744
 						$out .= ' selected'; // To preselect a value
@@ -8750,7 +8750,7 @@  discard block
 block discarded – undo
8750 8750
 					}
8751 8751
 				}
8752 8752
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8753
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8753
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8754 8754
 				}
8755 8755
 
8756 8756
 				if (is_array($tmpvalue)) {
@@ -8770,7 +8770,7 @@  discard block
 block discarded – undo
8770 8770
 		// Add code for jquery to use multiselect
8771 8771
 		if ($addjscombo && $jsbeautify) {
8772 8772
 			// Enhance with select2
8773
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8773
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8774 8774
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
8775 8775
 		}
8776 8776
 
@@ -8798,28 +8798,28 @@  discard block
 block discarded – undo
8798 8798
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8799 8799
 	{
8800 8800
 		global $conf, $langs;
8801
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8801
+		global $delayedhtmlcontent; // Will be used later outside of this function
8802 8802
 
8803 8803
 		// TODO Use an internal dolibarr component instead of select2
8804 8804
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8805 8805
 			return '';
8806 8806
 		}
8807 8807
 
8808
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
8808
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
8809 8809
 
8810 8810
 		$outdelayed = '';
8811 8811
 		if (!empty($conf->use_javascript_ajax)) {
8812 8812
 			$tmpplugin = 'select2';
8813
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8814
-		    	<script nonce="' . getNonce() . '">
8813
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8814
+		    	<script nonce="' . getNonce().'">
8815 8815
 		    	$(document).ready(function () {
8816 8816
 
8817
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
8817
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
8818 8818
 
8819
-	                $(".' . $htmlname . '").select2({
8819
+	                $(".' . $htmlname.'").select2({
8820 8820
 				    	ajax: {
8821 8821
 					    	dir: "ltr",
8822
-					    	url: "' . $url . '",
8822
+					    	url: "' . $url.'",
8823 8823
 					    	dataType: \'json\',
8824 8824
 					    	delay: 250,
8825 8825
 					    	data: function (params) {
@@ -8846,9 +8846,9 @@  discard block
 block discarded – undo
8846 8846
 				    	},
8847 8847
 		 				language: select2arrayoflanguage,
8848 8848
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8849
-					    placeholder: "' . dol_escape_js($placeholder) . '",
8849
+					    placeholder: "' . dol_escape_js($placeholder).'",
8850 8850
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8851
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
8851
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
8852 8852
 				        formatResult: function (result, container, query, escapeMarkup) {
8853 8853
 	                        return escapeMarkup(result.text);
8854 8854
 	                    },
@@ -8856,10 +8856,10 @@  discard block
 block discarded – undo
8856 8856
 
8857 8857
 	                ' . ($callurlonselect ? '
8858 8858
 	                /* Code to execute a GET when we select a value */
8859
-	                $(".' . $htmlname . '").change(function() {
8860
-				    	var selected = $(".' . $htmlname . '").val();
8859
+	                $(".' . $htmlname.'").change(function() {
8860
+				    	var selected = $(".' . $htmlname.'").val();
8861 8861
 	                	console.log("We select in selectArrayAjax the entry "+selected)
8862
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
8862
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
8863 8863
 	    			    $.each( saveRemoteData, function( key, value ) {
8864 8864
 	    				        if (key == selected)
8865 8865
 	    			            {
@@ -8867,7 +8867,7 @@  discard block
 block discarded – undo
8867 8867
 	    			                 location.assign(value.url);
8868 8868
 	    			            }
8869 8869
 	                    });
8870
-	    			});' : '') . '
8870
+	    			});' : '').'
8871 8871
 
8872 8872
 	    	   });
8873 8873
 		       </script>';
@@ -8903,14 +8903,14 @@  discard block
 block discarded – undo
8903 8903
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
8904 8904
 	{
8905 8905
 		global $conf, $langs;
8906
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8906
+		global $delayedhtmlcontent; // Will be used later outside of this function
8907 8907
 
8908 8908
 		// TODO Use an internal dolibarr component instead of select2
8909 8909
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8910 8910
 			return '';
8911 8911
 		}
8912 8912
 
8913
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8913
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
8914 8914
 
8915 8915
 		$formattedarrayresult = array();
8916 8916
 
@@ -8925,20 +8925,20 @@  discard block
 block discarded – undo
8925 8925
 		$outdelayed = '';
8926 8926
 		if (!empty($conf->use_javascript_ajax)) {
8927 8927
 			$tmpplugin = 'select2';
8928
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8929
-				<script nonce="' . getNonce() . '">
8928
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8929
+				<script nonce="' . getNonce().'">
8930 8930
 				$(document).ready(function () {
8931
-					var data = ' . json_encode($formattedarrayresult) . ';
8931
+					var data = ' . json_encode($formattedarrayresult).';
8932 8932
 
8933
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
8933
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
8934 8934
 
8935
-					$(".' . $htmlname . '").select2({
8935
+					$(".' . $htmlname.'").select2({
8936 8936
 						data: data,
8937 8937
 						language: select2arrayoflanguage,
8938 8938
 						containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */
8939
-						placeholder: "' . dol_escape_js($placeholder) . '",
8939
+						placeholder: "' . dol_escape_js($placeholder).'",
8940 8940
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
8941
-						minimumInputLength: ' . $minimumInputLength . ',
8941
+						minimumInputLength: ' . $minimumInputLength.',
8942 8942
 						formatResult: function (result, container, query, escapeMarkup) {
8943 8943
 							return escapeMarkup(result.text);
8944 8944
 						},
@@ -8977,11 +8977,11 @@  discard block
 block discarded – undo
8977 8977
 
8978 8978
 					' . ($callurlonselect ? '
8979 8979
 					/* Code to execute a GET when we select a value */
8980
-					$(".' . $htmlname . '").change(function() {
8981
-						var selected = $(".' . $htmlname . '").val();
8980
+					$(".' . $htmlname.'").change(function() {
8981
+						var selected = $(".' . $htmlname.'").val();
8982 8982
 						console.log("We select "+selected)
8983 8983
 
8984
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
8984
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
8985 8985
 						$.each( saveRemoteData, function( key, value ) {
8986 8986
 							if (key == selected)
8987 8987
 							{
@@ -8989,7 +8989,7 @@  discard block
 block discarded – undo
8989 8989
 								location.assign(value.url);
8990 8990
 							}
8991 8991
 						});
8992
-					});' : '') . '
8992
+					});' : '').'
8993 8993
 
8994 8994
 				});
8995 8995
 				</script>';
@@ -9038,7 +9038,7 @@  discard block
 block discarded – undo
9038 9038
 		$useenhancedmultiselect = 0;
9039 9039
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9040 9040
 			if ($addjscombo) {
9041
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9041
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9042 9042
 			}
9043 9043
 		}
9044 9044
 
@@ -9047,7 +9047,7 @@  discard block
 block discarded – undo
9047 9047
 		// submitted to nothing.
9048 9048
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9049 9049
 		// Output select component
9050
-		$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', (string) $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
9050
+		$out .= '<select id="'.$htmlname.'" class="multiselect'.($useenhancedmultiselect ? ' multiselectononeline' : '').($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', (string) $width) ? $width : $width.'px').'"' : '').'>'."\n";
9051 9051
 		if (is_array($array) && !empty($array)) {
9052 9052
 			if ($value_as_key) {
9053 9053
 				$array = array_combine($array, $array);
@@ -9065,36 +9065,36 @@  discard block
 block discarded – undo
9065 9065
 						$tmpvalue = empty($value['label']) ? '' : $value['label'];
9066 9066
 						$tmpcolor = empty($value['color']) ? '' : $value['color'];
9067 9067
 						$tmppicto = empty($value['picto']) ? '' : $value['picto'];
9068
-						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']): $value['labelhtml'];
9068
+						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9069 9069
 					}
9070 9070
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9071
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9071
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9072 9072
 
9073
-					$out .= '<option value="' . $tmpkey . '"';
9073
+					$out .= '<option value="'.$tmpkey.'"';
9074 9074
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9075 9075
 						$out .= ' selected';
9076 9076
 					}
9077 9077
 					if (!empty($tmplabelhtml)) {
9078
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9078
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9079 9079
 					} else {
9080
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9081
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9080
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9081
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9082 9082
 					}
9083 9083
 					$out .= '>';
9084 9084
 					$out .= dol_htmlentitiesbr($newval);
9085
-					$out .= '</option>' . "\n";
9085
+					$out .= '</option>'."\n";
9086 9086
 				}
9087 9087
 			}
9088 9088
 		}
9089
-		$out .= '</select>' . "\n";
9089
+		$out .= '</select>'."\n";
9090 9090
 
9091 9091
 		// Add code for jquery to use multiselect
9092 9092
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9093
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9094
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9093
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9094
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9095 9095
 			if ($addjscombo == 1) {
9096 9096
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9097
-				$out .= 'function formatResult(record, container) {' . "\n";
9097
+				$out .= 'function formatResult(record, container) {'."\n";
9098 9098
 				// If property data-html set, we decode html entities and use this.
9099 9099
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9100 9100
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9102,26 +9102,26 @@  discard block
 block discarded – undo
9102 9102
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9103 9103
 				$out .= '	}'."\n";
9104 9104
 				$out .= '	return record.text;';
9105
-				$out .= '}' . "\n";
9106
-				$out .= 'function formatSelection(record) {' . "\n";
9105
+				$out .= '}'."\n";
9106
+				$out .= 'function formatSelection(record) {'."\n";
9107 9107
 				if ($elemtype == 'category') {
9108
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9108
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9109 9109
 				} else {
9110 9110
 					$out .= 'return record.text;';
9111 9111
 				}
9112
-				$out .= '}' . "\n";
9112
+				$out .= '}'."\n";
9113 9113
 				$out .= '$(document).ready(function () {
9114
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9114
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9115 9115
 				if ($placeholder) {
9116 9116
 					$out .= '
9117 9117
 								placeholder: {
9118 9118
 								    id: \'-1\',
9119
-								    text: \'' . dol_escape_js($placeholder) . '\'
9119
+								    text: \'' . dol_escape_js($placeholder).'\'
9120 9120
 								  },';
9121 9121
 				}
9122 9122
 				$out .= '		dir: \'ltr\',
9123 9123
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9124
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9124
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9125 9125
 								// Specify format function for dropdown item
9126 9126
 								formatResult: formatResult,
9127 9127
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9133,21 +9133,21 @@  discard block
 block discarded – undo
9133 9133
 
9134 9134
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9135 9135
 								 the size only if component is not hidden by default on load */
9136
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9136
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9137 9137
 						});' . "\n";
9138 9138
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9139 9139
 				// Add other js lib
9140 9140
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9141 9141
 				// ...
9142
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9142
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9143 9143
 				$out .= '$(document).ready(function () {
9144
-							$(\'#' . $htmlname . '\').multiSelect({
9144
+							$(\'#' . $htmlname.'\').multiSelect({
9145 9145
 								containerHTML: \'<div class="multi-select-container">\',
9146 9146
 								menuHTML: \'<div class="multi-select-menu">\',
9147
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9147
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9148 9148
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9149 9149
 								activeClass: \'multi-select-container--open\',
9150
-								noneText: \'' . $placeholder . '\'
9150
+								noneText: \'' . $placeholder.'\'
9151 9151
 							});
9152 9152
 						})';
9153 9153
 			}
@@ -9180,7 +9180,7 @@  discard block
 block discarded – undo
9180 9180
 			return '';
9181 9181
 		}
9182 9182
 
9183
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9183
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9184 9184
 
9185 9185
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9186 9186
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9223,19 +9223,19 @@  discard block
 block discarded – undo
9223 9223
 				}
9224 9224
 
9225 9225
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9226
-				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
9227
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9226
+				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
9227
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9228 9228
 			}
9229 9229
 		}
9230 9230
 
9231
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9231
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9232 9232
 
9233 9233
         <dl class="dropdown">
9234 9234
             <dt>
9235
-            <a href="#' . $htmlname . '">
9236
-              ' . img_picto('', 'list') . '
9235
+            <a href="#' . $htmlname.'">
9236
+              ' . img_picto('', 'list').'
9237 9237
             </a>
9238
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9238
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9239 9239
             </dt>
9240 9240
             <dd class="dropdowndd">
9241 9241
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9247,19 +9247,19 @@  discard block
 block discarded – undo
9247 9247
             </dd>
9248 9248
         </dl>
9249 9249
 
9250
-        <script nonce="' . getNonce() . '" type="text/javascript">
9250
+        <script nonce="' . getNonce().'" type="text/javascript">
9251 9251
           jQuery(document).ready(function () {
9252
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9252
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9253 9253
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9254 9254
 
9255 9255
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9256 9256
 
9257 9257
                   var title = $(this).val() + ",";
9258 9258
                   if ($(this).is(\':checked\')) {
9259
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9259
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9260 9260
                   }
9261 9261
                   else {
9262
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9262
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9263 9263
                   }
9264 9264
                   // Now, we submit page
9265 9265
                   //$(this).parents(\'form:first\').submit();
@@ -9290,7 +9290,7 @@  discard block
 block discarded – undo
9290 9290
 	 */
9291 9291
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9292 9292
 	{
9293
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9293
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9294 9294
 
9295 9295
 		$cat = new Categorie($this->db);
9296 9296
 		$categories = $cat->containing($id, $type);
@@ -9300,10 +9300,10 @@  discard block
 block discarded – undo
9300 9300
 			foreach ($categories as $c) {
9301 9301
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9302 9302
 				foreach ($ways as $way) {
9303
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9303
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9304 9304
 				}
9305 9305
 			}
9306
-			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9306
+			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9307 9307
 		}
9308 9308
 
9309 9309
 		if ($rendermode == 0) {
@@ -9351,15 +9351,15 @@  discard block
 block discarded – undo
9351 9351
 
9352 9352
 
9353 9353
 			print '<div class="div-table-responsive-no-min">';
9354
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9354
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9355 9355
 
9356 9356
 			print '<tr class="liste_titre">';
9357
-			print '<td>' . $langs->trans("Type") . '</td>';
9358
-			print '<td>' . $langs->trans("Ref") . '</td>';
9357
+			print '<td>'.$langs->trans("Type").'</td>';
9358
+			print '<td>'.$langs->trans("Ref").'</td>';
9359 9359
 			print '<td class="center"></td>';
9360
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9361
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9362
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9360
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9361
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9362
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9363 9363
 			print '<td></td>';
9364 9364
 			print '</tr>';
9365 9365
 
@@ -9378,13 +9378,13 @@  discard block
 block discarded – undo
9378 9378
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9379 9379
 					$element = $regs[1];
9380 9380
 					$subelement = $regs[2];
9381
-					$tplpath = $element . '/' . $subelement;
9381
+					$tplpath = $element.'/'.$subelement;
9382 9382
 				}
9383 9383
 				$tplname = 'linkedobjectblock';
9384 9384
 
9385 9385
 				// To work with non standard path
9386 9386
 				if ($objecttype == 'facture') {
9387
-					$tplpath = 'compta/' . $element;
9387
+					$tplpath = 'compta/'.$element;
9388 9388
 					if (!isModEnabled('invoice')) {
9389 9389
 						continue; // Do not show if module disabled
9390 9390
 					}
@@ -9395,7 +9395,7 @@  discard block
 block discarded – undo
9395 9395
 						continue; // Do not show if module disabled
9396 9396
 					}
9397 9397
 				} elseif ($objecttype == 'propal') {
9398
-					$tplpath = 'comm/' . $element;
9398
+					$tplpath = 'comm/'.$element;
9399 9399
 					if (!isModEnabled('propal')) {
9400 9400
 						continue; // Do not show if module disabled
9401 9401
 					}
@@ -9446,7 +9446,7 @@  discard block
 block discarded – undo
9446 9446
 				$linkedObjectBlock = $objects;
9447 9447
 
9448 9448
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9449
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9449
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9450 9450
 				foreach ($dirtpls as $reldir) {
9451 9451
 					$reldir = rtrim($reldir, '/');
9452 9452
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9454,7 +9454,7 @@  discard block
 block discarded – undo
9454 9454
 						$noMoreLinkedObjectBlockAfter = 1;
9455 9455
 					}
9456 9456
 
9457
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9457
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9458 9458
 					if ($res) {
9459 9459
 						$nboftypesoutput++;
9460 9460
 						break;
@@ -9463,7 +9463,7 @@  discard block
 block discarded – undo
9463 9463
 			}
9464 9464
 
9465 9465
 			if (!$nboftypesoutput) {
9466
-				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9466
+				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9467 9467
 			}
9468 9468
 
9469 9469
 			print '</table>';
@@ -9503,14 +9503,14 @@  discard block
 block discarded – undo
9503 9503
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9504 9504
 			$listofidcompanytoscan = $object->thirdparty->id;
9505 9505
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9506
-				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
9506
+				$listofidcompanytoscan .= ','.$object->thirdparty->parent;
9507 9507
 			}
9508 9508
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9509
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9509
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9510 9510
 				$tmpproject = new Project($this->db);
9511 9511
 				$tmpproject->fetch($object->fk_project);
9512 9512
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9513
-					$listofidcompanytoscan .= ',' . $tmpproject->socid;
9513
+					$listofidcompanytoscan .= ','.$tmpproject->socid;
9514 9514
 				}
9515 9515
 				unset($tmpproject);
9516 9516
 			}
@@ -9520,63 +9520,63 @@  discard block
 block discarded – undo
9520 9520
 					'enabled' => isModEnabled('propal'),
9521 9521
 					'perms' => 1,
9522 9522
 					'label' => 'LinkToProposal',
9523
-					'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') . ')'),
9523
+					'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').')'),
9524 9524
 				'shipping' => array(
9525 9525
 					'enabled' => isModEnabled('shipping'),
9526 9526
 					'perms' => 1,
9527 9527
 					'label' => 'LinkToExpedition',
9528
-					'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') . ')'),
9528
+					'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').')'),
9529 9529
 				'order' => array(
9530 9530
 					'enabled' => isModEnabled('order'),
9531 9531
 					'perms' => 1,
9532 9532
 					'label' => 'LinkToOrder',
9533
-					'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') . ')'),
9533
+					'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').')'),
9534 9534
 				'invoice' => array(
9535 9535
 					'enabled' => isModEnabled('invoice'),
9536 9536
 					'perms' => 1,
9537 9537
 					'label' => 'LinkToInvoice',
9538
-					'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') . ')'),
9538
+					'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').')'),
9539 9539
 				'invoice_template' => array(
9540 9540
 					'enabled' => isModEnabled('invoice'),
9541 9541
 					'perms' => 1,
9542 9542
 					'label' => 'LinkToTemplateInvoice',
9543
-					'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') . ')'),
9543
+					'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').')'),
9544 9544
 				'contrat' => array(
9545 9545
 					'enabled' => isModEnabled('contract'),
9546 9546
 					'perms' => 1,
9547 9547
 					'label' => 'LinkToContract',
9548 9548
 					'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
9549
-							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'
9549
+							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'
9550 9550
 				),
9551 9551
 				'fichinter' => array(
9552 9552
 					'enabled' => isModEnabled('intervention'),
9553 9553
 					'perms' => 1,
9554 9554
 					'label' => 'LinkToIntervention',
9555
-					'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') . ')'),
9555
+					'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').')'),
9556 9556
 				'supplier_proposal' => array(
9557 9557
 					'enabled' => isModEnabled('supplier_proposal'),
9558 9558
 					'perms' => 1,
9559 9559
 					'label' => 'LinkToSupplierProposal',
9560
-					'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') . ')'),
9560
+					'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').')'),
9561 9561
 				'order_supplier' => array(
9562 9562
 					'enabled' => isModEnabled("supplier_order"),
9563 9563
 					'perms' => 1,
9564 9564
 					'label' => 'LinkToSupplierOrder',
9565
-					'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') . ')'),
9565
+					'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').')'),
9566 9566
 				'invoice_supplier' => array(
9567 9567
 					'enabled' => isModEnabled("supplier_invoice"),
9568 9568
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9569
-					'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') . ')'),
9569
+					'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').')'),
9570 9570
 				'ticket' => array(
9571 9571
 					'enabled' => isModEnabled('ticket'),
9572 9572
 					'perms' => 1,
9573 9573
 					'label' => 'LinkToTicket',
9574
-					'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') . ')'),
9574
+					'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').')'),
9575 9575
 				'mo' => array(
9576 9576
 					'enabled' => isModEnabled('mrp'),
9577 9577
 					'perms' => 1,
9578 9578
 					'label' => 'LinkToMo',
9579
-					'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') . ')')
9579
+					'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').')')
9580 9580
 			);
9581 9581
 		}
9582 9582
 
@@ -9612,22 +9612,22 @@  discard block
 block discarded – undo
9612 9612
 			}
9613 9613
 
9614 9614
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9615
-				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9615
+				print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9616 9616
 
9617 9617
 				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9618 9618
 					print '<br>'."\n";
9619 9619
 					print '<!-- form to add a link from anywhere -->'."\n";
9620
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9621
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9620
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9621
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9622 9622
 					print '<input type="hidden" name="action" value="addlinkbyref">';
9623
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9624
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9623
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9624
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9625 9625
 					print '<table class="noborder">';
9626 9626
 					print '<tr>';
9627 9627
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9628
-					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9629
-					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9630
-					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9628
+					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9629
+					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9630
+					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9631 9631
 					print '</tr>';
9632 9632
 					print '</table>';
9633 9633
 					print '</form>';
@@ -9642,48 +9642,48 @@  discard block
 block discarded – undo
9642 9642
 
9643 9643
 					print '<br>';
9644 9644
 					print '<!-- form to add a link from object to same thirdparty -->'."\n";
9645
-					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9645
+					print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9646 9646
 					print '<input type="hidden" name="action" value="addlink">';
9647
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
9648
-					print '<input type="hidden" name="id" value="' . $object->id . '">';
9649
-					print '<input type="hidden" name="addlink" value="' . $key . '">';
9647
+					print '<input type="hidden" name="token" value="'.newToken().'">';
9648
+					print '<input type="hidden" name="id" value="'.$object->id.'">';
9649
+					print '<input type="hidden" name="addlink" value="'.$key.'">';
9650 9650
 					print '<table class="noborder">';
9651 9651
 					print '<tr class="liste_titre">';
9652 9652
 					print '<td class="nowrap"></td>';
9653
-					print '<td class="center">' . $langs->trans("Ref") . '</td>';
9654
-					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>';
9655
-					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9656
-					print '<td class="left">' . $langs->trans("Company") . '</td>';
9653
+					print '<td class="center">'.$langs->trans("Ref").'</td>';
9654
+					print '<td class="left">'.$langs->trans("RefCustomer").'</td>';
9655
+					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9656
+					print '<td class="left">'.$langs->trans("Company").'</td>';
9657 9657
 					print '</tr>';
9658 9658
 					while ($i < $num) {
9659 9659
 						$objp = $this->db->fetch_object($resqllist);
9660 9660
 
9661 9661
 						print '<tr class="oddeven">';
9662 9662
 						print '<td class="left">';
9663
-						print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9663
+						print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9664 9664
 						print '</td>';
9665
-						print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9666
-						print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9665
+						print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9666
+						print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9667 9667
 						print '<td class="right">';
9668 9668
 						if ($possiblelink['label'] == 'LinkToContract') {
9669 9669
 							$form = new Form($this->db);
9670
-							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9670
+							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9671 9671
 						}
9672
-						print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9672
+						print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9673 9673
 						print '</td>';
9674
-						print '<td>' . $objp->name . '</td>';
9674
+						print '<td>'.$objp->name.'</td>';
9675 9675
 						print '</tr>';
9676 9676
 						$i++;
9677 9677
 					}
9678 9678
 					print '</table>';
9679 9679
 					print '<div class="center">';
9680 9680
 					if ($num) {
9681
-						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">';
9681
+						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">';
9682 9682
 					}
9683 9683
 					if (empty($conf->use_javascript_ajax)) {
9684
-						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9684
+						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9685 9685
 					} else {
9686
-						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>';
9686
+						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>';
9687 9687
 					}
9688 9688
 					print '</form>';
9689 9689
 					$this->db->free($resqllist);
@@ -9694,10 +9694,10 @@  discard block
 block discarded – undo
9694 9694
 
9695 9695
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
9696 9696
 				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
9697
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9697
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9698 9698
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9699 9699
 				} else {
9700
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9700
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9701 9701
 				}
9702 9702
 			}
9703 9703
 		}
@@ -9707,11 +9707,11 @@  discard block
 block discarded – undo
9707 9707
     		<dl class="dropdown" id="linktoobjectname">
9708 9708
     		';
9709 9709
 			if (!empty($conf->use_javascript_ajax)) {
9710
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9710
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9711 9711
 			}
9712 9712
 			$linktoelem .= '<dd>
9713 9713
     		<div class="multiselectlinkto">
9714
-    		<ul class="ulselectedfields">' . $linktoelemlist . '
9714
+    		<ul class="ulselectedfields">' . $linktoelemlist.'
9715 9715
     		</ul>
9716 9716
     		</div>
9717 9717
     		</dd>
@@ -9722,7 +9722,7 @@  discard block
 block discarded – undo
9722 9722
 
9723 9723
 		if (!empty($conf->use_javascript_ajax)) {
9724 9724
 			print '<!-- Add js to show linkto box -->
9725
-				<script nonce="' . getNonce() . '">
9725
+				<script nonce="' . getNonce().'">
9726 9726
 				jQuery(document).ready(function() {
9727 9727
 					jQuery(".linkto").click(function() {
9728 9728
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -9763,19 +9763,19 @@  discard block
 block discarded – undo
9763 9763
 
9764 9764
 		$disabled = ($disabled ? ' disabled' : '');
9765 9765
 
9766
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
9766
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
9767 9767
 		if ($useempty) {
9768
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9768
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
9769 9769
 		}
9770 9770
 		if (("$value" == 'yes') || ($value == 1)) {
9771
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
9772
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
9771
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
9772
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
9773 9773
 		} else {
9774 9774
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
9775
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
9776
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
9775
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
9776
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
9777 9777
 		}
9778
-		$resultyesno .= '</select>' . "\n";
9778
+		$resultyesno .= '</select>'."\n";
9779 9779
 
9780 9780
 		if ($addjscombo) {
9781 9781
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -9799,12 +9799,12 @@  discard block
 block discarded – undo
9799 9799
 	{
9800 9800
 		// phpcs:enable
9801 9801
 		$sql = "SELECT rowid, label";
9802
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
9803
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
9802
+		$sql .= " FROM ".$this->db->prefix()."export_model";
9803
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
9804 9804
 		$sql .= " ORDER BY rowid";
9805 9805
 		$result = $this->db->query($sql);
9806 9806
 		if ($result) {
9807
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
9807
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
9808 9808
 			if ($useempty) {
9809 9809
 				print '<option value="-1">&nbsp;</option>';
9810 9810
 			}
@@ -9814,9 +9814,9 @@  discard block
 block discarded – undo
9814 9814
 			while ($i < $num) {
9815 9815
 				$obj = $this->db->fetch_object($result);
9816 9816
 				if ($selected == $obj->rowid) {
9817
-					print '<option value="' . $obj->rowid . '" selected>';
9817
+					print '<option value="'.$obj->rowid.'" selected>';
9818 9818
 				} else {
9819
-					print '<option value="' . $obj->rowid . '">';
9819
+					print '<option value="'.$obj->rowid.'">';
9820 9820
 				}
9821 9821
 				print $obj->label;
9822 9822
 				print '</option>';
@@ -9907,8 +9907,8 @@  discard block
 block discarded – undo
9907 9907
 				$stringforfirstkey .= ' CTL +';
9908 9908
 			}
9909 9909
 
9910
-			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_previous) . $moreparam . '"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
9911
-			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="' . $navurl . '?' . $paramid . '=' . urlencode($object->ref_next) . $moreparam . '"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
9910
+			$previous_ref = $object->ref_previous ? '<a accesskey="p" alt="'.dol_escape_htmltag($langs->trans("Previous")).'" title="'.$stringforfirstkey.' p" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_previous).$moreparam.'"><i class="fa fa-chevron-left"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-left opacitymedium"></i></span>';
9911
+			$next_ref = $object->ref_next ? '<a accesskey="n" alt="'.dol_escape_htmltag($langs->trans("Next")).'" title="'.$stringforfirstkey.' n" class="classfortooltip" href="'.$navurl.'?'.$paramid.'='.urlencode($object->ref_next).$moreparam.'"><i class="fa fa-chevron-right"></i></a>' : '<span class="inactive"><i class="fa fa-chevron-right opacitymedium"></i></span>';
9912 9912
 		}
9913 9913
 
9914 9914
 		//print "xx".$previous_ref."x".$next_ref;
@@ -9916,18 +9916,18 @@  discard block
 block discarded – undo
9916 9916
 
9917 9917
 		// Right part of banner
9918 9918
 		if ($morehtmlright) {
9919
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
9919
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
9920 9920
 		}
9921 9921
 
9922 9922
 		if ($previous_ref || $next_ref || $morehtml) {
9923 9923
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
9924 9924
 		}
9925 9925
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
9926
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
9926
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
9927 9927
 		}
9928 9928
 		if ($shownav && ($previous_ref || $next_ref)) {
9929
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
9930
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
9929
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
9930
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
9931 9931
 		}
9932 9932
 		if ($previous_ref || $next_ref || $morehtml) {
9933 9933
 			$ret .= '</ul></div>';
@@ -9942,7 +9942,7 @@  discard block
 block discarded – undo
9942 9942
 			$morehtmlstatus = $hookmanager->resPrint;
9943 9943
 		}
9944 9944
 		if ($morehtmlstatus) {
9945
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
9945
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
9946 9946
 		}
9947 9947
 
9948 9948
 		$parameters = array();
@@ -9956,14 +9956,14 @@  discard block
 block discarded – undo
9956 9956
 		// Left part of banner
9957 9957
 		if ($morehtmlleft) {
9958 9958
 			if ($conf->browser->layout == 'phone') {
9959
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
9959
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
9960 9960
 			} else {
9961
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
9961
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
9962 9962
 			}
9963 9963
 		}
9964 9964
 
9965 9965
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
9966
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
9966
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
9967 9967
 
9968 9968
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
9969 9969
 		if ($object->element == 'societe') {
@@ -9977,7 +9977,7 @@  discard block
 block discarded – undo
9977 9977
 
9978 9978
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
9979 9979
 				if (!is_object($extralanguages)) {
9980
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
9980
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
9981 9981
 					$extralanguages = new ExtraLanguages($this->db);
9982 9982
 				}
9983 9983
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -9992,29 +9992,29 @@  discard block
 block discarded – undo
9992 9992
 						if ($object->array_languages['name'][$extralangcode]) {
9993 9993
 							$htmltext .= $object->array_languages['name'][$extralangcode];
9994 9994
 						} else {
9995
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
9995
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
9996 9996
 						}
9997 9997
 					}
9998
-					$ret .= '<!-- Show translations of name -->' . "\n";
9998
+					$ret .= '<!-- Show translations of name -->'."\n";
9999 9999
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
10000 10000
 				}
10001 10001
 			}
10002 10002
 		} elseif ($object->element == 'member') {
10003 10003
 			'@phan-var-force Adherent $object';
10004
-			$ret .= $object->ref . '<br>';
10004
+			$ret .= $object->ref.'<br>';
10005 10005
 			$fullname = $object->getFullName($langs);
10006 10006
 			if ($object->morphy == 'mor' && $object->societe) {
10007
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
10007
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
10008 10008
 			} else {
10009
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
10009
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
10010 10010
 			}
10011 10011
 		} elseif (in_array($object->element, array('contact', 'user'))) {
10012
-			$ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;
10012
+			$ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;
10013 10013
 		} elseif ($object->element == 'usergroup') {
10014 10014
 			$ret .= dol_htmlentities($object->name);
10015 10015
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
10016 10016
 			'@phan-var-force ActionComm $object';
10017
-			$ret .= $object->ref . '<br>' . $object->label;
10017
+			$ret .= $object->ref.'<br>'.$object->label;
10018 10018
 		} elseif (in_array($object->element, array('adherent_type'))) {
10019 10019
 			$ret .= $object->label;
10020 10020
 		} elseif ($object->element == 'ecm_directories') {
@@ -10067,9 +10067,9 @@  discard block
 block discarded – undo
10067 10067
 		}
10068 10068
 
10069 10069
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10070
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10071
-		$out = '<!-- url barcode = ' . $url . ' -->';
10072
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10070
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10071
+		$out = '<!-- url barcode = '.$url.' -->';
10072
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10073 10073
 
10074 10074
 		return $out;
10075 10075
 	}
@@ -10096,7 +10096,7 @@  discard block
 block discarded – undo
10096 10096
 		global $conf, $langs;
10097 10097
 
10098 10098
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10099
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10099
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10100 10100
 
10101 10101
 		$dir = '';
10102 10102
 		$file = '';
@@ -10109,28 +10109,28 @@  discard block
 block discarded – undo
10109 10109
 			if (!empty($object->logo)) {
10110 10110
 				if (dolIsAllowedForPreview($object->logo)) {
10111 10111
 					if ((string) $imagesize == 'mini') {
10112
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10112
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10113 10113
 					} elseif ((string) $imagesize == 'small') {
10114
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10114
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10115 10115
 					} else {
10116
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10116
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10117 10117
 					}
10118
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10118
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10119 10119
 				}
10120 10120
 			}
10121 10121
 			$email = $object->email;
10122 10122
 		} elseif ($modulepart == 'contact') {
10123
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10123
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10124 10124
 			if (!empty($object->photo)) {
10125 10125
 				if (dolIsAllowedForPreview($object->photo)) {
10126 10126
 					if ((string) $imagesize == 'mini') {
10127
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10127
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10128 10128
 					} elseif ((string) $imagesize == 'small') {
10129
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10129
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10130 10130
 					} else {
10131
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10131
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10132 10132
 					}
10133
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10133
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10134 10134
 				}
10135 10135
 			}
10136 10136
 			$email = $object->email;
@@ -10140,17 +10140,17 @@  discard block
 block discarded – undo
10140 10140
 			if (!empty($object->photo)) {
10141 10141
 				if (dolIsAllowedForPreview($object->photo)) {
10142 10142
 					if ((string) $imagesize == 'mini') {
10143
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10143
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10144 10144
 					} elseif ((string) $imagesize == 'small') {
10145
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10145
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10146 10146
 					} else {
10147
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10147
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10148 10148
 					}
10149
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10149
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10150 10150
 				}
10151 10151
 			}
10152 10152
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10153
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10153
+				$altfile = $object->id.".jpg"; // For backward compatibility
10154 10154
 			}
10155 10155
 			$email = $object->email;
10156 10156
 			$capture = 'user';
@@ -10159,17 +10159,17 @@  discard block
 block discarded – undo
10159 10159
 			if (!empty($object->photo)) {
10160 10160
 				if (dolIsAllowedForPreview($object->photo)) {
10161 10161
 					if ((string) $imagesize == 'mini') {
10162
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10162
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10163 10163
 					} elseif ((string) $imagesize == 'small') {
10164
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10164
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10165 10165
 					} else {
10166
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10166
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10167 10167
 					}
10168
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10168
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10169 10169
 				}
10170 10170
 			}
10171 10171
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10172
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10172
+				$altfile = $object->id.".jpg"; // For backward compatibility
10173 10173
 			}
10174 10174
 			$email = $object->email;
10175 10175
 			$capture = 'user';
@@ -10195,35 +10195,35 @@  discard block
 block discarded – undo
10195 10195
 		$ret = '';
10196 10196
 
10197 10197
 		if ($dir) {
10198
-			if ($file && file_exists($dir . "/" . $file)) {
10198
+			if ($file && file_exists($dir."/".$file)) {
10199 10199
 				if ($addlinktofullsize) {
10200
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10200
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10201 10201
 					if ($urladvanced) {
10202
-						$ret .= '<a href="' . $urladvanced . '">';
10202
+						$ret .= '<a href="'.$urladvanced.'">';
10203 10203
 					} else {
10204
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10204
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10205 10205
 					}
10206 10206
 				}
10207
-				$ret .= '<img alt="" class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . ' photologo' . (preg_replace('/[^a-z]/i', '_', $file)) . '" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($file) . '&cache=' . $cache . '">';
10207
+				$ret .= '<img alt="" class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').' photologo'.(preg_replace('/[^a-z]/i', '_', $file)).'" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
10208 10208
 				if ($addlinktofullsize) {
10209 10209
 					$ret .= '</a>';
10210 10210
 				}
10211
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10211
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10212 10212
 				if ($addlinktofullsize) {
10213
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10213
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10214 10214
 					if ($urladvanced) {
10215
-						$ret .= '<a href="' . $urladvanced . '">';
10215
+						$ret .= '<a href="'.$urladvanced.'">';
10216 10216
 					} else {
10217
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10217
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10218 10218
 					}
10219 10219
 				}
10220
-				$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 . '">';
10220
+				$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.'">';
10221 10221
 				if ($addlinktofullsize) {
10222 10222
 					$ret .= '</a>';
10223 10223
 				}
10224 10224
 			} else {
10225 10225
 				$nophoto = '/public/theme/common/nophoto.png';
10226
-				$defaultimg = 'identicon';        // For gravatar
10226
+				$defaultimg = 'identicon'; // For gravatar
10227 10227
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10228 10228
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10229 10229
 						$nophoto = 'company';
@@ -10241,13 +10241,13 @@  discard block
 block discarded – undo
10241 10241
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10242 10242
 					// see https://gravatar.com/site/implement/images/php/
10243 10243
 					$ret .= '<!-- Put link to gravatar -->';
10244
-					$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
10244
+					$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" title="'.$email.' Gravatar avatar" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)), 'sha256', 1).'?s='.$width.'&d='.$defaultimg.'">'; // gravatar need md5 hash
10245 10245
 				} else {
10246 10246
 					if ($nophoto == 'company') {
10247
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10247
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10248 10248
 						//$ret .= '<div class="difforspanimgright"></div>';
10249 10249
 					} else {
10250
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10250
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10251 10251
 					}
10252 10252
 				}
10253 10253
 			}
@@ -10258,15 +10258,15 @@  discard block
 block discarded – undo
10258 10258
 				}
10259 10259
 				$ret .= '<table class="nobordernopadding centpercent">';
10260 10260
 				if ($object->photo) {
10261
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10261
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10262 10262
 				}
10263 10263
 				$ret .= '<tr><td class="tdoverflow">';
10264 10264
 				$maxfilesizearray = getMaxFileSizeArray();
10265 10265
 				$maxmin = $maxfilesizearray['maxmin'];
10266 10266
 				if ($maxmin > 0) {
10267
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10267
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10268 10268
 				}
10269
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10269
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10270 10270
 				$ret .= '</td></tr>';
10271 10271
 				$ret .= '</table>';
10272 10272
 			}
@@ -10320,38 +10320,38 @@  discard block
 block discarded – undo
10320 10320
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10321 10321
 			$sql .= ", e.label";
10322 10322
 		}
10323
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10323
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10324 10324
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10325
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10325
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10326 10326
 			if ($force_entity) {
10327
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10327
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10328 10328
 			} else {
10329 10329
 				$sql .= " WHERE ug.entity IS NOT NULL";
10330 10330
 			}
10331 10331
 		} else {
10332
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10332
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10333 10333
 		}
10334 10334
 		if (is_array($exclude) && $excludeGroups) {
10335
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10335
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10336 10336
 		}
10337 10337
 		if (is_array($include) && $includeGroups) {
10338
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10338
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10339 10339
 		}
10340 10340
 		$sql .= " ORDER BY ug.nom ASC";
10341 10341
 
10342
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10342
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10343 10343
 		$resql = $this->db->query($sql);
10344 10344
 		if ($resql) {
10345 10345
 			// Enhance with select2
10346
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10346
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10347 10347
 
10348
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10348
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10349 10349
 
10350 10350
 			$num = $this->db->num_rows($resql);
10351 10351
 			$i = 0;
10352 10352
 			if ($num) {
10353 10353
 				if ($show_empty && !$multiple) {
10354
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10354
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10355 10355
 				}
10356 10356
 
10357 10357
 				while ($i < $num) {
@@ -10364,11 +10364,11 @@  discard block
 block discarded – undo
10364 10364
 					$label = $obj->name;
10365 10365
 					$labelhtml = $obj->name;
10366 10366
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10367
-						$label .= " (" . $obj->label . ")";
10368
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10367
+						$label .= " (".$obj->label.")";
10368
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10369 10369
 					}
10370 10370
 
10371
-					$out .= '<option value="' . $obj->rowid . '"';
10371
+					$out .= '<option value="'.$obj->rowid.'"';
10372 10372
 					if ($disableline) {
10373 10373
 						$out .= ' disabled';
10374 10374
 					}
@@ -10384,9 +10384,9 @@  discard block
 block discarded – undo
10384 10384
 				}
10385 10385
 			} else {
10386 10386
 				if ($show_empty) {
10387
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10387
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10388 10388
 				}
10389
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10389
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10390 10390
 			}
10391 10391
 			$out .= '</select>';
10392 10392
 
@@ -10430,25 +10430,25 @@  discard block
 block discarded – undo
10430 10430
 		$out = '';
10431 10431
 
10432 10432
 		if (!empty($conf->use_javascript_ajax)) {
10433
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10433
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10434 10434
 		}
10435
-		$out .= '<script nonce="' . getNonce() . '">
10435
+		$out .= '<script nonce="'.getNonce().'">
10436 10436
             $(document).ready(function() {
10437
-                $("#' . $cssclass . 's").click(function() {
10437
+                $("#' . $cssclass.'s").click(function() {
10438 10438
                     if($(this).is(\':checked\')){
10439
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10440
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10439
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10440
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10441 10441
                     }
10442 10442
                     else
10443 10443
                     {
10444 10444
                         console.log("We uncheck all");
10445
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10445
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10446 10446
                     }' . "\n";
10447 10447
 		if ($calljsfunction) {
10448
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10448
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10449 10449
 		}
10450 10450
 		$out .= '         });
10451
-        	        $(".' . $cssclass . '").change(function() {
10451
+        	        $(".' . $cssclass.'").change(function() {
10452 10452
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10453 10453
 				});
10454 10454
 		 	});
@@ -10493,67 +10493,67 @@  discard block
 block discarded – undo
10493 10493
 		global $langs, $user;
10494 10494
 
10495 10495
 		$out = '';
10496
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10497
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10496
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10497
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10498 10498
 		if (!empty($excludeid)) {
10499
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10499
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10500 10500
 		}
10501 10501
 		$sql .= " ORDER BY label";
10502 10502
 
10503 10503
 		$resql = $this->db->query($sql);
10504 10504
 		if ($resql) {
10505
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10505
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10506 10506
 			if ($useempty) {
10507 10507
 				$out .= '<option value="0">&nbsp;</option>';
10508 10508
 			}
10509 10509
 
10510 10510
 			while ($obj = $this->db->fetch_object($resql)) {
10511
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10511
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10512 10512
 			}
10513 10513
 			$out .= '</select>';
10514
-			$out .= ajax_combobox('select_' . $htmlname);
10514
+			$out .= ajax_combobox('select_'.$htmlname);
10515 10515
 
10516 10516
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10517
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10517
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10518 10518
 			}
10519 10519
 
10520 10520
 			if (!empty($target)) {
10521
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10521
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10522 10522
 				$resql = $this->db->query($sql);
10523 10523
 				if ($resql) {
10524 10524
 					if ($this->db->num_rows($resql) > 0) {
10525 10525
 						$obj = $this->db->fetch_object($resql);
10526
-						$out .= '<script nonce="' . getNonce() . '">
10526
+						$out .= '<script nonce="'.getNonce().'">
10527 10527
 							$(function() {
10528
-								$("select[name=' . $target . ']").on("change", function() {
10528
+								$("select[name=' . $target.']").on("change", function() {
10529 10529
 									var current_val = $(this).val();
10530
-									if (current_val == ' . $obj->id . ') {';
10530
+									if (current_val == ' . $obj->id.') {';
10531 10531
 						if (!empty($default_selected) || !empty($selected)) {
10532
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10532
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10533 10533
 						}
10534 10534
 
10535 10535
 						$out .= '
10536
-										$("select[name=' . $htmlname . ']").change();
10536
+										$("select[name=' . $htmlname.']").change();
10537 10537
 									}
10538 10538
 								});
10539 10539
 
10540
-								$("select[name=' . $htmlname . ']").change(function() {
10540
+								$("select[name=' . $htmlname.']").change(function() {
10541 10541
 
10542
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10542
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10543 10543
 										// get price of kilometer to fill the unit price
10544 10544
 										$.ajax({
10545 10545
 											method: "POST",
10546 10546
 											dataType: "json",
10547
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10548
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10547
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10548
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10549 10549
 										}).done(function( data, textStatus, jqXHR ) {
10550 10550
 											console.log(data);
10551 10551
 											if (typeof data.up != "undefined") {
10552 10552
 												$("input[name=value_unit]").val(data.up);
10553
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10553
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10554 10554
 											} else {
10555 10555
 												$("input[name=value_unit]").val("");
10556
-												$("select[name=' . $htmlname . ']").attr("title", "");
10556
+												$("select[name=' . $htmlname.']").attr("title", "");
10557 10557
 											}
10558 10558
 										});
10559 10559
 									}
@@ -10583,18 +10583,18 @@  discard block
 block discarded – undo
10583 10583
 		global $conf, $langs;
10584 10584
 
10585 10585
 		$out = '';
10586
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10587
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10586
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10587
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10588 10588
 
10589 10589
 		$resql = $this->db->query($sql);
10590 10590
 		if ($resql) {
10591
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10591
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10592 10592
 			if ($useempty) {
10593 10593
 				$out .= '<option value="0"></option>';
10594 10594
 			}
10595 10595
 
10596 10596
 			while ($obj = $this->db->fetch_object($resql)) {
10597
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10597
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10598 10598
 			}
10599 10599
 			$out .= '</select>';
10600 10600
 		} else {
@@ -10625,12 +10625,12 @@  discard block
 block discarded – undo
10625 10625
 
10626 10626
 		$resql = $this->db->query($sql);
10627 10627
 		if ($resql) {
10628
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10628
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10629 10629
 			if ($useempty) {
10630 10630
 				$out .= '<option value="0"></option>';
10631 10631
 			}
10632 10632
 			if ($allchoice) {
10633
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10633
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10634 10634
 			}
10635 10635
 
10636 10636
 			$field = 'code';
@@ -10640,7 +10640,7 @@  discard block
 block discarded – undo
10640 10640
 
10641 10641
 			while ($obj = $this->db->fetch_object($resql)) {
10642 10642
 				$key = $langs->trans($obj->code);
10643
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10643
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10644 10644
 			}
10645 10645
 			$out .= '</select>';
10646 10646
 
@@ -10674,7 +10674,7 @@  discard block
 block discarded – undo
10674 10674
 	{
10675 10675
 		global $user, $conf, $langs;
10676 10676
 
10677
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10677
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10678 10678
 
10679 10679
 		if (is_null($usertofilter)) {
10680 10680
 			$usertofilter = $user;
@@ -10698,10 +10698,10 @@  discard block
 block discarded – undo
10698 10698
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10699 10699
             p.title, p.fk_soc, p.fk_statut, p.public,";
10700 10700
 		$sql .= ' s.nom as name';
10701
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10702
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10703
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10704
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10701
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10702
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10703
+		$sql .= ' '.$this->db->prefix().'facture as f';
10704
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10705 10705
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10706 10706
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10707 10707
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10712,14 +10712,14 @@  discard block
 block discarded – undo
10712 10712
 		if ($resql) {
10713 10713
 			// Use select2 selector
10714 10714
 			if (!empty($conf->use_javascript_ajax)) {
10715
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10715
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10716 10716
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10717 10717
 				$out .= $comboenhancement;
10718 10718
 				$morecss = 'minwidth200imp maxwidth500';
10719 10719
 			}
10720 10720
 
10721 10721
 			if (empty($option_only)) {
10722
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10722
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10723 10723
 			}
10724 10724
 			if (!empty($show_empty)) {
10725 10725
 				$out .= '<option value="0" class="optiongrey">';
@@ -10749,33 +10749,33 @@  discard block
 block discarded – undo
10749 10749
 						if ($showproject == 'all') {
10750 10750
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
10751 10751
 							if ($obj->name) {
10752
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
10752
+								$labeltoshow .= ' - '.$obj->name; // Soc name
10753 10753
 							}
10754 10754
 
10755 10755
 							$disabled = 0;
10756 10756
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
10757 10757
 								$disabled = 1;
10758
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
10758
+								$labeltoshow .= ' - '.$langs->trans("Draft");
10759 10759
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
10760 10760
 								if ($discard_closed == 2) {
10761 10761
 									$disabled = 1;
10762 10762
 								}
10763
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
10763
+								$labeltoshow .= ' - '.$langs->trans("Closed");
10764 10764
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
10765 10765
 								$disabled = 1;
10766
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
10766
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
10767 10767
 							}
10768 10768
 						}
10769 10769
 
10770 10770
 						if (!empty($selected) && $selected == $obj->rowid) {
10771
-							$out .= '<option value="' . $obj->rowid . '" selected';
10771
+							$out .= '<option value="'.$obj->rowid.'" selected';
10772 10772
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10773
-							$out .= '>' . $labeltoshow . '</option>';
10773
+							$out .= '>'.$labeltoshow.'</option>';
10774 10774
 						} else {
10775 10775
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
10776 10776
 								$resultat = '';
10777 10777
 							} else {
10778
-								$resultat = '<option value="' . $obj->rowid . '"';
10778
+								$resultat = '<option value="'.$obj->rowid.'"';
10779 10779
 								if ($disabled) {
10780 10780
 									$resultat .= ' disabled';
10781 10781
 								}
@@ -10827,22 +10827,22 @@  discard block
 block discarded – undo
10827 10827
 
10828 10828
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
10829 10829
 		//$sql.= ', el.fk_source';
10830
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
10831
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
10830
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
10831
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
10832 10832
 		$sql .= " ORDER BY f.titre ASC";
10833 10833
 
10834 10834
 		$resql = $this->db->query($sql);
10835 10835
 		if ($resql) {
10836 10836
 			// Use select2 selector
10837 10837
 			if (!empty($conf->use_javascript_ajax)) {
10838
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10838
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10839 10839
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10840 10840
 				$out .= $comboenhancement;
10841 10841
 				$morecss = 'minwidth200imp maxwidth500';
10842 10842
 			}
10843 10843
 
10844 10844
 			if (empty($option_only)) {
10845
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10845
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10846 10846
 			}
10847 10847
 			if (!empty($show_empty)) {
10848 10848
 				$out .= '<option value="0" class="optiongrey">';
@@ -10861,19 +10861,19 @@  discard block
 block discarded – undo
10861 10861
 					$disabled = 0;
10862 10862
 					if (!empty($obj->suspended)) {
10863 10863
 						$disabled = 1;
10864
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
10864
+						$labeltoshow .= ' - '.$langs->trans("Closed");
10865 10865
 					}
10866 10866
 
10867 10867
 
10868 10868
 					if (!empty($selected) && $selected == $obj->rowid) {
10869
-						$out .= '<option value="' . $obj->rowid . '" selected';
10869
+						$out .= '<option value="'.$obj->rowid.'" selected';
10870 10870
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10871
-						$out .= '>' . $labeltoshow . '</option>';
10871
+						$out .= '>'.$labeltoshow.'</option>';
10872 10872
 					} else {
10873 10873
 						if ($disabled && ($selected != $obj->rowid)) {
10874 10874
 							$resultat = '';
10875 10875
 						} else {
10876
-							$resultat = '<option value="' . $obj->rowid . '"';
10876
+							$resultat = '<option value="'.$obj->rowid.'"';
10877 10877
 							if ($disabled) {
10878 10878
 								$resultat .= ' disabled';
10879 10879
 							}
@@ -10913,14 +10913,14 @@  discard block
 block discarded – undo
10913 10913
 		global $langs;
10914 10914
 
10915 10915
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
10916
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
10916
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
10917 10917
 		}
10918 10918
 
10919 10919
 		$ret = '';
10920 10920
 
10921 10921
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
10922 10922
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
10923
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
10923
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
10924 10924
 		$ret .= '</a>';
10925 10925
 
10926 10926
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -10964,29 +10964,29 @@  discard block
 block discarded – undo
10964 10964
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
10965 10965
 		}
10966 10966
 		$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%')) -->";
10967
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
10967
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
10968 10968
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
10969 10969
 
10970 10970
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
10971 10971
 		foreach ($arrayofcriterias as $criteria) {
10972 10972
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
10973
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10973
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
10974 10974
 					continue;
10975 10975
 				}
10976 10976
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
10977 10977
 					continue;
10978 10978
 				}
10979 10979
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
10980
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
10981
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
10982
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
10983
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
10984
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
10985
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
10986
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
10987
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
10980
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
10981
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
10982
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
10983
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
10984
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
10985
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
10986
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
10987
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
10988 10988
 				} else {
10989
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
10989
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
10990 10990
 				}
10991 10991
 			}
10992 10992
 		}
@@ -10994,7 +10994,7 @@  discard block
 block discarded – undo
10994 10994
 		$ret .= '</div>';
10995 10995
 
10996 10996
 		$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";
10997
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10997
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
10998 10998
 
10999 10999
 		$ret .= '</div>';
11000 11000
 		$ret .= '</div>';
@@ -11068,7 +11068,7 @@  discard block
 block discarded – undo
11068 11068
 
11069 11069
 		$TModels = array();
11070 11070
 
11071
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11071
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11072 11072
 		$formmail = new FormMail($this->db);
11073 11073
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11074 11074
 
@@ -11081,17 +11081,17 @@  discard block
 block discarded – undo
11081 11081
 			}
11082 11082
 		}
11083 11083
 
11084
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11084
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11085 11085
 
11086 11086
 		foreach ($TModels as $id_model => $label_model) {
11087
-			$retstring .= '<option value="' . $id_model . '"';
11088
-			$retstring .= ">" . $label_model . "</option>";
11087
+			$retstring .= '<option value="'.$id_model.'"';
11088
+			$retstring .= ">".$label_model."</option>";
11089 11089
 		}
11090 11090
 
11091 11091
 		$retstring .= "</select>";
11092 11092
 
11093 11093
 		if ($addjscombo) {
11094
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11094
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11095 11095
 		}
11096 11096
 
11097 11097
 		return $retstring;
@@ -11142,16 +11142,16 @@  discard block
 block discarded – undo
11142 11142
 
11143 11143
 		foreach ($buttons as $button) {
11144 11144
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11145
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
11145
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
11146 11146
 		}
11147 11147
 		$retstring .= $withoutdiv ? '' : '</div>';
11148 11148
 
11149 11149
 		if ($dol_openinpopup) {
11150
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";
11151
-			$retstring .= '<script nonce="' . getNonce() . '">';
11150
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";
11151
+			$retstring .= '<script nonce="'.getNonce().'">';
11152 11152
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11153
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');
11154
-				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');
11153
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');
11154
+				window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');
11155 11155
 				 });';
11156 11156
 			$retstring .= '</script>';
11157 11157
 		}
@@ -11180,7 +11180,7 @@  discard block
 block discarded – undo
11180 11180
 		dol_syslog(__METHOD__, LOG_DEBUG);
11181 11181
 
11182 11182
 		$sql = "SELECT rowid, code, label as label";
11183
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11183
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11184 11184
 		$sql .= " WHERE active = 1";
11185 11185
 
11186 11186
 		$resql = $this->db->query($sql);
@@ -11191,7 +11191,7 @@  discard block
 block discarded – undo
11191 11191
 				$obj = $this->db->fetch_object($resql);
11192 11192
 
11193 11193
 				// If translation exists, we use it, otherwise we take the default wording
11194
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11194
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11195 11195
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11196 11196
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11197 11197
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11223,18 +11223,18 @@  discard block
 block discarded – undo
11223 11223
 		global $langs, $user;
11224 11224
 
11225 11225
 		$out = '';
11226
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11226
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11227 11227
 
11228 11228
 		$this->load_cache_invoice_subtype();
11229 11229
 
11230
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11230
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11231 11231
 		if ($addempty) {
11232 11232
 			$out .= '<option value="0">&nbsp;</option>';
11233 11233
 		}
11234 11234
 
11235 11235
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11236 11236
 			$label = $subtype['label'];
11237
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11237
+			$out .= '<option value="'.$subtype['rowid'].'"';
11238 11238
 			if ($selected == $subtype['rowid']) {
11239 11239
 				$out .= ' selected="selected"';
11240 11240
 			}
Please login to merge, or discard this patch.
htdocs/societe/paymentmodes.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 
139 139
 	if ($action == 'update') {
140 140
 		// Update the bank account
141
-		if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')!=0))) {
141
+		if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') != 0))) {
142 142
 			if (!GETPOST('label', 'alpha')) {
143 143
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
144 144
 			}
145
-			if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
145
+			if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
146 146
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
147 147
 			}
148 148
 			$action = 'edit';
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				$action = 'edit';
156 156
 				$error++;
157 157
 			}
158
-			if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
158
+			if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
159 159
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
160 160
 				$action = 'edit';
161 161
 				$error++;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 			// Ajout
298 298
 			$companybankaccount = new CompanyBankAccount($db);
299 299
 
300
-			$companybankaccount->socid           = $object->id;
300
+			$companybankaccount->socid = $object->id;
301 301
 
302 302
 			$companybankaccount->fetch_thirdparty();
303 303
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 					$action = 'create';
339 339
 					$error++;
340 340
 				}
341
-				if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
341
+				if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
342 342
 					setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors');
343 343
 					$action = 'create';
344 344
 					$error++;
@@ -524,8 +524,8 @@  discard block
 block discarded – undo
524 524
 			'use_companybankid' => GETPOST('companybankid'),
525 525
 			'force_dir_output' => $conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->id)
526 526
 		);
527
-		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml');	// This is required by core/action_builddoc.inc.php
528
-		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); 		// This is required by core/action_builddoc.inc.php
527
+		$_POST['lang_id'] = GETPOST('lang_idrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
528
+		$_POST['model'] = GETPOST('modelrib'.GETPOSTINT('companybankid'), 'alphanohtml'); // This is required by core/action_builddoc.inc.php
529 529
 	}
530 530
 
531 531
 	$id = $socid;
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		}
596 596
 		if ($action == 'syncsepatostripe') {
597 597
 			// Create the bank account on current Stripe env
598
-			$companypaymentmode = new CompanyPaymentMode($db);	// Get record in llx_societe_rib
598
+			$companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib
599 599
 			$companypaymentmode->fetch($id);
600 600
 
601 601
 			if ($companypaymentmode->type != 'ban') {
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		print '<table class="liste centpercent">'."\n";
1197 1197
 		print '<tr class="liste_titre">';
1198 1198
 		print '<td>'.$langs->trans('Label').'</td>';
1199
-		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>';	// external system ID
1199
+		print '<td>'.$form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")).'</td>'; // external system ID
1200 1200
 		print '<td>'.$langs->trans('Type').'</td>';
1201 1201
 		print '<td>'.$langs->trans('Informations').'</td>';
1202 1202
 		print '<td></td>';
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 
1537 1537
 	// List of bank accounts
1538 1538
 	if ($permissiontoaddupdatepaymentinformation) {
1539
-		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&amp;action=create');
1539
+		$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=create');
1540 1540
 	}
1541 1541
 
1542 1542
 	print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank');
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 
1554 1554
 		print '<tr class="liste_titre">';
1555 1555
 		print_liste_field_titre("Label");
1556
-		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem")));		// external system ID
1556
+		print_liste_field_titre($form->textwithpicto($langs->trans('ExternalSystemID'), $langs->trans("IDOfPaymentInAnExternalSystem"))); // external system ID
1557 1557
 		print_liste_field_titre("Bank");
1558 1558
 		print_liste_field_titre("RIB");
1559 1559
 		print_liste_field_titre("IBAN");
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 				print '<td class="width200">';
1735 1735
 				$useonlinesignature = 1;
1736 1736
 				if ($useonlinesignature) {
1737
-					require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
1737
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
1738 1738
 					print showOnlineSignatureUrl($companybankaccount->element, $rib->id, $rib, 'short');
1739 1739
 				}
1740 1740
 				print '</td>';
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 	print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Label").'</td>';
1973 1973
 	print '<td><input class="minwidth300" type="text" name="label" value="'.$companybankaccount->label.'"></td></tr>';
1974 1974
 
1975
-	$required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0) ? "fieldrequired" : "";
1975
+	$required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) ? "fieldrequired" : "";
1976 1976
 	print '<tr><td class="'.$required.'">'.$langs->trans("BankName").'</td>';
1977 1977
 	print '<td><input class="minwidth200" type="text" name="bank" value="'.$companybankaccount->bank.'"></td></tr>';
1978 1978
 
@@ -2010,7 +2010,7 @@  discard block
 block discarded – undo
2010 2010
 			$name = 'bic';
2011 2011
 			$size = 12;
2012 2012
 			$content = $bankaccount->bic;
2013
-			if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
2013
+			if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
2014 2014
 				$require = true;
2015 2015
 			}
2016 2016
 			$tooltip = $langs->trans("Example").': LIABLT2XXXX';
@@ -2182,7 +2182,7 @@  discard block
 block discarded – undo
2182 2182
 			$name = 'bic';
2183 2183
 			$size = 12;
2184 2184
 			$content = $companybankaccount->bic;
2185
-			if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) {
2185
+			if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) {
2186 2186
 				$require = true;
2187 2187
 			}
2188 2188
 			$tooltip = $langs->trans("Example").': LIABLT2XXXX';
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +454 added lines, -454 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * \brief      File of withdrawal receipts class
30 30
  */
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
43 43
 
44 44
 
45 45
 /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 	const STATUS_DRAFT = 0;
106 106
 	const STATUS_TRANSFERED = 1;
107
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
107
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
109 109
 
110 110
 
111 111
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		if ($result == 0) {
260 260
 			if ($line_id > 0) {
261
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
261
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
262 262
 				if ($type != 'bank-transfer') {
263 263
 					$sql .= "fk_facture";
264 264
 				} else {
@@ -271,24 +271,24 @@  discard block
 block discarded – undo
271 271
 				$sql .= ",fk_prelevement_lignes";
272 272
 				$sql .= ") VALUES (";
273 273
 				$sql .= ((int) $invoice_id);
274
-				$sql .= ", " . ((int) $line_id);
274
+				$sql .= ", ".((int) $line_id);
275 275
 				$sql .= ")";
276 276
 
277 277
 				if ($this->db->query($sql)) {
278 278
 					$result = 0;
279 279
 				} else {
280 280
 					$result = -1;
281
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
282
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
281
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
282
+					dol_syslog(get_class($this)."::AddFacture Error $result");
283 283
 				}
284 284
 			} else {
285 285
 				$result = -2;
286
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
287
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
286
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
287
+				dol_syslog(get_class($this)."::AddFacture Error $result");
288 288
 			}
289 289
 		} else {
290 290
 			$result = -3;
291
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
291
+			dol_syslog(get_class($this)."::AddFacture Error $result");
292 292
 		}
293 293
 
294 294
 		return $result;
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
312 312
 	{
313 313
 		$result = -1;
314
-		$concat = 0;	// ??? what is this for. Seems not used.
314
+		$concat = 0; // ??? what is this for. Seems not used.
315 315
 
316 316
 		if ($concat == 1) {
317 317
 			/*
318 318
 			 * We aggregate the lines
319 319
 			 */
320 320
 			$sql = "SELECT rowid";
321
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
322
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
321
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
322
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
323 323
 			if ($sourcetype == 'salary') {
324
-				$sql .= " AND fk_soc = " . ((int) $client_id);
324
+				$sql .= " AND fk_soc = ".((int) $client_id);
325 325
 			} else {
326
-				$sql .= " AND fk_user = " . ((int) $client_id);
326
+				$sql .= " AND fk_user = ".((int) $client_id);
327 327
 			}
328
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
329
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
330
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
328
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
329
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
330
+			$sql .= " AND number = '".$this->db->escape($number)."'";
331 331
 
332 332
 			$resql = $this->db->query($sql);
333 333
 			if ($resql) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			/*
340 340
 			 * No aggregate
341 341
 			 */
342
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
342
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
343 343
 			$sql .= "fk_prelevement_bons";
344 344
 			$sql .= ", fk_soc";
345 345
 			$sql .= ", client_nom";
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
352 352
 			$sql .= ") VALUES (";
353 353
 			$sql .= $this->id;
354
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
355
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
356
-			$sql .= ", " . ((float) price2num($amount));
357
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
358
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
359
-			$sql .= ", '" . $this->db->escape($number) . "'";
360
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
361
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
354
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
355
+			$sql .= ", '".$this->db->escape($client_nom)."'";
356
+			$sql .= ", ".((float) price2num($amount));
357
+			$sql .= ", '".$this->db->escape($code_banque)."'";
358
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
359
+			$sql .= ", '".$this->db->escape($number)."'";
360
+			$sql .= ", '".$this->db->escape($number_key)."'";
361
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
362 362
 			$sql .= ")";
363 363
 			if ($this->db->query($sql)) {
364
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
364
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
365 365
 				$result = 0;
366 366
 			} else {
367
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
368
-				dol_syslog(get_class($this) . "::addline Error -2");
367
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
368
+				dol_syslog(get_class($this)."::addline Error -2");
369 369
 				$result = -2;
370 370
 			}
371 371
 		}
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$sql .= ", p.type";
409 409
 		$sql .= ", p.fk_bank_account";
410 410
 		$sql .= ", p.statut as status";
411
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
412
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
411
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
412
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
413 413
 		if ($rowid > 0) {
414
-			$sql .= " AND p.rowid = " . ((int) $rowid);
414
+			$sql .= " AND p.rowid = ".((int) $rowid);
415 415
 		} else {
416
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
416
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
417 417
 		}
418 418
 
419
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
419
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
420 420
 		$result = $this->db->query($sql);
421 421
 		if ($result) {
422 422
 			if ($this->db->num_rows($result)) {
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 				if (empty($this->status)) {		// Value is sometimes null in database
443 443
 					$this->status = 0;
444 444
 				}
445
-				$this->statut         = $this->status; // For backward compatibility
445
+				$this->statut = $this->status; // For backward compatibility
446 446
 
447 447
 				$this->fetched = 1;
448 448
 
449 449
 				return 1;
450 450
 			} else {
451
-				dol_syslog(get_class($this) . "::Fetch no record found");
451
+				dol_syslog(get_class($this)."::Fetch no record found");
452 452
 				return 0;
453 453
 			}
454 454
 		} else {
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 			if ($date < $this->date_trans) {
490 490
 				$langs->load("errors");
491 491
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
492
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
492
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
493 493
 				return -1027;
494 494
 			}
495 495
 
496 496
 			$this->db->begin();
497 497
 
498
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
499
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
500
-			$sql .= ", statut = " . self::STATUS_CREDITED;
501
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
502
-			$sql .= " WHERE rowid = " . ((int) $this->id);
503
-			$sql .= " AND entity = " . ((int) $conf->entity);
504
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
498
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
499
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
500
+			$sql .= ", statut = ".self::STATUS_CREDITED;
501
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
502
+			$sql .= " WHERE rowid = ".((int) $this->id);
503
+			$sql .= " AND entity = ".((int) $conf->entity);
504
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
505 505
 
506 506
 			$resql = $this->db->query($sql);
507 507
 			if ($resql) {
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 						$error++;
617 617
 						$this->error = $paiement->error;
618 618
 						$this->errors = $paiement->errors;
619
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
619
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
620 620
 					} else {
621 621
 						if ($this->type == 'bank-transfer') {
622 622
 							if ($type == 'salary') {
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 						} else {
632 632
 							$modeforaddpayment = 'payment';
633 633
 							$labelforaddpayment = '(CustomerInvoicePayment)';
634
-							$addbankurl = 'direct-debit';	// = 'directdebit'
634
+							$addbankurl = 'direct-debit'; // = 'directdebit'
635 635
 						}
636 636
 
637 637
 						$result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 							$error++;
641 641
 							$this->error = $paiement->error;
642 642
 							$this->errors = $paiement->errors;
643
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
643
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
644 644
 						}
645 645
 					}
646 646
 				}
@@ -648,24 +648,24 @@  discard block
 block discarded – undo
648 648
 				// Update withdrawal line
649 649
 				// TODO: Translate to ligneprelevement.class.php
650 650
 				if (!$error) {
651
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
651
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
652 652
 					$sql .= " SET statut = 2";
653
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
653
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
654 654
 
655 655
 					if (!$this->db->query($sql)) {
656
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
656
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
657 657
 						$error++;
658 658
 					}
659 659
 				}
660 660
 			} else {
661 661
 				$this->error = $this->db->lasterror();
662
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
662
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
663 663
 				$error++;
664 664
 			}
665 665
 
666 666
 			// End of procedure
667 667
 			if ($error == 0) {
668
-				$this->date_credit = $date;		// date credit or debit
668
+				$this->date_credit = $date; // date credit or debit
669 669
 				$this->statut = self::STATUS_CREDITED;
670 670
 				$this->status = self::STATUS_CREDITED;
671 671
 
@@ -696,17 +696,17 @@  discard block
 block discarded – undo
696 696
 
697 697
 		$error = 0;
698 698
 
699
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
699
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
700 700
 
701 701
 		if ($this->db->begin()) {
702
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
703
-			$sql .= " SET fk_user_trans = " . $user->id;
704
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
705
-			$sql .= " , method_trans = " . ((int) $method);
706
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
707
-			$sql .= " WHERE rowid = " . ((int) $this->id);
708
-			$sql .= " AND entity = " . ((int) $conf->entity);
709
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
702
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
703
+			$sql .= " SET fk_user_trans = ".$user->id;
704
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
705
+			$sql .= " , method_trans = ".((int) $method);
706
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
707
+			$sql .= " WHERE rowid = ".((int) $this->id);
708
+			$sql .= " AND entity = ".((int) $conf->entity);
709
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
710 710
 
711 711
 			if ($this->db->query($sql)) {
712 712
 				$this->method_trans = $method;
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 				return 0;
732 732
 			} else {
733 733
 				$this->db->rollback();
734
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
734
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
735 735
 
736 736
 				return -1;
737 737
 			}
738 738
 		} else {
739
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
739
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
740 740
 			return -2;
741 741
 		}
742 742
 	}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$arr = array();
756 756
 
757
-		dol_syslog(get_class($this) . "::getListInvoices");
757
+		dol_syslog(get_class($this)."::getListInvoices");
758 758
 
759 759
 		// Returns all invoices presented within same order
760 760
 		$sql = "SELECT ";
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 		if ($amounts) {
771 771
 			$sql .= ", SUM(pl.amount)";
772 772
 		}
773
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
774
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
775
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
773
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
774
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
775
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
776 776
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
777 777
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
778
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
779
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
778
+		$sql .= " AND pb.rowid = ".((int) $this->id);
779
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
780 780
 		if ($amounts) {
781 781
 			if ($this->type == 'bank-transfer') {
782 782
 				if ($type == 'salary') {
@@ -830,17 +830,17 @@  discard block
 block discarded – undo
830 830
 		$sql = "SELECT sum(pd.amount) as nb";
831 831
 		if ($type !== 'salary') {
832 832
 			if ($mode != 'bank-transfer') {
833
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
833
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
834 834
 			} else {
835
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
835
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
836 836
 			}
837 837
 		} else {
838
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
838
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
839 839
 		}
840
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
841
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
840
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
841
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
842 842
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
843
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
843
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
844 844
 		}
845 845
 		if ($type !== 'salary') {
846 846
 			if ($mode != 'bank-transfer') {
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 			return $obj->nb;
866 866
 		} else {
867 867
 			$error = 1;
868
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
868
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
869 869
 			dol_syslog($this->db->error());
870 870
 
871 871
 			return -1;
@@ -901,26 +901,26 @@  discard block
 block discarded – undo
901 901
 		// phpcs:enable
902 902
 		if ($forsalary == 1) {
903 903
 			$sql = "SELECT count(s.rowid) as nb";
904
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
904
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
905 905
 		} else {
906 906
 			$sql = "SELECT count(f.rowid) as nb";
907 907
 
908 908
 			if ($type == 'bank-transfer') {
909
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
909
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
910 910
 			} else {
911
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
911
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
912 912
 			}
913 913
 		}
914
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
914
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
915 915
 		if ($forsalary == 1) {
916
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
916
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
917 917
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
918 918
 				$sql .= " AND s.paye = 0";
919 919
 			}
920 920
 		} else {
921
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
921
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
922 922
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
923
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
923
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
924 924
 			}
925 925
 		}
926 926
 		if ($forsalary == 1) {
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 			$sql .= " AND s.paye = 0";
941 941
 		}
942 942
 
943
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
943
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
944 944
 		$resql = $this->db->query($sql);
945 945
 
946 946
 		if ($resql) {
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 
950 950
 			return $obj->nb;
951 951
 		} else {
952
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
952
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
953 953
 			return -1;
954 954
 		}
955 955
 	}
@@ -981,10 +981,10 @@  discard block
 block discarded – undo
981 981
 		// phpcs:enable
982 982
 		global $conf, $langs, $user;
983 983
 
984
-		dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG);
984
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
985 985
 
986
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
987
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
986
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
987
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
988 988
 
989 989
 		// Check params
990 990
 		if ($type != 'bank-transfer') {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 		$factures_prev_id = array();
1021 1021
 		$factures_errors = array();
1022 1022
 		if (!$error) {
1023
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1023
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1024 1024
 
1025 1025
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1026 1026
 			if ($sourcetype != 'salary') {
@@ -1039,28 +1039,28 @@  discard block
 block discarded – undo
1039 1039
 			}
1040 1040
 			if ($sourcetype != 'salary') {
1041 1041
 				if ($type != 'bank-transfer') {
1042
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
1043
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture";
1042
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
1043
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture";
1044 1044
 				} else {
1045
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
1046
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1045
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
1046
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1047 1047
 				}
1048
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
1049
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1048
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
1049
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1050 1050
 			} else {
1051
-				$sql .= " FROM " . MAIN_DB_PREFIX . "salary as f";
1052
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_salary";
1053
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as s ON s.rowid = f.fk_user";
1054
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user_rib as sr ON s.rowid = sr.fk_user";	// TODO Add AND sr.default_rib = 1 here
1051
+				$sql .= " FROM ".MAIN_DB_PREFIX."salary as f";
1052
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary";
1053
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user";
1054
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here
1055 1055
 			}
1056 1056
 			if ($sourcetype != 'salary') {
1057 1057
 				if ($type != 'bank-transfer') {
1058
-					$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ')';
1058
+					$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
1059 1059
 				} else {
1060
-					$sql .= " WHERE f.entity IN (" . getEntity('supplier_invoice') . ')';
1060
+					$sql .= " WHERE f.entity IN (".getEntity('supplier_invoice').')';
1061 1061
 				}
1062 1062
 			} else {
1063
-				$sql .= " WHERE f.entity IN (" . getEntity('salary') . ')';
1063
+				$sql .= " WHERE f.entity IN (".getEntity('salary').')';
1064 1064
 			}
1065 1065
 			if ($sourcetype != 'salary') {
1066 1066
 				$sql .= " AND f.fk_statut = 1"; // Invoice validated
@@ -1074,10 +1074,10 @@  discard block
 block discarded – undo
1074 1074
 			$sql .= " AND pd.traite = 0";
1075 1075
 			$sql .= " AND pd.ext_payment_id IS NULL";
1076 1076
 			if ($sourcetype != 'salary') {
1077
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1077
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1078 1078
 			}
1079 1079
 			if ($did > 0) {
1080
-				$sql .= " AND pd.rowid = " . ((int) $did);
1080
+				$sql .= " AND pd.rowid = ".((int) $did);
1081 1081
 			}
1082 1082
 
1083 1083
 			$resql = $this->db->query($sql);
@@ -1086,41 +1086,41 @@  discard block
 block discarded – undo
1086 1086
 				$i = 0;
1087 1087
 
1088 1088
 				while ($i < $num) {
1089
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1089
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1090 1090
 					$factures[$i] = $row; // All fields
1091 1091
 
1092 1092
 					if ($row[7] == 0) {
1093 1093
 						$error++;
1094
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1095
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1094
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1095
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1096 1096
 						break;
1097 1097
 					}
1098 1098
 					$i++;
1099 1099
 				}
1100 1100
 
1101 1101
 				$this->db->free($resql);
1102
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1102
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1103 1103
 			} else {
1104 1104
 				$error++;
1105 1105
 				$this->error = $this->db->lasterror();
1106
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1106
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1107 1107
 				return -1;
1108 1108
 			}
1109 1109
 		}
1110 1110
 
1111 1111
 		if (!$error) {
1112 1112
 			// Make some checks
1113
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1114
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1115
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1116
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1113
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1114
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1115
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1116
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1117 1117
 
1118 1118
 			$tmpsoc = new Societe($this->db);
1119 1119
 			$tmpuser = new User($this->db);
1120 1120
 
1121 1121
 			// Check BAN
1122 1122
 			$i = 0;
1123
-			dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG);
1123
+			dol_syslog(__METHOD__." Check BAN", LOG_DEBUG);
1124 1124
 
1125 1125
 			if (count($factures) > 0) {
1126 1126
 				foreach ($factures as $key => $fac) {
@@ -1160,31 +1160,31 @@  discard block
 block discarded – undo
1160 1160
 							if ($type != 'bank-transfer') {
1161 1161
 								$tmpsoc->id = $fac[2];
1162 1162
 								$tmpsoc->name = $fac[8];
1163
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1164
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1165
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1163
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1164
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1165
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1166 1166
 								$error++;
1167 1167
 							}
1168 1168
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1169 1169
 								$tmpsoc->id = $fac[2];
1170 1170
 								$tmpsoc->name = $fac[8];
1171
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1172
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1173
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1171
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1172
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1173
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1174 1174
 								$error++;
1175 1175
 							}
1176 1176
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1177 1177
 								$tmpuser->id = $fac[2];
1178 1178
 								$tmpuser->firstname = $fac[8];
1179
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1180
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1181
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1179
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1180
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1181
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1182 1182
 								$error++;
1183 1183
 							}
1184
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1184
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1185 1185
 						}
1186 1186
 					} else {
1187
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1187
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1188 1188
 					}
1189 1189
 					/*
1190 1190
 					} else {
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 					*/
1194 1194
 				}
1195 1195
 			} else {
1196
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1196
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1197 1197
 			}
1198 1198
 		}
1199 1199
 
1200 1200
 		$ok = 0;
1201 1201
 
1202 1202
 		// Withdraw invoices in factures_prev array
1203
-		$out = count($factures_prev) . " invoices will be included.";
1203
+		$out = count($factures_prev)." invoices will be included.";
1204 1204
 		//print $out."\n";
1205 1205
 		dol_syslog($out);
1206 1206
 
@@ -1234,32 +1234,32 @@  discard block
 block discarded – undo
1234 1234
 			 * Process order generation
1235 1235
 			 */
1236 1236
 			if (!$error) {
1237
-				$ref = substr($year, -2) . $month;
1237
+				$ref = substr($year, -2).$month;
1238 1238
 
1239 1239
 				// Get next free number for the ref of bon prelevement
1240
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1241
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1242
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1243
-				$sql .= " AND entity = " . ((int) $conf->entity);
1240
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1241
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1242
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1243
+				$sql .= " AND entity = ".((int) $conf->entity);
1244 1244
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1245 1245
 
1246
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1246
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1247 1247
 				$resql = $this->db->query($sql);
1248 1248
 
1249 1249
 				if ($resql) {
1250 1250
 					$row = $this->db->fetch_row($resql);
1251 1251
 
1252 1252
 					// Build the new ref
1253
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1253
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1254 1254
 
1255 1255
 					// $conf->abc->dir_output may be:
1256 1256
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1257 1257
 					// or
1258 1258
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1259 1259
 					if ($type != 'bank-transfer') {
1260
-						$dir = $conf->prelevement->dir_output . '/receipts';
1260
+						$dir = $conf->prelevement->dir_output.'/receipts';
1261 1261
 					} else {
1262
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1262
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1263 1263
 					}
1264 1264
 					if (!is_dir($dir)) {
1265 1265
 						dol_mkdir($dir);
@@ -1267,41 +1267,41 @@  discard block
 block discarded – undo
1267 1267
 
1268 1268
 					if (isModEnabled('multicompany')) {
1269 1269
 						$labelentity = $conf->entity;
1270
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1270
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1271 1271
 					} else {
1272
-						$this->filename = $dir . '/' . $ref . '.xml';
1272
+						$this->filename = $dir.'/'.$ref.'.xml';
1273 1273
 					}
1274 1274
 
1275 1275
 					// Create withdraw order in database
1276
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1276
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1277 1277
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1278 1278
 					$sql .= ") VALUES (";
1279
-					$sql .= "'" . $this->db->escape($ref) . "'";
1280
-					$sql .= ", " . ((int) $conf->entity);
1281
-					$sql .= ", '" . $this->db->idate($now) . "'";
1282
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1283
-					$sql .= ", " . ((int) $fk_bank_account);
1279
+					$sql .= "'".$this->db->escape($ref)."'";
1280
+					$sql .= ", ".((int) $conf->entity);
1281
+					$sql .= ", '".$this->db->idate($now)."'";
1282
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1283
+					$sql .= ", ".((int) $fk_bank_account);
1284 1284
 					$sql .= ")";
1285 1285
 
1286 1286
 					$resql = $this->db->query($sql);
1287 1287
 
1288 1288
 
1289 1289
 					if ($resql) {
1290
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1290
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1291 1291
 						$this->id = $prev_id;
1292 1292
 						$this->ref = $ref;
1293 1293
 					} else {
1294 1294
 						$error++;
1295
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1295
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1296 1296
 					}
1297 1297
 				} else {
1298 1298
 					$error++;
1299
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1299
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1300 1300
 				}
1301 1301
 			}
1302 1302
 
1303 1303
 			if (!$error) {
1304
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1304
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1305 1305
 
1306 1306
 				// Add lines for the bon
1307 1307
 				if (count($factures_prev) > 0) {
@@ -1330,17 +1330,17 @@  discard block
 block discarded – undo
1330 1330
 						}
1331 1331
 
1332 1332
 						// Update invoice requests as done
1333
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1333
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1334 1334
 						$sql .= " SET traite = 1";
1335
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1336
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1337
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1335
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1336
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1337
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1338 1338
 
1339 1339
 						$resql = $this->db->query($sql);
1340 1340
 						if (!$resql) {
1341 1341
 							$error++;
1342 1342
 							$this->errors[] = $this->db->lasterror();
1343
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1343
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1344 1344
 						}
1345 1345
 					}
1346 1346
 				}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1352 1352
 				 */
1353 1353
 
1354
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1354
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1355 1355
 
1356 1356
 				if (count($factures_prev) > 0) {
1357 1357
 					$this->date_echeance = $datetimeprev;
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 						$this->emetteur_iban               = $account->iban;
1368 1368
 						$this->emetteur_bic                = $account->bic;
1369 1369
 
1370
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1370
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1371 1371
 
1372 1372
 						$this->raison_sociale = $account->proprio;
1373 1373
 					}
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 						$error++;
1387 1387
 					}
1388 1388
 				}
1389
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1389
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1390 1390
 			}
1391 1391
 
1392 1392
 
@@ -1394,15 +1394,15 @@  discard block
 block discarded – undo
1394 1394
 			 * Update total defined after generation of file
1395 1395
 			 */
1396 1396
 			if (!$error) {
1397
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1398
-				$sql .= " SET amount = " . price2num($this->total);
1399
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1400
-				$sql .= " AND entity = " . ((int) $conf->entity);
1397
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1398
+				$sql .= " SET amount = ".price2num($this->total);
1399
+				$sql .= " WHERE rowid = ".((int) $this->id);
1400
+				$sql .= " AND entity = ".((int) $conf->entity);
1401 1401
 				$resql = $this->db->query($sql);
1402 1402
 
1403 1403
 				if (!$resql) {
1404 1404
 					$error++;
1405
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1405
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1406 1406
 				}
1407 1407
 			}
1408 1408
 
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
 			if (!$error) {
1424 1424
 				$this->db->commit();
1425
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1425
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1426 1426
 			} else {
1427 1427
 				$this->db->rollback();
1428 1428
 				return -1;
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 
1463 1463
 		if (!$error) {
1464
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")";
1464
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
1465 1465
 			$resql1 = $this->db->query($sql);
1466 1466
 			if (!$resql1) {
1467 1467
 				dol_print_error($this->db);
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 		}
1470 1470
 
1471 1471
 		if (!$error) {
1472
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1472
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1473 1473
 			$resql2 = $this->db->query($sql);
1474 1474
 			if (!$resql2) {
1475 1475
 				dol_print_error($this->db);
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 		}
1478 1478
 
1479 1479
 		if (!$error) {
1480
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1480
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1481 1481
 			$resql3 = $this->db->query($sql);
1482 1482
 			if (!$resql3) {
1483 1483
 				dol_print_error($this->db);
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		}
1486 1486
 
1487 1487
 		if (!$error) {
1488
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1488
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1489 1489
 			$resql4 = $this->db->query($sql);
1490 1490
 			if (!$resql4) {
1491 1491
 				dol_print_error($this->db);
@@ -1527,22 +1527,22 @@  discard block
 block discarded – undo
1527 1527
 			$labeltoshow = 'PaymentByBankTransfer';
1528 1528
 		}
1529 1529
 
1530
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1530
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1531 1531
 		$label .= '<br>';
1532
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1532
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1533 1533
 		if (isset($this->amount)) {
1534
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1534
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1535 1535
 		}
1536 1536
 		if (isset($this->date_trans)) {
1537
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1537
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1538 1538
 		}
1539 1539
 		/*if (isset($this->date_credit)) {
1540 1540
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1541 1541
 		}*/
1542 1542
 
1543
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1543
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1544 1544
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1545
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1545
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1546 1546
 		}
1547 1547
 
1548 1548
 		if ($option != 'nolink') {
@@ -1560,21 +1560,21 @@  discard block
 block discarded – undo
1560 1560
 		if (empty($notooltip)) {
1561 1561
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1562 1562
 				$label = $langs->trans("ShowMyObject");
1563
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1563
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1564 1564
 			}
1565
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1566
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1565
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1566
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1567 1567
 		} else {
1568
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1568
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1569 1569
 		}
1570 1570
 
1571
-		$linkstart = '<a href="' . $url . '"';
1572
-		$linkstart .= $linkclose . '>';
1571
+		$linkstart = '<a href="'.$url.'"';
1572
+		$linkstart .= $linkclose.'>';
1573 1573
 		$linkend = '</a>';
1574 1574
 
1575 1575
 		$result .= $linkstart;
1576 1576
 		if ($withpicto) {
1577
-			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1577
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1578 1578
 		}
1579 1579
 		if ($withpicto != 2) {
1580 1580
 			$result .= $this->ref;
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 */
1604 1604
 	public function deleteNotificationById($rowid)
1605 1605
 	{
1606
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1607
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1606
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1607
+		$sql .= " WHERE rowid = ".((int) $rowid);
1608 1608
 
1609 1609
 		if ($this->db->query($sql)) {
1610 1610
 			return 0;
@@ -1628,8 +1628,8 @@  discard block
 block discarded – undo
1628 1628
 			$userid = $user;
1629 1629
 		}
1630 1630
 
1631
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1632
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1631
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1632
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1633 1633
 
1634 1634
 		if ($this->db->query($sql)) {
1635 1635
 			return 0;
@@ -1661,15 +1661,15 @@  discard block
 block discarded – undo
1661 1661
 		if ($this->deleteNotification($user, $action) == 0) {
1662 1662
 			$now = dol_now();
1663 1663
 
1664
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1665
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1664
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1665
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1666 1666
 
1667
-			dol_syslog("adnotiff: " . $sql);
1667
+			dol_syslog("adnotiff: ".$sql);
1668 1668
 			if ($this->db->query($sql)) {
1669 1669
 				$result = 0;
1670 1670
 			} else {
1671 1671
 				$result = -1;
1672
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1672
+				dol_syslog(get_class($this)."::addNotification Error $result");
1673 1673
 			}
1674 1674
 		}
1675 1675
 
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 
1705 1705
 		$result = 0;
1706 1706
 
1707
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1707
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1708 1708
 
1709 1709
 		$this->file = fopen($this->filename, "w");
1710 1710
 		if ($this->file == false) {
@@ -1750,13 +1750,13 @@  discard block
 block discarded – undo
1750 1750
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1751 1751
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1752 1752
 				$sql .= " FROM";
1753
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1754
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1755
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1756
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1757
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1758
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1759
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1753
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1754
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1755
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1756
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1757
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1758
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1759
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1760 1760
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1761 1761
 				$sql .= " AND p.fk_facture = f.rowid";
1762 1762
 				$sql .= " AND f.fk_soc = soc.rowid";
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 					$nbtotalDrctDbtTxInf = $i;
1793 1793
 				} else {
1794 1794
 					$this->error = $this->db->lasterror();
1795
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1795
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1796 1796
 					$result = -2;
1797 1797
 				}
1798 1798
 
@@ -1809,26 +1809,26 @@  discard block
 block discarded – undo
1809 1809
 				 * SECTION CREATION SEPA FILE - ISO200022
1810 1810
 				 */
1811 1811
 				// SEPA File Header
1812
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1813
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1814
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1812
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1813
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1814
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1815 1815
 				// SEPA Group header
1816
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1817
-				fwrite($this->file, '			<MsgId>' . ('DD/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1818
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1819
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1820
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1821
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1822
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1823
-				fwrite($this->file, '				<Id>' . $CrLf);
1824
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1825
-				fwrite($this->file, '					<Othr>' . $CrLf);
1826
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1827
-				fwrite($this->file, '					</Othr>' . $CrLf);
1828
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1829
-				fwrite($this->file, '				</Id>' . $CrLf);
1830
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1831
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1816
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1817
+				fwrite($this->file, '			<MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1818
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1819
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1820
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1821
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1822
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1823
+				fwrite($this->file, '				<Id>'.$CrLf);
1824
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1825
+				fwrite($this->file, '					<Othr>'.$CrLf);
1826
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1827
+				fwrite($this->file, '					</Othr>'.$CrLf);
1828
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1829
+				fwrite($this->file, '				</Id>'.$CrLf);
1830
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1831
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1832 1832
 				// SEPA File Emetteur
1833 1833
 				if ($result != -2) {
1834 1834
 					fwrite($this->file, $fileEmetteurSection);
@@ -1838,9 +1838,9 @@  discard block
 block discarded – undo
1838 1838
 					fwrite($this->file, $fileDebiteurSection);
1839 1839
 				}
1840 1840
 				// SEPA FILE FOOTER
1841
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1842
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1843
-				fwrite($this->file, '</Document>' . $CrLf);
1841
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1842
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1843
+				fwrite($this->file, '</Document>'.$CrLf);
1844 1844
 			} else {
1845 1845
 				/**
1846 1846
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1872,13 +1872,13 @@  discard block
 block discarded – undo
1872 1872
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1873 1873
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1874 1874
 					$sql .= " FROM";
1875
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1876
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1877
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1878
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1879
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1880
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1881
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1875
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1876
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1877
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1878
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1879
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1880
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1881
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1882 1882
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1883 1883
 					$sql .= " AND p.fk_salary = s.rowid";
1884 1884
 					$sql .= " AND s.fk_user = u.rowid";
@@ -1889,13 +1889,13 @@  discard block
 block discarded – undo
1889 1889
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
1890 1890
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1891 1891
 					$sql .= " FROM";
1892
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1893
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
1894
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1895
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
1896
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
1897
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1898
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1892
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1893
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
1894
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1895
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
1896
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
1897
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1898
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1899 1899
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1900 1900
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
1901 1901
 					$sql .= " AND f.fk_soc = soc.rowid";
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
1923 1923
 						$refobj = $obj->reffac;
1924 1924
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
1925
-							$refobj = "SAL" . $obj->idfac;
1925
+							$refobj = "SAL".$obj->idfac;
1926 1926
 						}
1927 1927
 
1928 1928
 						$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 					$nbtotalDrctDbtTxInf = $i;
1934 1934
 				} else {
1935 1935
 					$this->error = $this->db->lasterror();
1936
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
1936
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
1937 1937
 					$result = -2;
1938 1938
 				}
1939 1939
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -1949,26 +1949,26 @@  discard block
 block discarded – undo
1949 1949
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
1950 1950
 				 */
1951 1951
 				// SEPA File Header
1952
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1953
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1954
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
1952
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1953
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1954
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
1955 1955
 				// SEPA Group header
1956
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1957
-				fwrite($this->file, '			<MsgId>' . ('TRF/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1958
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1959
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1960
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1961
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1962
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1963
-				fwrite($this->file, '				<Id>' . $CrLf);
1964
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1965
-				fwrite($this->file, '					<Othr>' . $CrLf);
1966
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1967
-				fwrite($this->file, '					</Othr>' . $CrLf);
1968
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1969
-				fwrite($this->file, '				</Id>' . $CrLf);
1970
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1971
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1956
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1957
+				fwrite($this->file, '			<MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1958
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1959
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1960
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1961
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1962
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1963
+				fwrite($this->file, '				<Id>'.$CrLf);
1964
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1965
+				fwrite($this->file, '					<Othr>'.$CrLf);
1966
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1967
+				fwrite($this->file, '					</Othr>'.$CrLf);
1968
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1969
+				fwrite($this->file, '				</Id>'.$CrLf);
1970
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1971
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1972 1972
 				// SEPA File Emetteur (mycompany)
1973 1973
 				if ($result != -2) {
1974 1974
 					fwrite($this->file, $fileEmetteurSection);
@@ -1978,9 +1978,9 @@  discard block
 block discarded – undo
1978 1978
 					fwrite($this->file, $fileCrediteurSection);
1979 1979
 				}
1980 1980
 				// SEPA FILE FOOTER
1981
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1982
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
1983
-				fwrite($this->file, '</Document>' . $CrLf);
1981
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1982
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
1983
+				fwrite($this->file, '</Document>'.$CrLf);
1984 1984
 			}
1985 1985
 		}
1986 1986
 
@@ -1989,10 +1989,10 @@  discard block
 block discarded – undo
1989 1989
 			if ($type != 'bank-transfer') {
1990 1990
 				$sql = "SELECT pl.amount";
1991 1991
 				$sql .= " FROM";
1992
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1993
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1994
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
1995
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1992
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1993
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1994
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
1995
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1996 1996
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1997 1997
 				$sql .= " AND p.fk_facture = f.rowid";
1998 1998
 
@@ -2015,10 +2015,10 @@  discard block
 block discarded – undo
2015 2015
 			} else {
2016 2016
 				$sql = "SELECT pl.amount";
2017 2017
 				$sql .= " FROM";
2018
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2019
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2020
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2021
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2018
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2019
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2020
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2021
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2022 2022
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2023 2023
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2024 2024
 				// Lines
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
2068 2068
 
2069 2069
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2070
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2070
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2071 2071
 	}
2072 2072
 
2073 2073
 
@@ -2106,11 +2106,11 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 		// Raison Sociale Destinataire C2
2108 2108
 
2109
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2109
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2110 2110
 
2111 2111
 		// Address optional D1
2112 2112
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2113
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2113
+		fwrite($this->file, substr($address."                         ", 0, 24));
2114 2114
 
2115 2115
 		// Zone Reservee D2
2116 2116
 
@@ -2122,17 +2122,17 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
 		// Numero de compte D4
2124 2124
 
2125
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2125
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2126 2126
 
2127 2127
 		// Zone E Montant
2128 2128
 
2129 2129
 		$montant = (round($amount, 2) * 100);
2130 2130
 
2131
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2131
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2132 2132
 
2133 2133
 		// Label F
2134 2134
 
2135
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2135
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2136 2136
 
2137 2137
 		// Code etablissement G1
2138 2138
 
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 			$row_somme = round((float) $row_somme, 2);
2184 2184
 		}
2185 2185
 
2186
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2186
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2187 2187
 
2188 2188
 		$CrLf = "\n";
2189 2189
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2198,61 +2198,61 @@  discard block
 block discarded – undo
2198 2198
 		if ($type != 'bank-transfer') {
2199 2199
 			// SEPA Paiement Information of buyer for Direct Debit
2200 2200
 			$XML_DEBITOR = '';
2201
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2202
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2201
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2202
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2203 2203
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2204
-			$XML_DEBITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2205
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2206
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2207
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2208
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2209
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2210
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2211
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2212
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2213
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2214
-			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0) {
2215
-				$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2216
-				$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2217
-				$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2218
-				$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2219
-				$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2204
+			$XML_DEBITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2205
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2206
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2207
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2208
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2209
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2210
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2211
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2212
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2213
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2214
+			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) {
2215
+				$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2216
+				$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2217
+				$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2218
+				$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2219
+				$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2220 2220
 			}
2221
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2222
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2223
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2224
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2221
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2222
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2223
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2224
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2225 2225
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2226
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2226
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2227 2227
 			if (trim($addressline1)) {
2228
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2228
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2229 2229
 			}
2230 2230
 			if (trim($addressline2)) {
2231
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2231
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2232 2232
 			}
2233
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2234
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2235
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2236
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2237
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2238
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2239
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2240
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2233
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2234
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2235
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2236
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2237
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2238
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2239
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2240
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2241 2241
 			// A string with some information on payment - 140 max
2242
-			$XML_DEBITOR .= '					<Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max
2243
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2244
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2242
+			$XML_DEBITOR .= '					<Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
2243
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2244
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2245 2245
 			return $XML_DEBITOR;
2246 2246
 		} else {
2247 2247
 			// SEPA Payment Information of seller for Credit Transfer
2248 2248
 			$XML_CREDITOR = '';
2249
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2250
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2249
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2250
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2251 2251
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2252
-			$XML_CREDITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2253
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2252
+			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2253
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2254 2254
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2255
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2255
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2256 2256
 
2257 2257
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2258 2258
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2260,18 +2260,18 @@  discard block
 block discarded – undo
2260 2260
 				} else {
2261 2261
 					$instrprty = 'NORM';
2262 2262
 				}
2263
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2264
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2265
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2266
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2267
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2268
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2269
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2270
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2263
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2264
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2265
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2266
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2267
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2268
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2269
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2270
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2271 2271
 			}
2272
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2272
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2273 2273
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2274
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2274
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2275 2275
 			/*
2276 2276
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2277 2277
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2282,35 +2282,35 @@  discard block
 block discarded – undo
2282 2282
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2283 2283
 			 */
2284 2284
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2285
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2286
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2287
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2288
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2289
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2290
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2291
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2292
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2293
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2285
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2286
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2287
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2288
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2289
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2290
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2291
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2292
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2293
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2294 2294
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2295
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2295
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2296 2296
 			if (trim($addressline1)) {
2297
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2297
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2298 2298
 			}
2299 2299
 			if (trim($addressline2)) {
2300
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2300
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2301 2301
 			}
2302
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2303
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2304
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2305
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2306
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2307
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2308
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2309
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2302
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2303
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2304
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2305
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2306
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2307
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2308
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2309
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2310 2310
 			// A string with some information on payment - 140 max
2311
-			$XML_CREDITOR .= '					<Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
2312
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2313
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2311
+			$XML_CREDITOR .= '					<Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
2312
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2313
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2314 2314
 			return $XML_CREDITOR;
2315 2315
 		}
2316 2316
 	}
@@ -2342,11 +2342,11 @@  discard block
 block discarded – undo
2342 2342
 
2343 2343
 		// Raison Sociale C2
2344 2344
 
2345
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2345
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2346 2346
 
2347 2347
 		// Ref of thirdparty on 7 characters
2348 2348
 
2349
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2349
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2350 2350
 
2351 2351
 		// Zone Reservee D1-2
2352 2352
 
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
 
2365 2365
 		// Numero de compte D4
2366 2366
 
2367
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2367
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2368 2368
 
2369 2369
 		// Zone Reservee E
2370 2370
 
@@ -2427,15 +2427,15 @@  discard block
 block discarded – undo
2427 2427
 			$this->emetteur_iban = $account->iban;
2428 2428
 			$this->emetteur_bic = $account->bic;
2429 2429
 
2430
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2430
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2431 2431
 
2432 2432
 			$this->raison_sociale = $account->proprio;
2433 2433
 		}
2434 2434
 
2435 2435
 		// Get pending payments
2436 2436
 		$sql = "SELECT rowid, ref";
2437
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2438
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2437
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2438
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2439 2439
 
2440 2440
 		$resql = $this->db->query($sql);
2441 2441
 		if ($resql) {
@@ -2452,45 +2452,45 @@  discard block
 block discarded – undo
2452 2452
 			if ($type != 'bank-transfer') {
2453 2453
 				// SEPA Paiement Information of my company for Direct Debit
2454 2454
 				$XML_SEPA_INFO = '';
2455
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2456
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DD/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2457
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2458
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2459
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2460
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2461
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2462
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2463
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2464
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2465
-				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2466
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2467
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2468
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2469
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2470
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2471
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2472
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2473
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2455
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2456
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2457
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2458
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2459
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2460
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2461
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2462
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2463
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2464
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2465
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2466
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2467
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2468
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2469
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2470
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2471
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2472
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2473
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2474 2474
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2475
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2475
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2476 2476
 				if ($addressline1) {
2477
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2477
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2478 2478
 				}
2479 2479
 				if ($addressline2) {
2480
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2480
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2481 2481
 				}
2482
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2483
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2484
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2485
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2486
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2487
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2488
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2489
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2490
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2491
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2492
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2493
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2482
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2483
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2484
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2485
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2486
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2487
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2488
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2489
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2490
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2491
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2492
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2493
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2494 2494
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2495 2495
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2496 2496
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2499,64 +2499,64 @@  discard block
 block discarded – undo
2499 2499
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2500 2500
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2501 2501
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2502
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2503
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2504
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2505
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2506
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2507
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2508
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2509
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2510
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2511
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2512
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2513
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2514
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2502
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2503
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2504
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2505
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2506
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2507
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2508
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2509
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2510
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2511
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2512
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2513
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2514
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2515 2515
 			} else {
2516 2516
 				// SEPA Paiement Information of my company for Credit Transfer
2517 2517
 				$XML_SEPA_INFO = '';
2518
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2519
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('TRF/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2520
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2518
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2519
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2520
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2521 2521
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2522
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2523
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2522
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2523
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2524 2524
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2525
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2526
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2527
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2528
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2529
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2530
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2531
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2532
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2533
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2525
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2526
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2527
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2528
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2529
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2530
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2531
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2532
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2533
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2534 2534
 				}
2535
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2536
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2537
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2538
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2539
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2535
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2536
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2537
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2538
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2539
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2540 2540
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2541
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2541
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2542 2542
 				if ($addressline1) {
2543
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2543
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2544 2544
 				}
2545 2545
 				if ($addressline2) {
2546
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2546
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2547 2547
 				}
2548
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2549
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2550
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2551
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2552
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2553
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2554
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2555
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2556
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2557
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2558
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2559
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2548
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2549
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2550
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2551
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2552
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2553
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2554
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2555
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2556
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2557
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2558
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2559
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2560 2560
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2561 2561
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2562 2562
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2565,7 +2565,7 @@  discard block
 block discarded – undo
2565 2565
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2566 2566
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2567 2567
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2568
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2568
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2569 2569
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2570 2570
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2571 2571
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2581 2581
 			}
2582 2582
 		} else {
2583
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2583
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2584 2584
 			$XML_SEPA_INFO = '';
2585 2585
 		}
2586 2586
 		return $XML_SEPA_INFO;
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
 
2633 2633
 		$montant = ($total * 100);
2634 2634
 
2635
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2635
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2636 2636
 
2637 2637
 		// Zone Reservee F
2638 2638
 
@@ -2789,18 +2789,18 @@  discard block
 block discarded – undo
2789 2789
 		$return .= img_picto('', $this->picto);
2790 2790
 		$return .= '</span>';
2791 2791
 		$return .= '<div class="info-box-content">';
2792
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2792
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2793 2793
 		if ($selected >= 0) {
2794
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2794
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2795 2795
 		}
2796 2796
 		if (property_exists($this, 'date_echeance')) {
2797
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>';
2797
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
2798 2798
 		}
2799 2799
 		if (property_exists($this, 'total')) {
2800
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2800
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2801 2801
 		}
2802 2802
 		if (method_exists($this, 'LibStatut')) {
2803
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2803
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2804 2804
 		}
2805 2805
 		$return .= '</div>';
2806 2806
 		$return .= '</div>';
@@ -2821,9 +2821,9 @@  discard block
 block discarded – undo
2821 2821
 			return 0;
2822 2822
 		}
2823 2823
 		if ($id) {
2824
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2825
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2826
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2824
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2825
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2826
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2827 2827
 			$sql .= " AND fk_user IS NOT NULL";
2828 2828
 
2829 2829
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/bom/tpl/objectline_title.tpl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,20 +80,20 @@
 block discarded – undo
80 80
 }
81 81
 if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
82 82
 	// Qty frozen
83
-	print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>';
83
+	print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
84 84
 
85 85
 	// Disable stock change
86
-	print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>';
86
+	print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
87 87
 
88 88
 	// Efficiency
89
-	print '<td class="linecolefficiency right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>';
89
+	print '<td class="linecolefficiency right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
90 90
 }
91 91
 
92 92
 // Service and workstations are active
93 93
 if ($filtertype == 1 && isModEnabled('workstation')) {
94 94
 	// Workstation
95 95
 	if (isModEnabled('workstation')) {
96
-		print '<td class="linecolworkstation">' .img_picto('', 'workstation', 'class="pictofixedwidth"').  $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
96
+		print '<td class="linecolworkstation">'.img_picto('', 'workstation', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans('DefaultWorkstation'), '').'</td>';
97 97
 	}
98 98
 }
99 99
 
Please login to merge, or discard this patch.