Completed
Branch develop (2e938f)
by
unknown
19:39
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)) ? '0' : $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/product/class/product.class.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public $price;
144 144
 
145
-	public $price_formated;			// used by takepos/ajax/ajax.php
145
+	public $price_formated; // used by takepos/ajax/ajax.php
146 146
 
147 147
 	/**
148 148
 	 * Selling price with tax
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public $price_ttc;
153 153
 
154
-	public $price_ttc_formated;		// used by takepos/ajax/ajax.php
154
+	public $price_ttc_formated; // used by takepos/ajax/ajax.php
155 155
 
156 156
 	/**
157 157
 	 * Minimum price net
@@ -404,20 +404,20 @@  discard block
 block discarded – undo
404 404
 
405 405
 	//! Metric of products
406 406
 	public $weight;
407
-	public $weight_units;	// scale -3, 0, 3, 6
407
+	public $weight_units; // scale -3, 0, 3, 6
408 408
 	public $length;
409
-	public $length_units;	// scale -3, 0, 3, 6
409
+	public $length_units; // scale -3, 0, 3, 6
410 410
 	public $width;
411
-	public $width_units;	// scale -3, 0, 3, 6
411
+	public $width_units; // scale -3, 0, 3, 6
412 412
 	public $height;
413
-	public $height_units;	// scale -3, 0, 3, 6
413
+	public $height_units; // scale -3, 0, 3, 6
414 414
 	public $surface;
415
-	public $surface_units;	// scale -3, 0, 3, 6
415
+	public $surface_units; // scale -3, 0, 3, 6
416 416
 	public $volume;
417
-	public $volume_units;	// scale -3, 0, 3, 6
417
+	public $volume_units; // scale -3, 0, 3, 6
418 418
 
419 419
 	public $net_measure;
420
-	public $net_measure_units;	// scale -3, 0, 3, 6
420
+	public $net_measure_units; // scale -3, 0, 3, 6
421 421
 
422 422
 	public $accountancy_code_sell;
423 423
 	public $accountancy_code_sell_intra;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
630 630
 		//'tosell'       =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
631 631
 		//'tobuy'        =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
632
-		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
632
+		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
633 633
 	);
634 634
 
635 635
 	/**
@@ -933,9 +933,9 @@  discard block
 block discarded – undo
933 933
 
934 934
 							// update accountancy for this entity
935 935
 							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
936
-								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity));
936
+								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
937 937
 
938
-								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
938
+								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
939 939
 								$sql .= " fk_product";
940 940
 								$sql .= ", entity";
941 941
 								$sql .= ", accountancy_code_buy";
@@ -946,13 +946,13 @@  discard block
 block discarded – undo
946 946
 								$sql .= ", accountancy_code_sell_export";
947 947
 								$sql .= ") VALUES (";
948 948
 								$sql .= $this->id;
949
-								$sql .= ", " . $conf->entity;
950
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
951
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
952
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
953
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
954
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
955
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
949
+								$sql .= ", ".$conf->entity;
950
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
951
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
952
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
953
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
954
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
955
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
956 956
 								$sql .= ")";
957 957
 								$result = $this->db->query($sql);
958 958
 								if (!$result) {
@@ -1332,12 +1332,12 @@  discard block
 block discarded – undo
1332 1332
 			$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null');
1333 1333
 			$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
1334 1334
 			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1335
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1336
-				$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1337
-				$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1338
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1339
-				$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1340
-				$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1335
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1336
+				$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1337
+				$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
1338
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1339
+				$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1340
+				$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
1341 1341
 			}
1342 1342
 			$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
1343 1343
 			$sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
@@ -1368,9 +1368,9 @@  discard block
 block discarded – undo
1368 1368
 
1369 1369
 				// update accountancy for this entity
1370 1370
 				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1371
-					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1371
+					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1372 1372
 
1373
-					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1373
+					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1374 1374
 					$sql .= " fk_product";
1375 1375
 					$sql .= ", entity";
1376 1376
 					$sql .= ", accountancy_code_buy";
@@ -1381,13 +1381,13 @@  discard block
 block discarded – undo
1381 1381
 					$sql .= ", accountancy_code_sell_export";
1382 1382
 					$sql .= ") VALUES (";
1383 1383
 					$sql .= $this->id;
1384
-					$sql .= ", " . $conf->entity;
1385
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1386
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1387
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1388
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1389
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1390
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1384
+					$sql .= ", ".$conf->entity;
1385
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1386
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1387
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1388
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1389
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1390
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1391 1391
 					$sql .= ")";
1392 1392
 					$result = $this->db->query($sql);
1393 1393
 					if (!$result) {
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 				}
1759 1759
 			} elseif (isset($this->multilangs[$key])) {
1760 1760
 				if (empty($this->multilangs["$key"]["label"])) {
1761
-					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1761
+					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1762 1762
 					return -1;
1763 1763
 				}
1764 1764
 
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	private function getArrayForPriceCompare($level = 0)
1955 1955
 	{
1956
-		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
1956
+		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
1957 1957
 
1958 1958
 		foreach ($testExit as $field) {
1959 1959
 			if (!isset($this->$field)) {
@@ -2597,12 +2597,12 @@  discard block
 block discarded – undo
2597 2597
 
2598 2598
 		//For MultiCompany
2599 2599
 		//PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2600
-		$separatedEntityPMP = false;	// Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2601
-		$separatedStock = false;		// Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2600
+		$separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2601
+		$separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2602 2602
 		$visibleWarehousesEntities = $conf->entity;
2603 2603
 		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2604 2604
 			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
2605
-				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2605
+				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2606 2606
 				if ($this->db->num_rows($checkPMPPerEntity) > 0) {
2607 2607
 					$separatedEntityPMP = true;
2608 2608
 				}
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
 			global $mc;
2611 2611
 			$separatedStock = true;
2612 2612
 			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) {
2613
-				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']);
2613
+				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']);
2614 2614
 			}
2615 2615
 		}
2616 2616
 		if ($separatedEntityPMP) {
@@ -2628,10 +2628,10 @@  discard block
 block discarded – undo
2628 2628
 		}
2629 2629
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2630 2630
 		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) {
2631
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
2631
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
2632 2632
 		}
2633 2633
 		if ($separatedStock) {
2634
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2634
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2635 2635
 		}
2636 2636
 
2637 2637
 		if ($id) {
@@ -2791,15 +2791,15 @@  discard block
 block discarded – undo
2791 2791
 						$sql .= " WHERE entity IN (".getEntity('productprice').")";
2792 2792
 						$sql .= " AND price_level=".((int) $i);
2793 2793
 						$sql .= " AND fk_product = ".((int) $this->id);
2794
-						$sql .= " ORDER BY date_price DESC, rowid DESC";	// Get the most recent line
2795
-						$sql .= " LIMIT 1";									// Only the first one
2794
+						$sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
2795
+						$sql .= " LIMIT 1"; // Only the first one
2796 2796
 						$resql = $this->db->query($sql);
2797 2797
 						if ($resql) {
2798 2798
 							$result = $this->db->fetch_array($resql);
2799 2799
 
2800 2800
 							$this->multiprices[$i] = $result ? $result["price"] : null;
2801 2801
 							$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
2802
-							$this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
2802
+							$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
2803 2803
 							$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
2804 2804
 							$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
2805 2805
 							// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -3024,7 +3024,7 @@  discard block
 block discarded – undo
3024 3024
 				$obj = $this->db->fetch_object($result);
3025 3025
 				$this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0;
3026 3026
 				$this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0;
3027
-				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;		// qty may be a float due to the SUM()
3027
+				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
3028 3028
 			} else {
3029 3029
 				$this->error = $this->db->error();
3030 3030
 				$error++;
@@ -4530,7 +4530,7 @@  discard block
 block discarded – undo
4530 4530
 				//Addition of a product with the highest rank +1
4531 4531
 				$sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4532 4532
 				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")";
4533
-				if (! $this->db->query($sql)) {
4533
+				if (!$this->db->query($sql)) {
4534 4534
 					dol_print_error($this->db);
4535 4535
 					return -1;
4536 4536
 				} else {
@@ -4651,7 +4651,7 @@  discard block
 block discarded – undo
4651 4651
 				$sql = "UPDATE ".$this->db->prefix()."product_association";
4652 4652
 				$sql .= " SET rang = ".((int) $cpt);
4653 4653
 				$sql .= " WHERE rowid = ".((int) $objrank->rowid);
4654
-				if (! $this->db->query($sql)) {
4654
+				if (!$this->db->query($sql)) {
4655 4655
 					dol_print_error($this->db);
4656 4656
 					return -1;
4657 4657
 				}
@@ -5087,7 +5087,7 @@  discard block
 block discarded – undo
5087 5087
 		if (isset($this->sousprods) && is_array($this->sousprods)) {
5088 5088
 			foreach ($this->sousprods as $prod_name => $desc_product) {
5089 5089
 				if (is_array($desc_product)) {
5090
-					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load);	// This set $this->res
5090
+					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res
5091 5091
 				}
5092 5092
 			}
5093 5093
 		}
@@ -5244,7 +5244,7 @@  discard block
 block discarded – undo
5244 5244
 		$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
5245 5245
 		$sql .= " ORDER BY pa.rang";
5246 5246
 
5247
-		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5247
+		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5248 5248
 
5249 5249
 		if ($level == 1) {
5250 5250
 			$alreadyfound = array($id => 1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediately
@@ -5335,7 +5335,7 @@  discard block
 block discarded – undo
5335 5335
 		if (!empty($this->entity)) {
5336 5336
 			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1);
5337 5337
 			if ($this->nbphoto > 0) {
5338
-				$datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>';
5338
+				$datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>';
5339 5339
 			}
5340 5340
 		}
5341 5341
 
@@ -5345,7 +5345,7 @@  discard block
 block discarded – undo
5345 5345
 			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
5346 5346
 		}
5347 5347
 		if (isset($this->status) && isset($this->status_buy)) {
5348
-			$datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
5348
+			$datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1);
5349 5349
 		}
5350 5350
 
5351 5351
 		if (!empty($this->ref)) {
@@ -5393,7 +5393,7 @@  discard block
 block discarded – undo
5393 5393
 				$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
5394 5394
 			}
5395 5395
 			if ($labelsurfacevolume) {
5396
-				$datas['surface'] = "<br>" . $labelsurfacevolume;
5396
+				$datas['surface'] = "<br>".$labelsurfacevolume;
5397 5397
 			}
5398 5398
 		}
5399 5399
 		if ($this->type == Product::TYPE_SERVICE && !empty($this->duration_value)) {
@@ -5435,9 +5435,9 @@  discard block
 block discarded – undo
5435 5435
 		}
5436 5436
 		// show categories for this record only in ajax to not overload lists
5437 5437
 		if (isModEnabled('category') && !$nofetch) {
5438
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5438
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5439 5439
 			$form = new Form($this->db);
5440
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5440
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5441 5441
 		}
5442 5442
 
5443 5443
 		return $datas;
@@ -5958,7 +5958,7 @@  discard block
 block discarded – undo
5958 5958
 		if (isModEnabled("supplier_order")) {
5959 5959
 			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4');
5960 5960
 			if (isset($includedraftpoforvirtual)) {
5961
-				$filterStatus = '0,1,2,'.$filterStatus;	// 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
5961
+				$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
5962 5962
 			}
5963 5963
 			$result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
5964 5964
 			if ($result < 0) {
@@ -6390,7 +6390,7 @@  discard block
 block discarded – undo
6390 6390
 		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
6391 6391
 			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
6392 6392
 			foreach ($dirsociete as $dirroot) {
6393
-				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6393
+				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6394 6394
 				if ($res) {
6395 6395
 					break;
6396 6396
 				}
@@ -6718,7 +6718,7 @@  discard block
 block discarded – undo
6718 6718
 	 */
6719 6719
 	public function getKanbanView($option = '', $arraydata = null)
6720 6720
 	{
6721
-		global $langs,$conf;
6721
+		global $langs, $conf;
6722 6722
 
6723 6723
 		$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
6724 6724
 
Please login to merge, or discard this patch.
htdocs/core/class/notify.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 				$this->fk_user = $obj->fk_user;
365 365
 				$this->email = $obj->email;
366 366
 				$this->threshold = $obj->threshold;
367
-				$this->context  = $obj->context;
367
+				$this->context = $obj->context;
368 368
 				$this->datec = $this->db->jdate($obj->datec);
369 369
 				$this->datem = $this->db->jdate($obj->datem);
370 370
 			}
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 					while ($i < $num) {
486 486
 						$obj = $this->db->fetch_object($resql);
487 487
 						// we want to notify only if contact is enable
488
-						if ($obj && $obj->status ==  1) {
488
+						if ($obj && $obj->status == 1) {
489 489
 							$newval2 = trim($obj->email);
490 490
 							$isvalid = isValidEmail($newval2);
491 491
 							if (empty($resarray[$newval2])) {
Please login to merge, or discard this patch.
htdocs/core/class/commonorder.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 		$return = 0;
85 85
 		foreach ($this->lines as $line) {
86 86
 			if (empty($line->fk_product) && !$ignoreFree) {
87
-				$return ++;
87
+				$return++;
88 88
 			} elseif ((int) $line->fk_product > 0) {
89 89
 				if ($product->fetch($line->fk_product) > 0) {
90
-					if ($product->status_buy) $return ++;
90
+					if ($product->status_buy) $return++;
91 91
 				}
92 92
 			}
93 93
 		}
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 	 * Boolean that indicates whether the product is available for sale '1' or not '0'
144 144
 	 * @var int
145 145
 	 */
146
-	public $product_tosell=0;
146
+	public $product_tosell = 0;
147 147
 
148 148
 	/**
149 149
 	 * Boolean that indicates whether the product is available for purchase '1' or not '0'
150 150
 	 * @var int
151 151
 	 */
152
-	public $product_tobuy=0;
152
+	public $product_tobuy = 0;
153 153
 
154 154
 	/**
155 155
 	 * Product description
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,9 @@
 block discarded – undo
87 87
 				$return ++;
88 88
 			} elseif ((int) $line->fk_product > 0) {
89 89
 				if ($product->fetch($line->fk_product) > 0) {
90
-					if ($product->status_buy) $return ++;
90
+					if ($product->status_buy) {
91
+						$return ++;
92
+					}
91 93
 				}
92 94
 			}
93 95
 		}
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -474,11 +474,11 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * Note: cond_reglement can not be aliased to cond_reglement!!!
476 476
 	 */
477
-	private $cond_reglement;  // Private to call DolDeprecationHandler
477
+	private $cond_reglement; // Private to call DolDeprecationHandler
478 478
 	/**
479 479
 	 * @var int|string Internal to detect deprecated access
480 480
 	 */
481
-	protected $depr_cond_reglement;  // Internal value for deprecation
481
+	protected $depr_cond_reglement; // Internal value for deprecation
482 482
 
483 483
 	/**
484 484
 	 * @var int 		Delivery address ID
@@ -535,12 +535,12 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @var float Multicurrency total localta1
537 537
 	 */
538
-	public $multicurrency_total_localtax1;	// not in database
538
+	public $multicurrency_total_localtax1; // not in database
539 539
 
540 540
 	/**
541 541
 	 * @var float Multicurrency total localtax2
542 542
 	 */
543
-	public $multicurrency_total_localtax2;	// not in database
543
+	public $multicurrency_total_localtax2; // not in database
544 544
 
545 545
 	/**
546 546
 	 * @var string
@@ -1025,17 +1025,17 @@  discard block
 block discarded – undo
1025 1025
 				}
1026 1026
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1027 1027
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1028
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1028
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1029 1029
 				} else {
1030
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1031
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1030
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1031
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1032 1032
 					$count++;
1033 1033
 				}
1034 1034
 			}
1035 1035
 			$data['closedivextra'] = '</div>';
1036 1036
 		}
1037 1037
 
1038
-		$hookmanager->initHooks(array($this->element . 'dao'));
1038
+		$hookmanager->initHooks(array($this->element.'dao'));
1039 1039
 		$parameters = array(
1040 1040
 			'tooltipcontentarray' => &$data,
1041 1041
 			'params' => $params,
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 		if ($source == 'external' || $source == 'thirdparty') {
1527 1527
 			$sql .= " AND tc.source = 'external'";
1528 1528
 			if ($status >= 0) {
1529
-				$sql .= " AND t.statut = ".((int) $status);	// t is llx_socpeople
1529
+				$sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople
1530 1530
 			}
1531 1531
 		}
1532 1532
 		$sql .= " AND tc.active = 1";
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
 		}
1911 1911
 
1912 1912
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1913
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1913
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1914 1914
 		$sql .= " LIMIT 1";
1915 1915
 
1916 1916
 		$query = $this->db->query($sql);
@@ -2202,9 +2202,9 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 		$oldvalue = null;
2204 2204
 		if ($trigkey) {
2205
-			$sql = "SELECT " . $field;
2206
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2207
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2205
+			$sql = "SELECT ".$field;
2206
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2207
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2208 2208
 
2209 2209
 			$resql = $this->db->query($sql);
2210 2210
 			if ($resql) {
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
 		// Triggers
2584 2584
 		if (!$error && !$notrigger) {
2585 2585
 			// Call triggers
2586
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2586
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2587 2587
 			if ($result < 0) {
2588 2588
 				$error++;
2589 2589
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
2950 2950
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
2951 2951
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
2952
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2952
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2953 2953
 			}
2954 2954
 			$sql .= ' WHERE rowid='.((int) $this->id);
2955 2955
 
@@ -3297,10 +3297,10 @@  discard block
 block discarded – undo
3297 3297
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3298 3298
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3299 3299
 		if (!$renum) {
3300
-			$sql .= " AND " . $fieldposition . " = 0";
3300
+			$sql .= " AND ".$fieldposition." = 0";
3301 3301
 		}
3302 3302
 		if ($renum) {
3303
-			$sql .= " AND " . $fieldposition . " <> 0";
3303
+			$sql .= " AND ".$fieldposition." <> 0";
3304 3304
 		}
3305 3305
 
3306 3306
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3321,7 +3321,7 @@  discard block
 block discarded – undo
3321 3321
 			if ($fk_parent_line) {
3322 3322
 				$sql .= ' AND fk_parent_line IS NULL';
3323 3323
 			}
3324
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3324
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3325 3325
 
3326 3326
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3327 3327
 			$resql = $this->db->query($sql);
@@ -3372,7 +3372,7 @@  discard block
 block discarded – undo
3372 3372
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3373 3373
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3374 3374
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3375
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3375
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3376 3376
 
3377 3377
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3378 3378
 		$resql = $this->db->query($sql);
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
 
3496 3496
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3497 3497
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3498
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3498
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3499 3499
 			if ($this->db->query($sql)) {
3500 3500
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
3501 3501
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3526,7 +3526,7 @@  discard block
 block discarded – undo
3526 3526
 
3527 3527
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3528 3528
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3529
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3529
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3530 3530
 			if ($this->db->query($sql)) {
3531 3531
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
3532 3532
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3552,7 +3552,7 @@  discard block
 block discarded – undo
3552 3552
 			$fieldposition = 'position';
3553 3553
 		}
3554 3554
 
3555
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3555
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3556 3556
 		$sql .= " WHERE rowid = ".((int) $rowid);
3557 3557
 
3558 3558
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3580,7 +3580,7 @@  discard block
 block discarded – undo
3580 3580
 
3581 3581
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3582 3582
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3583
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3583
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3584 3584
 		$resql = $this->db->query($sql);
3585 3585
 		if ($resql) {
3586 3586
 			$row = $this->db->fetch_row($resql);
@@ -3698,7 +3698,7 @@  discard block
 block discarded – undo
3698 3698
 			$newsuffix = '';
3699 3699
 		}
3700 3700
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3701
-			$fieldusermod =  "fk_user_mod";
3701
+			$fieldusermod = "fk_user_mod";
3702 3702
 		} elseif ($this->table_element == 'ecm_files') {
3703 3703
 			$fieldusermod = "fk_user_m";
3704 3704
 		} else {
@@ -3740,7 +3740,7 @@  discard block
 block discarded – undo
3740 3740
 						$trigger_name = 'EXPENSE_REPORT_MODIFY';
3741 3741
 						break;
3742 3742
 					default:
3743
-						$trigger_name = strtoupper($this->element) . '_MODIFY';
3743
+						$trigger_name = strtoupper($this->element).'_MODIFY';
3744 3744
 				}
3745 3745
 				$ret = $this->call_trigger($trigger_name, $user);
3746 3746
 				if ($ret < 0) {
@@ -4135,19 +4135,19 @@  discard block
 block discarded – undo
4135 4135
 		$this->db->begin();
4136 4136
 		$error = 0;
4137 4137
 
4138
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4138
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4139 4139
 		$sql .= "fk_source";
4140 4140
 		$sql .= ", sourcetype";
4141 4141
 		$sql .= ", fk_target";
4142 4142
 		$sql .= ", targettype";
4143 4143
 		$sql .= ") VALUES (";
4144 4144
 		$sql .= ((int) $origin_id);
4145
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4146
-		$sql .= ", " . ((int) $this->id);
4147
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4145
+		$sql .= ", '".$this->db->escape($origin)."'";
4146
+		$sql .= ", ".((int) $this->id);
4147
+		$sql .= ", '".$this->db->escape($targettype)."'";
4148 4148
 		$sql .= ")";
4149 4149
 
4150
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4150
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4151 4151
 		if ($this->db->query($sql)) {
4152 4152
 			if (!$notrigger) {
4153 4153
 				// Call trigger
@@ -4399,20 +4399,20 @@  discard block
 block discarded – undo
4399 4399
 		$this->db->begin();
4400 4400
 		$error = 0;
4401 4401
 
4402
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4402
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4403 4403
 		if ($updatesource) {
4404
-			$sql .= "fk_source = " . ((int) $sourceid);
4405
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4406
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4407
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4404
+			$sql .= "fk_source = ".((int) $sourceid);
4405
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4406
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4407
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4408 4408
 		} elseif ($updatetarget) {
4409
-			$sql .= "fk_target = " . ((int) $targetid);
4410
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4411
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4412
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4409
+			$sql .= "fk_target = ".((int) $targetid);
4410
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4411
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4412
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4413 4413
 		}
4414 4414
 
4415
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4415
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4416 4416
 		if ($this->db->query($sql)) {
4417 4417
 			if (!$notrigger) {
4418 4418
 				// Call trigger
@@ -4488,25 +4488,25 @@  discard block
 block discarded – undo
4488 4488
 		}
4489 4489
 
4490 4490
 		if (!$error) {
4491
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4491
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4492 4492
 			$sql .= " WHERE";
4493 4493
 			if ($rowid > 0) {
4494
-				$sql .= " rowid = " . ((int) $rowid);
4494
+				$sql .= " rowid = ".((int) $rowid);
4495 4495
 			} else {
4496 4496
 				if ($deletesource) {
4497
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4498
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'";
4497
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4498
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'";
4499 4499
 				} elseif ($deletetarget) {
4500
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4501
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4500
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4501
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'";
4502 4502
 				} else {
4503
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')";
4503
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')";
4504 4504
 					$sql .= " OR";
4505
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')";
4505
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')";
4506 4506
 				}
4507 4507
 			}
4508 4508
 
4509
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4509
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4510 4510
 			if (!$this->db->query($sql)) {
4511 4511
 				$this->error = $this->db->lasterror();
4512 4512
 				$this->errors[] = $this->error;
@@ -4671,14 +4671,14 @@  discard block
 block discarded – undo
4671 4671
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4672 4672
 		}
4673 4673
 		$sql .= " WHERE rowid = ".((int) $elementId);
4674
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4674
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4675 4675
 
4676 4676
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4677 4677
 		$resql = $this->db->query($sql);
4678 4678
 		if ($resql) {
4679 4679
 			$error = 0;
4680 4680
 
4681
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4681
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4682 4682
 
4683 4683
 			if ($nb_rows_affected > 0) {
4684 4684
 				if (empty($trigkey)) {
@@ -4723,7 +4723,7 @@  discard block
 block discarded – undo
4723 4723
 					if ($fieldstatus == 'tosell') {
4724 4724
 						$this->status = $status;
4725 4725
 					} elseif ($fieldstatus == 'tobuy') {
4726
-						$this->status_buy = $status;	// @phpstan-ignore-line
4726
+						$this->status_buy = $status; // @phpstan-ignore-line
4727 4727
 					} else {
4728 4728
 						$this->status = $status;
4729 4729
 					}
@@ -4831,7 +4831,7 @@  discard block
 block discarded – undo
4831 4831
 			return -1;
4832 4832
 		}
4833 4833
 
4834
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4834
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4835 4835
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
4836 4836
 		$tmparray = array_keys($this->childtables);
4837 4837
 		if (is_numeric($tmparray[0])) {
@@ -5905,7 +5905,7 @@  discard block
 block discarded – undo
5905 5905
 			$setsharekey = false;
5906 5906
 			if ($this->element == 'propal' || $this->element == 'proposal') {
5907 5907
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
5908
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
5908
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
5909 5909
 				}
5910 5910
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
5911 5911
 					$setsharekey = true;
@@ -5963,7 +5963,7 @@  discard block
 block discarded – undo
5963 5963
 				$ecmfile->gen_or_uploaded = 'generated';
5964 5964
 				$ecmfile->description = ''; // indexed content
5965 5965
 				$ecmfile->keywords = ''; // keyword content
5966
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
5966
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
5967 5967
 				$ecmfile->src_object_id   = $this->id;
5968 5968
 
5969 5969
 				$result = $ecmfile->create($user);
@@ -6015,7 +6015,7 @@  discard block
 block discarded – undo
6015 6015
 			$maxwidthmini = $tmparraysize['maxwidthmini'];
6016 6016
 			$maxheightmini = $tmparraysize['maxheightmini'];
6017 6017
 			//$quality = $tmparraysize['quality'];
6018
-			$quality = 50;	// For thumbs, we force quality to 50
6018
+			$quality = 50; // For thumbs, we force quality to 50
6019 6019
 
6020 6020
 			// Create small thumbs for company (Ratio is near 16/9)
6021 6021
 			// Used on logon for example
@@ -6115,8 +6115,8 @@  discard block
 block discarded – undo
6115 6115
 		// phpcs:enable
6116 6116
 		global $langs, $conf;
6117 6117
 
6118
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
6119
-			dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
6118
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
6119
+			dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
6120 6120
 			exit;
6121 6121
 		}
6122 6122
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6308,7 +6308,7 @@  discard block
 block discarded – undo
6308 6308
 		$savDisableCompute = $conf->disable_compute;
6309 6309
 		$conf->disable_compute = 1;
6310 6310
 
6311
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6311
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6312 6312
 
6313 6313
 		$conf->disable_compute = $savDisableCompute;
6314 6314
 
@@ -6370,7 +6370,7 @@  discard block
 block discarded – undo
6370 6370
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6371 6371
 			$sql = "SELECT rowid";
6372 6372
 			foreach ($optionsArray as $name => $label) {
6373
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6373
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6374 6374
 					$sql .= ", ".$name;
6375 6375
 				}
6376 6376
 				// use geo sql fonction to read as text
@@ -6423,7 +6423,7 @@  discard block
 block discarded – undo
6423 6423
 					 **/
6424 6424
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6425 6425
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6426
-							$this->array_options['options_' . $key] = null;
6426
+							$this->array_options['options_'.$key] = null;
6427 6427
 						}
6428 6428
 					}
6429 6429
 				}
@@ -6435,9 +6435,9 @@  discard block
 block discarded – undo
6435 6435
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6436 6436
 							//var_dump($conf->disable_compute);
6437 6437
 							if (empty($conf->disable_compute)) {
6438
-								global $objectoffield;        // We set a global variable to $objectoffield so
6439
-								$objectoffield = $this;        // we can use it inside computed formula
6440
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6438
+								global $objectoffield; // We set a global variable to $objectoffield so
6439
+								$objectoffield = $this; // we can use it inside computed formula
6440
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6441 6441
 							}
6442 6442
 						}
6443 6443
 					}
@@ -6618,7 +6618,7 @@  discard block
 block discarded – undo
6618 6618
 										// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6619 6619
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6620 6620
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6621
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6621
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6622 6622
 											} else {
6623 6623
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6624 6624
 											}
@@ -6629,7 +6629,7 @@  discard block
 block discarded – undo
6629 6629
 										// If value has changed
6630 6630
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6631 6631
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6632
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6632
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6633 6633
 											} else {
6634 6634
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6635 6635
 											}
@@ -6641,7 +6641,7 @@  discard block
 block discarded – undo
6641 6641
 									//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6642 6642
 									// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6643 6643
 									if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6644
-										$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6644
+										$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6645 6645
 									} else {
6646 6646
 										$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6647 6647
 									}
@@ -7066,7 +7066,7 @@  discard block
 block discarded – undo
7066 7066
 								if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) {	// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
7067 7067
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7068 7068
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
7069
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7069
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7070 7070
 										} else {
7071 7071
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7072 7072
 										}
@@ -7086,7 +7086,7 @@  discard block
 block discarded – undo
7086 7086
 								}
7087 7087
 							} else {
7088 7088
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7089
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7089
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7090 7090
 								} else {
7091 7091
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7092 7092
 								}
@@ -7608,7 +7608,7 @@  discard block
 block discarded – undo
7608 7608
 			if (is_array($param['options'])) {
7609 7609
 				$param_list = array_keys($param['options']);
7610 7610
 				$InfoFieldList = explode(":", $param_list[0], 5);
7611
-				if (! empty($InfoFieldList[4])) {
7611
+				if (!empty($InfoFieldList[4])) {
7612 7612
 					$pos = 0;
7613 7613
 					$parenthesisopen = 0;
7614 7614
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -7669,8 +7669,8 @@  discard block
 block discarded – undo
7669 7669
 					}
7670 7670
 
7671 7671
 					$sqlwhere = '';
7672
-					$sql = "SELECT " . $keyList;
7673
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7672
+					$sql = "SELECT ".$keyList;
7673
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7674 7674
 					if (!empty($InfoFieldList[4])) {
7675 7675
 						// can use SELECT request
7676 7676
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7687,18 +7687,18 @@  discard block
 block discarded – undo
7687 7687
 						// We have to join on extrafield table
7688 7688
 						$errstr = '';
7689 7689
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7690
-							$sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra";
7691
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2];
7692
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7690
+							$sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra";
7691
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2];
7692
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7693 7693
 						} else {
7694
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7694
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7695 7695
 						}
7696 7696
 					} else {
7697 7697
 						$sqlwhere .= ' WHERE 1=1';
7698 7698
 					}
7699 7699
 					// Some tables may have field, some other not. For the moment we disable it.
7700 7700
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7701
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7701
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7702 7702
 					}
7703 7703
 					$sql .= $sqlwhere;
7704 7704
 					//print $sql;
@@ -7710,7 +7710,7 @@  discard block
 block discarded – undo
7710 7710
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
7711 7711
 					}
7712 7712
 
7713
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
7713
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
7714 7714
 					$resql = $this->db->query($sql);
7715 7715
 					if ($resql) {
7716 7716
 						$out .= '<option value="0">&nbsp;</option>';
@@ -7726,7 +7726,7 @@  discard block
 block discarded – undo
7726 7726
 							if (count($fields_label) > 1) {
7727 7727
 								$notrans = true;
7728 7728
 								foreach ($fields_label as $field_toshow) {
7729
-									$labeltoshow .= $obj->$field_toshow . ' ';
7729
+									$labeltoshow .= $obj->$field_toshow.' ';
7730 7730
 								}
7731 7731
 							} else {
7732 7732
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7737,12 +7737,12 @@  discard block
 block discarded – undo
7737 7737
 								foreach ($fields_label as $field_toshow) {
7738 7738
 									$translabel = $langs->trans($obj->$field_toshow);
7739 7739
 									if ($translabel != $obj->$field_toshow) {
7740
-										$labeltoshow = dol_trunc($translabel) . ' ';
7740
+										$labeltoshow = dol_trunc($translabel).' ';
7741 7741
 									} else {
7742
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
7742
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
7743 7743
 									}
7744 7744
 								}
7745
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7745
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7746 7746
 							} else {
7747 7747
 								if (!$notrans) {
7748 7748
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -7756,34 +7756,34 @@  discard block
 block discarded – undo
7756 7756
 									$labeltoshow = '(not defined)';
7757 7757
 								}
7758 7758
 								if ($value == $obj->rowid) {
7759
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7759
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7760 7760
 								}
7761 7761
 
7762 7762
 								if (!empty($InfoFieldList[3]) && $parentField) {
7763
-									$parent = $parentName . ':' . $obj->{$parentField};
7763
+									$parent = $parentName.':'.$obj->{$parentField};
7764 7764
 									$isDependList = 1;
7765 7765
 								}
7766 7766
 
7767
-								$out .= '<option value="' . $obj->rowid . '"';
7767
+								$out .= '<option value="'.$obj->rowid.'"';
7768 7768
 								$out .= ($value == $obj->rowid ? ' selected' : '');
7769
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
7770
-								$out .= '>' . $labeltoshow . '</option>';
7769
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
7770
+								$out .= '>'.$labeltoshow.'</option>';
7771 7771
 							}
7772 7772
 
7773 7773
 							$i++;
7774 7774
 						}
7775 7775
 						$this->db->free($resql);
7776 7776
 					} else {
7777
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7777
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7778 7778
 					}
7779 7779
 				} else {
7780 7780
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7781 7781
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7782 7782
 					$out .= '<option value="0">&nbsp;</option>';
7783 7783
 					foreach ($data as $data_key => $data_value) {
7784
-						$out .= '<option value="' . $data_key . '"';
7784
+						$out .= '<option value="'.$data_key.'"';
7785 7785
 						$out .= ($value == $data_key ? ' selected' : '');
7786
-						$out .= '>' . $data_value . '</option>';
7786
+						$out .= '>'.$data_value.'</option>';
7787 7787
 					}
7788 7788
 				}
7789 7789
 			}
@@ -7850,8 +7850,8 @@  discard block
 block discarded – undo
7850 7850
 					}
7851 7851
 
7852 7852
 					$sqlwhere = '';
7853
-					$sql = "SELECT " . $keyList;
7854
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
7853
+					$sql = "SELECT ".$keyList;
7854
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
7855 7855
 					if (!empty($InfoFieldList[4])) {
7856 7856
 						// can use SELECT request
7857 7857
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7867,23 +7867,23 @@  discard block
 block discarded – undo
7867 7867
 
7868 7868
 						// We have to join on extrafield table
7869 7869
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7870
-							$sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra';
7871
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7870
+							$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
7871
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7872 7872
 						} else {
7873
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7873
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7874 7874
 						}
7875 7875
 					} else {
7876 7876
 						$sqlwhere .= ' WHERE 1=1';
7877 7877
 					}
7878 7878
 					// Some tables may have field, some other not. For the moment we disable it.
7879 7879
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7880
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7880
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7881 7881
 					}
7882 7882
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
7883 7883
 					// print $sql;
7884 7884
 
7885 7885
 					$sql .= $sqlwhere;
7886
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
7886
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
7887 7887
 					$resql = $this->db->query($sql);
7888 7888
 					if ($resql) {
7889 7889
 						$num = $this->db->num_rows($resql);
@@ -7901,7 +7901,7 @@  discard block
 block discarded – undo
7901 7901
 							if (count($fields_label) > 1) {
7902 7902
 								$notrans = true;
7903 7903
 								foreach ($fields_label as $field_toshow) {
7904
-									$labeltoshow .= $obj->$field_toshow . ' ';
7904
+									$labeltoshow .= $obj->$field_toshow.' ';
7905 7905
 								}
7906 7906
 							} else {
7907 7907
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7912,9 +7912,9 @@  discard block
 block discarded – undo
7912 7912
 								foreach ($fields_label as $field_toshow) {
7913 7913
 									$translabel = $langs->trans($obj->$field_toshow);
7914 7914
 									if ($translabel != $obj->$field_toshow) {
7915
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
7915
+										$labeltoshow = dol_trunc($translabel, 18).' ';
7916 7916
 									} else {
7917
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
7917
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
7918 7918
 									}
7919 7919
 								}
7920 7920
 
@@ -7937,7 +7937,7 @@  discard block
 block discarded – undo
7937 7937
 								}
7938 7938
 
7939 7939
 								if (!empty($InfoFieldList[3]) && $parentField) {
7940
-									$parent = $parentName . ':' . $obj->{$parentField};
7940
+									$parent = $parentName.':'.$obj->{$parentField};
7941 7941
 									$isDependList = 1;
7942 7942
 								}
7943 7943
 
@@ -7948,14 +7948,14 @@  discard block
 block discarded – undo
7948 7948
 						}
7949 7949
 						$this->db->free($resql);
7950 7950
 
7951
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
7951
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
7952 7952
 					} else {
7953
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7953
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7954 7954
 					}
7955 7955
 				} else {
7956 7956
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7957 7957
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7958
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
7958
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
7959 7959
 				}
7960 7960
 			}
7961 7961
 		} elseif ($type == 'link') {
@@ -8182,7 +8182,7 @@  discard block
 block discarded – undo
8182 8182
 			$value = $this->getLibStatut(3);
8183 8183
 		} elseif ($type == 'date') {
8184 8184
 			if (!empty($value)) {
8185
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8185
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8186 8186
 			} else {
8187 8187
 				$value = '';
8188 8188
 			}
@@ -8227,7 +8227,7 @@  discard block
 block discarded – undo
8227 8227
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8228 8228
 			if (strpos($value, "|") !== false) {
8229 8229
 				$value = $langs->trans(explode('|', $value)[0]);
8230
-			} elseif (! is_numeric($value)) {
8230
+			} elseif (!is_numeric($value)) {
8231 8231
 				$value = $langs->trans($value);
8232 8232
 			}
8233 8233
 		} elseif ($type == 'sellist') {
@@ -8289,9 +8289,9 @@  discard block
 block discarded – undo
8289 8289
 									$translabel = $langs->trans($obj->$field_toshow);
8290 8290
 								}
8291 8291
 								if ($translabel != $field_toshow) {
8292
-									$value .= dol_trunc($translabel, 18) . ' ';
8292
+									$value .= dol_trunc($translabel, 18).' ';
8293 8293
 								} else {
8294
-									$value .= $obj->$field_toshow . ' ';
8294
+									$value .= $obj->$field_toshow.' ';
8295 8295
 								}
8296 8296
 							}
8297 8297
 						} else {
@@ -8307,7 +8307,7 @@  discard block
 block discarded – undo
8307 8307
 						}
8308 8308
 					}
8309 8309
 				} else {
8310
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8310
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8311 8311
 
8312 8312
 					$toprint = array();
8313 8313
 					$obj = $this->db->fetch_object($resql);
@@ -8315,7 +8315,7 @@  discard block
 block discarded – undo
8315 8315
 					$c->fetch($obj->rowid);
8316 8316
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8317 8317
 					foreach ($ways as $way) {
8318
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8318
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8319 8319
 					}
8320 8320
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8321 8321
 				}
@@ -8331,11 +8331,11 @@  discard block
 block discarded – undo
8331 8331
 				$toprint = array();
8332 8332
 				foreach ($value_arr as $keyval => $valueval) {
8333 8333
 					if (!empty($valueval)) {
8334
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8334
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8335 8335
 					}
8336 8336
 				}
8337 8337
 				if (!empty($toprint)) {
8338
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8338
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8339 8339
 				}
8340 8340
 			}
8341 8341
 		} elseif ($type == 'chkbxlst') {
@@ -8390,9 +8390,9 @@  discard block
 block discarded – undo
8390 8390
 										$translabel = $langs->trans($obj->$field_toshow);
8391 8391
 									}
8392 8392
 									if ($translabel != $field_toshow) {
8393
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8393
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8394 8394
 									} else {
8395
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8395
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8396 8396
 									}
8397 8397
 								}
8398 8398
 							} else {
@@ -8401,15 +8401,15 @@  discard block
 block discarded – undo
8401 8401
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8402 8402
 								}
8403 8403
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8404
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8404
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8405 8405
 								} else {
8406
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8406
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8407 8407
 								}
8408 8408
 							}
8409 8409
 						}
8410 8410
 					}
8411 8411
 				} else {
8412
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8412
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8413 8413
 
8414 8414
 					$toprint = array();
8415 8415
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8418,7 +8418,7 @@  discard block
 block discarded – undo
8418 8418
 							$c->fetch($obj->rowid);
8419 8419
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8420 8420
 							foreach ($ways as $way) {
8421
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8421
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8422 8422
 							}
8423 8423
 						}
8424 8424
 					}
@@ -8571,7 +8571,7 @@  discard block
 block discarded – undo
8571 8571
 		global $langs;
8572 8572
 
8573 8573
 		if (!class_exists('Validate')) {
8574
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
8574
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
8575 8575
 		}
8576 8576
 
8577 8577
 		$this->clearFieldError($fieldKey);
@@ -8803,7 +8803,7 @@  discard block
 block discarded – undo
8803 8803
 				$out .= "\n";
8804 8804
 
8805 8805
 				$nbofextrafieldsshown = 0;
8806
-				$e = 0;	// var to manage the modulo (odd/even)
8806
+				$e = 0; // var to manage the modulo (odd/even)
8807 8807
 
8808 8808
 				$lastseparatorkeyfound = '';
8809 8809
 				$extrafields_collapse_num = '';
@@ -8891,7 +8891,7 @@  discard block
 block discarded – undo
8891 8891
 									$value = $getposttemp;
8892 8892
 								}
8893 8893
 							} elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('int'))) {
8894
-								$value =( !empty($this->array_options["options_".$key]) || $this->array_options["options_".$key] === '0' ) ? $this->array_options["options_".$key] : '';
8894
+								$value = (!empty($this->array_options["options_".$key]) || $this->array_options["options_".$key] === '0') ? $this->array_options["options_".$key] : '';
8895 8895
 							} else {
8896 8896
 								$value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object.
8897 8897
 							}
@@ -9895,7 +9895,7 @@  discard block
 block discarded – undo
9895 9895
 						continue;
9896 9896
 					}
9897 9897
 				}
9898
-				$keys_with_alias[] = $alias . '.' . $fieldname;
9898
+				$keys_with_alias[] = $alias.'.'.$fieldname;
9899 9899
 			}
9900 9900
 			return implode(',', $keys_with_alias);
9901 9901
 		} else {
@@ -10030,7 +10030,7 @@  discard block
 block discarded – undo
10030 10030
 		if (!$error) {
10031 10031
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10032 10032
 			$sql .= " (".implode(", ", $keys).')';
10033
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10033
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10034 10034
 
10035 10035
 			$res = $this->db->query($sql);
10036 10036
 			if (!$res) {
@@ -10327,7 +10327,7 @@  discard block
 block discarded – undo
10327 10327
 
10328 10328
 		// Update extrafield
10329 10329
 		if (!$error) {
10330
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
10330
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
10331 10331
 			if ($result < 0) {
10332 10332
 				$error++;
10333 10333
 			}
@@ -10529,12 +10529,12 @@  discard block
 block discarded – undo
10529 10529
 				$error++;
10530 10530
 			} else {
10531 10531
 				while ($obj = $this->db->fetch_object($resql)) {
10532
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
10532
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
10533 10533
 					if ($result < 0) {
10534 10534
 						$error++;
10535 10535
 						$this->errors[] = $this->error;
10536 10536
 					} else {
10537
-						$result = $this->delete($user);	// @phpstan-ignore-line
10537
+						$result = $this->delete($user); // @phpstan-ignore-line
10538 10538
 						if ($result < 0) {
10539 10539
 							$error++;
10540 10540
 							$this->errors[] = $this->error;
@@ -10750,7 +10750,7 @@  discard block
 block discarded – undo
10750 10750
 		);
10751 10751
 		foreach ($fields as $key => $value) {
10752 10752
 			if (array_key_exists($key, $this->fields)) {
10753
-				$this->{$key} = $value;		// @phpstan-ignore-line
10753
+				$this->{$key} = $value; // @phpstan-ignore-line
10754 10754
 			}
10755 10755
 		}
10756 10756
 
Please login to merge, or discard this patch.
htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$this->db = $db;
91 91
 		$this->name = "cornas";
92 92
 		$this->description = $langs->trans('SuppliersCommandModel');
93
-		$this->update_main_doc_field = 1;		// Save the name of generated file as the main doc when generating a doc with this template
93
+		$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
94 94
 
95 95
 		// Page size for A4 format
96 96
 		$this->type = 'pdf';
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 				$pdf->SetFont(pdf_getPDFFont($outputlangs));
280 280
 				// Set path to the background PDF File
281 281
 				if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) {
282
-					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
282
+					$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND'));
283 283
 					$tplidx = $pdf->importPage(1);
284 284
 				}
285 285
 
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 		$top_shift = 0;
1334 1334
 		// Show list of linked objects
1335 1335
 		$current_y = $pdf->getY();
1336
-		$posx = $posx+10;
1336
+		$posx = $posx + 10;
1337 1337
 		$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
1338 1338
 		if ($current_y < $pdf->getY()) {
1339 1339
 			$top_shift = $pdf->getY() - $current_y;
Please login to merge, or discard this patch.
htdocs/bom/tpl/objectline_title.tpl.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,29 +73,29 @@
 block discarded – undo
73 73
 
74 74
 if ($filtertype != 1) {
75 75
 	if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
76
-		print '<td class="linecoluseunit">' . $langs->trans('Unit') . '</td>';
76
+		print '<td class="linecoluseunit">'.$langs->trans('Unit').'</td>';
77 77
 	}
78 78
 
79 79
 	// Qty frozen
80
-	print '<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>';
80
+	print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
81 81
 
82 82
 	// Disable stock change
83
-	print '<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . '</td>';
83
+	print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
84 84
 
85 85
 	// Efficiency
86
-	print '<td class="linecolefficiency right">' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . '</td>';
86
+	print '<td class="linecolefficiency right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
87 87
 
88 88
 	// Cost
89 89
 	print '<td class="linecolcost right">'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td>';
90 90
 } else {
91
-	print '<td class="linecolunit">' . $form->textwithpicto($langs->trans('Unit'), '').'</td>';
91
+	print '<td class="linecolunit">'.$form->textwithpicto($langs->trans('Unit'), '').'</td>';
92 92
 
93 93
 	// Qty frozen
94
-	print '<td class="linecolqtyfrozen right">' .$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . '</td>';
94
+	print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
95 95
 
96 96
 	// Workstation
97 97
 	if (isModEnabled('workstation')) {
98
-		print '<td class="linecolworkstation">' .  $form->textwithpicto($langs->trans('DefaultWorkstation'), '') . '</td>';
98
+		print '<td class="linecolworkstation">'.$form->textwithpicto($langs->trans('DefaultWorkstation'), '').'</td>';
99 99
 	}
100 100
 
101 101
 	// Cost
Please login to merge, or discard this patch.
htdocs/bom/bom_net_needs.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 $formfile = new FormFile($db);
134 134
 
135 135
 $title = $langs->trans('BOM');
136
-$help_url ='EN:Module_BOM';
136
+$help_url = 'EN:Module_BOM';
137 137
 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bom page-net_needs');
138 138
 
139 139
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	print "<thead>\n";
215 215
 	print '<tr class="liste_titre nodrag nodrop">';
216 216
 	print '<td class="linecoldescription">'.$langs->trans('Product');
217
-	if (getDolGlobalString('BOM_SUB_BOM')  && $action == 'treeview') {
217
+	if (getDolGlobalString('BOM_SUB_BOM') && $action == 'treeview') {
218 218
 		print ' &nbsp; <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
219 219
 		print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
220 220
 	}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 		print '<td class="left">'.$langs->trans('ProducedBy').'</td>';
224 224
 	}
225 225
 	print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>';
226
-	print '<td></td>';	// For unit
226
+	print '<td></td>'; // For unit
227 227
 	print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
228 228
 	print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
229 229
 	print  '</tr>';
Please login to merge, or discard this patch.
htdocs/mrp/mo_movements.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
 
55 55
 $msid  = GETPOSTINT('msid');
56 56
 
57
-$year  = GETPOST("year");		// TODO Rename into search_year
58
-$month = GETPOST("month");		// TODO Rename into search_month
57
+$year  = GETPOST("year"); // TODO Rename into search_year
58
+$month = GETPOST("month"); // TODO Rename into search_month
59 59
 
60 60
 $search_ref = GETPOST('search_ref', 'alpha');
61 61
 $search_movement = GETPOST("search_movement", 'alpha');
Please login to merge, or discard this patch.