Completed
Branch develop (1648b4)
by
unknown
26:41
created
dev/tools/apstats.php 1 patch
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
 <!-- Made with [OSS Insight](https://ossinsight.io/) -->
733 733
 
734
-END;
734
+end;
735 735
 
736 736
 
737 737
 $html .= '</div>';
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 <a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" alt="Dolibarr" data-canonical-src="https://opencollective.com/dolibarr/contributors.svg?width=890&amp;button=false" style="max-width: 100%;"></a>
753 753
 </center>
754 754
 <br>
755
-END;
755
+end;
756 756
 
757 757
 /*
758 758
 $html .= <<<END
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 </a>
782 782
 
783 783
 <!-- Made with [OSS Insight](https://ossinsight.io/) -->
784
-END;
784
+end;
785 785
 
786 786
 $html .= '</div>';
787 787
 
Please login to merge, or discard this patch.
htdocs/projet/tasks/time.php 1 patch
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 // Load Dolibarr environment
35 35
 require '../../main.inc.php';
36
-require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
40
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
44 44
 
45 45
 /**
46 46
  * @var Conf $conf
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
180 180
 }
181 181
 
182
-include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
182
+include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
183 183
 
184 184
 // Purge search criteria
185 185
 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 }
365 365
 
366 366
 if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) {
367
-	$object->fetchTimeSpent(GETPOSTINT('lineid'));    // load properties like $object->timespent_xxx
367
+	$object->fetchTimeSpent(GETPOSTINT('lineid')); // load properties like $object->timespent_xxx
368 368
 
369 369
 	if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
370
-		$result = $object->delTimeSpent($user);    // delete line with $object->timespent_id
370
+		$result = $object->delTimeSpent($user); // delete line with $object->timespent_id
371 371
 
372 372
 		if ($result < 0) {
373 373
 			$langs->load("errors");
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		if (count($tasksarray) > 0) {
388 388
 			$id = $tasksarray[0]->id;
389 389
 		} else {
390
-			header("Location: " . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . ($withproject ? '&withproject=1' : '') . (empty($mode) ? '' : '&mode=' . $mode));
390
+			header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode));
391 391
 			exit;
392 392
 		}
393 393
 	}
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 	if (!($projectstatic->thirdparty->id > 0)) {
426 426
 		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors');
427 427
 	} else {
428
-		include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
429
-		include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
430
-		include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
428
+		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
429
+		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
430
+		include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
431 431
 
432 432
 		$tmpinvoice = new Facture($db);
433 433
 		$tmptimespent = new Task($db);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 				$arrayoftasks = array();
494 494
 				foreach ($toselect as $key => $value) {
495 495
 					// Get userid, timepent
496
-					$object->fetchTimeSpent($value);    // $value is ID of 1 line in timespent table
496
+					$object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table
497 497
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
498 498
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
499 499
 				}
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 						}
567 567
 
568 568
 						// Add lines
569
-						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username) . ' : ' . $qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject);
569
+						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject);
570 570
 						if ($lineid < 0) {
571 571
 							$error++;
572 572
 							setEventMessages(null, $tmpinvoice->errors, 'errors');
@@ -599,16 +599,16 @@  discard block
 block discarded – undo
599 599
 
600 600
 					$arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration;
601 601
 					$arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm;
602
-					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref . ' - ' . $ftask->label . ' - ' . $username;
602
+					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username;
603 603
 					$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $object->timespent_note);
604 604
 
605 605
 					if (!empty($withdetail)) {
606 606
 						if (!empty($object->timespent_withhour)) {
607
-							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour));
607
+							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_datehour));
608 608
 						} else {
609
-							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date") . ': ' . dol_print_date($object->timespent_date));
609
+							$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Date").': '.dol_print_date($object->timespent_date));
610 610
 						}
611
-						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration") . ': ' . convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY));
611
+						$arrayoftasks[$object->timespent_id]['note'] = dol_concatdesc($arrayoftasks[$object->timespent_id]['note'], $langs->trans("Duration").': '.convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY));
612 612
 					}
613 613
 					$arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user;
614 614
 					$arrayoftasks[$object->timespent_id]['fk_product'] = $object->timespent_fk_product;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				$arrayoftasks = array();
687 687
 				foreach ($toselect as $key => $value) {
688 688
 					// Get userid, timepent
689
-					$object->fetchTimeSpent($value);        // Call method to get list of timespent for a timespent line id (We use the utility method found into Task object)
689
+					$object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utility method found into Task object)
690 690
 					// $object->id is now the task id
691 691
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
692 692
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 						// Add lines
763 763
 						$date_start = '';
764 764
 						$date_end = '';
765
-						$lineName = $ftask->ref . ' - ' . $ftask->label;
765
+						$lineName = $ftask->ref.' - '.$ftask->label;
766 766
 						$lineid = $tmpinvoice->addline($lineName, (float) $pu_ht_for_task, (float) price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), (float) $remiseproject, $date_start, $date_end, 0, 0, 0, 'HT', 0, 1, -1, 0, '', 0, 0, 0, $pa_ht);
767 767
 						if ($lineid < 0) {
768 768
 							$error++;
@@ -772,8 +772,8 @@  discard block
 block discarded – undo
772 772
 
773 773
 						if (!$error) {
774 774
 							// Update lineid into line of timespent
775
-							$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'element_time SET invoice_line_id = ' . ((int) $lineid) . ', invoice_id = ' . ((int) $tmpinvoice->id);
776
-							$sql .= ' WHERE rowid IN (' . $db->sanitize(implode(',', $toselect)) . ')';
775
+							$sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id);
776
+							$sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')';
777 777
 							$result = $db->query($sql);
778 778
 							if (!$result) {
779 779
 								$error++;
@@ -809,12 +809,12 @@  discard block
 block discarded – undo
809 809
 	if (!($projectstatic->thirdparty->id > 0)) {
810 810
 		setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors');
811 811
 	} else {
812
-		include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
813
-		include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
814
-		include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
812
+		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
813
+		include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
814
+		include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
815 815
 
816 816
 
817
-		require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
817
+		require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
818 818
 		$tmpinter = new Fichinter($db);
819 819
 		$tmptimespent = new Task($db);
820 820
 		$fuser = new User($db);
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$tmpinter->socid = $projectstatic->thirdparty->id;
827 827
 		$tmpinter->date = dol_mktime(GETPOSTINT('rehour'), GETPOSTINT('remin'), GETPOSTINT('resec'), GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
828 828
 		$tmpinter->fk_project = $projectstatic->id;
829
-		$tmpinter->description = $projectstatic->title . (!empty($projectstatic->description) ? '-' . $projectstatic->label : '');
829
+		$tmpinter->description = $projectstatic->title.(!empty($projectstatic->description) ? '-'.$projectstatic->label : '');
830 830
 
831 831
 		if ($interToUse) {
832 832
 			$tmpinter->fetch($interToUse);
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 				$qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
860 860
 
861 861
 				// Add lines
862
-				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . (!empty($value['note']) ? ' - ' . $value['note'] : ''), (int) $value['date'], $value['timespent']);
862
+				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label.(!empty($value['note']) ? ' - '.$value['note'] : ''), (int) $value['date'], $value['timespent']);
863 863
 
864 864
 				if ($lineid > 0) {
865 865
 					// Link timespent to intervention
@@ -903,9 +903,9 @@  discard block
 block discarded – undo
903 903
 //$result = $projectstatic->fetch($object->fk_project);
904 904
 $arrayofselected = is_array($toselect) ? $toselect : array();
905 905
 
906
-$title = $object->ref . ' - ' . $langs->trans("TimeSpent");
906
+$title = $object->ref.' - '.$langs->trans("TimeSpent");
907 907
 if (!empty($withproject)) {
908
-	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': ' . $projectstatic->ref : '');
908
+	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '');
909 909
 }
910 910
 $help_url = '';
911 911
 
@@ -954,13 +954,13 @@  discard block
 block discarded – undo
954 954
 
955 955
 			$param = ((!empty($mode) && $mode == 'mine') ? '&mode=mine' : '');
956 956
 			if ($search_user) {
957
-				$param .= '&search_user=' . ((int) $search_user);
957
+				$param .= '&search_user='.((int) $search_user);
958 958
 			}
959 959
 			if ($search_month) {
960
-				$param .= '&search_month=' . ((int) $search_month);
960
+				$param .= '&search_month='.((int) $search_month);
961 961
 			}
962 962
 			if ($search_year) {
963
-				$param .= '&search_year=' . ((int) $search_year);
963
+				$param .= '&search_year='.((int) $search_year);
964 964
 			}
965 965
 
966 966
 			// Project card
@@ -972,14 +972,14 @@  discard block
 block discarded – undo
972 972
 			$morehtmlref .= $projectstatic->title;
973 973
 			// Thirdparty
974 974
 			if (!empty($projectstatic->thirdparty->id) && $projectstatic->thirdparty->id > 0) {
975
-				$morehtmlref .= '<br>' . $projectstatic->thirdparty->getNomUrl(1, 'project');
975
+				$morehtmlref .= '<br>'.$projectstatic->thirdparty->getNomUrl(1, 'project');
976 976
 			}
977 977
 			$morehtmlref .= '</div>';
978 978
 
979 979
 			// Define a complementary filter for search of next/prev ref.
980 980
 			if (!$user->hasRight('projet', 'all', 'lire')) {
981 981
 				$objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
982
-				$projectstatic->next_prev_filter = "rowid:IN:" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
982
+				$projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0');
983 983
 			}
984 984
 
985 985
 			dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
@@ -997,25 +997,25 @@  discard block
 block discarded – undo
997 997
 				print '</td>';
998 998
 				print '<td>';
999 999
 				if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
1000
-					print '<input type="checkbox" disabled name="usage_opportunity"' . (GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')) . '"> ';
1000
+					print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_opportunity ? ' checked="checked"' : '')).'"> ';
1001 1001
 					$htmltext = $langs->trans("ProjectFollowOpportunity");
1002 1002
 					print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
1003 1003
 					print '<br>';
1004 1004
 				}
1005 1005
 				if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
1006
-					print '<input type="checkbox" disabled name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')) . '"> ';
1006
+					print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_task ? ' checked="checked"' : '')).'"> ';
1007 1007
 					$htmltext = $langs->trans("ProjectFollowTasks");
1008 1008
 					print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
1009 1009
 					print '<br>';
1010 1010
 				}
1011 1011
 				if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
1012
-					print '<input type="checkbox" disabled name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')) . '"> ';
1012
+					print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_bill_time ? ' checked="checked"' : '')).'"> ';
1013 1013
 					$htmltext = $langs->trans("ProjectBillTimeDescription");
1014 1014
 					print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
1015 1015
 					print '<br>';
1016 1016
 				}
1017 1017
 				if (isModEnabled('eventorganization')) {
1018
-					print '<input type="checkbox" disabled name="usage_organize_event"' . (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')) . '"> ';
1018
+					print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($projectstatic->usage_organize_event ? ' checked="checked"' : '')).'"> ';
1019 1019
 					$htmltext = $langs->trans("EventOrganizationDescriptionLong");
1020 1020
 					print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
1021 1021
 				}
@@ -1023,14 +1023,14 @@  discard block
 block discarded – undo
1023 1023
 			}
1024 1024
 
1025 1025
 			// Budget
1026
-			print '<tr><td>' . $langs->trans("Budget") . '</td><td>';
1026
+			print '<tr><td>'.$langs->trans("Budget").'</td><td>';
1027 1027
 			if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) {
1028
-				print '<span class="amount">' . price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency) . '</span>';
1028
+				print '<span class="amount">'.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).'</span>';
1029 1029
 			}
1030 1030
 			print '</td></tr>';
1031 1031
 
1032 1032
 			// Date start - end project
1033
-			print '<tr><td>' . $langs->trans("Dates") . '</td><td>';
1033
+			print '<tr><td>'.$langs->trans("Dates").'</td><td>';
1034 1034
 			$start = dol_print_date($projectstatic->date_start, 'day');
1035 1035
 			print($start ? $start : '?');
1036 1036
 			$end = dol_print_date($projectstatic->date_end, 'day');
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			print '</td></tr>';
1043 1043
 
1044 1044
 			// Visibility
1045
-			print '<tr><td class="titlefield">' . $langs->trans("Visibility") . '</td><td>';
1045
+			print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
1046 1046
 			if ($projectstatic->public) {
1047 1047
 				print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"');
1048 1048
 				print $langs->trans('SharedProject');
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 			$cols = 2;
1057 1057
 			$savobject = $object;
1058 1058
 			$object = $projectstatic;
1059
-			include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1059
+			include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1060 1060
 			$object = $savobject;
1061 1061
 
1062 1062
 			print '</table>';
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 			// Categories
1071 1071
 			if (isModEnabled('category')) {
1072
-				print '<tr><td class="valignmiddle">' . $langs->trans("Categories") . '</td><td>';
1072
+				print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
1073 1073
 				print $form->showCategories($projectstatic->id, 'project', 1);
1074 1074
 				print "</td></tr>";
1075 1075
 			}
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 				if (!empty($projectidforalltimes)) {
1110 1110
 					// We are on tab 'Time Spent' of project
1111
-					$backtourl = $_SERVER['PHP_SELF'] . '?projectid=' . $projectstatic->id . ($withproject ? '&withproject=1' : '');
1112
-					$linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . '&projectid=' . $projectstatic->id . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);
1111
+					$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : '');
1112
+					$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);
1113 1113
 				} else {
1114 1114
 					// We are on tab 'Time Spent' of task
1115
-					$backtourl = $_SERVER['PHP_SELF'] . '?id=' . $object->id . ($withproject ? '&withproject=1' : '');
1116
-					$linktocreatetimeUrl = $_SERVER['PHP_SELF'] . '?' . ($withproject ? 'withproject=1' : '') . ($object->id > 0 ? '&id=' . $object->id : '&projectid=' . $projectstatic->id) . '&action=createtime&token=' . newToken() . $param . '&backtopage=' . urlencode($backtourl);
1115
+					$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : '');
1116
+					$linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime&token='.newToken().$param.'&backtopage='.urlencode($backtourl);
1117 1117
 				}
1118 1118
 			} else {
1119 1119
 				$linktocreatetimeBtnStatus = -2;
@@ -1158,19 +1158,19 @@  discard block
 block discarded – undo
1158 1158
 		print dol_get_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask', 0, '', 'reposition');
1159 1159
 
1160 1160
 		if ($action == 'deleteline') {
1161
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : '');
1161
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : '');
1162 1162
 			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1163 1163
 		}
1164 1164
 
1165 1165
 		$param = ($withproject ? '&withproject=1' : '');
1166
-		$param .= ($param ? '&' : '') . 'id=' . $object->id;        // ID of task
1167
-		$linkback = $withproject ? '<a href="' . DOL_URL_ROOT . '/projet/tasks.php?id=' . $projectstatic->id . '">' . $langs->trans("BackToList") . '</a>' : '';
1166
+		$param .= ($param ? '&' : '').'id='.$object->id; // ID of task
1167
+		$linkback = $withproject ? '<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>' : '';
1168 1168
 
1169 1169
 		if (!GETPOST('withproject') || empty($projectstatic->id)) {
1170 1170
 			$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
1171
-			$object->next_prev_filter = "fk_projet:IN:" . $db->sanitize($projectsListId);
1171
+			$object->next_prev_filter = "fk_projet:IN:".$db->sanitize($projectsListId);
1172 1172
 		} else {
1173
-			$object->next_prev_filter = "fk_projet:=:" . ((int) $projectstatic->id);
1173
+			$object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id);
1174 1174
 		}
1175 1175
 
1176 1176
 		$morehtmlref = '';
@@ -1178,12 +1178,12 @@  discard block
 block discarded – undo
1178 1178
 		// Project
1179 1179
 		if (empty($withproject)) {
1180 1180
 			$morehtmlref .= '<div class="refidno">';
1181
-			$morehtmlref .= $langs->trans("Project") . ': ';
1181
+			$morehtmlref .= $langs->trans("Project").': ';
1182 1182
 			$morehtmlref .= $projectstatic->getNomUrl(1);
1183 1183
 			$morehtmlref .= '<br>';
1184 1184
 
1185 1185
 			// Third party
1186
-			$morehtmlref .= $langs->trans("ThirdParty") . ': ';
1186
+			$morehtmlref .= $langs->trans("ThirdParty").': ';
1187 1187
 			if (!empty($projectstatic->thirdparty) && is_object($projectstatic->thirdparty)) {
1188 1188
 				$morehtmlref .= $projectstatic->thirdparty->getNomUrl(1);
1189 1189
 			}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		print '<table class="border centpercent tableforfield">';
1200 1200
 
1201 1201
 		// Task parent
1202
-		print '<tr><td>' . $langs->trans("ChildOfTask") . '</td><td>';
1202
+		print '<tr><td>'.$langs->trans("ChildOfTask").'</td><td>';
1203 1203
 		if ($object->fk_task_parent > 0) {
1204 1204
 			$tasktmp = new Task($db);
1205 1205
 			$tasktmp->fetch($object->fk_task_parent);
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		print '</td></tr>';
1209 1209
 
1210 1210
 		// Date start - Date end task
1211
-		print '<tr><td class="titlefield">' . $langs->trans("DateStart") . ' - ' . $langs->trans("Deadline") . '</td><td>';
1211
+		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("Deadline").'</td><td>';
1212 1212
 		$start = dol_print_date($object->date_start, 'dayhour');
1213 1213
 		print($start ? $start : '?');
1214 1214
 		$end = dol_print_date($object->date_end, 'dayhour');
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 		print '</td></tr>';
1221 1221
 
1222 1222
 		// Planned workload
1223
-		print '<tr><td>' . $langs->trans("PlannedWorkload") . '</td><td>';
1223
+		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
1224 1224
 		if ($object->planned_workload) {
1225 1225
 			print convertSecondToTime($object->planned_workload, 'allhourmin');
1226 1226
 		}
@@ -1235,21 +1235,21 @@  discard block
 block discarded – undo
1235 1235
 		print '<table class="border tableforfield centpercent">';
1236 1236
 
1237 1237
 		// Progress declared
1238
-		print '<tr><td class="titlefield">' . $langs->trans("ProgressDeclared") . '</td><td>';
1239
-		print $object->progress != '' ? $object->progress . ' %' : '';
1238
+		print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td>';
1239
+		print $object->progress != '' ? $object->progress.' %' : '';
1240 1240
 		print '</td></tr>';
1241 1241
 
1242 1242
 		// Progress calculated
1243
-		print '<tr><td>' . $langs->trans("ProgressCalculated") . '</td><td>';
1243
+		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td>';
1244 1244
 		if ($object->planned_workload) {
1245 1245
 			$tmparray = $object->getSummaryOfTimeSpent();
1246 1246
 			if ($tmparray['total_duration'] > 0) {
1247
-				print round($tmparray['total_duration'] / $object->planned_workload * 100, 2) . ' %';
1247
+				print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
1248 1248
 			} else {
1249 1249
 				print '0 %';
1250 1250
 			}
1251 1251
 		} else {
1252
-			print '<span class="opacitymedium">' . $langs->trans("WorkloadNotDefined") . '</span>';
1252
+			print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
1253 1253
 		}
1254 1254
 		print '</td>';
1255 1255
 
@@ -1265,7 +1265,7 @@  discard block
 block discarded – undo
1265 1265
 		print dol_get_fiche_end();
1266 1266
 	} else {
1267 1267
 		if ($action == 'deleteline') {
1268
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($object->id > 0 ? "id=" . $object->id : 'projectid=' . $projectstatic->id) . '&lineid=' . GETPOSTINT("lineid") . ($withproject ? '&withproject=1' : '');
1268
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOSTINT("lineid").($withproject ? '&withproject=1' : '');
1269 1269
 			print $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1270 1270
 		}
1271 1271
 	}
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
 		if ($action == 'deleteline' && !empty($projectidforalltimes)) {
1281 1281
 			// We must use projectidprojectid if on list of timespent of project and id=taskid if on list of timespent of a task
1282
-			$urlafterconfirm = $_SERVER["PHP_SELF"] . "?" . ($projectstatic->id > 0 ? 'projectid=' . $projectstatic->id : ($object->id > 0 ? "id=" . $object->id : '')) . '&lineid=' . GETPOSTINT('lineid') . ($withproject ? '&withproject=1' : '') . "&contextpage=" . urlencode($contextpage);
1282
+			$urlafterconfirm = $_SERVER["PHP_SELF"]."?".($projectstatic->id > 0 ? 'projectid='.$projectstatic->id : ($object->id > 0 ? "id=".$object->id : '')).'&lineid='.GETPOSTINT('lineid').($withproject ? '&withproject=1' : '')."&contextpage=".urlencode($contextpage);
1283 1283
 			$formconfirm = $form->formconfirm($urlafterconfirm, $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_deleteline", '', '', 1);
1284 1284
 		}
1285 1285
 
@@ -1298,10 +1298,10 @@  discard block
 block discarded – undo
1298 1298
 		// Definition of fields for list
1299 1299
 		$arrayfields = array();
1300 1300
 		$arrayfields['t.element_date'] = array('label' => $langs->trans("Date"), 'checked' => '1');
1301
-		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1','checked' => '1');
1301
+		$arrayfields['p.fk_soc'] = array('label' => $langs->trans("ThirdParty"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1', 'checked' => '1');
1302 1302
 		$arrayfields['s.name_alias'] = array('label' => $langs->trans("AliasNameShort"), 'type' => 'integer:Societe:/societe/class/societe.class.php:1');
1303 1303
 		if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {	// Not a dedicated task
1304
-			if (! empty($allprojectforuser)) {
1304
+			if (!empty($allprojectforuser)) {
1305 1305
 				$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => '1'];
1306 1306
 				$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => '1'];
1307 1307
 			}
@@ -1317,82 +1317,82 @@  discard block
 block discarded – undo
1317 1317
 		$arrayfields['value'] = array('label' => $langs->trans("Value"), 'checked' => '1', 'enabled' => (string) (int) isModEnabled("salaries"));
1318 1318
 		$arrayfields['valuebilled'] = array('label' => $langs->trans("Billed"), 'checked' => '1', 'enabled' => (string) (int) (((getDolGlobalInt('PROJECT_HIDE_TASKS') || !getDolGlobalInt('PROJECT_BILL_TIME_SPENT')) ? 0 : 1) && $projectstatic->usage_bill_time));
1319 1319
 		// Extra fields
1320
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
1320
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
1321 1321
 
1322 1322
 		$arrayfields = dol_sort_array($arrayfields, 'position');
1323 1323
 
1324 1324
 		$param = '';
1325 1325
 		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
1326
-			$param .= '&contextpage=' . urlencode($contextpage);
1326
+			$param .= '&contextpage='.urlencode($contextpage);
1327 1327
 		}
1328 1328
 		if ($limit > 0 && $limit != $conf->liste_limit) {
1329 1329
 			$param .= '&limit='.((int) $limit);
1330 1330
 		}
1331 1331
 		if ($search_month > 0) {
1332
-			$param .= '&search_month=' . urlencode((string) ($search_month));
1332
+			$param .= '&search_month='.urlencode((string) ($search_month));
1333 1333
 		}
1334 1334
 		if ($search_year > 0) {
1335
-			$param .= '&search_year=' . urlencode((string) ($search_year));
1335
+			$param .= '&search_year='.urlencode((string) ($search_year));
1336 1336
 		}
1337 1337
 		if (!empty($search_user)) { 	// We keep param if -1 because default value is forced to user id if not set
1338 1338
 			$param .= '&search_user='.urlencode($search_user);
1339 1339
 		}
1340 1340
 		if ($search_task_ref != '') {
1341
-			$param .= '&search_task_ref=' . urlencode($search_task_ref);
1341
+			$param .= '&search_task_ref='.urlencode($search_task_ref);
1342 1342
 		}
1343 1343
 		if ($search_company != '') {
1344
-			$param .= '&amp;$search_company=' . urlencode($search_company);
1344
+			$param .= '&amp;$search_company='.urlencode($search_company);
1345 1345
 		}
1346 1346
 		if ($search_company_alias != '') {
1347
-			$param .= '&amp;$search_company_alias=' . urlencode($search_company_alias);
1347
+			$param .= '&amp;$search_company_alias='.urlencode($search_company_alias);
1348 1348
 		}
1349 1349
 		if ($search_project_ref != '') {
1350
-			$param .= '&amp;$search_project_ref=' . urlencode($search_project_ref);
1350
+			$param .= '&amp;$search_project_ref='.urlencode($search_project_ref);
1351 1351
 		}
1352 1352
 		if ($search_project_label != '') {
1353
-			$param .= '&amp;$search_project_label=' . urlencode($search_project_label);
1353
+			$param .= '&amp;$search_project_label='.urlencode($search_project_label);
1354 1354
 		}
1355 1355
 		if ($search_task_label != '') {
1356
-			$param .= '&search_task_label=' . urlencode($search_task_label);
1356
+			$param .= '&search_task_label='.urlencode($search_task_label);
1357 1357
 		}
1358 1358
 		if ($search_note != '') {
1359
-			$param .= '&search_note=' . urlencode($search_note);
1359
+			$param .= '&search_note='.urlencode($search_note);
1360 1360
 		}
1361 1361
 		if ($search_duration != '') {
1362
-			$param .= '&amp;search_field2=' . urlencode((string) ($search_duration));
1362
+			$param .= '&amp;search_field2='.urlencode((string) ($search_duration));
1363 1363
 		}
1364 1364
 		if ($optioncss != '') {
1365
-			$param .= '&optioncss=' . urlencode($optioncss);
1365
+			$param .= '&optioncss='.urlencode($optioncss);
1366 1366
 		}
1367 1367
 		if ($search_date_startday) {
1368
-			$param .= '&search_date_startday=' . urlencode((string) ($search_date_startday));
1368
+			$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
1369 1369
 		}
1370 1370
 		if ($search_date_startmonth) {
1371
-			$param .= '&search_date_startmonth=' . urlencode((string) ($search_date_startmonth));
1371
+			$param .= '&search_date_startmonth='.urlencode((string) ($search_date_startmonth));
1372 1372
 		}
1373 1373
 		if ($search_date_startyear) {
1374
-			$param .= '&search_date_startyear=' . urlencode((string) ($search_date_startyear));
1374
+			$param .= '&search_date_startyear='.urlencode((string) ($search_date_startyear));
1375 1375
 		}
1376 1376
 		if ($search_date_endday) {
1377
-			$param .= '&search_date_endday=' . urlencode((string) ($search_date_endday));
1377
+			$param .= '&search_date_endday='.urlencode((string) ($search_date_endday));
1378 1378
 		}
1379 1379
 		if ($search_date_endmonth) {
1380
-			$param .= '&search_date_endmonth=' . urlencode((string) ($search_date_endmonth));
1380
+			$param .= '&search_date_endmonth='.urlencode((string) ($search_date_endmonth));
1381 1381
 		}
1382 1382
 		if ($search_date_endyear) {
1383
-			$param .= '&search_date_endyear=' . urlencode((string) ($search_date_endyear));
1383
+			$param .= '&search_date_endyear='.urlencode((string) ($search_date_endyear));
1384 1384
 		}
1385 1385
 		if ($search_timespent_starthour) {
1386
-			$param .= '&search_timespent_duration_starthour=' . urlencode((string) ($search_timespent_starthour));
1386
+			$param .= '&search_timespent_duration_starthour='.urlencode((string) ($search_timespent_starthour));
1387 1387
 		}
1388 1388
 		if ($search_timespent_startmin) {
1389
-			$param .= '&search_timespent_duration_startmin=' . urlencode((string) ($search_timespent_startmin));
1389
+			$param .= '&search_timespent_duration_startmin='.urlencode((string) ($search_timespent_startmin));
1390 1390
 		}
1391 1391
 		if ($search_timespent_endhour) {
1392
-			$param .= '&search_timespent_duration_endhour=' . urlencode((string) ($search_timespent_endhour));
1392
+			$param .= '&search_timespent_duration_endhour='.urlencode((string) ($search_timespent_endhour));
1393 1393
 		}
1394 1394
 		if ($search_timespent_endmin) {
1395
-			$param .= '&search_timespent_duration_endmin=' . urlencode((string) ($search_timespent_endmin));
1395
+			$param .= '&search_timespent_duration_endmin='.urlencode((string) ($search_timespent_endmin));
1396 1396
 		}
1397 1397
 
1398 1398
 		/*
@@ -1400,24 +1400,24 @@  discard block
 block discarded – undo
1400 1400
 		 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1401 1401
 		 */
1402 1402
 		if ($id) {
1403
-			$param .= '&id=' . urlencode((string) ($id));
1403
+			$param .= '&id='.urlencode((string) ($id));
1404 1404
 		}
1405 1405
 		if ($projectid) {
1406
-			$param .= '&projectid=' . urlencode((string) ($projectid));
1406
+			$param .= '&projectid='.urlencode((string) ($projectid));
1407 1407
 		}
1408 1408
 		if ($withproject) {
1409
-			$param .= '&withproject=' . urlencode((string) ($withproject));
1409
+			$param .= '&withproject='.urlencode((string) ($withproject));
1410 1410
 		}
1411 1411
 		// Add $param from hooks
1412 1412
 		$parameters = array('param' => &$param);
1413 1413
 		$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1414 1414
 		$param .= $hookmanager->resPrint;
1415 1415
 
1416
-		print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
1416
+		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
1417 1417
 		if ($optioncss != '') {
1418
-			print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
1418
+			print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1419 1419
 		}
1420
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
1420
+		print '<input type="hidden" name="token" value="'.newToken().'">';
1421 1421
 		print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1422 1422
 		if ($action == 'editline') {
1423 1423
 			print '<input type="hidden" name="action" value="updateline">';
@@ -1432,13 +1432,13 @@  discard block
 block discarded – undo
1432 1432
 		} else {
1433 1433
 			print '<input type="hidden" name="action" value="list">';
1434 1434
 		}
1435
-		print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
1436
-		print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
1435
+		print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1436
+		print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1437 1437
 
1438
-		print '<input type="hidden" name="id" value="' . $id . '">';
1439
-		print '<input type="hidden" name="projectid" value="' . $projectidforalltimes . '">';
1440
-		print '<input type="hidden" name="withproject" value="' . $withproject . '">';
1441
-		print '<input type="hidden" name="tab" value="' . $tab . '">';
1438
+		print '<input type="hidden" name="id" value="'.$id.'">';
1439
+		print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
1440
+		print '<input type="hidden" name="withproject" value="'.$withproject.'">';
1441
+		print '<input type="hidden" name="tab" value="'.$tab.'">';
1442 1442
 		print '<input type="hidden" name="page_y" value="">';
1443 1443
 
1444 1444
 		// Form to convert time spent into invoice
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 					'onelineperperiod' => 'OneLinePerTimeSpentLine',
1466 1466
 				);
1467 1467
 				print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
1468
-				print "\n" . '<script type="text/javascript">';
1468
+				print "\n".'<script type="text/javascript">';
1469 1469
 				print '
1470 1470
 				$(document).ready(function () {
1471 1471
 					setDetailVisibility();
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
             		}
1483 1483
             	});
1484 1484
             			';
1485
-				print '</script>' . "\n";
1486
-				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>' . $langs->trans('AddDetailDateAndDuration') . '</span>';
1485
+				print '</script>'."\n";
1486
+				print '<span style="display:none" id="detail_time_duration"><input type="checkbox" value="detail" name="detail_time_duration"/>'.$langs->trans('AddDetailDateAndDuration').'</span>';
1487 1487
 				print '</td>';
1488 1488
 				print '</tr>';
1489 1489
 
@@ -1533,14 +1533,14 @@  discard block
 block discarded – undo
1533 1533
 
1534 1534
 				print '<br>';
1535 1535
 				print '<div class="center">';
1536
-				print '<input type="submit" class="button" id="createbills" name="createbills" value="' . $langs->trans('GenerateBill') . '">  ';
1537
-				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
1536
+				print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('GenerateBill').'">  ';
1537
+				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1538 1538
 				print '</div>';
1539 1539
 				print '<br>';
1540 1540
 			} else {
1541
-				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateInvoice") . '</div>';
1541
+				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateInvoice").'</div>';
1542 1542
 				print '<div class="center">';
1543
-				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
1543
+				print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1544 1544
 				print '</div>';
1545 1545
 				$massaction = '';
1546 1546
 			}
@@ -1553,7 +1553,7 @@  discard block
 block discarded – undo
1553 1553
 				print '<table class="noborder centpercent">';
1554 1554
 				print '<tr>';
1555 1555
 				print '<td class="titlefield">';
1556
-				print img_picto('', 'intervention', 'class="pictofixedwidth"') . $langs->trans('InterToUse');
1556
+				print img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterToUse');
1557 1557
 				print '</td>';
1558 1558
 				print '<td>';
1559 1559
 				$forminter = new FormIntervention($db);
@@ -1563,14 +1563,14 @@  discard block
 block discarded – undo
1563 1563
 				print '</table>';
1564 1564
 
1565 1565
 				print '<div class="center">';
1566
-				print '<input type="submit" class="button" id="createinter" name="createinter" value="' . $langs->trans('GenerateInter') . '">  ';
1567
-				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">';
1566
+				print '<input type="submit" class="button" id="createinter" name="createinter" value="'.$langs->trans('GenerateInter').'">  ';
1567
+				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
1568 1568
 				print '</div>';
1569 1569
 				print '<br>';
1570 1570
 			} else {
1571
-				print '<div class="warning">' . $langs->trans("ThirdPartyRequiredToGenerateIntervention") . '</div>';
1571
+				print '<div class="warning">'.$langs->trans("ThirdPartyRequiredToGenerateIntervention").'</div>';
1572 1572
 				print '<div class="center">';
1573
-				print '<input type="submit" class="button" id="cancel" name="cancel" value="' . $langs->trans('Cancel') . '">';
1573
+				print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
1574 1574
 				print '</div>';
1575 1575
 				$massaction = '';
1576 1576
 			}
@@ -1640,14 +1640,14 @@  discard block
 block discarded – undo
1640 1640
 			$sql .= " AND t.fk_element =".((int) $object->id);
1641 1641
 		} elseif (!empty($projectidforalltimes)) {
1642 1642
 			// Limit on one project
1643
-			$sql .= " AND pt.fk_projet IN (" . $db->sanitize((string) $projectidforalltimes) . ")";
1643
+			$sql .= " AND pt.fk_projet IN (".$db->sanitize((string) $projectidforalltimes).")";
1644 1644
 		} elseif (!empty($allprojectforuser)) {
1645 1645
 			// Limit on on user
1646 1646
 			if (empty($search_user) && !empty($arrayfields['author']['checked'])) {
1647 1647
 				$search_user = $user->id;
1648 1648
 			}
1649 1649
 			if ($search_user > 0) {
1650
-				$sql .= " AND t.fk_user = " . ((int) $search_user);
1650
+				$sql .= " AND t.fk_user = ".((int) $search_user);
1651 1651
 			}
1652 1652
 		}
1653 1653
 
@@ -1700,13 +1700,13 @@  discard block
 block discarded – undo
1700 1700
 			if ($search_timespent_starthour || $search_timespent_startmin) {
1701 1701
 				$timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds
1702 1702
 				$timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds
1703
-				$sql .= " AND t.element_duration >= " . $timespent_duration_start;
1703
+				$sql .= " AND t.element_duration >= ".$timespent_duration_start;
1704 1704
 			}
1705 1705
 
1706 1706
 			if ($search_timespent_endhour || $search_timespent_endmin) {
1707 1707
 				$timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds
1708 1708
 				$timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds
1709
-				$sql .= " AND t.element_duration <= " . $timespent_duration_end;
1709
+				$sql .= " AND t.element_duration <= ".$timespent_duration_end;
1710 1710
 			}
1711 1711
 		}
1712 1712
 
@@ -1754,13 +1754,13 @@  discard block
 block discarded – undo
1754 1754
 
1755 1755
 		if ($num >= 0) {
1756 1756
 			if (!empty($projectidforalltimes)) {
1757
-				print '<!-- List of time spent for project -->' . "\n";
1757
+				print '<!-- List of time spent for project -->'."\n";
1758 1758
 
1759 1759
 				$title = $langs->trans("ListTaskTimeUserProject");
1760 1760
 
1761 1761
 				print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'clock', 0, $linktocreatetime, '', $limit, 0, 0, 1);
1762 1762
 			} else {
1763
-				print '<!-- List of time spent -->' . "\n";
1763
+				print '<!-- List of time spent -->'."\n";
1764 1764
 
1765 1765
 				$title = $langs->trans("ListTaskTimeForTask");
1766 1766
 
@@ -1782,26 +1782,26 @@  discard block
 block discarded – undo
1782 1782
 		 * Form to add a new line of time spent
1783 1783
 		 */
1784 1784
 		if ($action == 'createtime' && $user->hasRight('projet', 'time')) {
1785
-			print '<!-- table to add time spent -->' . "\n";
1785
+			print '<!-- table to add time spent -->'."\n";
1786 1786
 			if (!empty($id)) {
1787
-				print '<input type="hidden" name="taskid" value="' . $id . '">';
1787
+				print '<input type="hidden" name="taskid" value="'.$id.'">';
1788 1788
 			}
1789 1789
 
1790 1790
 			print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
1791 1791
 			print '<table class="noborder nohover centpercent">';
1792 1792
 
1793 1793
 			print '<tr class="liste_titre">';
1794
-			print '<td>' . $langs->trans("Date") . '</td>';
1794
+			print '<td>'.$langs->trans("Date").'</td>';
1795 1795
 			if (!empty($allprojectforuser)) {
1796
-				print '<td>' . $langs->trans("Project") . '</td>';
1796
+				print '<td>'.$langs->trans("Project").'</td>';
1797 1797
 			}
1798 1798
 			if (empty($id)) {
1799
-				print '<td>' . $langs->trans("Task") . '</td>';
1799
+				print '<td>'.$langs->trans("Task").'</td>';
1800 1800
 			}
1801
-			print '<td>' . $langs->trans("By") . '</td>';
1802
-			print '<td>' . $langs->trans("Note") . '</td>';
1803
-			print '<td>' . $langs->trans("NewTimeSpent") . '</td>';
1804
-			print '<td>' . $langs->trans("ProgressDeclared") . '</td>';
1801
+			print '<td>'.$langs->trans("By").'</td>';
1802
+			print '<td>'.$langs->trans("Note").'</td>';
1803
+			print '<td>'.$langs->trans("NewTimeSpent").'</td>';
1804
+			print '<td>'.$langs->trans("ProgressDeclared").'</td>';
1805 1805
 			if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) {
1806 1806
 				print '<td></td>';
1807 1807
 
@@ -1855,14 +1855,14 @@  discard block
 block discarded – undo
1855 1855
 				print $form->select_dolusers((GETPOSTINT('userid') ? GETPOSTINT('userid') : $userid), 'userid', 0, null, 0, '', $contactsofproject, '0', 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200');
1856 1856
 			} else {
1857 1857
 				if ($nboftasks) {
1858
-					print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime');
1858
+					print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime');
1859 1859
 				}
1860 1860
 			}
1861 1861
 			print '</td>';
1862 1862
 
1863 1863
 			// Note
1864 1864
 			print '<td>';
1865
-			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="' . ROWS_2 . '">' . (GETPOST('timespent_note') ? GETPOST('timespent_note') : '') . '</textarea>';
1865
+			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="'.ROWS_2.'">'.(GETPOST('timespent_note') ? GETPOST('timespent_note') : '').'</textarea>';
1866 1866
 			print '</td>';
1867 1867
 
1868 1868
 			// Duration - Time spent
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
 
1932 1932
 		print '<!-- Liste of time spent -->'."\n";
1933 1933
 		print '<div class="div-table-responsive">';
1934
-		print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
1934
+		print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1935 1935
 
1936 1936
 		// Fields title search
1937 1937
 		// --------------------------------------------------------------------
@@ -1956,20 +1956,20 @@  discard block
 block discarded – undo
1956 1956
 		}
1957 1957
 		// Thirdparty
1958 1958
 		if (!empty($arrayfields['p.fk_soc']['checked'])) {
1959
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="' . dol_escape_htmltag($search_company) . '"></td>';
1959
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company" value="'.dol_escape_htmltag($search_company).'"></td>';
1960 1960
 		}
1961 1961
 
1962 1962
 		// Thirdparty alias
1963 1963
 		if (!empty($arrayfields['s.name_alias']['checked'])) {
1964
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="' . dol_escape_htmltag($search_company_alias) . '"></td>';
1964
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="$search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'"></td>';
1965 1965
 		}
1966 1966
 
1967 1967
 		if (!empty($allprojectforuser)) {
1968 1968
 			if (!empty($arrayfields['p.project_ref']['checked'])) {
1969
-				print '<td class="liste_titre"><input type="text" class="flat maxwidth125" name="$search_project_ref" value="' . dol_escape_htmltag($search_project_ref) . '"></td>';
1969
+				print '<td class="liste_titre"><input type="text" class="flat maxwidth125" name="$search_project_ref" value="'.dol_escape_htmltag($search_project_ref).'"></td>';
1970 1970
 			}
1971 1971
 			if (!empty($arrayfields['p.project_label']['checked'])) {
1972
-				print '<td class="liste_titre"><input type="text" class="flat maxwidth125" name="$search_project_label" value="' . dol_escape_htmltag($search_project_label) . '"></td>';
1972
+				print '<td class="liste_titre"><input type="text" class="flat maxwidth125" name="$search_project_label" value="'.dol_escape_htmltag($search_project_label).'"></td>';
1973 1973
 			}
1974 1974
 		}
1975 1975
 		// Task
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 		}
1988 1988
 		// Note
1989 1989
 		if (!empty($arrayfields['t.note']['checked'])) {
1990
-			print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="' . dol_escape_htmltag($search_note) . '"></td>';
1990
+			print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_note" value="'.dol_escape_htmltag($search_note).'"></td>';
1991 1991
 		}
1992 1992
 		// Duration
1993 1993
 		if (!empty($arrayfields['t.element_duration']['checked'])) {
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 			if ($search_timespent_starthour || $search_timespent_startmin) {
1999 1999
 				$durationtouse_start = ($search_timespent_starthour * 3600 + $search_timespent_startmin * 60);
2000 2000
 			}
2001
-			print '<div class="nowraponall">' . $langs->trans('from') . ' ';
2001
+			print '<div class="nowraponall">'.$langs->trans('from').' ';
2002 2002
 			print $form->select_duration('search_timespent_duration_start', $durationtouse_start, 0, 'text', 0, 1);
2003 2003
 			print '</div>';
2004 2004
 
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 			if ($search_timespent_endhour || $search_timespent_endmin) {
2007 2007
 				$durationtouse_end = ($search_timespent_endhour * 3600 + $search_timespent_endmin * 60);
2008 2008
 			}
2009
-			print '<div class="nowraponall">' . $langs->trans('to') . ' ';
2009
+			print '<div class="nowraponall">'.$langs->trans('to').' ';
2010 2010
 			print $form->select_duration('search_timespent_duration_end', $durationtouse_end, 0, 'text', 0, 1);
2011 2011
 			print '</div>';
2012 2012
 
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 		}
2023 2023
 		// Value billed
2024 2024
 		if (!empty($arrayfields['valuebilled']['checked'])) {
2025
-			print '<td class="liste_titre center">' . $form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1) . '</td>';
2025
+			print '<td class="liste_titre center">'.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'</td>';
2026 2026
 		}
2027 2027
 
2028 2028
 		/*
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 			print $searchpicto;
2041 2041
 			print '</td>';
2042 2042
 		}
2043
-		print '</tr>' . "\n";
2043
+		print '</tr>'."\n";
2044 2044
 
2045 2045
 
2046 2046
 		$totalarray = array();
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
 			if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
2159 2159
 				print '<td class="center nowraponall">';
2160 2160
 				if (($action == 'editline' || $action == 'splitline') && GETPOSTINT('lineid') == $task_time->rowid) {
2161
-					print '<input type="hidden" name="lineid" value="' . GETPOSTINT('lineid') . '">';
2161
+					print '<input type="hidden" name="lineid" value="'.GETPOSTINT('lineid').'">';
2162 2162
 					print '<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-save" name="save" value="'.$langs->trans("Save").'">';
2163 2163
 					print '<br>';
2164 2164
 					print '<input type="submit" class="button buttongen reposition smallpaddingimp margintoponlyshort marginbottomonlyshort button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
 						print '</a>';
2170 2170
 
2171 2171
 						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) {
2172
-							print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';
2172
+							print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
2173 2173
 							print img_split('', 'class="pictofixedwidth paddingleft"');
2174 2174
 							print '</a>';
2175 2175
 						}
@@ -2187,12 +2187,12 @@  discard block
 block discarded – undo
2187 2187
 
2188 2188
 							// Disable select if task not billable or already invoiced
2189 2189
 							$disabled = (intval($task_time->billable) != 1 || $invoiced);
2190
-							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
2190
+							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2191 2191
 							if ($disabled) {
2192 2192
 								// If disabled, a dbl-click very close outside the control
2193 2193
 								// will re-enable it, so that user is not blocked if needed.
2194
-								print '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>';
2195
-								print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>';
2194
+								print '<span id="cbsp'.$task_time->rowid.'">'.$ctrl.'</span>';
2195
+								print '<script>$("#cbsp'.$task_time->rowid.'").dblclick(()=>{ $("#cb'.$task_time->rowid.'").removeAttr("disabled") })</script>';
2196 2196
 							} else {
2197 2197
 								print $ctrl;
2198 2198
 							}
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 					}
2321 2321
 				}
2322 2322
 			} elseif ($action !== 'createtime') {
2323
-				print '<input type="hidden" name="taskid" value="' . $id . '">';
2323
+				print '<input type="hidden" name="taskid" value="'.$id.'">';
2324 2324
 			}
2325 2325
 
2326 2326
 			// Task label
@@ -2356,9 +2356,9 @@  discard block
 block discarded – undo
2356 2356
 					}
2357 2357
 					if (count($contactsoftask) > 0) {
2358 2358
 						print img_object('', 'user', 'class="pictofixedwidth hideonsmartphone"');
2359
-						print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100');	// maxwidth must be lowed than minwidth of the td
2359
+						print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask, '0', 0, 0, '', 0, '', 'minwidth100 maxwidth100'); // maxwidth must be lowed than minwidth of the td
2360 2360
 					} else {
2361
-						print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2361
+						print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2362 2362
 					}
2363 2363
 				} else {
2364 2364
 					$userstatic->id = $task_time->fk_user;
@@ -2380,7 +2380,7 @@  discard block
 block discarded – undo
2380 2380
 			if (!empty($arrayfields['t.note']['checked'])) {
2381 2381
 				if ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
2382 2382
 					print '<td class="small">';
2383
-					print '<textarea name="timespent_note_line" class="centpercentimp" rows="' . ROWS_2 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2383
+					print '<textarea name="timespent_note_line" class="centpercentimp" rows="'.ROWS_2.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2384 2384
 					print '</td>';
2385 2385
 				} else {
2386 2386
 					print '<td class="small tdoverflowmax150 classfortooltip" title="'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($task_time->note)).'">';
@@ -2391,7 +2391,7 @@  discard block
 block discarded – undo
2391 2391
 					$totalarray['nbfield']++;
2392 2392
 				}
2393 2393
 			} elseif ($action == 'editline' && GETPOSTINT('lineid') == $task_time->rowid) {
2394
-				print '<input type="hidden" name="timespent_note_line" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2394
+				print '<input type="hidden" name="timespent_note_line" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2395 2395
 			}
2396 2396
 
2397 2397
 			// Time spent
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 				$value = price2num($task_time->thm * $task_time->element_duration / 3600, 'MT', 1);
2453 2453
 
2454 2454
 				print '<td class="nowraponall right">';
2455
-				print '<span class="amount" title="' . $langs->trans("THM") . ': ' . price($task_time->thm) . '">';
2455
+				print '<span class="amount" title="'.$langs->trans("THM").': '.price($task_time->thm).'">';
2456 2456
 				print price($value, 1, $langs, 1, -1, -1, $conf->currency);
2457 2457
 				print '</span>';
2458 2458
 				print '</td>';
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
 							}
2509 2509
 						}
2510 2510
 					} else {
2511
-						print '<span class="opacitymedium">' . $langs->trans("NA") . '</span>';
2511
+						print '<span class="opacitymedium">'.$langs->trans("NA").'</span>';
2512 2512
 					}
2513 2513
 				}
2514 2514
 				print '</td>';
@@ -2542,7 +2542,7 @@  discard block
 block discarded – undo
2542 2542
 						print '</a>';
2543 2543
 
2544 2544
 						if (getDolGlobalString('PROJECT_ALLOW_SPLIT_TIMESPENT')) {
2545
-							print '<a class="reposition editfielda paddingleft" href="' . $_SERVER["PHP_SELF"] . '?action=splitline&token=' . newToken() . '&lineid=' . $task_time->rowid . $param . ((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '') . '">';
2545
+							print '<a class="reposition editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=splitline&token='.newToken().'&lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
2546 2546
 							print img_split('', 'class="pictofixedwidth paddingleft"');
2547 2547
 							print '</a>';
2548 2548
 						}
@@ -2560,12 +2560,12 @@  discard block
 block discarded – undo
2560 2560
 
2561 2561
 							// Disable select if task not billable or already invoiced
2562 2562
 							$disabled = (intval($task_time->billable) != 1 || $invoiced);
2563
-							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb' . $task_time->rowid . '" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="' . $task_time->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
2563
+							$ctrl = '<input '.($disabled ? 'disabled' : '').' id="cb'.$task_time->rowid.'" class="flat checkforselect marginleftonly" type="checkbox" name="toselect[]" value="'.$task_time->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
2564 2564
 							if ($disabled) {
2565 2565
 								// If disabled, a dbl-click very close outside the control
2566 2566
 								// will re-enable it, so that user is not blocked if needed.
2567
-								print '<span id="cbsp'. $task_time->rowid . '">'.$ctrl.'</span>';
2568
-								print '<script>$("#cbsp' . $task_time->rowid . '").dblclick(()=>{ $("#cb' . $task_time->rowid . '").removeAttr("disabled") })</script>';
2567
+								print '<span id="cbsp'.$task_time->rowid.'">'.$ctrl.'</span>';
2568
+								print '<script>$("#cbsp'.$task_time->rowid.'").dblclick(()=>{ $("#cb'.$task_time->rowid.'").removeAttr("disabled") })</script>';
2569 2569
 							} else {
2570 2570
 								print $ctrl;
2571 2571
 							}
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
 							print img_object('', 'user', 'class="hideonsmartphone"');
2665 2665
 							print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, null, 0, '', $contactsoftask);
2666 2666
 						} else {
2667
-							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2667
+							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2668 2668
 						}
2669 2669
 					} else {
2670 2670
 						$userstatic->id = $task_time->fk_user;
@@ -2681,13 +2681,13 @@  discard block
 block discarded – undo
2681 2681
 				if (!empty($arrayfields['t.note']['checked'])) {
2682 2682
 					print '<td class="tdoverflowmax300">';
2683 2683
 					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2684
-						print '<textarea name="timespent_note_line" class="centpercentimp" rows="' . ROWS_2 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2684
+						print '<textarea name="timespent_note_line" class="centpercentimp" rows="'.ROWS_2.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2685 2685
 					} else {
2686 2686
 						print dol_nl2br($task_time->note);
2687 2687
 					}
2688 2688
 					print '</td>';
2689 2689
 				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2690
-					print '<input type="hidden" name="timespent_note_line" rows="' . ROWS_2 . '" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2690
+					print '<input type="hidden" name="timespent_note_line" rows="'.ROWS_2.'" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2691 2691
 				}
2692 2692
 
2693 2693
 				// Time spent
@@ -2829,7 +2829,7 @@  discard block
 block discarded – undo
2829 2829
 							print img_object('', 'user', 'class="hideonsmartphone"');
2830 2830
 							print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, null, 0, '', $contactsoftask);
2831 2831
 						} else {
2832
-							print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime');
2832
+							print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime');
2833 2833
 						}
2834 2834
 					} else {
2835 2835
 						$userstatic->id = $task_time->fk_user;
@@ -2846,13 +2846,13 @@  discard block
 block discarded – undo
2846 2846
 				if (!empty($arrayfields['t.note']['checked'])) {
2847 2847
 					print '<td class="small tdoverflowmax300"">';
2848 2848
 					if ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2849
-						print '<textarea name="timespent_note_line_2" class="centpercentimp" rows="' . ROWS_2 . '">' . dol_escape_htmltag($task_time->note, 0, 1) . '</textarea>';
2849
+						print '<textarea name="timespent_note_line_2" class="centpercentimp" rows="'.ROWS_2.'">'.dol_escape_htmltag($task_time->note, 0, 1).'</textarea>';
2850 2850
 					} else {
2851 2851
 						print dol_nl2br($task_time->note);
2852 2852
 					}
2853 2853
 					print '</td>';
2854 2854
 				} elseif ($action == 'splitline' && GETPOSTINT('lineid') == $task_time->rowid) {
2855
-					print '<input type="hidden" name="timespent_note_line_2" value="' . dol_escape_htmltag($task_time->note, 0, 1) . '">';
2855
+					print '<input type="hidden" name="timespent_note_line_2" value="'.dol_escape_htmltag($task_time->note, 0, 1).'">';
2856 2856
 				}
2857 2857
 
2858 2858
 				// Time spent
@@ -2927,14 +2927,14 @@  discard block
 block discarded – undo
2927 2927
 				$i++;
2928 2928
 				if ($i == 1) {
2929 2929
 					if ($num < $limit && empty($offset)) {
2930
-						print '<td class="left">' . $langs->trans("Total") . '</td>';
2930
+						print '<td class="left">'.$langs->trans("Total").'</td>';
2931 2931
 					} else {
2932 2932
 						print '<td class="left">'.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'</td>';
2933 2933
 					}
2934 2934
 				} elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) {
2935
-					print '<td class="right">' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '</td>';
2935
+					print '<td class="right">'.convertSecondToTime($totalarray['totalduration'], 'allhourmin').'</td>';
2936 2936
 				} elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) {
2937
-					print '<td class="right">' . price($totalarray['totalvalue']) . '</td>';
2937
+					print '<td class="right">'.price($totalarray['totalvalue']).'</td>';
2938 2938
 					//} elseif ($totalarray['totalvaluebilledfield'] == $i) { print '<td class="center">'.price($totalarray['totalvaluebilled']).'</td>';
2939 2939
 				} else {
2940 2940
 					print '<td></td>';
@@ -2950,8 +2950,8 @@  discard block
 block discarded – undo
2950 2950
 					$totalnboffields++;
2951 2951
 				}
2952 2952
 			}
2953
-			print '<tr class="oddeven"><td colspan="' . $totalnboffields . '">';
2954
-			print '<span class="opacitymedium">' . $langs->trans("None") . '</span>';
2953
+			print '<tr class="oddeven"><td colspan="'.$totalnboffields.'">';
2954
+			print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
2955 2955
 			print '</td></tr>';
2956 2956
 		}
2957 2957
 
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +144 added lines, -144 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)
@@ -1042,17 +1042,17 @@  discard block
 block discarded – undo
1042 1042
 				}
1043 1043
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
1044 1044
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
1045
-					$data[$key] = '<br><b><u>'. $labelextra . '</u></b>';
1045
+					$data[$key] = '<br><b><u>'.$labelextra.'</u></b>';
1046 1046
 				} else {
1047
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
1048
-					$data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
1047
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
1048
+					$data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
1049 1049
 					$count++;
1050 1050
 				}
1051 1051
 			}
1052 1052
 			$data['closedivextra'] = '</div>';
1053 1053
 		}
1054 1054
 
1055
-		$hookmanager->initHooks(array($this->element . 'dao'));
1055
+		$hookmanager->initHooks(array($this->element.'dao'));
1056 1056
 		$parameters = array(
1057 1057
 			'tooltipcontentarray' => &$data,
1058 1058
 			'params' => $params,
@@ -1272,8 +1272,8 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
 		if ($this->restrictiononfksoc && property_exists($this, 'socid') && !empty($this->socid) && !$user->hasRight('societe', 'client', 'voir')) {
1274 1274
 			$sql_allowed_contacts = 'SELECT COUNT(*) as cnt FROM '.$this->db->prefix().'societe_commerciaux as sc';
1275
-			$sql_allowed_contacts.= ' WHERE sc.fk_soc = '.(int) $this->socid;
1276
-			$sql_allowed_contacts.= ' AND sc.fk_user = '.(int) $user->id;
1275
+			$sql_allowed_contacts .= ' WHERE sc.fk_soc = '.(int) $this->socid;
1276
+			$sql_allowed_contacts .= ' AND sc.fk_user = '.(int) $user->id;
1277 1277
 
1278 1278
 			$resql_allowed_contacts = $this->db->query($sql_allowed_contacts);
1279 1279
 
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 			$sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")";
1573 1573
 		}
1574 1574
 		if ($status >= 0) {
1575
-			$sql .= " AND t.statut = ".((int) $status);	// t is llx_user or llx_socpeople
1575
+			$sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople
1576 1576
 		}
1577 1577
 		if ($statusoflink >= 0) {
1578 1578
 			$sql .= " AND ec.statut = ".((int) $statusoflink);
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 		}
1962 1962
 
1963 1963
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1964
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1964
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1965 1965
 		$sql .= " LIMIT 1";
1966 1966
 
1967 1967
 		$query = $this->db->query($sql);
@@ -2280,9 +2280,9 @@  discard block
 block discarded – undo
2280 2280
 
2281 2281
 		$oldvalue = null;
2282 2282
 		if ($trigkey) {
2283
-			$sql = "SELECT " . $field;
2284
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2285
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2283
+			$sql = "SELECT ".$field;
2284
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2285
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2286 2286
 
2287 2287
 			$resql = $this->db->query($sql);
2288 2288
 			if ($resql) {
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
 		// Triggers
2663 2663
 		if (!$error && !$notrigger) {
2664 2664
 			// Call triggers
2665
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2665
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2666 2666
 			if ($result < 0) {
2667 2667
 				$error++;
2668 2668
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
 					// Call triggers
2726 2726
 					$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
2727 2727
 					if (get_class($this) == 'Commande') {
2728
-						$triggerName = 'ORDER';	// TODO Remove this when TRIGGER_PREFI in order is implemented
2728
+						$triggerName = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
2729 2729
 					}
2730 2730
 					$result = $this->call_trigger($triggerName.'_MODIFY', $user);
2731 2731
 					if ($result < 0) {
@@ -3074,7 +3074,7 @@  discard block
 block discarded – undo
3074 3074
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
3075 3075
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
3076 3076
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
3077
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3077
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'");
3078 3078
 			}
3079 3079
 			$sql .= ' WHERE rowid='.((int) $this->id);
3080 3080
 
@@ -3367,7 +3367,7 @@  discard block
 block discarded – undo
3367 3367
 
3368 3368
 				$triggerName = (empty($this->TRIGGER_PREFIX) ? strtoupper(get_class($this)) : $this->TRIGGER_PREFIX);
3369 3369
 				if (get_class($this) == 'Commande') {
3370
-					$triggerName = 'ORDER';	// TODO Remove this when TRIGGER_PREFI in order is implemented
3370
+					$triggerName = 'ORDER'; // TODO Remove this when TRIGGER_PREFI in order is implemented
3371 3371
 				}
3372 3372
 				if ($triggerName == 'FACTUREREC_MODIFY') {	// TODO Use the $this->TRIGGER_PREFIX when implemented
3373 3373
 					$triggerName = 'BILLREC_MODIFY';
@@ -3424,10 +3424,10 @@  discard block
 block discarded – undo
3424 3424
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3425 3425
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3426 3426
 		if (!$renum) {
3427
-			$sql .= " AND " . $fieldposition . " = 0";
3427
+			$sql .= " AND ".$fieldposition." = 0";
3428 3428
 		}
3429 3429
 		if ($renum) {
3430
-			$sql .= " AND " . $fieldposition . " <> 0";
3430
+			$sql .= " AND ".$fieldposition." <> 0";
3431 3431
 		}
3432 3432
 
3433 3433
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3448,7 +3448,7 @@  discard block
 block discarded – undo
3448 3448
 			if ($fk_parent_line) {
3449 3449
 				$sql .= ' AND fk_parent_line IS NULL';
3450 3450
 			}
3451
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3451
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3452 3452
 
3453 3453
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3454 3454
 			$resql = $this->db->query($sql);
@@ -3502,7 +3502,7 @@  discard block
 block discarded – undo
3502 3502
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3503 3503
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3504 3504
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3505
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3505
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3506 3506
 
3507 3507
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3508 3508
 
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
 
3630 3630
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3631 3631
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3632
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3632
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3633 3633
 		if (!$this->db->query($sql)) {
3634 3634
 			$this->error = $this->db->lasterror();
3635 3635
 			return -1;
@@ -3666,7 +3666,7 @@  discard block
 block discarded – undo
3666 3666
 
3667 3667
 		$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3668 3668
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3669
-		$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3669
+		$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3670 3670
 		if (!$this->db->query($sql)) {
3671 3671
 			$this->error = $this->db->lasterror();
3672 3672
 			return -1;
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
 			$fieldposition = 'position';
3696 3696
 		}
3697 3697
 
3698
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3698
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3699 3699
 		$sql .= " WHERE rowid = ".((int) $rowid);
3700 3700
 
3701 3701
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3723,7 +3723,7 @@  discard block
 block discarded – undo
3723 3723
 
3724 3724
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3725 3725
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3726
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3726
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3727 3727
 		$resql = $this->db->query($sql);
3728 3728
 		if (!$resql) {
3729 3729
 			return 0;
@@ -3837,7 +3837,7 @@  discard block
 block discarded – undo
3837 3837
 			$newsuffix = '';
3838 3838
 		}
3839 3839
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3840
-			$fieldusermod =  "fk_user_mod";
3840
+			$fieldusermod = "fk_user_mod";
3841 3841
 		} elseif ($this->table_element == 'ecm_files') {
3842 3842
 			$fieldusermod = "fk_user_m";
3843 3843
 		} else {
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
 						$triggerName = 'EXPENSE_REPORT_MODIFY';
3881 3881
 						break;
3882 3882
 					default:
3883
-						$triggerName = strtoupper($this->element) . '_MODIFY';
3883
+						$triggerName = strtoupper($this->element).'_MODIFY';
3884 3884
 				}
3885 3885
 				$ret = $this->call_trigger($triggerName, $user);
3886 3886
 				if ($ret < 0) {
@@ -4178,7 +4178,7 @@  discard block
 block discarded – undo
4178 4178
 			// Situations totals
4179 4179
 			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
4180 4180
 				'@phan-var-force Facture $this';
4181
-				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
4181
+				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
4182 4182
 				if ($this->type != Facture::TYPE_CREDIT_NOTE) {	// @phpstan-ignore-line
4183 4183
 					if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
4184 4184
 						$prev_sits = $this->get_prev_sits();
@@ -4304,26 +4304,26 @@  discard block
 block discarded – undo
4304 4304
 		$this->db->begin();
4305 4305
 		$error = 0;
4306 4306
 
4307
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
4307
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
4308 4308
 		$sql .= "fk_source";
4309 4309
 		$sql .= ", sourcetype";
4310 4310
 		$sql .= ", fk_target";
4311 4311
 		$sql .= ", targettype";
4312 4312
 		$sql .= ") VALUES (";
4313 4313
 		$sql .= ((int) $origin_id);
4314
-		$sql .= ", '" . $this->db->escape($origin) . "'";
4315
-		$sql .= ", " . ((int) $this->id);
4316
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
4314
+		$sql .= ", '".$this->db->escape($origin)."'";
4315
+		$sql .= ", ".((int) $this->id);
4316
+		$sql .= ", '".$this->db->escape($targettype)."'";
4317 4317
 		$sql .= ")";
4318 4318
 
4319
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
4319
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
4320 4320
 		if ($this->db->query($sql)) {
4321 4321
 			if (!$notrigger) {
4322 4322
 				// Call trigger
4323 4323
 				$this->context['link_origin'] = $origin;
4324 4324
 				$this->context['link_origin_id'] = $origin_id;
4325 4325
 
4326
-				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user);	// Note: We should have used here a hook. Not a business event
4326
+				$result = $this->call_trigger('OBJECT_LINK_INSERT', $f_user); // Note: We should have used here a hook. Not a business event
4327 4327
 				if ($result < 0) {
4328 4328
 					$error++;
4329 4329
 				}
@@ -4588,20 +4588,20 @@  discard block
 block discarded – undo
4588 4588
 		$this->db->begin();
4589 4589
 		$error = 0;
4590 4590
 
4591
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4591
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4592 4592
 		if ($updatesource) {
4593
-			$sql .= "fk_source = " . ((int) $sourceid);
4594
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4595
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4596
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4593
+			$sql .= "fk_source = ".((int) $sourceid);
4594
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4595
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4596
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4597 4597
 		} elseif ($updatetarget) {
4598
-			$sql .= "fk_target = " . ((int) $targetid);
4599
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4600
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4601
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4598
+			$sql .= "fk_target = ".((int) $targetid);
4599
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4600
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4601
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4602 4602
 		}
4603 4603
 
4604
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4604
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4605 4605
 		if ($this->db->query($sql)) {
4606 4606
 			if (!$notrigger) {
4607 4607
 				// Call trigger
@@ -4610,7 +4610,7 @@  discard block
 block discarded – undo
4610 4610
 				$this->context['link_target_id'] = $targetid;
4611 4611
 				$this->context['link_target_type'] = $targettype;
4612 4612
 
4613
-				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user);	// Note: We should have used here a hook. Not a business event
4613
+				$result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user); // Note: We should have used here a hook. Not a business event
4614 4614
 				if ($result < 0) {
4615 4615
 					$error++;
4616 4616
 				}
@@ -4672,7 +4672,7 @@  discard block
 block discarded – undo
4672 4672
 			$this->context['link_target_id'] = $targetid;
4673 4673
 			$this->context['link_target_type'] = $targettype;
4674 4674
 
4675
-			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user);	// Note: We should have used here a hook. Not a business event
4675
+			$result = $this->call_trigger('OBJECT_LINK_DELETE', $f_user); // Note: We should have used here a hook. Not a business event
4676 4676
 			if ($result < 0) {
4677 4677
 				$error++;
4678 4678
 			}
@@ -4680,25 +4680,25 @@  discard block
 block discarded – undo
4680 4680
 		}
4681 4681
 
4682 4682
 		if (!$error) {
4683
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4683
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4684 4684
 			$sql .= " WHERE";
4685 4685
 			if ($rowid > 0) {
4686
-				$sql .= " rowid = " . ((int) $rowid);
4686
+				$sql .= " rowid = ".((int) $rowid);
4687 4687
 			} else {
4688 4688
 				if ($deletesource) {
4689
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4690
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'";
4689
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4690
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'";
4691 4691
 				} elseif ($deletetarget) {
4692
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4693
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'";
4692
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4693
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'";
4694 4694
 				} else {
4695
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')";
4695
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')";
4696 4696
 					$sql .= " OR";
4697
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')";
4697
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')";
4698 4698
 				}
4699 4699
 			}
4700 4700
 
4701
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4701
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4702 4702
 			if (!$this->db->query($sql)) {
4703 4703
 				$this->error = $this->db->lasterror();
4704 4704
 				$this->errors[] = $this->error;
@@ -4870,14 +4870,14 @@  discard block
 block discarded – undo
4870 4870
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4871 4871
 		}
4872 4872
 		$sql .= " WHERE rowid = ".((int) $elementId);
4873
-		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status);	// We avoid update if status already correct
4873
+		$sql .= " AND ".$this->db->sanitize($fieldstatus)." <> ".((int) $status); // We avoid update if status already correct
4874 4874
 
4875 4875
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4876 4876
 		$resql = $this->db->query($sql);
4877 4877
 		if ($resql) {
4878 4878
 			$error = 0;
4879 4879
 
4880
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4880
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4881 4881
 
4882 4882
 			if ($nb_rows_affected > 0) {
4883 4883
 				if (empty($trigkey)) {
@@ -4926,9 +4926,9 @@  discard block
 block discarded – undo
4926 4926
 					} elseif ($fieldstatus == 'tosell') {
4927 4927
 						$this->status = $status;
4928 4928
 					} elseif ($fieldstatus == 'tobuy') {
4929
-						$this->status_buy = $status;	// @phpstan-ignore-line
4929
+						$this->status_buy = $status; // @phpstan-ignore-line
4930 4930
 					} elseif ($fieldstatus == 'tobatch') {
4931
-						$this->status_batch = $status;	// @phpstan-ignore-line
4931
+						$this->status_batch = $status; // @phpstan-ignore-line
4932 4932
 					} else {
4933 4933
 						$this->status = $status;
4934 4934
 					}
@@ -5034,7 +5034,7 @@  discard block
 block discarded – undo
5034 5034
 			return -1;
5035 5035
 		}
5036 5036
 
5037
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5037
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
5038 5038
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
5039 5039
 		$tmparray = array_keys($this->childtables);
5040 5040
 		if (is_numeric($tmparray[0])) {
@@ -6098,7 +6098,7 @@  discard block
 block discarded – undo
6098 6098
 		} else {
6099 6099
 			// TODO: Try to set type above again
6100 6100
 			'@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';
6101
-			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);  // @phan-suppress-line-PhanTypeMismatchArgument
6101
+			$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument
6102 6102
 		}
6103 6103
 		// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
6104 6104
 
@@ -6171,7 +6171,7 @@  discard block
 block discarded – undo
6171 6171
 			$setsharekey = false;
6172 6172
 			if ($this->element == 'propal' || $this->element == 'proposal') {
6173 6173
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
6174
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
6174
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
6175 6175
 				}
6176 6176
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
6177 6177
 					$setsharekey = true;
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
 				$ecmfile->gen_or_uploaded = 'generated';
6232 6232
 				$ecmfile->description = ''; // indexed content
6233 6233
 				$ecmfile->keywords = ''; // keyword content
6234
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
6234
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
6235 6235
 				$ecmfile->src_object_id   = $this->id;
6236 6236
 
6237 6237
 				$result = $ecmfile->create($user);
@@ -6534,7 +6534,7 @@  discard block
 block discarded – undo
6534 6534
 		$savDisableCompute = $conf->disable_compute;
6535 6535
 		$conf->disable_compute = 1;
6536 6536
 
6537
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6537
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6538 6538
 
6539 6539
 		$conf->disable_compute = $savDisableCompute;
6540 6540
 
@@ -6596,7 +6596,7 @@  discard block
 block discarded – undo
6596 6596
 		if (is_array($optionsArray) && count($optionsArray) > 0) {
6597 6597
 			$sql = "SELECT rowid";
6598 6598
 			foreach ($optionsArray as $name => $label) {
6599
-				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) {
6599
+				if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) {
6600 6600
 					$sql .= ", ".$name;
6601 6601
 				}
6602 6602
 				// use geo sql fonction to read as text
@@ -6641,7 +6641,7 @@  discard block
 block discarded – undo
6641 6641
 					 **/
6642 6642
 					if (is_array($extrafields->attributes[$this->table_element]['label'])) {
6643 6643
 						foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
6644
-							$this->array_options['options_' . $key] = null;
6644
+							$this->array_options['options_'.$key] = null;
6645 6645
 						}
6646 6646
 					}
6647 6647
 				}
@@ -6653,9 +6653,9 @@  discard block
 block discarded – undo
6653 6653
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6654 6654
 							//var_dump($conf->disable_compute);
6655 6655
 							if (empty($conf->disable_compute)) {
6656
-								global $objectoffield;        // We set a global variable to $objectoffield so
6657
-								$objectoffield = $this;        // we can use it inside computed formula
6658
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6656
+								global $objectoffield; // We set a global variable to $objectoffield so
6657
+								$objectoffield = $this; // we can use it inside computed formula
6658
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6659 6659
 							}
6660 6660
 						}
6661 6661
 					}
@@ -6841,7 +6841,7 @@  discard block
 block discarded – undo
6841 6841
 									// If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update.
6842 6842
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6843 6843
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6844
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6844
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6845 6845
 										} else {
6846 6846
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6847 6847
 										}
@@ -6852,7 +6852,7 @@  discard block
 block discarded – undo
6852 6852
 									// If value has changed
6853 6853
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6854 6854
 										if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6855
-											$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6855
+											$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6856 6856
 										} else {
6857 6857
 											$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6858 6858
 										}
@@ -6864,7 +6864,7 @@  discard block
 block discarded – undo
6864 6864
 								//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6865 6865
 								// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6866 6866
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6867
-									$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6867
+									$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6868 6868
 								} else {
6869 6869
 									$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6870 6870
 								}
@@ -6909,9 +6909,9 @@  discard block
 block discarded – undo
6909 6909
 
6910 6910
 							$sqlFetchObject = "SELECT rowid FROM ".$this->db->prefix().$object->table_element;
6911 6911
 							if (is_numeric($value)) {
6912
-								$sqlFetchObject .= " WHERE rowid = " . (int) $value;
6912
+								$sqlFetchObject .= " WHERE rowid = ".(int) $value;
6913 6913
 							} else {
6914
-								$sqlFetchObject .= " WHERE ref = '" . $this->db->escape($value) . "'";
6914
+								$sqlFetchObject .= " WHERE ref = '".$this->db->escape($value)."'";
6915 6915
 							}
6916 6916
 
6917 6917
 							$obj = $this->db->getRow($sqlFetchObject);
@@ -6956,7 +6956,7 @@  discard block
 block discarded – undo
6956 6956
 			}
6957 6957
 			$geoDataType = ExtraFields::$geoDataTypes[$attributeType] ?? null;
6958 6958
 			// Add field of attribute
6959
-			if (! $geoDataType) {
6959
+			if (!$geoDataType) {
6960 6960
 				// not a geodata type
6961 6961
 				if ($newValue != '') {
6962 6962
 					$sqlColumnValues[$attributeKey] = "'".$this->db->escape($newValue)."'";
@@ -6989,7 +6989,7 @@  discard block
 block discarded – undo
6989 6989
 		if ($table_element == 'categorie') {
6990 6990
 			$table_element = 'categories'; // For compatibility
6991 6991
 		}
6992
-		$extrafieldsTable = $this->db->prefix() . $table_element . '_extrafields';
6992
+		$extrafieldsTable = $this->db->prefix().$table_element.'_extrafields';
6993 6993
 
6994 6994
 		dol_syslog(get_class($this)."::insertExtraFields update or insert record line", LOG_DEBUG);
6995 6995
 
@@ -7012,7 +7012,7 @@  discard block
 block discarded – undo
7012 7012
 				 * @param string $key
7013 7013
 				 * @return string
7014 7014
 				 */
7015
-				array_map(function ($key) use ($sqlColumnValues) {
7015
+				array_map(function($key) use ($sqlColumnValues) {
7016 7016
 					return "{$key} = {$sqlColumnValues[$key]}";
7017 7017
 				}, array_keys($sqlColumnValues))
7018 7018
 			);
@@ -7315,7 +7315,7 @@  discard block
 block discarded – undo
7315 7315
 								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.
7316 7316
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
7317 7317
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
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
 										}
@@ -7335,7 +7335,7 @@  discard block
 block discarded – undo
7335 7335
 								}
7336 7336
 							} else {
7337 7337
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
7338
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
7338
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
7339 7339
 								} else {
7340 7340
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
7341 7341
 								}
@@ -7932,7 +7932,7 @@  discard block
 block discarded – undo
7932 7932
 				// 7 : sort field
7933 7933
 
7934 7934
 				// If there is filter
7935
-				if (! empty($InfoFieldList[4])) {
7935
+				if (!empty($InfoFieldList[4])) {
7936 7936
 					$pos = 0;
7937 7937
 					$parenthesisopen = 0;
7938 7938
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -7996,8 +7996,8 @@  discard block
 block discarded – undo
7996 7996
 					}
7997 7997
 
7998 7998
 					$sqlwhere = '';
7999
-					$sql = "SELECT " . $keyList;
8000
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7999
+					$sql = "SELECT ".$keyList;
8000
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
8001 8001
 
8002 8002
 					if (!empty($InfoFieldList[4])) {
8003 8003
 						// can use SELECT request
@@ -8015,11 +8015,11 @@  discard block
 block discarded – undo
8015 8015
 						// We have to join on extrafield table
8016 8016
 						$errstr = '';
8017 8017
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8018
-							$sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra";
8019
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8020
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8018
+							$sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra";
8019
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8020
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8021 8021
 						} else {
8022
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8022
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
8023 8023
 						}
8024 8024
 					} else {
8025 8025
 						$sqlwhere .= ' WHERE 1=1';
@@ -8040,7 +8040,7 @@  discard block
 block discarded – undo
8040 8040
 
8041 8041
 					// Some tables may have field, some other not. For the moment we disable it.
8042 8042
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8043
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8043
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8044 8044
 					}
8045 8045
 					$sql .= $sqlwhere;
8046 8046
 
@@ -8050,10 +8050,10 @@  discard block
 block discarded – undo
8050 8050
 					} else {
8051 8051
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
8052 8052
 					}
8053
-					$sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8053
+					$sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000);
8054 8054
 					// print $sql;
8055 8055
 
8056
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
8056
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
8057 8057
 					$resql = $this->db->query($sql);
8058 8058
 					if ($resql) {
8059 8059
 						$out .= '<option value="0">&nbsp;</option>';
@@ -8069,7 +8069,7 @@  discard block
 block discarded – undo
8069 8069
 							if (count($fields_label) > 1) {
8070 8070
 								$notrans = true;
8071 8071
 								foreach ($fields_label as $field_toshow) {
8072
-									$labeltoshow .= $obj->$field_toshow . ' ';
8072
+									$labeltoshow .= $obj->$field_toshow.' ';
8073 8073
 								}
8074 8074
 							} else {
8075 8075
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8080,12 +8080,12 @@  discard block
 block discarded – undo
8080 8080
 								foreach ($fields_label as $field_toshow) {
8081 8081
 									$translabel = $langs->trans($obj->$field_toshow);
8082 8082
 									if ($translabel != $obj->$field_toshow) {
8083
-										$labeltoshow = dol_trunc($translabel) . ' ';
8083
+										$labeltoshow = dol_trunc($translabel).' ';
8084 8084
 									} else {
8085
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
8085
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
8086 8086
 									}
8087 8087
 								}
8088
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8088
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8089 8089
 							} else {
8090 8090
 								if (!$notrans) {
8091 8091
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -8099,25 +8099,25 @@  discard block
 block discarded – undo
8099 8099
 									$labeltoshow = '(not defined)';
8100 8100
 								}
8101 8101
 								if ($value == $obj->rowid) {
8102
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
8102
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
8103 8103
 								}
8104 8104
 
8105 8105
 								if (!empty($InfoFieldList[3]) && $parentField) {
8106
-									$parent = $parentName . ':' . $obj->{$parentField};
8106
+									$parent = $parentName.':'.$obj->{$parentField};
8107 8107
 									$isDependList = 1;
8108 8108
 								}
8109 8109
 
8110
-								$out .= '<option value="' . $obj->rowid . '"';
8110
+								$out .= '<option value="'.$obj->rowid.'"';
8111 8111
 								$out .= ($value == $obj->rowid ? ' selected' : '');
8112
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
8113
-								$out .= '>' . $labeltoshow . '</option>';
8112
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
8113
+								$out .= '>'.$labeltoshow.'</option>';
8114 8114
 							}
8115 8115
 
8116 8116
 							$i++;
8117 8117
 						}
8118 8118
 						$this->db->free($resql);
8119 8119
 					} else {
8120
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8120
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8121 8121
 					}
8122 8122
 				} else {
8123 8123
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8131,9 +8131,9 @@  discard block
 block discarded – undo
8131 8131
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8132 8132
 					$out .= '<option value="0">&nbsp;</option>';
8133 8133
 					foreach ($data as $data_key => $data_value) {
8134
-						$out .= '<option value="' . $data_key . '"';
8134
+						$out .= '<option value="'.$data_key.'"';
8135 8135
 						$out .= ($value == $data_key ? ' selected' : '');
8136
-						$out .= '>' . $data_value . '</option>';
8136
+						$out .= '>'.$data_value.'</option>';
8137 8137
 					}
8138 8138
 				}
8139 8139
 			}
@@ -8173,7 +8173,7 @@  discard block
 block discarded – undo
8173 8173
 				// 7 : sort field
8174 8174
 
8175 8175
 				// If there is a filter
8176
-				if (! empty($InfoFieldList[4])) {
8176
+				if (!empty($InfoFieldList[4])) {
8177 8177
 					$pos = 0;
8178 8178
 					$parenthesisopen = 0;
8179 8179
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
@@ -8239,8 +8239,8 @@  discard block
 block discarded – undo
8239 8239
 					}
8240 8240
 
8241 8241
 					$sqlwhere = '';
8242
-					$sql = "SELECT " . $keyList;
8243
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
8242
+					$sql = "SELECT ".$keyList;
8243
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
8244 8244
 
8245 8245
 					if (!empty($InfoFieldList[4])) {
8246 8246
 						// can use SELECT request
@@ -8258,11 +8258,11 @@  discard block
 block discarded – undo
8258 8258
 						// We have to join on extrafield table
8259 8259
 						$errstr = '';
8260 8260
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
8261
-							$sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra';
8262
-							$sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]);
8263
-							$sqlwhere .= " AND " . $InfoFieldList[4];
8261
+							$sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra';
8262
+							$sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]);
8263
+							$sqlwhere .= " AND ".$InfoFieldList[4];
8264 8264
 						} else {
8265
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
8265
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
8266 8266
 						}
8267 8267
 					} else {
8268 8268
 						$sqlwhere .= ' WHERE 1=1';
@@ -8283,14 +8283,14 @@  discard block
 block discarded – undo
8283 8283
 
8284 8284
 					// Some tables may have field, some other not. For the moment we disable it.
8285 8285
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
8286
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
8286
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
8287 8287
 					}
8288 8288
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
8289 8289
 					// print $sql;
8290 8290
 
8291 8291
 					$sql .= $sqlwhere;
8292 8292
 
8293
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
8293
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
8294 8294
 
8295 8295
 					$resql = $this->db->query($sql);
8296 8296
 					if ($resql) {
@@ -8309,7 +8309,7 @@  discard block
 block discarded – undo
8309 8309
 							if (count($fields_label) > 1) {
8310 8310
 								$notrans = true;
8311 8311
 								foreach ($fields_label as $field_toshow) {
8312
-									$labeltoshow .= $obj->$field_toshow . ' ';
8312
+									$labeltoshow .= $obj->$field_toshow.' ';
8313 8313
 								}
8314 8314
 							} else {
8315 8315
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -8320,9 +8320,9 @@  discard block
 block discarded – undo
8320 8320
 								foreach ($fields_label as $field_toshow) {
8321 8321
 									$translabel = $langs->trans($obj->$field_toshow);
8322 8322
 									if ($translabel != $obj->$field_toshow) {
8323
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
8323
+										$labeltoshow = dol_trunc($translabel, 18).' ';
8324 8324
 									} else {
8325
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
8325
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
8326 8326
 									}
8327 8327
 								}
8328 8328
 
@@ -8345,7 +8345,7 @@  discard block
 block discarded – undo
8345 8345
 								}
8346 8346
 
8347 8347
 								if (!empty($InfoFieldList[3]) && $parentField) {
8348
-									$parent = $parentName . ':' . $obj->{$parentField};
8348
+									$parent = $parentName.':'.$obj->{$parentField};
8349 8349
 									$isDependList = 1;
8350 8350
 								}
8351 8351
 
@@ -8356,9 +8356,9 @@  discard block
 block discarded – undo
8356 8356
 						}
8357 8357
 						$this->db->free($resql);
8358 8358
 
8359
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8359
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8360 8360
 					} else {
8361
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
8361
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
8362 8362
 					}
8363 8363
 				} else {
8364 8364
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -8370,7 +8370,7 @@  discard block
 block discarded – undo
8370 8370
 					}
8371 8371
 
8372 8372
 					$data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1);
8373
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8373
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
8374 8374
 				}
8375 8375
 			}
8376 8376
 		} elseif ($type == 'link') {
@@ -8405,7 +8405,7 @@  discard block
 block discarded – undo
8405 8405
 			// $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.
8406 8406
 
8407 8407
 			//$objectfield = $valparent;
8408
-			$objectfield = $val;			// Is better than using old method $valparent
8408
+			$objectfield = $val; // Is better than using old method $valparent
8409 8409
 
8410 8410
 			// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
8411 8411
 			$out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield);
@@ -8618,7 +8618,7 @@  discard block
 block discarded – undo
8618 8618
 			$value = $this->getLibStatut(3);
8619 8619
 		} elseif ($type == 'date') {
8620 8620
 			if (!empty($value)) {
8621
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
8621
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
8622 8622
 			} else {
8623 8623
 				$value = '';
8624 8624
 			}
@@ -8719,7 +8719,7 @@  discard block
 block discarded – undo
8719 8719
 			$value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : '';
8720 8720
 			if (strpos($value, "|") !== false) {
8721 8721
 				$value = $langs->trans(explode('|', $value)[0]);
8722
-			} elseif (! is_numeric($value)) {
8722
+			} elseif (!is_numeric($value)) {
8723 8723
 				$value = $langs->trans($value);
8724 8724
 			}
8725 8725
 		} elseif ($type == 'sellist') {
@@ -8781,9 +8781,9 @@  discard block
 block discarded – undo
8781 8781
 									$translabel = $langs->trans($obj->$field_toshow);
8782 8782
 								}
8783 8783
 								if ($translabel != $field_toshow) {
8784
-									$value .= dol_trunc($translabel, 18) . ' ';
8784
+									$value .= dol_trunc($translabel, 18).' ';
8785 8785
 								} else {
8786
-									$value .= $obj->$field_toshow . ' ';
8786
+									$value .= $obj->$field_toshow.' ';
8787 8787
 								}
8788 8788
 							}
8789 8789
 						} else {
@@ -8799,7 +8799,7 @@  discard block
 block discarded – undo
8799 8799
 						}
8800 8800
 					}
8801 8801
 				} else {
8802
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8802
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8803 8803
 
8804 8804
 					$toprint = array();
8805 8805
 					$obj = $this->db->fetch_object($resql);
@@ -8807,7 +8807,7 @@  discard block
 block discarded – undo
8807 8807
 					$c->fetch($obj->rowid);
8808 8808
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8809 8809
 					foreach ($ways as $way) {
8810
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8810
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8811 8811
 					}
8812 8812
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8813 8813
 				}
@@ -8823,11 +8823,11 @@  discard block
 block discarded – undo
8823 8823
 				$toprint = array();
8824 8824
 				foreach ($value_arr as $keyval => $valueval) {
8825 8825
 					if (!empty($valueval)) {
8826
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8826
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8827 8827
 					}
8828 8828
 				}
8829 8829
 				if (!empty($toprint)) {
8830
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8830
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8831 8831
 				}
8832 8832
 			}
8833 8833
 		} elseif ($type == 'chkbxlst') {
@@ -8882,9 +8882,9 @@  discard block
 block discarded – undo
8882 8882
 										$translabel = $langs->trans($obj->$field_toshow);
8883 8883
 									}
8884 8884
 									if ($translabel != $field_toshow) {
8885
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8885
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8886 8886
 									} else {
8887
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8887
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8888 8888
 									}
8889 8889
 								}
8890 8890
 							} else {
@@ -8893,15 +8893,15 @@  discard block
 block discarded – undo
8893 8893
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8894 8894
 								}
8895 8895
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8896
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8896
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8897 8897
 								} else {
8898
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8898
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8899 8899
 								}
8900 8900
 							}
8901 8901
 						}
8902 8902
 					}
8903 8903
 				} else {
8904
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8904
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8905 8905
 
8906 8906
 					$toprint = array();
8907 8907
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8910,7 +8910,7 @@  discard block
 block discarded – undo
8910 8910
 							$c->fetch($obj->rowid);
8911 8911
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8912 8912
 							foreach ($ways as $way) {
8913
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8913
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8914 8914
 							}
8915 8915
 						}
8916 8916
 					}
@@ -9080,7 +9080,7 @@  discard block
 block discarded – undo
9080 9080
 		global $langs;
9081 9081
 
9082 9082
 		if (!class_exists('Validate')) {
9083
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
9083
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
9084 9084
 		}
9085 9085
 
9086 9086
 		$this->clearFieldError($fieldKey);
@@ -9319,7 +9319,7 @@  discard block
 block discarded – undo
9319 9319
 				$out .= "\n";
9320 9320
 
9321 9321
 				$nbofextrafieldsshown = 0;
9322
-				$e = 0;	// var to manage the modulo (odd/even)
9322
+				$e = 0; // var to manage the modulo (odd/even)
9323 9323
 
9324 9324
 				$lastseparatorkeyfound = '';
9325 9325
 				$extrafields_collapse_num = '';
@@ -9357,9 +9357,9 @@  discard block
 block discarded – undo
9357 9357
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
9358 9358
 					} elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) {
9359 9359
 						// 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
9360
-						$ef_name = 'options_' . $key;
9360
+						$ef_name = 'options_'.$key;
9361 9361
 						$ef_value = $this->array_options[$ef_name];
9362
-						$out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n";
9362
+						$out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n";
9363 9363
 						continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation
9364 9364
 					} elseif ($mode == 'view' && empty($visibility)) {
9365 9365
 						continue;
@@ -10449,7 +10449,7 @@  discard block
 block discarded – undo
10449 10449
 						continue;
10450 10450
 					}
10451 10451
 				}
10452
-				$keys_with_alias[] = $alias . '.' . $fieldname;
10452
+				$keys_with_alias[] = $alias.'.'.$fieldname;
10453 10453
 			}
10454 10454
 			return implode(', ', $keys_with_alias);
10455 10455
 		} else {
@@ -10593,7 +10593,7 @@  discard block
 block discarded – undo
10593 10593
 		if (!$error) {
10594 10594
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
10595 10595
 			$sql .= " (".implode(", ", $keys).')';
10596
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
10596
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
10597 10597
 
10598 10598
 			$res = $this->db->query($sql);
10599 10599
 			if (!$res) {
@@ -10907,7 +10907,7 @@  discard block
 block discarded – undo
10907 10907
 
10908 10908
 		// Update extrafield
10909 10909
 		if (!$error) {
10910
-			$result = $this->insertExtraFields();	// This update extrafields
10910
+			$result = $this->insertExtraFields(); // This update extrafields
10911 10911
 			if ($result < 0) {
10912 10912
 				$error++;
10913 10913
 			}
@@ -11131,12 +11131,12 @@  discard block
 block discarded – undo
11131 11131
 				$error++;
11132 11132
 			} else {
11133 11133
 				while ($obj = $this->db->fetch_object($resql)) {
11134
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
11134
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
11135 11135
 					if ($result < 0) {
11136 11136
 						$error++;
11137 11137
 						$this->errors[] = $this->error;
11138 11138
 					} else {
11139
-						$result = $this->delete($user);	// @phpstan-ignore-line
11139
+						$result = $this->delete($user); // @phpstan-ignore-line
11140 11140
 						if ($result < 0) {
11141 11141
 							$error++;
11142 11142
 							$this->errors[] = $this->error;
@@ -11303,7 +11303,7 @@  discard block
 block discarded – undo
11303 11303
 		);
11304 11304
 		foreach ($fields as $key => $value) {
11305 11305
 			if (array_key_exists($key, $this->fields)) {
11306
-				$this->{$key} = $value;		// @phpstan-ignore-line
11306
+				$this->{$key} = $value; // @phpstan-ignore-line
11307 11307
 			}
11308 11308
 		}
11309 11309
 
Please login to merge, or discard this patch.
htdocs/public/stripe/ipn.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 		if (!empty($user->email)) {
205 205
 			$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
206 206
 		} else {
207
-			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
207
+			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
208 208
 		}
209 209
 		$replyto = $sendto;
210 210
 		$sendtocc = '';
211 211
 		if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
212
-			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
212
+			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
213 213
 		}
214 214
 
215 215
 		$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 			$typefrom = 'PRE';
271 271
 			$typeto = 'VIR';
272 272
 
273
-			$numChqOrOpe = '';	// TODO Store the po ref from $event->data
273
+			$numChqOrOpe = ''; // TODO Store the po ref from $event->data
274 274
 
275 275
 			$db->begin();
276 276
 
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	dol_syslog("object = ".var_export($event->data, true));
365 365
 	dol_syslog("object = ".var_export($event->data, true), LOG_DEBUG, 0, '_payment');
366 366
 
367
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
367
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
368 368
 	global $stripearrayofkeysbyenv;
369 369
 	$error = 0;
370 370
 	$object = $event->data->object;
371 371
 	$objectType = $object->metadata->dol_type;
372
-	$TRANSACTIONID = $object->id;	// Example 'pi_123456789...'
372
+	$TRANSACTIONID = $object->id; // Example 'pi_123456789...'
373 373
 	$ipaddress = $object->metadata->ipaddress;
374 374
 	$now = dol_now();
375 375
 	$currencyCodeType = strtoupper($object->currency);
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 	$invoice_id = "";
379 379
 	$supplierinvoice_id = "";
380 380
 	$salary_id = "";
381
-	$paymentTypeCode = "";				// payment type according to Stripe
382
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
381
+	$paymentTypeCode = ""; // payment type according to Stripe
382
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
383 383
 	$payment_amount = 0;
384 384
 	$payment_amountInDolibarr = 0;
385 385
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 		$s = new \Stripe\StripeClient($stripeacc);
455 455
 
456 456
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
457
-		$paymentTypeCode =  $paymentmethodstripe->type;
457
+		$paymentTypeCode = $paymentmethodstripe->type;
458 458
 		if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") {
459 459
 			$paymentTypeCode = "PRE";
460 460
 		} elseif ($paymentTypeCode == "card") {
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
 			$paiement->datepaye = $now;
486 486
 			$paiement->date = $now;
487 487
 			if ($currencyCodeType == $conf->currency) {
488
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
488
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
489 489
 			} else {
490
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
490
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
491 491
 
492 492
 				$postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')';
493 493
 				$ispostactionok = -1;
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 
511 511
 			$paiement->num_payment = '';
512 512
 			$paiement->note_public = '';
513
-			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - ' . dol_print_date($now, 'standard') . ' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
513
+			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - '.dol_print_date($now, 'standard').' (TZ server) using servicestatus='.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID;
514 514
 
515
-			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];		// May be we should store py_... instead of pi_... but we started with pi_... so we continue.
515
+			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue.
516 516
 			$paiement->ext_payment_site = $service;
517 517
 
518 518
 			$ispaymentdone = 0;
@@ -531,23 +531,23 @@  discard block
 block discarded – undo
531 531
 			$db->begin();
532 532
 
533 533
 			if (!$error && !$ispaymentdone) {
534
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.');
535
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
534
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.');
535
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
536 536
 
537 537
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
538 538
 				$paiement_id = $paiement->create($user, 1);
539 539
 				if ($paiement_id < 0) {
540
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
540
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
541 541
 					$ispostactionok = -1;
542 542
 					$error++;
543 543
 
544
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
545
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
544
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
545
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
546 546
 				} else {
547 547
 					$postactionmessages[] = 'Payment created';
548 548
 
549
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
550
-					dol_syslog("The payment has been created for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
549
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
550
+					dol_syslog("The payment has been created for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
551 551
 				}
552 552
 			}
553 553
 
@@ -579,14 +579,14 @@  discard block
 block discarded – undo
579 579
 						$label = '(CustomerInvoicePayment)';
580 580
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
581 581
 						if ($result < 0) {
582
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
582
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
583 583
 							$ispostactionok = -1;
584 584
 							$error++;
585 585
 						} else {
586 586
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
587 587
 						}
588 588
 					} else {
589
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
589
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
590 590
 						$ispostactionok = -1;
591 591
 						$error++;
592 592
 					}
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 			$error++;
759 759
 		}
760 760
 
761
-		if (! $error) {
761
+		if (!$error) {
762 762
 			$db->commit();
763 763
 		} else {
764 764
 			$db->rollback();
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		$companypaymentmode->card_type       = $event->data->object->card->branding;
793 793
 
794 794
 		$companypaymentmode->owner_name      = $event->data->object->billing_details->name;
795
-		$companypaymentmode->proprio         = $companypaymentmode->owner_name;			// We may still need this for modulebuilder code because name of field is "proprio"
795
+		$companypaymentmode->proprio         = $companypaymentmode->owner_name; // We may still need this for modulebuilder code because name of field is "proprio"
796 796
 
797 797
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
798 798
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 		$companypaymentmode->label           = '';
835 835
 		$companypaymentmode->number          = $db->escape($event->data->object->id);
836 836
 		$companypaymentmode->last_four       = $db->escape($event->data->object->card->last4);
837
-		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name);	// deprecated but still needed
837
+		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name); // deprecated but still needed
838 838
 		$companypaymentmode->owner_name      = $db->escape($event->data->object->billing_details->name);
839 839
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
840 840
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	$paymentmethodstripeid = $object->payment_method;
891 891
 	$customer_id = $object->customer;
892 892
 	$reason = $object->reason;
893
-	$amountdisputestripe = $object->amount;			// In stripe format
894
-	$amountdispute = $stripe->convertAmount($amountdisputestripe, $currencyCodeType, 1);			// In real currency format
893
+	$amountdisputestripe = $object->amount; // In stripe format
894
+	$amountdispute = $stripe->convertAmount($amountdisputestripe, $currencyCodeType, 1); // In real currency format
895 895
 	$statusdispute = $object->status;
896 896
 
897 897
 	$pkey = '';
@@ -906,15 +906,15 @@  discard block
 block discarded – undo
906 906
 	if (!empty($balance_transactions_array) && is_array($balance_transactions_array)) {
907 907
 		foreach ($balance_transactions_array as $tmpval) {
908 908
 			if (isset($tmpval['fee'])) {
909
-				$feesstripe += (int) $tmpval['fee'];		// In stripe format
909
+				$feesstripe += (int) $tmpval['fee']; // In stripe format
910 910
 			}
911 911
 		}
912 912
 	}
913
-	$fees = $stripe->convertAmount($feesstripe, $currencyCodeType, 1);			// In real currency format
913
+	$fees = $stripe->convertAmount($feesstripe, $currencyCodeType, 1); // In real currency format
914 914
 
915 915
 	$invoice_id = 0;
916
-	$paymentTypeCode = "";			// payment type according to Stripe
917
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
916
+	$paymentTypeCode = ""; // payment type according to Stripe
917
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
918 918
 	$payment_amount = 0;
919 919
 	$payment_amountInDolibarr = 0;
920 920
 
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 		// If invoice was closed, we reopen it
995 995
 		if ($tmpinvoice->status == Facture::STATUS_CLOSED) {
996 996
 			// Switch back the invoice to status validated
997
-			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none');	// Trigger will be run later
997
+			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none'); // Trigger will be run later
998 998
 			if ($result < 0) {
999 999
 				$errormsg = $tmpinvoice->error.implode(', ', $tmpinvoice->errors);
1000 1000
 				$error++;
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 		$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
1067 1067
 		*/
1068 1068
 		$paiement->paiementid   = dol_getIdFromCode($db, 'PRE', 'c_paiement', 'code', 'id', 1);
1069
-		$paiement->num_payment  = $object->id;	// A string like 'du_...'
1069
+		$paiement->num_payment  = $object->id; // A string like 'du_...'
1070 1070
 		$paiement->note_public = 'Fund withdrawn by bank. Reason: '.$reason;
1071 1071
 		$paiement->note_private = '';
1072 1072
 		$paiement->fk_account   = $accountfrom->id;
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			$error++;
1083 1083
 		}
1084 1084
 
1085
-		if (! $error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
1085
+		if (!$error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
1086 1086
 			// Switch back the invoice to status validated
1087 1087
 			$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED, null, '', 'none');
1088 1088
 			if ($result < 0) {
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 			}
1098 1098
 		}
1099 1099
 
1100
-		if (! $error) {
1100
+		if (!$error) {
1101 1101
 			$paiement_id = $paiement->create($user, 0, $tmpinvoice->thirdparty); // This include regenerating documents
1102 1102
 			if ($paiement_id < 0) {
1103 1103
 				$errormsg = $paiement->error.implode(', ', $paiement->errors);
Please login to merge, or discard this patch.
test/phpunit/FactureTest.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *      \remarks    To run this script as CLI:  phpunit filename.php
27 27
  */
28 28
 
29
-global $conf,$user,$langs,$db;
29
+global $conf, $user, $langs, $db;
30 30
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
31 31
 //require_once 'PHPUnit/Autoload.php';
32 32
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function testFactureCreate()
72 72
 	{
73
-		global $conf,$user,$langs,$db;
73
+		global $conf, $user, $langs, $db;
74 74
 		$conf = $this->savconf;
75 75
 		$user = $this->savuser;
76 76
 		$langs = $this->savlangs;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function testFactureFetch($id)
97 97
 	{
98
-		global $conf,$user,$langs,$db;
98
+		global $conf, $user, $langs, $db;
99 99
 		$conf = $this->savconf;
100 100
 		$user = $this->savuser;
101 101
 		$langs = $this->savlangs;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function testFactureUpdate($localobject)
122 122
 	{
123
-		global $conf,$user,$langs,$db;
123
+		global $conf, $user, $langs, $db;
124 124
 		$conf = $this->savconf;
125 125
 		$user = $this->savuser;
126 126
 		$langs = $this->savlangs;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function testFactureValid($localobject)
147 147
 	{
148
-		global $conf,$user,$langs,$db;
148
+		global $conf, $user, $langs, $db;
149 149
 		$conf = $this->savconf;
150 150
 		$user = $this->savuser;
151 151
 		$langs = $this->savlangs;
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
 			true,
172 172
 			// Not comparing:
173 173
 			array(
174
-				'newref','oldref','id','lines','client','thirdparty','brouillon', 'fk_user_author', 'user_modification_id', 'date_creation','date_validation','datem','date_modification',
175
-				'ref','statut','status','paye','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement',
174
+				'newref', 'oldref', 'id', 'lines', 'client', 'thirdparty', 'brouillon', 'fk_user_author', 'user_modification_id', 'date_creation', 'date_validation', 'datem', 'date_modification',
175
+				'ref', 'statut', 'status', 'paye', 'ref', 'actiontypecode', 'actionmsg2', 'actionmsg', 'mode_reglement', 'cond_reglement',
176 176
 				'cond_reglement_doc', 'modelpdf',
177
-				'multicurrency_total_ht','multicurrency_total_tva',	'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx',
178
-				'retained_warranty' ,'retained_warranty_date_limit', 'retained_warranty_fk_cond_reglement', 'specimen', 'situation_cycle_ref', 'situation_counter', 'situation_final',
179
-				'trackid','user_creat','user_valid', 'note'
177
+				'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'fk_multicurrency', 'multicurrency_code', 'multicurrency_tx',
178
+				'retained_warranty', 'retained_warranty_date_limit', 'retained_warranty_fk_cond_reglement', 'specimen', 'situation_cycle_ref', 'situation_counter', 'situation_final',
179
+				'trackid', 'user_creat', 'user_valid', 'note'
180 180
 			)
181 181
 		);
182
-		$this->assertEquals($arraywithdiff, array());    // Actual, Expected
182
+		$this->assertEquals($arraywithdiff, array()); // Actual, Expected
183 183
 
184 184
 		return $localobject;
185 185
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function testFactureOther($localobject)
197 197
 	{
198
-		global $conf,$user,$langs,$db;
198
+		global $conf, $user, $langs, $db;
199 199
 		$conf = $this->savconf;
200 200
 		$user = $this->savuser;
201 201
 		$langs = $this->savlangs;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function testFactureDelete($id)
230 230
 	{
231
-		global $conf,$user,$langs,$db;
231
+		global $conf, $user, $langs, $db;
232 232
 		$conf = $this->savconf;
233 233
 		$user = $this->savuser;
234 234
 		$langs = $this->savlangs;
@@ -251,21 +251,21 @@  discard block
 block discarded – undo
251 251
 
252 252
 		$conf->global->INVOICE_CAN_NEVER_BE_REMOVED = 1;
253 253
 
254
-		$result = $localobject2->delete($user);					// Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
254
+		$result = $localobject2->delete($user); // Deletion is KO, option INVOICE_CAN_NEVER_BE_REMOVED is on
255 255
 		print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
256 256
 		$this->assertEquals(0, $result, 'Deletion should fail, option INVOICE_CAN_NEVER_BE_REMOVED is on');
257 257
 
258 258
 		unset($conf->global->INVOICE_CAN_NEVER_BE_REMOVED);
259 259
 
260
-		$result = $localobject->delete($user);					// Deletion is KO, it is not last invoice
260
+		$result = $localobject->delete($user); // Deletion is KO, it is not last invoice
261 261
 		print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
262 262
 		$this->assertEquals(0, $result, 'Deletion should fail, it is not last invoice');
263 263
 
264
-		$result = $localobject2->delete($user);					// Deletion is OK, it is last invoice
264
+		$result = $localobject2->delete($user); // Deletion is OK, it is last invoice
265 265
 		print __METHOD__." id=".$localobject2->id." ref=".$localobject2->ref." result=".$result."\n";
266 266
 		$this->assertGreaterThan(0, $result, 'Deletion should work, it is last invoice');
267 267
 
268
-		$result = $localobject->delete($user);					// Deletion is KO, it is not last invoice
268
+		$result = $localobject->delete($user); // Deletion is KO, it is not last invoice
269 269
 		print __METHOD__." id=".$localobject->id." ref=".$localobject->ref." result=".$result."\n";
270 270
 		$this->assertGreaterThan(0, $result, 'Deletion should work, it is again last invoice');
271 271
 
Please login to merge, or discard this patch.