Completed
Branch develop (a9439d)
by
unknown
26:15
created
htdocs/product/class/product.class.php 2 patches
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	/**
151 151
 	 * @var string
152 152
 	 */
153
-	public $price_formated;			// used by takepos/ajax/ajax.php
153
+	public $price_formated; // used by takepos/ajax/ajax.php
154 154
 
155 155
 	/**
156 156
 	 * Selling price with tax
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @var string
164 164
 	 */
165
-	public $price_ttc_formated;		// used by takepos/ajax/ajax.php
165
+	public $price_ttc_formated; // used by takepos/ajax/ajax.php
166 166
 
167 167
 	/**
168 168
 	 * Minimum price net
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	/**
512 512
 	 * @var ?int
513 513
 	 */
514
-	public $weight_units;	// scale -3, 0, 3, 6
514
+	public $weight_units; // scale -3, 0, 3, 6
515 515
 	/**
516 516
 	 * @var float|string
517 517
 	 */
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	/**
520 520
 	 * @var ?int
521 521
 	 */
522
-	public $length_units;	// scale -3, 0, 3, 6
522
+	public $length_units; // scale -3, 0, 3, 6
523 523
 	/**
524 524
 	 * @var float|string
525 525
 	 */
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	/**
528 528
 	 * @var ?int
529 529
 	 */
530
-	public $width_units;	// scale -3, 0, 3, 6
530
+	public $width_units; // scale -3, 0, 3, 6
531 531
 	/**
532 532
 	 * @var float|string|null
533 533
 	 */
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @var ?int
537 537
 	 */
538
-	public $height_units;	// scale -3, 0, 3, 6
538
+	public $height_units; // scale -3, 0, 3, 6
539 539
 	/**
540 540
 	 * @var float|string|null
541 541
 	 */
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 	/**
544 544
 	 * @var ?int
545 545
 	 */
546
-	public $surface_units;	// scale -3, 0, 3, 6
546
+	public $surface_units; // scale -3, 0, 3, 6
547 547
 	/**
548 548
 	 * @var float|string|null
549 549
 	 */
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	/**
552 552
 	 * @var ?int
553 553
 	 */
554
-	public $volume_units;	// scale -3, 0, 3, 6
554
+	public $volume_units; // scale -3, 0, 3, 6
555 555
 
556 556
 	/**
557 557
 	 * @var float|string|null
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	/**
561 561
 	 * @var ?int
562 562
 	 */
563
-	public $net_measure_units;	// scale -3, 0, 3, 6
563
+	public $net_measure_units; // scale -3, 0, 3, 6
564 564
 
565 565
 	/**
566 566
 	 * @var string
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
882 882
 		//'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')),
883 883
 		//'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')),
884
-		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
884
+		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
885 885
 		'stockable_product'	=>array('type' => 'integer', 'label' => 'stockable_product', 'enabled' => 1, 'visible' => 1, 'default' => '1', 'notnull' => 1, 'index' => 1, 'position' => 502),
886 886
 	);
887 887
 
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 					$sql .= ", fk_unit";
1139 1139
 					$sql .= ", mandatory_period";
1140 1140
 					$sql .= ", stockable_product";
1141
-					if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
1141
+					if (!empty($this->default_vat_code)) $sql .= ", default_vat_code";
1142 1142
 					$sql .= ") VALUES (";
1143 1143
 					$sql .= "'".$this->db->idate($this->date_creation)."'";
1144 1144
 					$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 					$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
1172 1172
 					$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
1173 1173
 					$sql .= ", ".((int) $this->stockable_product);
1174
-					if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
1174
+					if (!empty($this->default_vat_code)) $sql .= ", '".$this->db->escape($this->default_vat_code)."'";
1175 1175
 					$sql .= ")";
1176 1176
 					dol_syslog(get_class($this)."::Create", LOG_DEBUG);
1177 1177
 
@@ -1198,9 +1198,9 @@  discard block
 block discarded – undo
1198 1198
 
1199 1199
 							// update accountancy for this entity
1200 1200
 							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1201
-								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1201
+								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1202 1202
 
1203
-								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1203
+								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1204 1204
 								$sql .= " fk_product";
1205 1205
 								$sql .= ", entity";
1206 1206
 								$sql .= ", accountancy_code_buy";
@@ -1211,13 +1211,13 @@  discard block
 block discarded – undo
1211 1211
 								$sql .= ", accountancy_code_sell_export";
1212 1212
 								$sql .= ") VALUES (";
1213 1213
 								$sql .= $this->id;
1214
-								$sql .= ", " . ((int) $conf->entity);
1215
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1216
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1217
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1218
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1219
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1220
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1214
+								$sql .= ", ".((int) $conf->entity);
1215
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1216
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1217
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1218
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1219
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1220
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1221 1221
 								$sql .= ")";
1222 1222
 								$result = $this->db->query($sql);
1223 1223
 								if (!$result) {
@@ -1605,12 +1605,12 @@  discard block
 block discarded – undo
1605 1605
 			$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null');
1606 1606
 			$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
1607 1607
 			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1608
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1609
-				$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1610
-				$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1611
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1612
-				$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1613
-				$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1608
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1609
+				$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1610
+				$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
1611
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1612
+				$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1613
+				$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
1614 1614
 			}
1615 1615
 			$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
1616 1616
 			$sql .= ", cost_price = ".($this->cost_price != '' ? ((float) $this->cost_price) : 'null');
@@ -1645,9 +1645,9 @@  discard block
 block discarded – undo
1645 1645
 
1646 1646
 				// update accountancy for this entity
1647 1647
 				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1648
-					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1648
+					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1649 1649
 
1650
-					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1650
+					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1651 1651
 					$sql .= " fk_product";
1652 1652
 					$sql .= ", entity";
1653 1653
 					$sql .= ", accountancy_code_buy";
@@ -1658,13 +1658,13 @@  discard block
 block discarded – undo
1658 1658
 					$sql .= ", accountancy_code_sell_export";
1659 1659
 					$sql .= ") VALUES (";
1660 1660
 					$sql .= ((int) $this->id);
1661
-					$sql .= ", " . ((int) $conf->entity);
1662
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1663
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1664
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1665
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1666
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1667
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1661
+					$sql .= ", ".((int) $conf->entity);
1662
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1663
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1664
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1665
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1666
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1667
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1668 1668
 					$sql .= ")";
1669 1669
 					$result = $this->db->query($sql);
1670 1670
 					if (!$result) {
@@ -1742,7 +1742,7 @@  discard block
 block discarded – undo
1742 1742
 								$error++;
1743 1743
 							} else {
1744 1744
 								// to keep old entries with the new dir
1745
-								require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
1745
+								require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
1746 1746
 								$ecmfiles = new EcmFiles($this->db);
1747 1747
 								$ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref));
1748 1748
 							}
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 				}
2041 2041
 			} elseif (isset($this->multilangs[$key])) {
2042 2042
 				if (empty($this->multilangs[$key]["label"])) {
2043
-					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
2043
+					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
2044 2044
 					return -1;
2045 2045
 				}
2046 2046
 
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 	 */
2239 2239
 	private function getArrayForPriceCompare($level = 0)
2240 2240
 	{
2241
-		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
2241
+		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
2242 2242
 
2243 2243
 		foreach ($testExit as $field) {
2244 2244
 			if (!isset($this->$field)) {
@@ -2389,7 +2389,7 @@  discard block
 block discarded – undo
2389 2389
 							$price_base_type = $custprice_line->price_base_type;
2390 2390
 							$tva_tx = $custprice_line->tva_tx;
2391 2391
 							if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
2392
-								$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
2392
+								$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
2393 2393
 							}
2394 2394
 							$tva_npr = $custprice_line->recuperableonly;
2395 2395
 							if (empty($tva_tx)) {
@@ -2455,7 +2455,7 @@  discard block
 block discarded – undo
2455 2455
 							$price_base_type = $custprice_line->price_base_type;
2456 2456
 							$tva_tx = $custprice_line->tva_tx;
2457 2457
 							if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
2458
-								$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
2458
+								$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
2459 2459
 							}
2460 2460
 							$tva_npr = $custprice_line->recuperableonly;
2461 2461
 							if (empty($tva_tx)) {
@@ -2940,12 +2940,12 @@  discard block
 block discarded – undo
2940 2940
 
2941 2941
 		// For MultiCompany
2942 2942
 		// PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2943
-		$separatedEntityPMP = false;	// Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2944
-		$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.
2943
+		$separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2944
+		$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.
2945 2945
 		$visibleWarehousesEntities = $conf->entity;
2946 2946
 		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2947 2947
 			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
2948
-				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2948
+				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2949 2949
 				if ($this->db->num_rows($checkPMPPerEntity) > 0) {
2950 2950
 					$separatedEntityPMP = true;
2951 2951
 				}
@@ -2953,7 +2953,7 @@  discard block
 block discarded – undo
2953 2953
 			global $mc;
2954 2954
 			$separatedStock = true;
2955 2955
 			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) {
2956
-				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']);
2956
+				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']);
2957 2957
 			}
2958 2958
 		}
2959 2959
 		if ($separatedEntityPMP) {
@@ -2971,10 +2971,10 @@  discard block
 block discarded – undo
2971 2971
 		}
2972 2972
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2973 2973
 		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) {
2974
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
2974
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
2975 2975
 		}
2976 2976
 		if ($separatedStock) {
2977
-			$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)."))";
2977
+			$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)."))";
2978 2978
 		}
2979 2979
 
2980 2980
 		if ($id) {
@@ -3142,15 +3142,15 @@  discard block
 block discarded – undo
3142 3142
 						$sql .= " WHERE entity IN (".getEntity('productprice').")";
3143 3143
 						$sql .= " AND price_level=".((int) $i);
3144 3144
 						$sql .= " AND fk_product = ".((int) $this->id);
3145
-						$sql .= " ORDER BY date_price DESC, rowid DESC";	// Get the most recent line
3146
-						$sql .= " LIMIT 1";									// Only the first one
3145
+						$sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
3146
+						$sql .= " LIMIT 1"; // Only the first one
3147 3147
 						$resql = $this->db->query($sql);
3148 3148
 						if ($resql) {
3149 3149
 							$result = $this->db->fetch_array($resql);
3150 3150
 
3151 3151
 							$this->multiprices[$i] = $result ? $result["price"] : null;
3152 3152
 							$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
3153
-							$this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
3153
+							$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
3154 3154
 							$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
3155 3155
 							$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
3156 3156
 							// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -3375,7 +3375,7 @@  discard block
 block discarded – undo
3375 3375
 				$obj = $this->db->fetch_object($result);
3376 3376
 				$this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0;
3377 3377
 				$this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0;
3378
-				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;		// qty may be a float due to the SUM()
3378
+				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
3379 3379
 			} else {
3380 3380
 				$this->error = $this->db->error();
3381 3381
 				$error++;
@@ -4898,7 +4898,7 @@  discard block
 block discarded – undo
4898 4898
 				//Addition of a product with the highest rank +1
4899 4899
 				$sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4900 4900
 				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")";
4901
-				if (! $this->db->query($sql)) {
4901
+				if (!$this->db->query($sql)) {
4902 4902
 					dol_print_error($this->db);
4903 4903
 					return -1;
4904 4904
 				} else {
@@ -5019,7 +5019,7 @@  discard block
 block discarded – undo
5019 5019
 				$sql = "UPDATE ".$this->db->prefix()."product_association";
5020 5020
 				$sql .= " SET rang = ".((int) $cpt);
5021 5021
 				$sql .= " WHERE rowid = ".((int) $objrank->rowid);
5022
-				if (! $this->db->query($sql)) {
5022
+				if (!$this->db->query($sql)) {
5023 5023
 					dol_print_error($this->db);
5024 5024
 					return -1;
5025 5025
 				}
@@ -5459,7 +5459,7 @@  discard block
 block discarded – undo
5459 5459
 		if (isset($this->sousprods) && is_array($this->sousprods)) {
5460 5460
 			foreach ($this->sousprods as $prod_name => $desc_product) {
5461 5461
 				if (is_array($desc_product)) {
5462
-					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load);	// This set $this->res
5462
+					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res
5463 5463
 				}
5464 5464
 			}
5465 5465
 		}
@@ -5614,7 +5614,7 @@  discard block
 block discarded – undo
5614 5614
 		$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
5615 5615
 		$sql .= " ORDER BY pa.rang";
5616 5616
 
5617
-		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5617
+		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5618 5618
 
5619 5619
 		// Protection against infinite loop
5620 5620
 		if ($level > 30) {
@@ -5677,7 +5677,7 @@  discard block
 block discarded – undo
5677 5677
 			$parent[$this->label][$keyChild] = $valueChild;
5678 5678
 		}
5679 5679
 		foreach ($parent as $key => $value) {        // key=label, value is array of children
5680
-			$this->sousprods[$key] = $value;  // @phan-suppress-current-line PhanTypeMismatchProperty
5680
+			$this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty
5681 5681
 		}
5682 5682
 	}
5683 5683
 
@@ -5713,7 +5713,7 @@  discard block
 block discarded – undo
5713 5713
 		if (!empty($this->entity) && $permissiontoreadproduct) {
5714 5714
 			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, '1');
5715 5715
 			if ($this->nbphoto > 0) {
5716
-				$datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>';
5716
+				$datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>';
5717 5717
 			}
5718 5718
 		}
5719 5719
 
@@ -5723,7 +5723,7 @@  discard block
 block discarded – undo
5723 5723
 			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
5724 5724
 		}
5725 5725
 		if (isset($this->status) && isset($this->status_buy)) {
5726
-			$datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
5726
+			$datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1);
5727 5727
 		}
5728 5728
 
5729 5729
 		if (!empty($this->ref)) {
@@ -5773,7 +5773,7 @@  discard block
 block discarded – undo
5773 5773
 					$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
5774 5774
 				}
5775 5775
 				if ($labelsurfacevolume) {
5776
-					$datas['surface'] = "<br>" . $labelsurfacevolume;
5776
+					$datas['surface'] = "<br>".$labelsurfacevolume;
5777 5777
 				}
5778 5778
 			}
5779 5779
 			if ($this->isService() && !empty($this->duration_value)) {
@@ -5815,9 +5815,9 @@  discard block
 block discarded – undo
5815 5815
 			}
5816 5816
 			// show categories for this record only in ajax to not overload lists
5817 5817
 			if (isModEnabled('category') && !$nofetch) {
5818
-				require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5818
+				require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5819 5819
 				$form = new Form($this->db);
5820
-				$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5820
+				$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5821 5821
 			}
5822 5822
 		}
5823 5823
 
@@ -6345,7 +6345,7 @@  discard block
 block discarded – undo
6345 6345
 		if (isModEnabled("supplier_order")) {
6346 6346
 			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4');
6347 6347
 			if (isset($includedraftpoforvirtual)) {
6348
-				$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
6348
+				$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
6349 6349
 			}
6350 6350
 			$result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
6351 6351
 			if ($result < 0) {
@@ -6386,7 +6386,7 @@  discard block
 block discarded – undo
6386 6386
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER')) {
6387 6387
 			if (getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER_INCLUDE_DRAFT')) {	// By default, draft means "does not exist", so we do not include them by default, except if option is on
6388 6388
 				$tmpnewprod = dol_clone($this, 1);
6389
-				$result = $tmpnewprod->load_stats_commande(0, '0', 1);	// Get qty in draft orders
6389
+				$result = $tmpnewprod->load_stats_commande(0, '0', 1); // Get qty in draft orders
6390 6390
 				$this->stock_theorique += $tmpnewprod->stats_commande['qty'];
6391 6391
 			}
6392 6392
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_BILL') && $weBillOrderOrShipmentReception == 'order') {
@@ -6403,7 +6403,7 @@  discard block
 block discarded – undo
6403 6403
 		} elseif (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER')) {	// Warning: stock change "on approval", not on validation !
6404 6404
 			if (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER_INCLUDE_DRAFT')) {	// By default, draft means "does not exist", so we do not include them by default, except if option is on
6405 6405
 				$tmpnewprod = dol_clone($this, 1);
6406
-				$result = $tmpnewprod->load_stats_commande_fournisseur(0, '0', 1);	// Get qty in draft orders
6406
+				$result = $tmpnewprod->load_stats_commande_fournisseur(0, '0', 1); // Get qty in draft orders
6407 6407
 				$this->stock_theorique += $this->stats_commande_fournisseur['qty'];
6408 6408
 			}
6409 6409
 			$this->stock_theorique -= $stock_reception_fournisseur;
@@ -6780,7 +6780,7 @@  discard block
 block discarded – undo
6780 6780
 		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
6781 6781
 			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
6782 6782
 			foreach ($dirsociete as $dirroot) {
6783
-				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6783
+				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6784 6784
 				if ($res) {
6785 6785
 					break;
6786 6786
 				}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1138,7 +1138,9 @@  discard block
 block discarded – undo
1138 1138
 					$sql .= ", fk_unit";
1139 1139
 					$sql .= ", mandatory_period";
1140 1140
 					$sql .= ", stockable_product";
1141
-					if (!empty($this->default_vat_code)) $sql.=", default_vat_code";
1141
+					if (!empty($this->default_vat_code)) {
1142
+						$sql.=", default_vat_code";
1143
+					}
1142 1144
 					$sql .= ") VALUES (";
1143 1145
 					$sql .= "'".$this->db->idate($this->date_creation)."'";
1144 1146
 					$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
@@ -1171,7 +1173,9 @@  discard block
 block discarded – undo
1171 1173
 					$sql .= ", ".($this->fk_unit > 0 ? ((int) $this->fk_unit) : 'NULL');
1172 1174
 					$sql .= ", '".$this->db->escape((string) $this->mandatory_period)."'";
1173 1175
 					$sql .= ", ".((int) $this->stockable_product);
1174
-					if (!empty($this->default_vat_code)) $sql.=", '".$this->db->escape($this->default_vat_code)."'";
1176
+					if (!empty($this->default_vat_code)) {
1177
+						$sql.=", '".$this->db->escape($this->default_vat_code)."'";
1178
+					}
1175 1179
 					$sql .= ")";
1176 1180
 					dol_syslog(get_class($this)."::Create", LOG_DEBUG);
1177 1181
 
Please login to merge, or discard this patch.
htdocs/product/list.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 $search_id = GETPOST("search_id", 'alpha');
91 91
 $search_ref = GETPOST("search_ref", 'alpha');
92 92
 $search_ref_ext = trim(GETPOST("search_ref_ext", 'alpha'));
93
-$search_ref_supplier = GETPOST("search_ref_supplier", 'alpha');	// ref of supplier price
93
+$search_ref_supplier = GETPOST("search_ref_supplier", 'alpha'); // ref of supplier price
94 94
 $search_barcode = GETPOST("search_barcode", 'alpha');
95 95
 $search_label = GETPOST("search_label", 'alpha');
96 96
 $search_default_workstation = GETPOST("search_default_workstation", 'alpha');
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	'p.tobatch' => array('label' => "ManageLotSerial", 'checked' => 0, 'enabled' => (isModEnabled('productbatch')), 'position' => 60),
279 279
 	'p.fk_country' => array('label' => "Country", 'checked' => 0, 'position' => 100),
280 280
 	'p.fk_state' => array('label' => "State", 'checked' => 0, 'position' => 101),
281
-	$alias_product_perentity . '.accountancy_code_sell' => array('label' => "ProductAccountancySellCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 400),
282
-	$alias_product_perentity . '.accountancy_code_sell_intra' => array('label' => "ProductAccountancySellIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 401),
283
-	$alias_product_perentity . '.accountancy_code_sell_export' => array('label' => "ProductAccountancySellExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 402),
284
-	$alias_product_perentity . '.accountancy_code_buy' => array('label' => "ProductAccountancyBuyCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 403),
285
-	$alias_product_perentity . '.accountancy_code_buy_intra' => array('label' => "ProductAccountancyBuyIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 404),
286
-	$alias_product_perentity . '.accountancy_code_buy_export' => array('label' => "ProductAccountancyBuyExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 405),
281
+	$alias_product_perentity.'.accountancy_code_sell' => array('label' => "ProductAccountancySellCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 400),
282
+	$alias_product_perentity.'.accountancy_code_sell_intra' => array('label' => "ProductAccountancySellIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 401),
283
+	$alias_product_perentity.'.accountancy_code_sell_export' => array('label' => "ProductAccountancySellExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 402),
284
+	$alias_product_perentity.'.accountancy_code_buy' => array('label' => "ProductAccountancyBuyCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 403),
285
+	$alias_product_perentity.'.accountancy_code_buy_intra' => array('label' => "ProductAccountancyBuyIntraCode", 'checked' => 0, 'enabled' => $isInEEC && !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 404),
286
+	$alias_product_perentity.'.accountancy_code_buy_export' => array('label' => "ProductAccountancyBuyExportCode", 'checked' => 0, 'enabled' => !getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING'), 'position' => 405),
287 287
 	'p.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
288 288
 	'p.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500),
289 289
 	'p.tosell' => array('label' => $langs->transnoentitiesnoconv("Status").' ('.$langs->transnoentitiesnoconv("Sell").')', 'checked' => 1, 'position' => 1000),
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 	'p.import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'checked' => -1, 'position' => 1100),
292 292
 );
293 293
 
294
-if (! empty($conf->stock->enabled)) {
294
+if (!empty($conf->stock->enabled)) {
295 295
 	// service
296 296
 	if ($type == 1) {
297
-		if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
297
+		if (!empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
298 298
 			$arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => 0, 'position' => 1001);
299 299
 		}
300 300
 	} else {
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 $object->fields = dol_sort_array($object->fields, 'position');
338 338
 $arrayfields = dol_sort_array($arrayfields, 'position');
339 339
 // Note: forcing int for position, but in reality it is a float here.
340
-'@phan-var-force array<string,array{label:string,checked?:string,position?:int,enabled?:string,help?:string}> $arrayfields';  // dol_sort_array looses type for Phan
340
+'@phan-var-force array<string,array{label:string,checked?:string,position?:int,enabled?:string,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
341 341
 
342 342
 // Security check
343 343
 if ($search_type == '0') {
@@ -512,10 +512,10 @@  discard block
 block discarded – undo
512 512
 
513 513
 $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
514 514
 if (isModEnabled('workstation')) {
515
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid)";
515
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."workstation_workstation as ws ON (p.fk_default_workstation = ws.rowid)";
516 516
 }
517 517
 if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
518
-	$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
518
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
519 519
 }
520 520
 if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
521 521
 	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)";
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	$sql .= " AND p.tobuy = ".((int) $search_tobuy);
598 598
 }
599 599
 if (isset($search_stockable_product) && dol_strlen($search_stockable_product) > 0 && $search_stockable_product != -1) {
600
-	$sql .= " AND p.stockable_product = '". ((int) $search_stockable_product) . "'";
600
+	$sql .= " AND p.stockable_product = '".((int) $search_stockable_product)."'";
601 601
 }
602 602
 if (isset($search_tobatch) && dol_strlen($search_tobatch) > 0 && $search_tobatch != -1) {
603 603
 	$sql .= " AND p.tobatch = ".((int) $search_tobatch);
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 			if ($searchCategoryProductOperator == 0) {
621 621
 				$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
622 622
 			} else {
623
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
623
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct);
624 624
 			}
625 625
 		}
626 626
 	}
@@ -650,22 +650,22 @@  discard block
 block discarded – undo
650 650
 	$sql .= " AND p.finished = ".((int) $search_finished);
651 651
 }
652 652
 if ($search_accountancy_code_sell) {
653
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell', clean_account($search_accountancy_code_sell));
653
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_sell', clean_account($search_accountancy_code_sell));
654 654
 }
655 655
 if ($search_accountancy_code_sell_intra) {
656
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_intra', clean_account($search_accountancy_code_sell_intra));
656
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_sell_intra', clean_account($search_accountancy_code_sell_intra));
657 657
 }
658 658
 if ($search_accountancy_code_sell_export) {
659
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_export', clean_account($search_accountancy_code_sell_export));
659
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_sell_export', clean_account($search_accountancy_code_sell_export));
660 660
 }
661 661
 if ($search_accountancy_code_buy) {
662
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy', clean_account($search_accountancy_code_buy));
662
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_buy', clean_account($search_accountancy_code_buy));
663 663
 }
664 664
 if ($search_accountancy_code_buy_intra) {
665
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_intra', clean_account($search_accountancy_code_buy_intra));
665
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_buy_intra', clean_account($search_accountancy_code_buy_intra));
666 666
 }
667 667
 if ($search_accountancy_code_buy_export) {
668
-	$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
668
+	$sql .= natural_search($alias_product_perentity.'.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
669 669
 }
670 670
 if (getDolGlobalString('PRODUCT_USE_UNITS') && !empty($search_units) && $search_units != '-1' && $search_units !== 'none') {
671 671
 	$sql .= natural_search('cu.rowid', $search_units);
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 if (isModEnabled('category') && $user->hasRight($rightskey, 'creer')) {
909 909
 	$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
910 910
 }
911
-if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields', 'preupdateprice'))) {
911
+if (in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'edit_extrafields', 'preupdateprice'))) {
912 912
 	$arrayofmassactions = array();
913 913
 }
914 914
 if ($user->hasRight($rightskey, 'supprimer')) {
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 }
1023 1023
 
1024 1024
 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1025
-$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));  // This also change content of $arrayfields with user setup
1025
+$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
1026 1026
 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
1027 1027
 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1028 1028
 
@@ -1274,23 +1274,23 @@  discard block
 block discarded – undo
1274 1274
 	print '</td>';
1275 1275
 }
1276 1276
 // Accountancy code sell
1277
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
1277
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell']['checked'])) {
1278 1278
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell" value="'.dol_escape_htmltag($search_accountancy_code_sell).'"></td>';
1279 1279
 }
1280
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
1280
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_intra']['checked'])) {
1281 1281
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_intra" value="'.dol_escape_htmltag($search_accountancy_code_sell_intra).'"></td>';
1282 1282
 }
1283
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
1283
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_export']['checked'])) {
1284 1284
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_sell_export" value="'.dol_escape_htmltag($search_accountancy_code_sell_export).'"></td>';
1285 1285
 }
1286 1286
 // Accountancy code buy
1287
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
1287
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy']['checked'])) {
1288 1288
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy" value="'.dol_escape_htmltag($search_accountancy_code_buy).'"></td>';
1289 1289
 }
1290
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
1290
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_intra']['checked'])) {
1291 1291
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_intra" value="'.dol_escape_htmltag($search_accountancy_code_buy_intra).'"></td>';
1292 1292
 }
1293
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
1293
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_export']['checked'])) {
1294 1294
 	print '<td class="liste_titre"><input class="flat maxwidth75" type="text" name="search_accountancy_code_buy_export" value="'.dol_escape_htmltag($search_accountancy_code_buy_export).'"></td>';
1295 1295
 }
1296 1296
 // Extra fields
@@ -1515,28 +1515,28 @@  discard block
 block discarded – undo
1515 1515
 	print_liste_field_titre($arrayfields['p.fk_state']['label'], $_SERVER["PHP_SELF"], "p.fk_state", "", $param, '', $sortfield, $sortorder);
1516 1516
 	$totalarray['nbfield']++;
1517 1517
 }
1518
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
1519
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_sell", "", $param, '', $sortfield, $sortorder);
1518
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell']['checked'])) {
1519
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_sell", "", $param, '', $sortfield, $sortorder);
1520 1520
 	$totalarray['nbfield']++;
1521 1521
 }
1522
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
1523
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_sell_intra", "", $param, '', $sortfield, $sortorder);
1522
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_intra']['checked'])) {
1523
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_sell_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_sell_intra", "", $param, '', $sortfield, $sortorder);
1524 1524
 	$totalarray['nbfield']++;
1525 1525
 }
1526
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
1527
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_sell_export", "", $param, '', $sortfield, $sortorder);
1526
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_export']['checked'])) {
1527
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_sell_export']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_sell_export", "", $param, '', $sortfield, $sortorder);
1528 1528
 	$totalarray['nbfield']++;
1529 1529
 }
1530
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
1531
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
1530
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy']['checked'])) {
1531
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
1532 1532
 	$totalarray['nbfield']++;
1533 1533
 }
1534
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
1535
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
1534
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_intra']['checked'])) {
1535
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
1536 1536
 	$totalarray['nbfield']++;
1537 1537
 }
1538
-if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
1539
-	print_liste_field_titre($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity . ".accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
1538
+if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_export']['checked'])) {
1539
+	print_liste_field_titre($arrayfields[$alias_product_perentity.'.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], $alias_product_perentity.".accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
1540 1540
 	$totalarray['nbfield']++;
1541 1541
 }
1542 1542
 // Extra fields
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 				}
1759 1759
 			}
1760 1760
 
1761
-			print '<td class="center">' . $product_thumbnail_html . '</td>';
1761
+			print '<td class="center">'.$product_thumbnail_html.'</td>';
1762 1762
 			if (!$i) {
1763 1763
 				$totalarray['nbfield']++;
1764 1764
 			}
@@ -2159,7 +2159,7 @@  discard block
 block discarded – undo
2159 2159
 		}
2160 2160
 
2161 2161
 		// not managed in stock
2162
-		if (! empty($arrayfields['p.stockable_product']['checked'])) {
2162
+		if (!empty($arrayfields['p.stockable_product']['checked'])) {
2163 2163
 			print '<td class="nowrap center">';
2164 2164
 			print ($product_static->stockable_product == '1') ? $langs->trans('Yes') : $langs->trans('No');
2165 2165
 			print '</td>';
@@ -2248,38 +2248,38 @@  discard block
 block discarded – undo
2248 2248
 			}
2249 2249
 		}
2250 2250
 		// Accountancy code sell
2251
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
2251
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell']['checked'])) {
2252 2252
 			print '<td>'.length_accountg($product_static->accountancy_code_sell).'</td>';
2253 2253
 			if (!$i) {
2254 2254
 				$totalarray['nbfield']++;
2255 2255
 			}
2256 2256
 		}
2257
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
2257
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_intra']['checked'])) {
2258 2258
 			print '<td>'.length_accountg($product_static->accountancy_code_sell_intra).'</td>';
2259 2259
 			if (!$i) {
2260 2260
 				$totalarray['nbfield']++;
2261 2261
 			}
2262 2262
 		}
2263
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
2263
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_sell_export']['checked'])) {
2264 2264
 			print '<td>'.length_accountg($product_static->accountancy_code_sell_export).'</td>';
2265 2265
 			if (!$i) {
2266 2266
 				$totalarray['nbfield']++;
2267 2267
 			}
2268 2268
 		}
2269 2269
 		// Accountancy code buy
2270
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
2270
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy']['checked'])) {
2271 2271
 			print '<td>'.length_accountg($product_static->accountancy_code_buy).'</td>';
2272 2272
 			if (!$i) {
2273 2273
 				$totalarray['nbfield']++;
2274 2274
 			}
2275 2275
 		}
2276
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
2276
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_intra']['checked'])) {
2277 2277
 			print '<td>'.length_accountg($product_static->accountancy_code_buy_intra).'</td>';
2278 2278
 			if (!$i) {
2279 2279
 				$totalarray['nbfield']++;
2280 2280
 			}
2281 2281
 		}
2282
-		if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
2282
+		if (!empty($arrayfields[$alias_product_perentity.'.accountancy_code_buy_export']['checked'])) {
2283 2283
 			print '<td>'.length_accountg($product_static->accountancy_code_buy_export).'</td>';
2284 2284
 			if (!$i) {
2285 2285
 				$totalarray['nbfield']++;
Please login to merge, or discard this patch.
htdocs/product/card.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 $formbarcode = null;
109 109
 
110 110
 // Get parameters
111
-$id  = GETPOSTINT('id');
111
+$id = GETPOSTINT('id');
112 112
 if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
113 113
 	$ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null);
114 114
 } else {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 $backtopage = GETPOST('backtopage', 'alpha');
121 121
 $confirm = GETPOST('confirm', 'alpha');
122 122
 $socid = GETPOSTINT('socid');
123
-$duration_value = GETPOST('duration_value');	// duration value can be an empty string
123
+$duration_value = GETPOST('duration_value'); // duration value can be an empty string
124 124
 $duration_unit = GETPOST('duration_unit', 'alpha');
125 125
 
126 126
 $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 		if (!$error) {
544 544
 			$units = GETPOSTINT('units');
545 545
 
546
-			$object->entity				= $conf->entity;
547
-			$object->ref				= (string) $ref;
548
-			$object->label				= GETPOST('label', $label_security_check);
549
-			$object->price_base_type	= GETPOST('price_base_type', 'aZ09');
550
-			$object->mandatory_period	= empty(GETPOST("mandatoryperiod", 'alpha')) ? 0 : 1;
546
+			$object->entity = $conf->entity;
547
+			$object->ref = (string) $ref;
548
+			$object->label = GETPOST('label', $label_security_check);
549
+			$object->price_base_type = GETPOST('price_base_type', 'aZ09');
550
+			$object->mandatory_period = empty(GETPOST("mandatoryperiod", 'alpha')) ? 0 : 1;
551 551
 			if ($object->price_base_type == 'TTC') {
552 552
 				$object->price_ttc = GETPOSTFLOAT('price');
553 553
 			} else {
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 			$object->duration_value     	 = $duration_value;
636 636
 			$object->duration_unit      	 = $duration_unit;
637 637
 			$object->fk_default_warehouse	 = GETPOSTINT('fk_default_warehouse');
638
-			$object->fk_default_workstation	 = GETPOSTINT('fk_default_workstation');
638
+			$object->fk_default_workstation = GETPOSTINT('fk_default_workstation');
639 639
 			$object->seuil_stock_alerte 	 = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0;
640 640
 			$object->desiredstock          = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0;
641 641
 			$object->canvas             	 = GETPOST('canvas');
642 642
 			$object->net_measure           = GETPOST('net_measure');
643
-			$object->net_measure_units      = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit
643
+			$object->net_measure_units = GETPOST('net_measure_units') === '' ? null : GETPOSTINT('net_measure_units'); // This is not the fk_unit but the power of unit
644 644
 			$object->weight             	 = GETPOST('weight');
645 645
 			$object->weight_units       	 = GETPOST('weight_units'); // This is not the fk_unit but the power of unit
646 646
 			$object->length             	 = GETPOST('size');
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 				$object->oldcopy = dol_clone($object, 1);
787 787
 
788 788
 				if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) {
789
-					$object->ref                = (string) $ref;
789
+					$object->ref = (string) $ref;
790 790
 				}
791 791
 				$object->label                  = GETPOST('label', $label_security_check);
792 792
 
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 				$object->status_batch = GETPOSTINT('status_batch');
809 809
 				$object->sell_or_eat_by_mandatory = GETPOSTINT('sell_or_eat_by_mandatory');
810 810
 				$object->batch_mask = GETPOST('batch_mask', 'alpha');
811
-				$object->fk_default_warehouse   = GETPOSTINT('fk_default_warehouse');
811
+				$object->fk_default_warehouse = GETPOSTINT('fk_default_warehouse');
812 812
 				$object->fk_default_workstation   = GETPOSTINT('fk_default_workstation');
813 813
 				// removed from update view so GETPOST always empty
814 814
 				/*
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 				}
849 849
 
850 850
 				// managed_in_stock
851
-				$object->stockable_product   = (int) GETPOSTISSET('stockable_product');
851
+				$object->stockable_product = (int) GETPOSTISSET('stockable_product');
852 852
 
853 853
 				$units = GETPOSTINT('units');
854 854
 				if ($units > 0) {
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 					$object->accountancy_code_buy_export = $accountancy_code_buy_export;
912 912
 				}
913 913
 				if ($object->isService()) {
914
-					$object->mandatory_period =  (!empty($checkmandatory)) ? 1 : 0 ;
914
+					$object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0;
915 915
 				}
916 916
 
917 917
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 							$action = "";
1047 1047
 
1048 1048
 							$mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref);
1049
-							$mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.';
1049
+							$mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
1050 1050
 							setEventMessages($mesg, null, 'errors');
1051 1051
 						} else {
1052 1052
 							setEventMessages(empty($clone->error) ? '' : $langs->trans($clone->error), $clone->errors, 'errors');
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 					} else {
1062 1062
 						$db->commit();
1063 1063
 						$db->close();
1064
-						header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
1064
+						header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
1065 1065
 						exit;
1066 1066
 					}
1067 1067
 				} else {
@@ -2271,9 +2271,9 @@  discard block
 block discarded – undo
2271 2271
 					if (isModEnabled('productbatch') && $object->hasbatch()) {
2272 2272
 						print '<td><input type="hidden" id="stockable_product" name="stockable_product" value="on" /></td></tr>';
2273 2273
 					} else {
2274
-						print '<tr><td valign="top">' . $langs->trans("StockableProduct") . '</td>';
2274
+						print '<tr><td valign="top">'.$langs->trans("StockableProduct").'</td>';
2275 2275
 						$checked = $object->stockable_product == 1 ? "checked" : "";
2276
-						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '. $checked . ' /></td></tr>';
2276
+						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '.$checked.' /></td></tr>';
2277 2277
 					}
2278 2278
 				}
2279 2279
 
@@ -2315,9 +2315,9 @@  discard block
 block discarded – undo
2315 2315
 					print '</td></tr>';
2316 2316
 
2317 2317
 					if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
2318
-						print '<tr><td valign="top">' . $langs->trans("StockableProduct") . '</td>';
2318
+						print '<tr><td valign="top">'.$langs->trans("StockableProduct").'</td>';
2319 2319
 						$checked = $object->stockable_product == 1 ? "checked" : "";
2320
-						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" ' . $checked . ' /></td></tr>';
2320
+						print '<td><input type="checkbox" id="stockable_product" name="stockable_product" '.$checked.' /></td></tr>';
2321 2321
 					}
2322 2322
 				} else {
2323 2323
 					if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) {
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
 
2806 2806
 				// View stockable_product
2807 2807
 				if (($object->isProduct() || ($object->isService() && !empty($conf->global->STOCK_SUPPORTS_SERVICES))) && isModEnabled('stock') && !$object->hasbatch()) {
2808
-					print '<tr><td valign="top">' . $form->textwithpicto($langs->trans("StockableProduct"), $langs->trans('StockableProductDescription')) . '</td>';
2808
+					print '<tr><td valign="top">'.$form->textwithpicto($langs->trans("StockableProduct"), $langs->trans('StockableProductDescription')).'</td>';
2809 2809
 					print '<td><input type="checkbox" readonly disabled '.($object->stockable_product == 1 ? 'checked' : '').'></td></tr>';
2810 2810
 				}
2811 2811
 
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
 					$result = $measuringUnits->fetchAll('', 'scale', 0, 0, ['t.active' => 1, 't.unit_type' => 'time']);
2844 2844
 					if ($result !== -1) {
2845 2845
 						foreach ($measuringUnits->records as $record) {
2846
-							$durations[$record->short_label] = dol_ucfirst($record->label) . $plural;
2846
+							$durations[$record->short_label] = dol_ucfirst($record->label).$plural;
2847 2847
 						}
2848 2848
 					}
2849 2849
 					print '<tr><td class="titlefieldmiddle">'.$langs->trans("Duration").'</td><td>';
@@ -3089,7 +3089,7 @@  discard block
 block discarded – undo
3089 3089
 			}
3090 3090
 
3091 3091
 			//Send
3092
-			print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
3092
+			print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
3093 3093
 
3094 3094
 			if (!isset($hookmanager->resArray['no_button_copy']) || $hookmanager->resArray['no_button_copy'] != 1) {
3095 3095
 				if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
 	$modelmail = 'product_send';
3272 3272
 	$defaulttopic = $object->label;
3273 3273
 	$diroutput = $conf->product->multidir_output[$object->entity];
3274
-	$trackid = 'prod' . $object->id;
3274
+	$trackid = 'prod'.$object->id;
3275 3275
 
3276 3276
 	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
3277 3277
 }
Please login to merge, or discard this patch.