Completed
Branch develop (c4c55b)
by
unknown
23:14
created
htdocs/product/class/product.class.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'),
88 88
 		'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'),
89 89
 		'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'),
90
-		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo' ),
90
+		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo'),
91 91
 		'bom_bom' => array('name' => 'BOM'),
92 92
 		'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom'),
93 93
 	);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @var string
157 157
 	 */
158
-	public $price_formated;			// used by takepos/ajax/ajax.php
158
+	public $price_formated; // used by takepos/ajax/ajax.php
159 159
 
160 160
 	/**
161 161
 	 * Selling price with tax
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	/**
168 168
 	 * @var string
169 169
 	 */
170
-	public $price_ttc_formated;		// used by takepos/ajax/ajax.php
170
+	public $price_ttc_formated; // used by takepos/ajax/ajax.php
171 171
 
172 172
 	/**
173 173
 	 * Minimum price net
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @var int|string
519 519
 	 */
520
-	public $weight_units;	// scale -3, 0, 3, 6
520
+	public $weight_units; // scale -3, 0, 3, 6
521 521
 	/**
522 522
 	 * @var float|string
523 523
 	 */
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	/**
526 526
 	 * @var int|string
527 527
 	 */
528
-	public $length_units;	// scale -3, 0, 3, 6
528
+	public $length_units; // scale -3, 0, 3, 6
529 529
 	/**
530 530
 	 * @var float|string
531 531
 	 */
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	/**
534 534
 	 * @var int|string
535 535
 	 */
536
-	public $width_units;	// scale -3, 0, 3, 6
536
+	public $width_units; // scale -3, 0, 3, 6
537 537
 	/**
538 538
 	 * @var float|string|null
539 539
 	 */
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	/**
542 542
 	 * @var int|string|null
543 543
 	 */
544
-	public $height_units;	// scale -3, 0, 3, 6
544
+	public $height_units; // scale -3, 0, 3, 6
545 545
 	/**
546 546
 	 * @var float|string|null
547 547
 	 */
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	/**
550 550
 	 * @var int|string|null
551 551
 	 */
552
-	public $surface_units;	// scale -3, 0, 3, 6
552
+	public $surface_units; // scale -3, 0, 3, 6
553 553
 	/**
554 554
 	 * @var float|string|null
555 555
 	 */
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	/**
558 558
 	 * @var int|string|null
559 559
 	 */
560
-	public $volume_units;	// scale -3, 0, 3, 6
560
+	public $volume_units; // scale -3, 0, 3, 6
561 561
 
562 562
 	/**
563 563
 	 * @var float|string|null
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	/**
567 567
 	 * @var ?string
568 568
 	 */
569
-	public $net_measure_units;	// scale -3, 0, 3, 6
569
+	public $net_measure_units; // scale -3, 0, 3, 6
570 570
 
571 571
 	/**
572 572
 	 * @var string
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
820 820
 		//'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')),
821 821
 		//'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')),
822
-		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
822
+		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
823 823
 	);
824 824
 
825 825
 	/**
@@ -1123,9 +1123,9 @@  discard block
 block discarded – undo
1123 1123
 
1124 1124
 							// update accountancy for this entity
1125 1125
 							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1126
-								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1126
+								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1127 1127
 
1128
-								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1128
+								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1129 1129
 								$sql .= " fk_product";
1130 1130
 								$sql .= ", entity";
1131 1131
 								$sql .= ", accountancy_code_buy";
@@ -1136,13 +1136,13 @@  discard block
 block discarded – undo
1136 1136
 								$sql .= ", accountancy_code_sell_export";
1137 1137
 								$sql .= ") VALUES (";
1138 1138
 								$sql .= $this->id;
1139
-								$sql .= ", " . ((int) $conf->entity);
1140
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1141
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1142
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1143
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1144
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1145
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1139
+								$sql .= ", ".((int) $conf->entity);
1140
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1141
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1142
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1143
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1144
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1145
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1146 1146
 								$sql .= ")";
1147 1147
 								$result = $this->db->query($sql);
1148 1148
 								if (!$result) {
@@ -1523,12 +1523,12 @@  discard block
 block discarded – undo
1523 1523
 			$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null');
1524 1524
 			$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
1525 1525
 			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1526
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1527
-				$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1528
-				$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1529
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1530
-				$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1531
-				$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1526
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1527
+				$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1528
+				$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
1529
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1530
+				$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1531
+				$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
1532 1532
 			}
1533 1533
 			$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
1534 1534
 			$sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
@@ -1559,9 +1559,9 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
 				// update accountancy for this entity
1561 1561
 				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1562
-					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1562
+					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1563 1563
 
1564
-					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1564
+					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1565 1565
 					$sql .= " fk_product";
1566 1566
 					$sql .= ", entity";
1567 1567
 					$sql .= ", accountancy_code_buy";
@@ -1572,13 +1572,13 @@  discard block
 block discarded – undo
1572 1572
 					$sql .= ", accountancy_code_sell_export";
1573 1573
 					$sql .= ") VALUES (";
1574 1574
 					$sql .= ((int) $this->id);
1575
-					$sql .= ", " . ((int) $conf->entity);
1576
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1577
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1578
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1579
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1580
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1581
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1575
+					$sql .= ", ".((int) $conf->entity);
1576
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1577
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1578
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1579
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1580
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1581
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1582 1582
 					$sql .= ")";
1583 1583
 					$result = $this->db->query($sql);
1584 1584
 					if (!$result) {
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 								$error++;
1657 1657
 							} else {
1658 1658
 								// to keep old entries with the new dir
1659
-								require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
1659
+								require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
1660 1660
 								$ecmfiles = new EcmFiles($this->db);
1661 1661
 								$ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref));
1662 1662
 							}
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 				}
1955 1955
 			} elseif (isset($this->multilangs[$key])) {
1956 1956
 				if (empty($this->multilangs[$key]["label"])) {
1957
-					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1957
+					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1958 1958
 					return -1;
1959 1959
 				}
1960 1960
 
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 	 */
2150 2150
 	private function getArrayForPriceCompare($level = 0)
2151 2151
 	{
2152
-		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
2152
+		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
2153 2153
 
2154 2154
 		foreach ($testExit as $field) {
2155 2155
 			if (!isset($this->$field)) {
@@ -2793,12 +2793,12 @@  discard block
 block discarded – undo
2793 2793
 
2794 2794
 		//For MultiCompany
2795 2795
 		//PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2796
-		$separatedEntityPMP = false;	// Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2797
-		$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.
2796
+		$separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2797
+		$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.
2798 2798
 		$visibleWarehousesEntities = $conf->entity;
2799 2799
 		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2800 2800
 			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
2801
-				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2801
+				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2802 2802
 				if ($this->db->num_rows($checkPMPPerEntity) > 0) {
2803 2803
 					$separatedEntityPMP = true;
2804 2804
 				}
@@ -2806,7 +2806,7 @@  discard block
 block discarded – undo
2806 2806
 			global $mc;
2807 2807
 			$separatedStock = true;
2808 2808
 			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) {
2809
-				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']);
2809
+				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']);
2810 2810
 			}
2811 2811
 		}
2812 2812
 		if ($separatedEntityPMP) {
@@ -2824,10 +2824,10 @@  discard block
 block discarded – undo
2824 2824
 		}
2825 2825
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2826 2826
 		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) {
2827
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
2827
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
2828 2828
 		}
2829 2829
 		if ($separatedStock) {
2830
-			$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)."))";
2830
+			$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)."))";
2831 2831
 		}
2832 2832
 
2833 2833
 		if ($id) {
@@ -2987,15 +2987,15 @@  discard block
 block discarded – undo
2987 2987
 						$sql .= " WHERE entity IN (".getEntity('productprice').")";
2988 2988
 						$sql .= " AND price_level=".((int) $i);
2989 2989
 						$sql .= " AND fk_product = ".((int) $this->id);
2990
-						$sql .= " ORDER BY date_price DESC, rowid DESC";	// Get the most recent line
2991
-						$sql .= " LIMIT 1";									// Only the first one
2990
+						$sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
2991
+						$sql .= " LIMIT 1"; // Only the first one
2992 2992
 						$resql = $this->db->query($sql);
2993 2993
 						if ($resql) {
2994 2994
 							$result = $this->db->fetch_array($resql);
2995 2995
 
2996 2996
 							$this->multiprices[$i] = $result ? $result["price"] : null;
2997 2997
 							$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
2998
-							$this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
2998
+							$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
2999 2999
 							$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
3000 3000
 							$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
3001 3001
 							// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -3220,7 +3220,7 @@  discard block
 block discarded – undo
3220 3220
 				$obj = $this->db->fetch_object($result);
3221 3221
 				$this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0;
3222 3222
 				$this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0;
3223
-				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;		// qty may be a float due to the SUM()
3223
+				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
3224 3224
 			} else {
3225 3225
 				$this->error = $this->db->error();
3226 3226
 				$error++;
@@ -4723,7 +4723,7 @@  discard block
 block discarded – undo
4723 4723
 				//Addition of a product with the highest rank +1
4724 4724
 				$sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4725 4725
 				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")";
4726
-				if (! $this->db->query($sql)) {
4726
+				if (!$this->db->query($sql)) {
4727 4727
 					dol_print_error($this->db);
4728 4728
 					return -1;
4729 4729
 				} else {
@@ -4844,7 +4844,7 @@  discard block
 block discarded – undo
4844 4844
 				$sql = "UPDATE ".$this->db->prefix()."product_association";
4845 4845
 				$sql .= " SET rang = ".((int) $cpt);
4846 4846
 				$sql .= " WHERE rowid = ".((int) $objrank->rowid);
4847
-				if (! $this->db->query($sql)) {
4847
+				if (!$this->db->query($sql)) {
4848 4848
 					dol_print_error($this->db);
4849 4849
 					return -1;
4850 4850
 				}
@@ -5279,7 +5279,7 @@  discard block
 block discarded – undo
5279 5279
 		if (isset($this->sousprods) && is_array($this->sousprods)) {
5280 5280
 			foreach ($this->sousprods as $prod_name => $desc_product) {
5281 5281
 				if (is_array($desc_product)) {
5282
-					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load);	// This set $this->res
5282
+					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res
5283 5283
 				}
5284 5284
 			}
5285 5285
 		}
@@ -5435,7 +5435,7 @@  discard block
 block discarded – undo
5435 5435
 		$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
5436 5436
 		$sql .= " ORDER BY pa.rang";
5437 5437
 
5438
-		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5438
+		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5439 5439
 
5440 5440
 		if ($level == 1) {
5441 5441
 			$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
@@ -5500,7 +5500,7 @@  discard block
 block discarded – undo
5500 5500
 			$parent[$this->label][$keyChild] = $valueChild;
5501 5501
 		}
5502 5502
 		foreach ($parent as $key => $value) {        // key=label, value is array of children
5503
-			$this->sousprods[$key] = $value;  // @phan-suppress-current-line PhanTypeMismatchProperty
5503
+			$this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty
5504 5504
 		}
5505 5505
 	}
5506 5506
 
@@ -5536,7 +5536,7 @@  discard block
 block discarded – undo
5536 5536
 		if (!empty($this->entity) && $permissiontoreadproduct) {
5537 5537
 			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1);
5538 5538
 			if ($this->nbphoto > 0) {
5539
-				$datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>';
5539
+				$datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>';
5540 5540
 			}
5541 5541
 		}
5542 5542
 
@@ -5546,7 +5546,7 @@  discard block
 block discarded – undo
5546 5546
 			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
5547 5547
 		}
5548 5548
 		if (isset($this->status) && isset($this->status_buy)) {
5549
-			$datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
5549
+			$datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1);
5550 5550
 		}
5551 5551
 
5552 5552
 		if (!empty($this->ref)) {
@@ -5596,7 +5596,7 @@  discard block
 block discarded – undo
5596 5596
 					$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
5597 5597
 				}
5598 5598
 				if ($labelsurfacevolume) {
5599
-					$datas['surface'] = "<br>" . $labelsurfacevolume;
5599
+					$datas['surface'] = "<br>".$labelsurfacevolume;
5600 5600
 				}
5601 5601
 			}
5602 5602
 			if ($this->isService() && !empty($this->duration_value)) {
@@ -5638,9 +5638,9 @@  discard block
 block discarded – undo
5638 5638
 			}
5639 5639
 			// show categories for this record only in ajax to not overload lists
5640 5640
 			if (isModEnabled('category') && !$nofetch) {
5641
-				require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5641
+				require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5642 5642
 				$form = new Form($this->db);
5643
-				$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5643
+				$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5644 5644
 			}
5645 5645
 		}
5646 5646
 
@@ -6163,7 +6163,7 @@  discard block
 block discarded – undo
6163 6163
 		if (isModEnabled("supplier_order")) {
6164 6164
 			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4');
6165 6165
 			if (isset($includedraftpoforvirtual)) {
6166
-				$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
6166
+				$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
6167 6167
 			}
6168 6168
 			$result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
6169 6169
 			if ($result < 0) {
@@ -6580,7 +6580,7 @@  discard block
 block discarded – undo
6580 6580
 		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
6581 6581
 			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
6582 6582
 			foreach ($dirsociete as $dirroot) {
6583
-				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6583
+				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6584 6584
 				if ($res) {
6585 6585
 					break;
6586 6586
 				}
Please login to merge, or discard this patch.
htdocs/product/stock/stockatdate.php 1 patch
Spacing   +22 added lines, -24 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 $type = GETPOSTINT('type');
49 49
 $mode = GETPOST('mode', 'alpha');
50 50
 
51
-$ext=(GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : '';
51
+$ext = (GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : '';
52 52
 
53 53
 $date = '';
54 54
 $dateendofday = '';
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	$socid = $user->socid;
119 119
 }
120 120
 
121
-$result = restrictedArea($user, 'produit|service');	// Must have permission to read product
122
-$result = restrictedArea($user, 'stock');	// Must have permission to read stock
121
+$result = restrictedArea($user, 'produit|service'); // Must have permission to read product
122
+$result = restrictedArea($user, 'stock'); // Must have permission to read stock
123 123
 
124 124
 
125 125
 /*
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	if ($productid > 0) {
159 159
 		$sql .= " AND ps.fk_product = ".((int) $productid);
160 160
 	}
161
-	if (! empty($search_fk_warehouse)) {
161
+	if (!empty($search_fk_warehouse)) {
162 162
 		$sql .= " AND ps.fk_entrepot IN (".$db->sanitize(implode(",", $search_fk_warehouse)).")";
163 163
 	}
164 164
 	if ($search_ref) {
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 			$movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;
250 250
 
251 251
 			// Pour llx_product.stock
252
-			$movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod)?$movements_prod[$fk_product]:0);
253
-			$movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb)?$movements_prod_nb[$fk_product]:0);
252
+			$movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod) ? $movements_prod[$fk_product] : 0);
253
+			$movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb) ? $movements_prod_nb[$fk_product] : 0);
254 254
 
255 255
 			$i++;
256 256
 		}
@@ -370,12 +370,11 @@  discard block
 block discarded – undo
370 370
 if ($ext == 'csv') {
371 371
 	top_httphead("text/csv");
372 372
 	//header("Content-Type: text/csv");
373
-	header("Content-Disposition: attachment; filename=stock".($date?'-'.date("Y-m-d", $date):'').".csv");
373
+	header("Content-Disposition: attachment; filename=stock".($date ? '-'.date("Y-m-d", $date) : '').".csv");
374 374
 
375 375
 	// Lines of title
376 376
 	print implode(";", ($mode == 'future') ?
377
-		array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"'):
378
-		array('"Product Reference"', '"Label"', '"'.$stocklabel.'"', '"Estimated Stock Value"', '"Estimate Sell Value"', '"Movements"', '"Current Stock"'))."\r\n";
377
+		array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"') : array('"Product Reference"', '"Label"', '"'.$stocklabel.'"', '"Estimated Stock Value"', '"Estimate Sell Value"', '"Movements"', '"Current Stock"'))."\r\n";
379 378
 } else {
380 379
 	llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'mod-product page-stock_stockatdate');
381 380
 
@@ -472,13 +471,13 @@  discard block
 block discarded – undo
472 471
 	if ($num) {
473 472
 		print '<p>';
474 473
 		print '<a href="stockatdate.php?output=csv&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&type='.((int) $type).'&mode='.urlencode($mode).
475
-			(($productid > 0)?"&productid=".((int) $productid):'').
474
+			(($productid > 0) ? "&productid=".((int) $productid) : '').
476 475
 			$param_warehouse.
477 476
 			"&search_ref=".dol_escape_htmltag($search_ref).
478 477
 			"&search_nom=".dol_escape_htmltag($search_nom).
479
-			(GETPOSTISSET('dateday')?"&dateday=".GETPOSTINT('dateday'):'').
480
-			(GETPOSTISSET('datemonth')?"&datemonth=".GETPOSTINT('datemonth'):'').
481
-			(GETPOSTISSET('dateyear')?"&dateyear=".GETPOSTINT('dateyear'):'').
478
+			(GETPOSTISSET('dateday') ? "&dateday=".GETPOSTINT('dateday') : '').
479
+			(GETPOSTISSET('datemonth') ? "&datemonth=".GETPOSTINT('datemonth') : '').
480
+			(GETPOSTISSET('dateyear') ? "&dateyear=".GETPOSTINT('dateyear') : '').
482 481
 			'" title="Download CSV" />';
483 482
 		print img_picto('', 'download', 'class="pictofixedwidth"');
484 483
 		print 'Download CSV';
@@ -605,9 +604,9 @@  discard block
 block discarded – undo
605 604
 
606 605
 		if ($mode == 'future') {
607 606
 			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
608
-			$stock = $prod->stock_theorique;		// virtual stock at a date
607
+			$stock = $prod->stock_theorique; // virtual stock at a date
609 608
 			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0);
610
-			$virtualstock = $prod->stock_theorique;	// virtual stock in infinite future
609
+			$virtualstock = $prod->stock_theorique; // virtual stock in infinite future
611 610
 		} else {
612 611
 			$stock = $currentstock;
613 612
 			$nbofmovement = 0;
@@ -637,8 +636,8 @@  discard block
 block discarded – undo
637 636
 					'"'.$objp->ref.'"',
638 637
 					'"'.$objp->label.'"',
639 638
 					'"'.price(price2num($stock, 'MS')).'"',
640
-					price2num($stock * $objp->pmp, 'MT')?'"'.price2num($stock * $objp->pmp, 'MT').'"':'',
641
-					!getDolGlobalString('PRODUIT_MULTIPRICES')?'"'.price2num($stock * $objp->price, 'MT').'"':'"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"',
639
+					price2num($stock * $objp->pmp, 'MT') ? '"'.price2num($stock * $objp->pmp, 'MT').'"' : '',
640
+					!getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($stock * $objp->price, 'MT').'"' : '"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"',
642 641
 					"$nbofmovement",
643 642
 					'"'.price2num($currentstock, 'MS').'"'))."\r\n";
644 643
 				$totalbuyingprice += $stock * $objp->pmp;
@@ -713,7 +712,7 @@  discard block
 block discarded – undo
713 712
 						$url .= '&search_date_startyear='.GETPOSTINT('dateyear');
714 713
 					}
715 714
 					if (count($search_fk_warehouse) > 1) {
716
-						$url = '';	// Do not show link, multi warehouse as filter not managed yet by target page
715
+						$url = ''; // Do not show link, multi warehouse as filter not managed yet by target page
717 716
 					} else {
718 717
 						foreach ($search_fk_warehouse as $val) {
719 718
 							$url .= ($val > 0 ? '&search_warehouse='.((int) $val) : '');
@@ -751,7 +750,7 @@  discard block
 block discarded – undo
751 750
 
752 751
 $parameters = array('sql'=>$sql);
753 752
 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
754
-if ($ext!='csv') {
753
+if ($ext != 'csv') {
755 754
 	print $hookmanager->resPrint;
756 755
 }
757 756
 
@@ -760,20 +759,19 @@  discard block
 block discarded – undo
760 759
 	$colspan++;
761 760
 }
762 761
 
763
-if ($ext=='csv') {
762
+if ($ext == 'csv') {
764 763
 	print implode(";",
765
-		($mode == 'future')?array(
764
+		($mode == 'future') ? array(
766 765
 		'"'.$langs->trans("Totalforthispage").'"',
767 766
 		'',
768 767
 		$productid > 0 ? price2num($totalcurrentstock, 'MS') : '',
769 768
 		'',
770
-		price(price2num($totalvirtualstock, 'MS'))):
771
-		array(
769
+		price(price2num($totalvirtualstock, 'MS'))) : array(
772 770
 		'"'.$langs->trans("Totalforthispage").'"',
773 771
 		'',
774 772
 		'',
775 773
 		'"'.price2num($totalbuyingprice, 'MT').'"',
776
-		!getDolGlobalString('PRODUIT_MULTIPRICES')?'"'.price2num($totalsellingprice, 'MT').'"':'',
774
+		!getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price2num($totalsellingprice, 'MT').'"' : '',
777 775
 		'',
778 776
 		$productid > 0 ? price2num($totalcurrentstock, 'MS') : ''));
779 777
 } else {
Please login to merge, or discard this patch.
htdocs/product/stock/class/mouvementstock.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 				'skip_batch'       => &$skip_batch,
238 238
 				'id_product_batch' => &$id_product_batch
239 239
 			);
240
-			$reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
240
+			$reshook = $hookmanager->executeHooks('stockMovementCreate', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
241 241
 
242 242
 			if ($reshook < 0) {
243 243
 				if (!empty($hookmanager->resPrint)) {
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			// Update stock quantity
580 580
 			if (!$error) {
581 581
 				if ($alreadyarecord > 0) {
582
-					$sql = "UPDATE ".$this->db->prefix()."product_stock SET reel = " . ((float) $oldqtywarehouse + (float) $qty);
582
+					$sql = "UPDATE ".$this->db->prefix()."product_stock SET reel = ".((float) $oldqtywarehouse + (float) $qty);
583 583
 					$sql .= " WHERE fk_entrepot = ".((int) $entrepot_id)." AND fk_product = ".((int) $fk_product);
584 584
 				} else {
585 585
 					$sql = "INSERT INTO ".$this->db->prefix()."product_stock";
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 				$this->price = $obj->price;
728 728
 				$this->fk_user_author = $obj->fk_user_author;
729 729
 				$this->label = $obj->label;
730
-				$this->fk_origin = $obj->origin_id;		// For backward compatibility
731
-				$this->origintype = $obj->origin_type;	// For backward compatibility
730
+				$this->fk_origin = $obj->origin_id; // For backward compatibility
731
+				$this->origintype = $obj->origin_type; // For backward compatibility
732 732
 				$this->origin_id = $obj->origin_id;
733 733
 				$this->origin_type = $obj->origin_type;
734 734
 				$this->inventorycode = $obj->inventorycode;
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 			} else {					// product_batch record not found
964 964
 				$pdluo->fk_product_stock = $vfk_product_stock;
965 965
 				$pdluo->qty = $qty;
966
-				$pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby'];		// No more used. Now eatby date is store in table of lot, no more into prouct_batch table.
967
-				$pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby'];		// No more used. Now sellby date is store in table of lot, no more into prouct_batch table.
966
+				$pdluo->eatby = empty($dluo['eatby']) ? '' : $dluo['eatby']; // No more used. Now eatby date is store in table of lot, no more into prouct_batch table.
967
+				$pdluo->sellby = empty($dluo['sellby']) ? '' : $dluo['sellby']; // No more used. Now sellby date is store in table of lot, no more into prouct_batch table.
968 968
 				$pdluo->batch = $vbatchnumber;
969 969
 
970 970
 				$result = $pdluo->create($user, 1);
@@ -1161,11 +1161,11 @@  discard block
 block discarded – undo
1161 1161
 		$label .= '<div width="100%">';
1162 1162
 		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->id;
1163 1163
 		$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
1164
-		$qtylabel = (($this->qty > 0) ? '<span class="stockmovemententry">+' : '<span class="stockmovementexit">') . $this->qty . '</span>';
1164
+		$qtylabel = (($this->qty > 0) ? '<span class="stockmovemententry">+' : '<span class="stockmovementexit">').$this->qty.'</span>';
1165 1165
 		if ($this->inventorycode) {
1166 1166
 			$label .= '<br><b>'.$langs->trans('InventoryCode').':</b> '.$this->inventorycode;
1167 1167
 		}
1168
-		$label .= '<br><b>'.$langs->trans('Qty').':</b> ' . $qtylabel;
1168
+		$label .= '<br><b>'.$langs->trans('Qty').':</b> '.$qtylabel;
1169 1169
 		if ($this->batch) {
1170 1170
 			$label .= '<br><b>'.$langs->trans('Batch').':</b> '.$this->batch;
1171 1171
 		}
@@ -1293,8 +1293,8 @@  discard block
 block discarded – undo
1293 1293
 		$sql = "SELECT sum(pb.qty) as cpt";
1294 1294
 		$sql .= " FROM ".$this->db->prefix()."product_batch as pb";
1295 1295
 		$sql .= " INNER JOIN ".$this->db->prefix()."product_stock as ps ON ps.rowid = pb.fk_product_stock";
1296
-		$sql .= " WHERE ps.fk_product = " . ((int) $fk_product);
1297
-		$sql .= " AND pb.batch = '" . $this->db->escape($batch) . "'";
1296
+		$sql .= " WHERE ps.fk_product = ".((int) $fk_product);
1297
+		$sql .= " AND pb.batch = '".$this->db->escape($batch)."'";
1298 1298
 
1299 1299
 		$result = $this->db->query($sql);
1300 1300
 		if ($result) {
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 	 */
1319 1319
 	public function reverseMouvement()
1320 1320
 	{
1321
-		$formattedDate = "REVERTMV" .dol_print_date($this->datem, '%Y%m%d%His');
1321
+		$formattedDate = "REVERTMV".dol_print_date($this->datem, '%Y%m%d%His');
1322 1322
 		if ($this->label == 'Annulation movement ID'.$this->id) {
1323 1323
 			return -1;
1324 1324
 		}
@@ -1354,11 +1354,11 @@  discard block
 block discarded – undo
1354 1354
 	{
1355 1355
 		$date = '';
1356 1356
 
1357
-		$sql = 	"SELECT MAX(datem) as datem";
1357
+		$sql = "SELECT MAX(datem) as datem";
1358 1358
 		$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement";
1359
-		$sql .= " WHERE fk_product = " . ((int) $fk_product);
1360
-		$sql .= " AND fk_entrepot  = " .((int) $fk_entrepot);
1361
-		$sql .= " AND batch = '" . $this->db->escape($batch) . "'";
1359
+		$sql .= " WHERE fk_product = ".((int) $fk_product);
1360
+		$sql .= " AND fk_entrepot  = ".((int) $fk_entrepot);
1361
+		$sql .= " AND batch = '".$this->db->escape($batch)."'";
1362 1362
 
1363 1363
 		$result = $this->db->query($sql);
1364 1364
 		if ($result) {
Please login to merge, or discard this patch.
htdocs/variants/list.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 $object->fields = dol_sort_array($object->fields, 'position');
143 143
 $arrayfields = dol_sort_array($arrayfields, 'position');
144
-'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan
144
+'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
145 145
 
146 146
 $permissiontoread = $user->hasRight('variants', 'read');
147 147
 $permissiontoadd = $user->hasRight('variants', 'write');
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 //}
324 324
 // Add where from hooks
325 325
 $parameters = array();
326
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action);    // Note that $action and $object may have been modified by hook
326
+$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
327 327
 $sql .= $hookmanager->resPrint;
328 328
 $sql = preg_replace("/,\s*$/", "", $sql);
329 329
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
391 391
 	$obj = $db->fetch_object($resql);
392 392
 	$id = $obj->rowid;
393
-	header("Location: " . dol_buildpath('/variants/card.php', 2) . '?id='.((int) $id));
393
+	header("Location: ".dol_buildpath('/variants/card.php', 2).'?id='.((int) $id));
394 394
 	exit;
395 395
 }
396 396
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 }
518 518
 
519 519
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
520
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
520
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
521 521
 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
522 522
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
523 523
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
623 623
 		$cssforfield .= ($cssforfield ? ' ' : '').'right';
624 624
 	}
625
-	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
625
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
626 626
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
627 627
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
628 628
 		$totalarray['nbfield']++;
@@ -724,23 +724,23 @@  discard block
 block discarded – undo
724 724
 		foreach ($object->fields as $key => $val) {
725 725
 			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
726 726
 			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
727
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
727
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
728 728
 			} elseif ($key == 'status') {
729
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
729
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
730 730
 			}
731 731
 
732 732
 			if (in_array($val['type'], array('timestamp'))) {
733
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowraponall';
733
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
734 734
 			} elseif ($key == 'ref') {
735
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowraponall';
735
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
736 736
 			}
737 737
 
738 738
 			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
739
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
739
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
740 740
 			}
741 741
 			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
742 742
 
743
-			if (!empty($arrayfields['t.' . $key]['checked'])) {
743
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
744 744
 				print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
745 745
 				if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
746 746
 					print ' title="'.dol_escape_htmltag($object->$key).'"';
@@ -759,15 +759,15 @@  discard block
 block discarded – undo
759 759
 				}
760 760
 				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
761 761
 					if (!$i) {
762
-						$totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
762
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
763 763
 					}
764 764
 					if (!isset($totalarray['val'])) {
765 765
 						$totalarray['val'] = array();
766 766
 					}
767
-					if (!isset($totalarray['val']['t.' . $key])) {
768
-						$totalarray['val']['t.' . $key] = 0;
767
+					if (!isset($totalarray['val']['t.'.$key])) {
768
+						$totalarray['val']['t.'.$key] = 0;
769 769
 					}
770
-					$totalarray['val']['t.' . $key] += $object->$key;
770
+					$totalarray['val']['t.'.$key] += $object->$key;
771 771
 				}
772 772
 			}
773 773
 		}
@@ -814,17 +814,17 @@  discard block
 block discarded – undo
814 814
 		// Move
815 815
 		print '<td class="center linecolmove tdlineupdown">';
816 816
 		if ($i > 0) {
817
-			print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=up&amp;rowid=' . $obj->rowid . '">' . img_up('default', 0, 'imgupforline') . '</a>';
817
+			print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=up&amp;rowid='.$obj->rowid.'">'.img_up('default', 0, 'imgupforline').'</a>';
818 818
 		}
819 819
 		if ($i < $num - 1) {
820
-			print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=down&amp;rowid=' . $obj->rowid . '">' . img_down('default', 0, 'imgdownforline') . '</a>';
820
+			print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$obj->rowid.'">'.img_down('default', 0, 'imgdownforline').'</a>';
821 821
 		}
822 822
 		print '</td>';
823 823
 		if (!$i) {
824 824
 			$totalarray['nbfield']++;
825 825
 		}
826 826
 
827
-		print '</tr>' . "\n";
827
+		print '</tr>'."\n";
828 828
 	}
829 829
 
830 830
 	$i++;
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 			$colspan++;
842 842
 		}
843 843
 	}
844
-	$colspan++; 	// For the move column
844
+	$colspan++; // For the move column
845 845
 	print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
846 846
 }
847 847
 
Please login to merge, or discard this patch.
htdocs/install/step2.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
41 41
 
42 42
 $err = error_reporting();
43
-error_reporting(0);      // Disable all errors
43
+error_reporting(0); // Disable all errors
44 44
 //error_reporting(E_ALL);
45
-@set_time_limit(1800);   // Need 1800 on some very slow OS like Windows 7/64
45
+@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
46 46
 error_reporting($err);
47 47
 
48 48
 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 dolibarr_install_syslog("--- step2: entering step2.php page");
93 93
 
94
-'@phan-var-force string $dolibarr_main_db_prefix';  // From configuraiotn file or install/inc.php
94
+'@phan-var-force string $dolibarr_main_db_prefix'; // From configuraiotn file or install/inc.php
95 95
 
96 96
 
97 97
 /*
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
593 593
 
594
-$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256');	// Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
594
+$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
595 595
 
596 596
 $out  = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"'.((getDolGlobalString('MAIN_FIRST_PING_OK_ID') == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
597 597
 $out .= '<label for="dolibarrpingno">'.$langs->trans("MakeAnonymousPing").'</label>';
Please login to merge, or discard this patch.
htdocs/workstation/class/workstation.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,),
113 113
 		'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 512, 'notnull' => -1, 'visible' => -2,),
114 114
 		'nb_operators_required' => array('type' => 'integer', 'label' => 'NbOperatorsRequired', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'),
115
-		'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp','label' => 'THMOperatorEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'),
115
+		'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp', 'label' => 'THMOperatorEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'),
116 116
 		'thm_machine_estimated' => array('type' => 'double', 'help' => 'THMMachineEstimatedHelp', 'label' => 'THMMachineEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'),
117 117
 		'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '1', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Disabled', '1' => 'Enabled'),),
118 118
 	);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	/**
136 136
 	 * @var string type
137 137
 	 */
138
-	public $type;	// HUMAN, MACHINE, ...
138
+	public $type; // HUMAN, MACHINE, ...
139 139
 
140 140
 	/**
141 141
 	 * @var int User ID
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		$id = $this->createCommon($user, $notrigger);
237 237
 
238 238
 		// Usergroups
239
-		$groups = GETPOST('groups', 'array:int');	// FIXME We should not GETPOST but receive array as parameter
239
+		$groups = GETPOST('groups', 'array:int'); // FIXME We should not GETPOST but receive array as parameter
240 240
 		if (empty($groups)) {
241 241
 			$groups = $this->usergroups; // createFromClone
242 242
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		}
252 252
 
253 253
 		// Resources
254
-		$resources = GETPOST('resources', 'array:int');	// FIXME We should not GETPOST but receive array as parameter
254
+		$resources = GETPOST('resources', 'array:int'); // FIXME We should not GETPOST but receive array as parameter
255 255
 		if (empty($resources)) {
256 256
 			$resources = $this->resources; // createFromClone
257 257
 		}
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 		if (getDolGlobalString('WORKSTATION_WORKSTATION_ADDON')) {
867 867
 			$mybool = false;
868 868
 
869
-			$file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON') . ".php";
869
+			$file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON').".php";
870 870
 			$classname = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON');
871 871
 
872 872
 			// Include file with class
Please login to merge, or discard this patch.
htdocs/adherents/card.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 $action = GETPOST('action', 'aZ09');
58 58
 $cancel = GETPOST('cancel', 'alpha');
59 59
 $backtopage = GETPOST('backtopage', 'alpha');
60
-$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used
60
+$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
61 61
 $confirm = GETPOST('confirm', 'alpha');
62 62
 $rowid = GETPOSTINT('rowid');
63 63
 $id = GETPOST('id') ? GETPOSTINT('id') : $rowid;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			$object->gender      = trim(GETPOST("gender", 'alphanohtml'));
302 302
 			$object->login       = trim(GETPOST("login", 'alphanohtml'));
303 303
 			if (GETPOSTISSET('pass')) {
304
-				$object->pass        = trim(GETPOST("pass", 'password'));	// For password, we must use 'none'
304
+				$object->pass = trim(GETPOST("pass", 'password')); // For password, we must use 'none'
305 305
 			}
306 306
 
307 307
 			$object->societe     = trim(GETPOST("societe", 'alphanohtml')); // deprecated
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 			}
357 357
 
358 358
 			// Check if we need to also synchronize password information
359
-			$nosyncuserpass = 1;	// no by default
359
+			$nosyncuserpass = 1; // no by default
360 360
 			if (GETPOSTISSET('pass')) {
361 361
 				if ($object->user_id) {	// If member is linked to a user
362
-					$nosyncuserpass = 0;	// We may try to sync password
362
+					$nosyncuserpass = 0; // We may try to sync password
363 363
 					if ($user->id == $object->user_id) {
364 364
 						if (!$user->hasRight('user', 'self', 'password')) {
365 365
 							$nosyncuserpass = 1; // Disable synchronizing
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 		$email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase'));
470 470
 		$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
471 471
 		$login = GETPOST("member_login", 'alphanohtml');
472
-		$pass = GETPOST("password", 'password');	// For password, we use 'none'
472
+		$pass = GETPOST("password", 'password'); // For password, we use 'none'
473 473
 		$photo = GETPOST("photo", 'alphanohtml');
474 474
 		$morphy = GETPOST("morphy", 'alphanohtml');
475 475
 		$public = GETPOSTINT("public");
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
 			$maxfilesizearray = getMaxFileSizeArray();
1292 1292
 			$maxmin = $maxfilesizearray['maxmin'];
1293 1293
 			if ($maxmin > 0) {
1294
-				print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
1294
+				print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
1295 1295
 			}
1296 1296
 			print '<input type="file" class="flat" name="photo" id="photoinput">';
1297 1297
 			print '</td></tr>';
Please login to merge, or discard this patch.
htdocs/categories/photos.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
  * Actions
76 76
  */
77 77
 
78
-$parameters = array('id' => $id,  'label' => $label, 'confirm' => $confirm, 'type' => $type, 'uploaddir' => $upload_dir, 'sendfile' => (GETPOST("sendit") ? true : false));
78
+$parameters = array('id' => $id, 'label' => $label, 'confirm' => $confirm, 'type' => $type, 'uploaddir' => $upload_dir, 'sendfile' => (GETPOST("sendit") ? true : false));
79 79
 // Note that $action and $object may be modified by some hooks
80 80
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
81 81
 if ($reshook < 0) {
Please login to merge, or discard this patch.
htdocs/categories/traduction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 
56 56
 $type = $object->type;
57 57
 if (is_numeric($type)) {
58
-	$type = Categorie::$MAP_ID_TO_CODE[$type];   // For backward compatibility
58
+	$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
59 59
 }
60 60
 
61 61
 // Security check
Please login to merge, or discard this patch.