Completed
Branch develop (10c9c4)
by
unknown
22:45
created
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 *
477 477
 	 * Note: cond_reglement can not be aliased to cond_reglement!!!
478 478
 	 */
479
-	private $cond_reglement;  // Private to call DolDeprecationHandler
479
+	private $cond_reglement; // Private to call DolDeprecationHandler
480 480
 	/**
481 481
 	 * @var int|string Internal to detect deprecated access
482 482
 	 */
483
-	protected $depr_cond_reglement;  // Internal value for deprecation
483
+	protected $depr_cond_reglement; // Internal value for deprecation
484 484
 
485 485
 	/**
486 486
 	 * @var int 		Delivery address ID
@@ -532,12 +532,12 @@  discard block
 block discarded – undo
532 532
 	/**
533 533
 	 * @var float|string Multicurrency total localtax1
534 534
 	 */
535
-	public $multicurrency_total_localtax1;	// not in database
535
+	public $multicurrency_total_localtax1; // not in database
536 536
 
537 537
 	/**
538 538
 	 * @var float|string Multicurrency total localtax2
539 539
 	 */
540
-	public $multicurrency_total_localtax2;	// not in database
540
+	public $multicurrency_total_localtax2; // not in database
541 541
 
542 542
 	/**
543 543
 	 * @var float 		Multicurrency total amount including taxes (TTC = "Toutes Taxes Comprises" in French)
@@ -1034,17 +1034,17 @@  discard block
 block discarded – undo
1034 1034
 				}
1035 1035
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1036 1036
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1037
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1037
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1038 1038
 				} else {
1039
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1040
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1039
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1040
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1041 1041
 					$count++;
1042 1042
 				}
1043 1043
 			}
1044 1044
 			$data['closedivextra'] = '</div>';
1045 1045
 		}
1046 1046
 
1047
-		$hookmanager->initHooks(array($this->element . 'dao'));
1047
+		$hookmanager->initHooks(array($this->element.'dao'));
1048 1048
 		$parameters = array(
1049 1049
 			'tooltipcontentarray' => &$data,
1050 1050
 			'params' => $params,
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
 
1265 1265
 		if ($this->restrictiononfksoc && property_exists($this, 'socid') && !empty($this->socid) && !$user->hasRight('societe', 'client', 'voir')) {
1266 1266
 			$sql_allowed_contacts = 'SELECT COUNT(*) as cnt FROM '.$this->db->prefix().'societe_commerciaux as sc';
1267
-			$sql_allowed_contacts.= ' WHERE sc.fk_soc = '.(int) $this->socid;
1268
-			$sql_allowed_contacts.= ' AND sc.fk_user = '.(int) $user->id;
1267
+			$sql_allowed_contacts .= ' WHERE sc.fk_soc = '.(int) $this->socid;
1268
+			$sql_allowed_contacts .= ' AND sc.fk_user = '.(int) $user->id;
1269 1269
 
1270 1270
 			$resql_allowed_contacts = $this->db->query($sql_allowed_contacts);
1271 1271
 
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 			$sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")";
1565 1565
 		}
1566 1566
 		if ($status >= 0) {
1567
-			$sql .= " AND t.statut = ".((int) $status);	// t is llx_user or llx_socpeople
1567
+			$sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople
1568 1568
 		}
1569 1569
 		if ($statusoflink >= 0) {
1570 1570
 			$sql .= " AND ec.statut = ".((int) $statusoflink);
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 		}
1954 1954
 
1955 1955
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1956
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1956
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1957 1957
 		$sql .= " LIMIT 1";
1958 1958
 
1959 1959
 		$query = $this->db->query($sql);
@@ -2272,9 +2272,9 @@  discard block
 block discarded – undo
2272 2272
 
2273 2273
 		$oldvalue = null;
2274 2274
 		if ($trigkey) {
2275
-			$sql = "SELECT " . $field;
2276
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2277
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2275
+			$sql = "SELECT ".$field;
2276
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2277
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2278 2278
 
2279 2279
 			$resql = $this->db->query($sql);
2280 2280
 			if ($resql) {
@@ -2654,7 +2654,7 @@  discard block
 block discarded – undo
2654 2654
 		// Triggers
2655 2655
 		if (!$error && !$notrigger) {
2656 2656
 			// Call triggers
2657
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2657
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2658 2658
 			if ($result < 0) {
2659 2659
 				$error++;
2660 2660
 			} //Do also here what you must do to rollback action if trigger fail
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
3067 3067
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
3068 3068
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
3069
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3069
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3070 3070
 			}
3071 3071
 			$sql .= ' WHERE rowid='.((int) $this->id);
3072 3072
 
@@ -3413,10 +3413,10 @@  discard block
 block discarded – undo
3413 3413
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3414 3414
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3415 3415
 		if (!$renum) {
3416
-			$sql .= " AND " . $fieldposition . " = 0";
3416
+			$sql .= " AND ".$fieldposition." = 0";
3417 3417
 		}
3418 3418
 		if ($renum) {
3419
-			$sql .= " AND " . $fieldposition . " <> 0";
3419
+			$sql .= " AND ".$fieldposition." <> 0";
3420 3420
 		}
3421 3421
 
3422 3422
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
 			if ($fk_parent_line) {
3438 3438
 				$sql .= ' AND fk_parent_line IS NULL';
3439 3439
 			}
3440
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3440
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3441 3441
 
3442 3442
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3443 3443
 			$resql = $this->db->query($sql);
@@ -3491,7 +3491,7 @@  discard block
 block discarded – undo
3491 3491
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3492 3492
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3493 3493
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3494
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3494
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3495 3495
 
3496 3496
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3497 3497
 
@@ -3618,7 +3618,7 @@  discard block
 block discarded – undo
3618 3618
 
3619 3619
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3620 3620
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3621
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3621
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3622 3622
 		if (!$this->db->query($sql)) {
3623 3623
 			$this->error = $this->db->lasterror();
3624 3624
 			return -1;
@@ -3655,7 +3655,7 @@  discard block
 block discarded – undo
3655 3655
 
3656 3656
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3657 3657
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3658
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3658
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3659 3659
 		if (!$this->db->query($sql)) {
3660 3660
 			$this->error = $this->db->lasterror();
3661 3661
 			return -1;
@@ -3684,7 +3684,7 @@  discard block
 block discarded – undo
3684 3684
 			$fieldposition = 'position';
3685 3685
 		}
3686 3686
 
3687
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3687
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3688 3688
 		$sql .= " WHERE rowid = ".((int) $rowid);
3689 3689
 
3690 3690
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
 
3713 3713
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3714 3714
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3715
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3715
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3716 3716
 		$resql = $this->db->query($sql);
3717 3717
 		if (!$resql) {
3718 3718
 			return 0;
@@ -3831,7 +3831,7 @@  discard block
 block discarded – undo
3831 3831
 			$newsuffix = '';
3832 3832
 		}
3833 3833
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3834
-			$fieldusermod =  "fk_user_mod";
3834
+			$fieldusermod = "fk_user_mod";
3835 3835
 		} elseif ($this->table_element == 'ecm_files') {
3836 3836
 			$fieldusermod = "fk_user_m";
3837 3837
 		} else {
@@ -3873,7 +3873,7 @@  discard block
 block discarded – undo
3873 3873
 						$trigger_name = 'EXPENSE_REPORT_MODIFY';
3874 3874
 						break;
3875 3875
 					default:
3876
-						$trigger_name = strtoupper($this->element) . '_MODIFY';
3876
+						$trigger_name = strtoupper($this->element).'_MODIFY';
3877 3877
 				}
3878 3878
 				$ret = $this->call_trigger($trigger_name, $user);
3879 3879
 				if ($ret < 0) {
@@ -4171,7 +4171,7 @@  discard block
 block discarded – undo
4171 4171
 			// Situations totals
4172 4172
 			if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {  // @phan-suppress-current-line PhanUndeclaredProperty
4173 4173
 				'@phan-var-force Facture $this';
4174
-				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';  // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4174
+				include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
4175 4175
 				if ($this->type != Facture::TYPE_CREDIT_NOTE) {	// @phpstan-ignore-line
4176 4176
 					if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
4177 4177
 						$prev_sits = $this->get_prev_sits();
@@ -4297,19 +4297,19 @@  discard block
 block discarded – undo
4297 4297
 		$this->db->begin();
4298 4298
 		$error = 0;
4299 4299
 
4300
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4300
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4301 4301
 		$sql .= "fk_source";
4302 4302
 		$sql .= ", sourcetype";
4303 4303
 		$sql .= ", fk_target";
4304 4304
 		$sql .= ", targettype";
4305 4305
 		$sql .= ") VALUES (";
4306 4306
 		$sql .= ((int) $origin_id);
4307
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4308
-		$sql .= ", " . ((int) $this->id);
4309
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4307
+		$sql .= ", '".$this->db->escape($origin)."'";
4308
+		$sql .= ", ".((int) $this->id);
4309
+		$sql .= ", '".$this->db->escape($targettype)."'";
4310 4310
 		$sql .= ")";
4311 4311
 
4312
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4312
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4313 4313
 		if ($this->db->query($sql)) {
4314 4314
 			if (!$notrigger) {
4315 4315
 				// Call trigger
@@ -4564,20 +4564,20 @@  discard block
 block discarded – undo
4564 4564
 		$this->db->begin();
4565 4565
 		$error = 0;
4566 4566
 
4567
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4567
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4568 4568
 		if ($updatesource) {
4569
-			$sql .= "fk_source = " . ((int) $sourceid);
4570
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4571
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4572
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4569
+			$sql .= "fk_source = ".((int) $sourceid);
4570
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4571
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4572
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4573 4573
 		} elseif ($updatetarget) {
4574
-			$sql .= "fk_target = " . ((int) $targetid);
4575
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4576
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4577
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4574
+			$sql .= "fk_target = ".((int) $targetid);
4575
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4576
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4577
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4578 4578
 		}
4579 4579
 
4580
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4580
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4581 4581
 		if ($this->db->query($sql)) {
4582 4582
 			if (!$notrigger) {
4583 4583
 				// Call trigger
@@ -4654,25 +4654,25 @@  discard block
 block discarded – undo
4654 4654
 		}
4655 4655
 
4656 4656
 		if (!$error) {
4657
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4657
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4658 4658
 			$sql .= " WHERE";
4659 4659
 			if ($rowid > 0) {
4660
-				$sql .= " rowid = " . ((int) $rowid);
4660
+				$sql .= " rowid = ".((int) $rowid);
4661 4661
 			} else {
4662 4662
 				if ($deletesource) {
4663
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4664
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'";
4663
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4664
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'";
4665 4665
 				} elseif ($deletetarget) {
4666
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4667
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'";
4666
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4667
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'";
4668 4668
 				} else {
4669
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')";
4669
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')";
4670 4670
 					$sql .= " OR";
4671
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')";
4671
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')";
4672 4672
 				}
4673 4673
 			}
4674 4674
 
4675
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4675
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4676 4676
 			if (!$this->db->query($sql)) {
4677 4677
 				$this->error = $this->db->lasterror();
4678 4678
 				$this->errors[] = $this->error;
@@ -4837,14 +4837,14 @@  discard block
 block discarded – undo
4837 4837
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4838 4838
 		}
4839 4839
 		$sql .= " WHERE rowid = ".((int) $elementId);
4840
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4840
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4841 4841
 
4842 4842
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4843 4843
 		$resql = $this->db->query($sql);
4844 4844
 		if ($resql) {
4845 4845
 			$error = 0;
4846 4846
 
4847
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4847
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4848 4848
 
4849 4849
 			if ($nb_rows_affected > 0) {
4850 4850
 				if (empty($trigkey)) {
@@ -4891,9 +4891,9 @@  discard block
 block discarded – undo
4891 4891
 					if ($fieldstatus == 'tosell') {
4892 4892
 						$this->status = $status;
4893 4893
 					} elseif ($fieldstatus == 'tobuy') {
4894
-						$this->status_buy = $status;	// @phpstan-ignore-line
4894
+						$this->status_buy = $status; // @phpstan-ignore-line
4895 4895
 					} elseif ($fieldstatus == 'tobatch') {
4896
-						$this->status_batch = $status;	// @phpstan-ignore-line
4896
+						$this->status_batch = $status; // @phpstan-ignore-line
4897 4897
 					} else {
4898 4898
 						$this->status = $status;
4899 4899
 					}
@@ -4999,7 +4999,7 @@  discard block
 block discarded – undo
4999 4999
 			return -1;
5000 5000
 		}
5001 5001
 
5002
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5002
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5003 5003
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
5004 5004
 		$tmparray = array_keys($this->childtables);
5005 5005
 		if (is_numeric($tmparray[0])) {
@@ -6052,7 +6052,7 @@  discard block
 block discarded – undo
6052 6052
 		} else {
6053 6053
 			// TODO: Try to set type above again
6054 6054
 			'@phan-var-force ModeleBarCode|ModeleExports|ModeleImports|ModelePDFAsset|ModelePDFContract|ModelePDFDeliveryOrder|ModelePDFEvaluation|ModelePDFFactures|ModelePDFFicheinter|ModelePDFMo|ModelePDFMovement|ModelePDFProduct|ModelePDFProjects|ModelePDFPropales|ModelePDFRecruitmentJobPosition|ModelePDFStock|ModelePDFStockTransfer|ModelePDFSupplierProposal|ModelePDFSuppliersInvoices|ModelePDFSuppliersOrders|ModelePDFSuppliersPayments|ModelePDFTask|ModelePDFTicket|ModelePDFUser|ModelePDFUserGroup|ModelePdfExpedition|ModelePdfReception|ModeleThirdPartyDoc $obj';
6055
-			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);  // @phan-suppress-line-PhanTypeMismatchArgument
6055
+			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument
6056 6056
 		}
6057 6057
 		// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
6058 6058
 
@@ -6125,7 +6125,7 @@  discard block
 block discarded – undo
6125 6125
 			$setsharekey = false;
6126 6126
 			if ($this->element == 'propal' || $this->element == 'proposal') {
6127 6127
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
6128
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
6128
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
6129 6129
 				}
6130 6130
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
6131 6131
 					$setsharekey = true;
@@ -6185,7 +6185,7 @@  discard block
 block discarded – undo
6185 6185
 				$ecmfile->gen_or_uploaded = 'generated';
6186 6186
 				$ecmfile->description = ''; // indexed content
6187 6187
 				$ecmfile->keywords = ''; // keyword content
6188
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
6188
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
6189 6189
 				$ecmfile->src_object_id   = $this->id;
6190 6190
 
6191 6191
 				$result = $ecmfile->create($user);
@@ -6337,8 +6337,8 @@  discard block
 block discarded – undo
6337 6337
 		// phpcs:enable
6338 6338
 		global $langs, $conf;
6339 6339
 
6340
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
6341
-			dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
6340
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
6341
+			dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
6342 6342
 			exit;
6343 6343
 		}
6344 6344
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6533,7 +6533,7 @@  discard block
 block discarded – undo
6533 6533
 		$savDisableCompute = $conf->disable_compute;
6534 6534
 		$conf->disable_compute = 1;
6535 6535
 
6536
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6536
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6537 6537
 
6538 6538
 		$conf->disable_compute = $savDisableCompute;
6539 6539
 
@@ -6595,7 +6595,7 @@  discard block
 block discarded – undo
6595 6595
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6596 6596
 			$sql = "SELECT rowid";
6597 6597
 			foreach ($optionsArray as $name => $label) {
6598
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6598
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6599 6599
 					$sql .= ", ".$name;
6600 6600
 				}
6601 6601
 				// use geo sql fonction to read as text
@@ -6640,7 +6640,7 @@  discard block
 block discarded – undo
6640 6640
 					 **/
6641 6641
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6642 6642
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6643
-							$this->array_options['options_' . $key] = null;
6643
+							$this->array_options['options_'.$key] = null;
6644 6644
 						}
6645 6645
 					}
6646 6646
 				}
@@ -6652,9 +6652,9 @@  discard block
 block discarded – undo
6652 6652
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6653 6653
 							//var_dump($conf->disable_compute);
6654 6654
 							if (empty($conf->disable_compute)) {
6655
-								global $objectoffield;        // We set a global variable to $objectoffield so
6656
-								$objectoffield = $this;        // we can use it inside computed formula
6657
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6655
+								global $objectoffield; // We set a global variable to $objectoffield so
6656
+								$objectoffield = $this; // we can use it inside computed formula
6657
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6658 6658
 							}
6659 6659
 						}
6660 6660
 					}
@@ -6835,7 +6835,7 @@  discard block
 block discarded – undo
6835 6835
 									// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6836 6836
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6837 6837
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6838
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6838
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6839 6839
 										} else {
6840 6840
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6841 6841
 										}
@@ -6846,7 +6846,7 @@  discard block
 block discarded – undo
6846 6846
 									// If value has changed
6847 6847
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6848 6848
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6849
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6849
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6850 6850
 										} else {
6851 6851
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6852 6852
 										}
@@ -6858,7 +6858,7 @@  discard block
 block discarded – undo
6858 6858
 								//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6859 6859
 								// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6860 6860
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6861
-									$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6861
+									$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6862 6862
 								} else {
6863 6863
 									$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6864 6864
 								}
@@ -6903,9 +6903,9 @@  discard block
 block discarded – undo
6903 6903
 
6904 6904
 							$sqlFetchObject = "SELECT rowid FROM ".$this->db->prefix().$object->table_element;
6905 6905
 							if (is_numeric($value)) {
6906
-								$sqlFetchObject .= " WHERE rowid = " . (int) $value;
6906
+								$sqlFetchObject .= " WHERE rowid = ".(int) $value;
6907 6907
 							} else {
6908
-								$sqlFetchObject .= " WHERE ref = '" . $this->db->escape($value) . "'";
6908
+								$sqlFetchObject .= " WHERE ref = '".$this->db->escape($value)."'";
6909 6909
 							}
6910 6910
 
6911 6911
 							$obj = $this->db->getRow($sqlFetchObject);
@@ -6950,7 +6950,7 @@  discard block
 block discarded – undo
6950 6950
 			}
6951 6951
 			$geoDataType = ExtraFields::$geoDataTypes[$attributeType] ?? null;
6952 6952
 			// Add field of attribute
6953
-			if (! $geoDataType) {
6953
+			if (!$geoDataType) {
6954 6954
 				// not a geodata type
6955 6955
 				if ($newValue != '') {
6956 6956
 					$sqlColumnValues[$attributeKey] = "'".$this->db->escape($newValue)."'";
@@ -6986,7 +6986,7 @@  discard block
 block discarded – undo
6986 6986
 		if ($table_element == 'categorie') {
6987 6987
 			$table_element = 'categories'; // For compatibility
6988 6988
 		}
6989
-		$extrafieldsTable = $this->db->prefix() . $table_element . '_extrafields';
6989
+		$extrafieldsTable = $this->db->prefix().$table_element.'_extrafields';
6990 6990
 
6991 6991
 		dol_syslog(get_class($this)."::insertExtraFields delete then insert", LOG_DEBUG);
6992 6992
 
@@ -6999,7 +6999,7 @@  discard block
 block discarded – undo
6999 6999
 				 * @param string $key
7000 7000
 				 * @return string
7001 7001
 				 */
7002
-				array_map(function ($key) use ($sqlColumnValues) {
7002
+				array_map(function($key) use ($sqlColumnValues) {
7003 7003
 					return "{$key} = {$sqlColumnValues[$key]}";
7004 7004
 				}, array_keys($sqlColumnValues))
7005 7005
 			);
@@ -7295,7 +7295,7 @@  discard block
 block discarded – undo
7295 7295
 								if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) {	// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
7296 7296
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7297 7297
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
7298
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7298
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7299 7299
 										} else {
7300 7300
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7301 7301
 										}
@@ -7315,7 +7315,7 @@  discard block
 block discarded – undo
7315 7315
 								}
7316 7316
 							} else {
7317 7317
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7318
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7318
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7319 7319
 								} else {
7320 7320
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7321 7321
 								}
@@ -7904,7 +7904,7 @@  discard block
 block discarded – undo
7904 7904
 				// 7 : sort field
7905 7905
 
7906 7906
 				// If there is filter
7907
-				if (! empty($InfoFieldList[4])) {
7907
+				if (!empty($InfoFieldList[4])) {
7908 7908
 					$pos = 0;
7909 7909
 					$parenthesisopen = 0;
7910 7910
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -7968,8 +7968,8 @@  discard block
 block discarded – undo
7968 7968
 					}
7969 7969
 
7970 7970
 					$sqlwhere = '';
7971
-					$sql = "SELECT " . $keyList;
7972
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7971
+					$sql = "SELECT ".$keyList;
7972
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7973 7973
 
7974 7974
 					if (!empty($InfoFieldList[4])) {
7975 7975
 						// can use SELECT request
@@ -7987,11 +7987,11 @@  discard block
 block discarded – undo
7987 7987
 						// We have to join on extrafield table
7988 7988
 						$errstr = '';
7989 7989
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7990
-							$sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra";
7991
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
7992
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7990
+							$sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra";
7991
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
7992
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7993 7993
 						} else {
7994
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7994
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7995 7995
 						}
7996 7996
 					} else {
7997 7997
 						$sqlwhere .= ' WHERE 1=1';
@@ -8012,7 +8012,7 @@  discard block
 block discarded – undo
8012 8012
 
8013 8013
 					// Some tables may have field, some other not. For the moment we disable it.
8014 8014
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8015
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8015
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8016 8016
 					}
8017 8017
 					$sql .= $sqlwhere;
8018 8018
 
@@ -8022,10 +8022,10 @@  discard block
 block discarded – undo
8022 8022
 					} else {
8023 8023
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
8024 8024
 					}
8025
-					$sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8025
+					$sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8026 8026
 					// print $sql;
8027 8027
 
8028
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
8028
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
8029 8029
 					$resql = $this->db->query($sql);
8030 8030
 					if ($resql) {
8031 8031
 						$out .= '<option value="0">&nbsp;</option>';
@@ -8041,7 +8041,7 @@  discard block
 block discarded – undo
8041 8041
 							if (count($fields_label) > 1) {
8042 8042
 								$notrans = true;
8043 8043
 								foreach ($fields_label as $field_toshow) {
8044
-									$labeltoshow .= $obj->$field_toshow . ' ';
8044
+									$labeltoshow .= $obj->$field_toshow.' ';
8045 8045
 								}
8046 8046
 							} else {
8047 8047
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8052,12 +8052,12 @@  discard block
 block discarded – undo
8052 8052
 								foreach ($fields_label as $field_toshow) {
8053 8053
 									$translabel = $langs->trans($obj->$field_toshow);
8054 8054
 									if ($translabel != $obj->$field_toshow) {
8055
-										$labeltoshow = dol_trunc($translabel) . ' ';
8055
+										$labeltoshow = dol_trunc($translabel).' ';
8056 8056
 									} else {
8057
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
8057
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
8058 8058
 									}
8059 8059
 								}
8060
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8060
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8061 8061
 							} else {
8062 8062
 								if (!$notrans) {
8063 8063
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -8071,25 +8071,25 @@  discard block
 block discarded – undo
8071 8071
 									$labeltoshow = '(not defined)';
8072 8072
 								}
8073 8073
 								if ($value == $obj->rowid) {
8074
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8074
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8075 8075
 								}
8076 8076
 
8077 8077
 								if (!empty($InfoFieldList[3]) && $parentField) {
8078
-									$parent = $parentName . ':' . $obj->{$parentField};
8078
+									$parent = $parentName.':'.$obj->{$parentField};
8079 8079
 									$isDependList = 1;
8080 8080
 								}
8081 8081
 
8082
-								$out .= '<option value="' . $obj->rowid . '"';
8082
+								$out .= '<option value="'.$obj->rowid.'"';
8083 8083
 								$out .= ($value == $obj->rowid ? ' selected' : '');
8084
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
8085
-								$out .= '>' . $labeltoshow . '</option>';
8084
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
8085
+								$out .= '>'.$labeltoshow.'</option>';
8086 8086
 							}
8087 8087
 
8088 8088
 							$i++;
8089 8089
 						}
8090 8090
 						$this->db->free($resql);
8091 8091
 					} else {
8092
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8092
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8093 8093
 					}
8094 8094
 				} else {
8095 8095
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8100,9 +8100,9 @@  discard block
 block discarded – undo
8100 8100
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8101 8101
 					$out .= '<option value="0">&nbsp;</option>';
8102 8102
 					foreach ($data as $data_key => $data_value) {
8103
-						$out .= '<option value="' . $data_key . '"';
8103
+						$out .= '<option value="'.$data_key.'"';
8104 8104
 						$out .= ($value == $data_key ? ' selected' : '');
8105
-						$out .= '>' . $data_value . '</option>';
8105
+						$out .= '>'.$data_value.'</option>';
8106 8106
 					}
8107 8107
 				}
8108 8108
 			}
@@ -8142,7 +8142,7 @@  discard block
 block discarded – undo
8142 8142
 				// 7 : sort field
8143 8143
 
8144 8144
 				// If there is a filter
8145
-				if (! empty($InfoFieldList[4])) {
8145
+				if (!empty($InfoFieldList[4])) {
8146 8146
 					$pos = 0;
8147 8147
 					$parenthesisopen = 0;
8148 8148
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8208,8 +8208,8 @@  discard block
 block discarded – undo
8208 8208
 					}
8209 8209
 
8210 8210
 					$sqlwhere = '';
8211
-					$sql = "SELECT " . $keyList;
8212
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
8211
+					$sql = "SELECT ".$keyList;
8212
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
8213 8213
 
8214 8214
 					if (!empty($InfoFieldList[4])) {
8215 8215
 						// can use SELECT request
@@ -8227,11 +8227,11 @@  discard block
 block discarded – undo
8227 8227
 						// We have to join on extrafield table
8228 8228
 						$errstr = '';
8229 8229
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8230
-							$sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra';
8231
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8232
-							$sqlwhere .= " AND " . $InfoFieldList[4];
8230
+							$sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra';
8231
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8232
+							$sqlwhere .= " AND ".$InfoFieldList[4];
8233 8233
 						} else {
8234
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
8234
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
8235 8235
 						}
8236 8236
 					} else {
8237 8237
 						$sqlwhere .= ' WHERE 1=1';
@@ -8252,14 +8252,14 @@  discard block
 block discarded – undo
8252 8252
 
8253 8253
 					// Some tables may have field, some other not. For the moment we disable it.
8254 8254
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8255
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8255
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8256 8256
 					}
8257 8257
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
8258 8258
 					// print $sql;
8259 8259
 
8260 8260
 					$sql .= $sqlwhere;
8261 8261
 
8262
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
8262
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
8263 8263
 
8264 8264
 					$resql = $this->db->query($sql);
8265 8265
 					if ($resql) {
@@ -8278,7 +8278,7 @@  discard block
 block discarded – undo
8278 8278
 							if (count($fields_label) > 1) {
8279 8279
 								$notrans = true;
8280 8280
 								foreach ($fields_label as $field_toshow) {
8281
-									$labeltoshow .= $obj->$field_toshow . ' ';
8281
+									$labeltoshow .= $obj->$field_toshow.' ';
8282 8282
 								}
8283 8283
 							} else {
8284 8284
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8289,9 +8289,9 @@  discard block
 block discarded – undo
8289 8289
 								foreach ($fields_label as $field_toshow) {
8290 8290
 									$translabel = $langs->trans($obj->$field_toshow);
8291 8291
 									if ($translabel != $obj->$field_toshow) {
8292
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
8292
+										$labeltoshow = dol_trunc($translabel, 18).' ';
8293 8293
 									} else {
8294
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
8294
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
8295 8295
 									}
8296 8296
 								}
8297 8297
 
@@ -8314,7 +8314,7 @@  discard block
 block discarded – undo
8314 8314
 								}
8315 8315
 
8316 8316
 								if (!empty($InfoFieldList[3]) && $parentField) {
8317
-									$parent = $parentName . ':' . $obj->{$parentField};
8317
+									$parent = $parentName.':'.$obj->{$parentField};
8318 8318
 									$isDependList = 1;
8319 8319
 								}
8320 8320
 
@@ -8325,9 +8325,9 @@  discard block
 block discarded – undo
8325 8325
 						}
8326 8326
 						$this->db->free($resql);
8327 8327
 
8328
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8328
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8329 8329
 					} else {
8330
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8330
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8331 8331
 					}
8332 8332
 				} else {
8333 8333
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8336,7 +8336,7 @@  discard block
 block discarded – undo
8336 8336
 						$categcode = Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]];
8337 8337
 					}
8338 8338
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8339
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8339
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8340 8340
 				}
8341 8341
 			}
8342 8342
 		} elseif ($type == 'link') {
@@ -8371,7 +8371,7 @@  discard block
 block discarded – undo
8371 8371
 			// $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller.
8372 8372
 
8373 8373
 			//$objectfield = $valparent;
8374
-			$objectfield = $val;			// Is better than using old method $valparent
8374
+			$objectfield = $val; // Is better than using old method $valparent
8375 8375
 
8376 8376
 			// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
8377 8377
 			$out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield);
@@ -8584,7 +8584,7 @@  discard block
 block discarded – undo
8584 8584
 			$value = $this->getLibStatut(3);
8585 8585
 		} elseif ($type == 'date') {
8586 8586
 			if (!empty($value)) {
8587
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8587
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8588 8588
 			} else {
8589 8589
 				$value = '';
8590 8590
 			}
@@ -8685,7 +8685,7 @@  discard block
 block discarded – undo
8685 8685
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8686 8686
 			if (strpos($value, "|") !== false) {
8687 8687
 				$value = $langs->trans(explode('|', $value)[0]);
8688
-			} elseif (! is_numeric($value)) {
8688
+			} elseif (!is_numeric($value)) {
8689 8689
 				$value = $langs->trans($value);
8690 8690
 			}
8691 8691
 		} elseif ($type == 'sellist') {
@@ -8747,9 +8747,9 @@  discard block
 block discarded – undo
8747 8747
 									$translabel = $langs->trans($obj->$field_toshow);
8748 8748
 								}
8749 8749
 								if ($translabel != $field_toshow) {
8750
-									$value .= dol_trunc($translabel, 18) . ' ';
8750
+									$value .= dol_trunc($translabel, 18).' ';
8751 8751
 								} else {
8752
-									$value .= $obj->$field_toshow . ' ';
8752
+									$value .= $obj->$field_toshow.' ';
8753 8753
 								}
8754 8754
 							}
8755 8755
 						} else {
@@ -8765,7 +8765,7 @@  discard block
 block discarded – undo
8765 8765
 						}
8766 8766
 					}
8767 8767
 				} else {
8768
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8768
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8769 8769
 
8770 8770
 					$toprint = array();
8771 8771
 					$obj = $this->db->fetch_object($resql);
@@ -8773,7 +8773,7 @@  discard block
 block discarded – undo
8773 8773
 					$c->fetch($obj->rowid);
8774 8774
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8775 8775
 					foreach ($ways as $way) {
8776
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8776
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8777 8777
 					}
8778 8778
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8779 8779
 				}
@@ -8789,11 +8789,11 @@  discard block
 block discarded – undo
8789 8789
 				$toprint = array();
8790 8790
 				foreach ($value_arr as $keyval => $valueval) {
8791 8791
 					if (!empty($valueval)) {
8792
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8792
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8793 8793
 					}
8794 8794
 				}
8795 8795
 				if (!empty($toprint)) {
8796
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8796
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8797 8797
 				}
8798 8798
 			}
8799 8799
 		} elseif ($type == 'chkbxlst') {
@@ -8848,9 +8848,9 @@  discard block
 block discarded – undo
8848 8848
 										$translabel = $langs->trans($obj->$field_toshow);
8849 8849
 									}
8850 8850
 									if ($translabel != $field_toshow) {
8851
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8851
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8852 8852
 									} else {
8853
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8853
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8854 8854
 									}
8855 8855
 								}
8856 8856
 							} else {
@@ -8859,15 +8859,15 @@  discard block
 block discarded – undo
8859 8859
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8860 8860
 								}
8861 8861
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8862
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8862
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8863 8863
 								} else {
8864
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8864
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8865 8865
 								}
8866 8866
 							}
8867 8867
 						}
8868 8868
 					}
8869 8869
 				} else {
8870
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8870
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8871 8871
 
8872 8872
 					$toprint = array();
8873 8873
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8876,7 +8876,7 @@  discard block
 block discarded – undo
8876 8876
 							$c->fetch($obj->rowid);
8877 8877
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8878 8878
 							foreach ($ways as $way) {
8879
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8879
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8880 8880
 							}
8881 8881
 						}
8882 8882
 					}
@@ -9046,7 +9046,7 @@  discard block
 block discarded – undo
9046 9046
 		global $langs;
9047 9047
 
9048 9048
 		if (!class_exists('Validate')) {
9049
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
9049
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
9050 9050
 		}
9051 9051
 
9052 9052
 		$this->clearFieldError($fieldKey);
@@ -9285,7 +9285,7 @@  discard block
 block discarded – undo
9285 9285
 				$out .= "\n";
9286 9286
 
9287 9287
 				$nbofextrafieldsshown = 0;
9288
-				$e = 0;	// var to manage the modulo (odd/even)
9288
+				$e = 0; // var to manage the modulo (odd/even)
9289 9289
 
9290 9290
 				$lastseparatorkeyfound = '';
9291 9291
 				$extrafields_collapse_num = '';
@@ -9323,9 +9323,9 @@  discard block
 block discarded – undo
9323 9323
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
9324 9324
 					} elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) {
9325 9325
 						// We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost
9326
-						$ef_name = 'options_' . $key;
9326
+						$ef_name = 'options_'.$key;
9327 9327
 						$ef_value = $this->array_options[$ef_name];
9328
-						$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
9328
+						$out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n";
9329 9329
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
9330 9330
 					} elseif ($mode == 'view' && empty($visibility)) {
9331 9331
 						continue;
@@ -10414,7 +10414,7 @@  discard block
 block discarded – undo
10414 10414
 						continue;
10415 10415
 					}
10416 10416
 				}
10417
-				$keys_with_alias[] = $alias . '.' . $fieldname;
10417
+				$keys_with_alias[] = $alias.'.'.$fieldname;
10418 10418
 			}
10419 10419
 			return implode(', ', $keys_with_alias);
10420 10420
 		} else {
@@ -10555,7 +10555,7 @@  discard block
 block discarded – undo
10555 10555
 		if (!$error) {
10556 10556
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10557 10557
 			$sql .= " (".implode(", ", $keys).')';
10558
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10558
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10559 10559
 
10560 10560
 			$res = $this->db->query($sql);
10561 10561
 			if (!$res) {
@@ -10866,7 +10866,7 @@  discard block
 block discarded – undo
10866 10866
 
10867 10867
 		// Update extrafield
10868 10868
 		if (!$error) {
10869
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
10869
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
10870 10870
 			if ($result < 0) {
10871 10871
 				$error++;
10872 10872
 			}
@@ -11090,12 +11090,12 @@  discard block
 block discarded – undo
11090 11090
 				$error++;
11091 11091
 			} else {
11092 11092
 				while ($obj = $this->db->fetch_object($resql)) {
11093
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
11093
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
11094 11094
 					if ($result < 0) {
11095 11095
 						$error++;
11096 11096
 						$this->errors[] = $this->error;
11097 11097
 					} else {
11098
-						$result = $this->delete($user);	// @phpstan-ignore-line
11098
+						$result = $this->delete($user); // @phpstan-ignore-line
11099 11099
 						if ($result < 0) {
11100 11100
 							$error++;
11101 11101
 							$this->errors[] = $this->error;
@@ -11261,7 +11261,7 @@  discard block
 block discarded – undo
11261 11261
 		);
11262 11262
 		foreach ($fields as $key => $value) {
11263 11263
 			if (array_key_exists($key, $this->fields)) {
11264
-				$this->{$key} = $value;		// @phpstan-ignore-line
11264
+				$this->{$key} = $value; // @phpstan-ignore-line
11265 11265
 			}
11266 11266
 		}
11267 11267
 
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/class/actions_mymodule.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 			if (in_array($element, ['context1', 'context2'])) {
359 359
 				$datacount = 0;
360 360
 
361
-				$parameters['head'][$counter][0] = dol_buildpath('/mymodule/mymodule_tab.php', 1) . '?id=' . $id . '&amp;module='.$element;
361
+				$parameters['head'][$counter][0] = dol_buildpath('/mymodule/mymodule_tab.php', 1).'?id='.$id.'&amp;module='.$element;
362 362
 				$parameters['head'][$counter][1] = $langs->trans('MyModuleTab');
363 363
 				if ($datacount > 0) {
364
-					$parameters['head'][$counter][1] .= '<span class="badge marginleftonlyshort">' . $datacount . '</span>';
364
+					$parameters['head'][$counter][1] .= '<span class="badge marginleftonlyshort">'.$datacount.'</span>';
365 365
 				}
366 366
 				$parameters['head'][$counter][2] = 'mymoduleemails';
367 367
 				$counter++;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			'enabled' => isModEnabled('mymodule'),
398 398
 			'perms' => 1,
399 399
 			'label' => 'LinkToMyObject',
400
-			'sql' => "SELECT t.rowid, t.ref, t.ref as 'name' FROM " . $this->db->prefix() . $myobject->table_element. " as t "),);
400
+			'sql' => "SELECT t.rowid, t.ref, t.ref as 'name' FROM ".$this->db->prefix().$myobject->table_element." as t "),);
401 401
 
402 402
 		return 1;
403 403
 	}
Please login to merge, or discard this patch.