Passed
Branch develop (75104c)
by
unknown
85:26
created
htdocs/projet/tasks/time.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php';
40 40
 
41 41
 // Load translation files required by the page
42
-$langsLoad=array('projects', 'bills', 'orders', 'companies');
42
+$langsLoad = array('projects', 'bills', 'orders', 'companies');
43 43
 if (isModEnabled('eventorganization')) {
44
-	$langsLoad[]='eventorganization';
44
+	$langsLoad[] = 'eventorganization';
45 45
 }
46 46
 
47 47
 $langs->loadLangs($langsLoad);
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
54 54
 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'timespentlist'; // To manage different context of search
55 55
 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
56
-$optioncss	= GETPOST('optioncss', 'alpha');
56
+$optioncss = GETPOST('optioncss', 'alpha');
57 57
 $mode       = GETPOST('mode', 'alpha');
58 58
 
59 59
 $id			= GETPOST('id', 'int');
60
-$projectid	= GETPOST('projectid', 'int');
60
+$projectid = GETPOST('projectid', 'int');
61 61
 $ref		= GETPOST('ref', 'alpha');
62 62
 $withproject = GETPOST('withproject', 'int');
63 63
 $project_ref = GETPOST('project_ref', 'alpha');
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 }
356 356
 
357 357
 if ($action == 'confirm_deleteline' && $confirm == "yes" && ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer'))) {
358
-	$object->fetchTimeSpent(GETPOST('lineid', 'int'));	// load properties like $object->timespent_xxx
358
+	$object->fetchTimeSpent(GETPOST('lineid', 'int')); // load properties like $object->timespent_xxx
359 359
 
360 360
 	if (in_array($object->timespent_fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) {
361
-		$result = $object->delTimeSpent($user);	// delete line with $object->timespent_id
361
+		$result = $object->delTimeSpent($user); // delete line with $object->timespent_id
362 362
 
363 363
 		if ($result < 0) {
364 364
 			$langs->load("errors");
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 		$product_data_cache = array();
434 434
 		if ($idprod > 0) {
435 435
 			$tmpproduct->fetch($idprod);
436
-			if ($result<0) {
436
+			if ($result < 0) {
437 437
 				$error++;
438 438
 				setEventMessages($tmpproduct->error, $tmpproduct->errors, 'errors');
439 439
 			}
440 440
 
441
-			$prodDurationHoursBase=$tmpproduct->getProductDurationHours();
442
-			if ($prodDurationHoursBase<0) {
441
+			$prodDurationHoursBase = $tmpproduct->getProductDurationHours();
442
+			if ($prodDurationHoursBase < 0) {
443 443
 				$error++;
444 444
 				$langs->load("errors");
445 445
 				setEventMessages(null, $tmpproduct->errors, 'errors');
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 				$arrayoftasks = array();
483 483
 				foreach ($toselect as $key => $value) {
484 484
 					// Get userid, timepent
485
-					$object->fetchTimeSpent($value);	// $value is ID of 1 line in timespent table
485
+					$object->fetchTimeSpent($value); // $value is ID of 1 line in timespent table
486 486
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
487 487
 					$arrayoftasks[$object->timespent_fk_user][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
488 488
 				}
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
 						// Add lines
516 516
 						$prodDurationHours = $prodDurationHoursBase;
517
-						$idprodline=$idprod;
517
+						$idprodline = $idprod;
518 518
 						$pu_htline = $pu_ht;
519 519
 						$txtvaline = $txtva;
520 520
 						$localtax1line = $localtax1;
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 								$localtax1line = $dataforprice['localtax1'];
543 543
 								$localtax2line = $dataforprice['localtax2'];
544 544
 
545
-								$product_data_cache[$fk_product] = array('duration'=>$prodDurationHours,'dataforprice'=>$dataforprice);
545
+								$product_data_cache[$fk_product] = array('duration'=>$prodDurationHours, 'dataforprice'=>$dataforprice);
546 546
 							} else {
547 547
 								$prodDurationHours = $product_data_cache[$fk_product]['duration'];
548 548
 								$pu_htline = empty($product_data_cache[$fk_product]['dataforprice']['pu_ht']) ? 0 : $product_data_cache[$fk_product]['dataforprice']['pu_ht'];
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
 								$localtax1line = $product_data_cache[$fk_product]['dataforprice']['localtax1'];
551 551
 								$localtax2line = $product_data_cache[$fk_product]['dataforprice']['localtax2'];
552 552
 							}
553
-							$idprodline=$fk_product;
553
+							$idprodline = $fk_product;
554 554
 						}
555 555
 
556 556
 						// Add lines
557 557
 						$lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0));
558
-						if ($lineid<0) {
558
+						if ($lineid < 0) {
559 559
 							$error++;
560 560
 							setEventMessages(null, $tmpinvoice->errors, 'errors');
561 561
 						}
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			} elseif ($generateinvoicemode == 'onelineperperiod') {	// One line for each time spent line
575 575
 				$arrayoftasks = array();
576 576
 
577
-				$withdetail=GETPOST('detail_time_duration', 'alpha');
577
+				$withdetail = GETPOST('detail_time_duration', 'alpha');
578 578
 				foreach ($toselect as $key => $value) {
579 579
 					// Get userid, timepent
580 580
 					$object->fetchTimeSpent($value);
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
 					$arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration;
589 589
 					$arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm;
590
-					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username.($object->timespent_note ? ' - '.$object->timespent_note : '');		// TODO Add user name in note
590
+					$arrayoftasks[$object->timespent_id]['note'] = $ftask->ref.' - '.$ftask->label.' - '.$username.($object->timespent_note ? ' - '.$object->timespent_note : ''); // TODO Add user name in note
591 591
 					if (!empty($withdetail)) {
592 592
 						if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {
593 593
 							$arrayoftasks[$object->timespent_id]['note'] .= "<br/>";
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 						}
597 597
 
598 598
 						if (!empty($object->timespent_withhour)) {
599
-							$arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date") . ': ' . dol_print_date($object->timespent_datehour);
599
+							$arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date").': '.dol_print_date($object->timespent_datehour);
600 600
 						} else {
601
-							$arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date") . ': ' . dol_print_date($object->timespent_date);
601
+							$arrayoftasks[$object->timespent_id]['note'] .= $langs->trans("Date").': '.dol_print_date($object->timespent_date);
602 602
 						}
603 603
 						$arrayoftasks[$object->timespent_id]['note'] .= ' - '.$langs->trans("Duration").': '.convertSecondToTime($object->timespent_duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
604 604
 					}
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
 
621 621
 					// Add lines
622 622
 					$prodDurationHours = $prodDurationHoursBase;
623
-					$idprodline=$idprod;
623
+					$idprodline = $idprod;
624 624
 					$pu_htline = $pu_ht;
625 625
 					$txtvaline = $txtva;
626 626
 					$localtax1line = $localtax1;
627 627
 					$localtax2line = $localtax2;
628 628
 
629
-					if (!empty($value['fk_product']) && $value['fk_product']!==$idprod) {
629
+					if (!empty($value['fk_product']) && $value['fk_product'] !== $idprod) {
630 630
 						if (!array_key_exists($value['fk_product'], $product_data_cache)) {
631 631
 							$result = $tmpproduct->fetch($value['fk_product']);
632 632
 							if ($result < 0) {
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 							$localtax1line = $dataforprice['localtax1'];
648 648
 							$localtax2line = $dataforprice['localtax2'];
649 649
 
650
-							$product_data_cache[$value['fk_product']] = array('duration'=>$prodDurationHours,'dataforprice'=>$dataforprice);
650
+							$product_data_cache[$value['fk_product']] = array('duration'=>$prodDurationHours, 'dataforprice'=>$dataforprice);
651 651
 						} else {
652 652
 							$prodDurationHours = $product_data_cache[$value['fk_product']]['duration'];
653 653
 							$pu_htline = empty($product_data_cache[$value['fk_product']]['dataforprice']['pu_ht']) ? 0 : $product_data_cache[$value['fk_product']]['dataforprice']['pu_ht'];
@@ -655,10 +655,10 @@  discard block
 block discarded – undo
655 655
 							$localtax1line = $product_data_cache[$value['fk_product']]['dataforprice']['localtax1'];
656 656
 							$localtax2line = $product_data_cache[$value['fk_product']]['dataforprice']['localtax2'];
657 657
 						}
658
-						$idprodline=$value['fk_product'];
658
+						$idprodline = $value['fk_product'];
659 659
 					}
660 660
 					$lineid = $tmpinvoice->addline($value['note'], $pu_htline, round($qtyhour / $prodDurationHours, 2), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0));
661
-					if ($lineid<0) {
661
+					if ($lineid < 0) {
662 662
 						$error++;
663 663
 						setEventMessages(null, $tmpinvoice->errors, 'errors');
664 664
 					}
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 				$arrayoftasks = array();
679 679
 				foreach ($toselect as $key => $value) {
680 680
 					// Get userid, timepent
681
-					$object->fetchTimeSpent($value);		// Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)
681
+					$object->fetchTimeSpent($value); // Call method to get list of timespent for a timespent line id (We use the utiliy method found into Task object)
682 682
 					// $object->id is now the task id
683 683
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['timespent'] += $object->timespent_duration;
684 684
 					$arrayoftasks[$object->id][(int) $object->timespent_fk_product]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm);
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 
695 695
 						// Add lines
696 696
 						$prodDurationHours = $prodDurationHoursBase;
697
-						$idprodline=$idprod;
697
+						$idprodline = $idprod;
698 698
 						$pu_htline = $pu_ht;
699 699
 						$txtvaline = $txtva;
700 700
 						$localtax1line = $localtax1;
701 701
 						$localtax2line = $localtax2;
702 702
 
703
-						if (!empty($fk_product) && $fk_product!==$idprod) {
703
+						if (!empty($fk_product) && $fk_product !== $idprod) {
704 704
 							if (!array_key_exists($fk_product, $product_data_cache)) {
705 705
 								$result = $tmpproduct->fetch($fk_product);
706 706
 								if ($result < 0) {
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 								$localtax1line = $dataforprice['localtax1'];
722 722
 								$localtax2line = $dataforprice['localtax2'];
723 723
 
724
-								$product_data_cache[$fk_product] = array('duration'=>$prodDurationHours,'dataforprice'=>$dataforprice);
724
+								$product_data_cache[$fk_product] = array('duration'=>$prodDurationHours, 'dataforprice'=>$dataforprice);
725 725
 							} else {
726 726
 								$prodDurationHours = $product_data_cache[$fk_product]['duration'];
727 727
 								$pu_htline = empty($product_data_cache[$fk_product]['dataforprice']['pu_ht']) ? 0 : $product_data_cache[$fk_product]['dataforprice']['pu_ht'];
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 								$localtax1line = $product_data_cache[$fk_product]['dataforprice']['localtax1'];
730 730
 								$localtax2line = $product_data_cache[$fk_product]['dataforprice']['localtax2'];
731 731
 							}
732
-							$idprodline=$fk_product;
732
+							$idprodline = $fk_product;
733 733
 						}
734 734
 
735 735
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 						// Add lines
755 755
 						$date_start = '';
756 756
 						$date_end = '';
757
-						$lineName = $ftask->ref . ' - ' . $ftask->label;
757
+						$lineName = $ftask->ref.' - '.$ftask->label;
758 758
 						$lineid = $tmpinvoice->addline($lineName, $pu_ht_for_task, price2num($qtyhour / $prodDurationHours, 'MS'), $txtvaline, $localtax1line, $localtax2line, ($idprodline > 0 ? $idprodline : 0), 0, $date_start, $date_end, 0, 0, '', 'HT', 0, 1, -1, 0, '', 0, 0, null, $pa_ht);
759 759
 						if ($lineid < 0) {
760 760
 							$error++;
@@ -764,8 +764,8 @@  discard block
 block discarded – undo
764 764
 
765 765
 						if (!$error) {
766 766
 							// Update lineid into line of timespent
767
-							$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'projet_task_time SET invoice_line_id = ' . ((int) $lineid) . ', invoice_id = ' . ((int) $tmpinvoice->id);
768
-							$sql .= ' WHERE rowid IN (' . $db->sanitize(join(',', $toselect)) . ')';
767
+							$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id);
768
+							$sql .= ' WHERE rowid IN ('.$db->sanitize(join(',', $toselect)).')';
769 769
 							$result = $db->query($sql);
770 770
 							if (!$result) {
771 771
 								$error++;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		$tmpinter->socid = $projectstatic->thirdparty->id;
819 819
 		$tmpinter->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
820 820
 		$tmpinter->fk_project = $projectstatic->id;
821
-		$tmpinter->description = $projectstatic->title . ( !empty($projectstatic->description) ? '-' . $projectstatic->label : '' );
821
+		$tmpinter->description = $projectstatic->title.(!empty($projectstatic->description) ? '-'.$projectstatic->label : '');
822 822
 
823 823
 		if ($interToUse) {
824 824
 			$tmpinter->fetch($interToUse);
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 				$qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
852 852
 
853 853
 				// Add lines
854
-				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label . ( !empty($value['note']) ? ' - ' . $value['note'] : '' ), $value['date'], $value['timespent']);
854
+				$lineid = $tmpinter->addline($user, $tmpinter->id, $ftask->label.(!empty($value['note']) ? ' - '.$value['note'] : ''), $value['date'], $value['timespent']);
855 855
 			}
856 856
 		}
857 857
 
@@ -880,9 +880,9 @@  discard block
 block discarded – undo
880 880
 //$result = $projectstatic->fetch($object->fk_project);
881 881
 $arrayofselected = is_array($toselect) ? $toselect : array();
882 882
 
883
-$title = $object->ref . ' - ' . $langs->trans("TimeSpent");
883
+$title = $object->ref.' - '.$langs->trans("TimeSpent");
884 884
 if (!empty($withproject)) {
885
-	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '')  ;
885
+	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '');
886 886
 }
887 887
 $help_url = '';
888 888
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 			$cols = 2;
1034 1034
 			$savobject = $object;
1035 1035
 			$object = $projectstatic;
1036
-			include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1036
+			include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1037 1037
 			$object = $savobject;
1038 1038
 
1039 1039
 			print '</table>';
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 				//'builddoc'=>$langs->trans("PDFMerge"),
1110 1110
 			);
1111 1111
 		}
1112
-		if ( isModEnabled('ficheinter') && $user->rights->ficheinter->creer) {
1112
+		if (isModEnabled('ficheinter') && $user->rights->ficheinter->creer) {
1113 1113
 			$langs->load("interventions");
1114 1114
 			$arrayofmassactions['generateinter'] = $langs->trans("GenerateInter");
1115 1115
 		}
@@ -1261,10 +1261,10 @@  discard block
 block discarded – undo
1261 1261
 		// Definition of fields for list
1262 1262
 		$arrayfields = array();
1263 1263
 		$arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1);
1264
-		$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1','checked'=>1);
1264
+		$arrayfields['p.fk_soc'] = array('label'=>$langs->trans("ThirdParty"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1', 'checked'=>1);
1265 1265
 		$arrayfields['s.name_alias'] = array('label'=>$langs->trans("AliasNameShort"), 'type'=>'integer:Societe:/societe/class/societe.class.php:1');
1266 1266
 		if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) {	// Not a dedicated task
1267
-			if (! empty($allprojectforuser)) {
1267
+			if (!empty($allprojectforuser)) {
1268 1268
 				$arrayfields['p.project_ref'] = ['label' => $langs->trans('RefProject'), 'checked' => 1];
1269 1269
 				$arrayfields['p.project_label'] = ['label' => $langs->trans('ProjectLabel'), 'checked' => 1];
1270 1270
 			}
@@ -1633,13 +1633,13 @@  discard block
 block discarded – undo
1633 1633
 			if ($search_timespent_starthour || $search_timespent_startmin) {
1634 1634
 				$timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds
1635 1635
 				$timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds
1636
-				$sql .= " AND t.task_duration >= " . $timespent_duration_start;
1636
+				$sql .= " AND t.task_duration >= ".$timespent_duration_start;
1637 1637
 			}
1638 1638
 
1639 1639
 			if ($search_timespent_endhour || $search_timespent_endmin) {
1640 1640
 				$timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds
1641 1641
 				$timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds
1642
-				$sql .= " AND t.task_duration <= " . $timespent_duration_end;
1642
+				$sql .= " AND t.task_duration <= ".$timespent_duration_end;
1643 1643
 			}
1644 1644
 		}
1645 1645
 
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 		if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
1657 1657
 			$resql = $db->query($sql);
1658 1658
 
1659
-			if (! $resql) {
1659
+			if (!$resql) {
1660 1660
 				dol_print_error($db);
1661 1661
 				exit;
1662 1662
 			}
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 					}
2105 2105
 					print $tmpproject->getNomUrl(1);
2106 2106
 					print '</td>';
2107
-					if (! $i) {
2107
+					if (!$i) {
2108 2108
 						$totalarray['nbfield']++;
2109 2109
 					}
2110 2110
 				}
@@ -2119,7 +2119,7 @@  discard block
 block discarded – undo
2119 2119
 					}
2120 2120
 					print $tmpproject->title;
2121 2121
 					print '</td>';
2122
-					if (! $i) {
2122
+					if (!$i) {
2123 2123
 						$totalarray['nbfield']++;
2124 2124
 					}
2125 2125
 				}
Please login to merge, or discard this patch.
htdocs/hrm/position.php 1 patch
Spacing   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -27,36 +27,36 @@  discard block
 block discarded – undo
27 27
 
28 28
 // Load Dolibarr environment
29 29
 require '../main.inc.php';
30
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
31
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
37
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
38
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
37
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
39 39
 
40 40
 
41 41
 // Load translation files required by the page
42 42
 $langs->loadLangs(array("hrm", "other", 'products'));
43 43
 
44
-$action 	 = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
44
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
45 45
 $massaction  = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
46 46
 $show_files  = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
47
-$confirm 	 = GETPOST('confirm', 'alpha'); // Result of a confirmation
48
-$cancel 	 = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49
-$toselect 	 = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
47
+$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
48
+$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
49
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
50 50
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobpositionlist'; // To manage different context of search
51 51
 $optioncss 	 = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
52
-$id 		 = GETPOST('id', 'int');
53
-$fk_job 	 = GETPOST('fk_job', 'int');
52
+$id = GETPOST('id', 'int');
53
+$fk_job = GETPOST('fk_job', 'int');
54 54
 
55 55
 // Load variable for pagination
56 56
 $limit 	     = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
57 57
 $sortfield   = GETPOST('sortfield', 'aZ09comma');
58 58
 $sortorder   = GETPOST('sortorder', 'aZ09comma');
59
-$page 	     = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
59
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
60 60
 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
61 61
 	// If $page is not defined, or '' or -1 or if we click on clear filters
62 62
 	$page = 0;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 $extrafields = new ExtraFields($db);
86 86
 
87
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
87
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
88 88
 
89 89
 $hookmanager->initHooks(array('jobpositionlist', 'globalcard')); // Note that conf->hooks_modules contains array
90 90
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
 // Default sort order (if not yet defined by previous GETPOST)
99 99
 if (!$sortfield) {
100
-	reset($objectposition->fields);                    // Reset is required to avoid key() to return null.
101
-	$sortfield = "t." . key($objectposition->fields); // Set here default search field. By default 1st field in definition.
100
+	reset($objectposition->fields); // Reset is required to avoid key() to return null.
101
+	$sortfield = "t.".key($objectposition->fields); // Set here default search field. By default 1st field in definition.
102 102
 }
103 103
 if (!$sortorder) {
104 104
 	$sortorder = "ASC";
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
109 109
 $search = array();
110 110
 foreach ($objectposition->fields as $key => $val) {
111
-	if (GETPOST('search_' . $key, 'alpha') !== '') {
112
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
111
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
112
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
113 113
 	}
114 114
 	if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
115
-		$search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
116
-		$search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
115
+		$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
116
+		$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
117 117
 	}
118 118
 }
119 119
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 $fieldstosearchall = array();
122 122
 foreach ($objectposition->fields as $key => $val) {
123 123
 	if (!empty($val['searchall'])) {
124
-		$fieldstosearchall['t.' . $key] = $val['label'];
124
+		$fieldstosearchall['t.'.$key] = $val['label'];
125 125
 	}
126 126
 }
127 127
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	// If $val['visible']==0, then we never show the field
132 132
 	if (!empty($val['visible'])) {
133 133
 		$visible = (int) dol_eval($val['visible'], 1, 1, '1');
134
-		$arrayfields['t.' . $key] = array(
134
+		$arrayfields['t.'.$key] = array(
135 135
 			'label' => $val['label'],
136 136
 			'checked' => (($visible < 0) ? 0 : 1),
137 137
 			'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 }
143 143
 // Extra fields
144
-include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
144
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
145 145
 
146 146
 $objectposition->fields = dol_sort_array($objectposition->fields, 'position');
147 147
 $arrayfields = dol_sort_array($arrayfields, 'position');
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
 
151 151
 
152 152
 // Load object
153
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
153
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
154 154
 
155 155
 // Permissions
156 156
 $permissiontoread = $user->rights->hrm->all->read;
157 157
 $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
158 158
 $permissiontodelete = $user->rights->hrm->all->delete;
159
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position';
159
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position';
160 160
 
161 161
 // Security check (enable the most restrictive one)
162 162
 //if ($user->socid > 0) accessforbidden();
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
 				$backtopage = $backurlforlist;
190 190
 			} else {
191 191
 				if ($fk_job > 0) {
192
-					$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__');
192
+					$backtopage = dol_buildpath('/hrm/position.php', 1).'?fk_job='.($fk_job > 0 ? $fk_job : '__ID__');
193 193
 				} else {
194
-					$backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=__ID__';
194
+					$backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id=__ID__';
195 195
 				}
196 196
 			}
197 197
 		}
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
 	$object = new Position($db);
205 205
 
206 206
 	// Selection of new fields
207
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
207
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
208 208
 
209 209
 	// Purge search criteria
210 210
 	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
211 211
 		foreach ($object->fields as $key => $val) {
212 212
 			$search[$key] = '';
213 213
 			if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
214
-				$search[$key . '_dtstart'] = '';
215
-				$search[$key . '_dtend'] = '';
214
+				$search[$key.'_dtstart'] = '';
215
+				$search[$key.'_dtend'] = '';
216 216
 			}
217 217
 		}
218 218
 		$toselect = array();
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	$objectclass = 'Position';
228 228
 	$objectlabel = 'Position';
229 229
 	$uploaddir = $conf->hrm->dir_output;
230
-	include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php';
230
+	include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
231 231
 
232
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
232
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
233 233
 	$object = $job;
234 234
 }
235 235
 
@@ -248,38 +248,38 @@  discard block
 block discarded – undo
248 248
 	$object = new Position($db);
249 249
 	// Fetch optionals attributes and labels
250 250
 	$extrafields->fetch_name_optionals_label($object->table_element);
251
-	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto);
251
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_'.$object->picto);
252 252
 
253
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
254
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
253
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
254
+	print '<input type="hidden" name="token" value="'.newToken().'">';
255 255
 	print '<input type="hidden" name="action" value="add">';
256 256
 	if ($backtopage) {
257
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
257
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
258 258
 	}
259 259
 
260 260
 	if ($backtopageforcancel) {
261
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
261
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
262 262
 	}
263 263
 
264 264
 	print dol_get_fiche_head(array(), '');
265 265
 
266
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
266
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
267 267
 
268 268
 	// Common attributes
269
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
269
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
270 270
 
271 271
 	// Other attributes
272
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
272
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
273 273
 
274
-	print '</table>' . "\n";
274
+	print '</table>'."\n";
275 275
 
276 276
 	print dol_get_fiche_end();
277 277
 
278 278
 	print '<div class="center">';
279 279
 
280
-	print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">';
280
+	print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
281 281
 	print '&nbsp; ';
282
-	print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="javascript:history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage
282
+	print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
283 283
 	print '</div>';
284 284
 
285 285
 	print '</form>';
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 
290 290
 if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
291 291
 	if ($backtopage) {
292
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
292
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
293 293
 	}
294 294
 	if ($backtopageforcancel) {
295
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
295
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
296 296
 	}
297 297
 
298 298
 	// Part to show record
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
 
306 306
 	// Object card
307 307
 	// ------------------------------------------------------------
308
-	$linkback = '<a href="' . dol_buildpath('/hrm/position_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($fk_job) ? '&fk_job=' . $fk_job : '') . '">' . $langs->trans("BackToList") . '</a>';
308
+	$linkback = '<a href="'.dol_buildpath('/hrm/position_list.php', 1).'?restore_lastsearch_values=1'.(!empty($fk_job) ? '&fk_job='.$fk_job : '').'">'.$langs->trans("BackToList").'</a>';
309 309
 
310 310
 	$morehtmlref = '<div class="refid">';
311
-	$morehtmlref.= $object->label;
311
+	$morehtmlref .= $object->label;
312 312
 	$morehtmlref .= '</div>';
313 313
 
314 314
 	dol_banner_tab($object, 'fk_job', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 	print '<div class="fichecenter">';
318 318
 	print '<div class="fichehalfleft">';
319 319
 	print '<div class="underbanner clearboth"></div>';
320
-	print '<table class="border centpercent tableforfield">' . "\n";
320
+	print '<table class="border centpercent tableforfield">'."\n";
321 321
 
322 322
 	// Common attributes
323 323
 	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
324 324
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
325 325
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
326
-	$object->fields['label']['visible']=0; // Already in banner
327
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
326
+	$object->fields['label']['visible'] = 0; // Already in banner
327
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
328 328
 
329 329
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
330
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
330
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
331 331
 
332 332
 	print '</table>';
333 333
 	print '</div>';
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	// Add fields from extrafields
358 358
 	if (!empty($extrafields->attributes[$object->table_element]['label'])) {
359 359
 		foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
360
-			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : '');
360
+			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
361 361
 		}
362 362
 	}
363 363
 	// Add fields from hooks
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 	$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
366 366
 	$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
367 367
 	$sql = preg_replace('/,\s*$/', '', $sql);
368
-	$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
368
+	$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
369 369
 	if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
370
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
370
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
371 371
 	}
372 372
 	// Add table from hooks
373 373
 	$parameters = array();
374 374
 	$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
375 375
 	$sql .= $hookmanager->resPrint;
376 376
 	if ($object->ismultientitymanaged == 1) {
377
-		$sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")";
377
+		$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
378 378
 	} else {
379 379
 		$sql .= " WHERE 1 = 1";
380 380
 	}
381
-	$sql .= " AND t.fk_job =  " . ((int) $fk_job) . " ";
381
+	$sql .= " AND t.fk_job =  ".((int) $fk_job)." ";
382 382
 
383 383
 	foreach ($search as $key => $val) {
384 384
 		if (array_key_exists($key, $object->fields)) {
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 				$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
401 401
 				if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
402 402
 					if (preg_match('/_dtstart$/', $key)) {
403
-						$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
403
+						$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
404 404
 					}
405 405
 					if (preg_match('/_dtend$/', $key)) {
406
-						$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
406
+						$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
407 407
 					}
408 408
 				}
409 409
 			}
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 	}
415 415
 	//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
416 416
 	// Add where from extra fields
417
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
417
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
418 418
 	// Add where from hooks
419 419
 	$parameters = array();
420 420
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -453,33 +453,33 @@  discard block
 block discarded – undo
453 453
 	if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
454 454
 		$obj = $db->fetch_object($resql);
455 455
 		$id = $obj->rowid;
456
-		header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id);
456
+		header("Location: ".dol_buildpath('/hrm/position.php', 1).'?id='.$id);
457 457
 		exit;
458 458
 	}
459 459
 
460 460
 	$arrayofselected = is_array($toselect) ? $toselect : array();
461 461
 
462
-	$param = 'fk_job=' . $fk_job;
462
+	$param = 'fk_job='.$fk_job;
463 463
 	if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
464
-		$param .= '&contextpage=' . urlencode($contextpage);
464
+		$param .= '&contextpage='.urlencode($contextpage);
465 465
 	}
466 466
 	if ($limit > 0 && $limit != $conf->liste_limit) {
467
-		$param .= '&limit=' . urlencode($limit);
467
+		$param .= '&limit='.urlencode($limit);
468 468
 	}
469 469
 	foreach ($search as $key => $val) {
470 470
 		if (is_array($search[$key]) && count($search[$key])) {
471 471
 			foreach ($search[$key] as $skey) {
472
-				$param .= '&search_' . $key . '[]=' . urlencode($skey);
472
+				$param .= '&search_'.$key.'[]='.urlencode($skey);
473 473
 			}
474 474
 		} else {
475
-			$param .= '&search_' . $key . '=' . urlencode($search[$key]);
475
+			$param .= '&search_'.$key.'='.urlencode($search[$key]);
476 476
 		}
477 477
 	}
478 478
 	if ($optioncss != '') {
479
-		$param .= '&optioncss=' . urlencode($optioncss);
479
+		$param .= '&optioncss='.urlencode($optioncss);
480 480
 	}
481 481
 	// Add $param from extra fields
482
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
482
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
483 483
 	// Add $param from hooks
484 484
 	$parameters = array();
485 485
 	$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -493,42 +493,42 @@  discard block
 block discarded – undo
493 493
 		//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
494 494
 	);
495 495
 	if ($permissiontodelete) {
496
-		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
496
+		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
497 497
 	}
498 498
 	if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
499 499
 		$arrayofmassactions = array();
500 500
 	}
501 501
 	$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
502 502
 
503
-	print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n";
503
+	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?fk_job='.$fk_job.'">'."\n";
504 504
 	if ($optioncss != '') {
505
-		print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
505
+		print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
506 506
 	}
507
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
507
+	print '<input type="hidden" name="token" value="'.newToken().'">';
508 508
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
509 509
 	print '<input type="hidden" name="action" value="list">';
510
-	print '<input type="hidden" name="massaction" value="' . $massaction . '">';
511
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
512
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
513
-	print '<input type="hidden" name="page" value="' . $page . '">';
514
-	print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
510
+	print '<input type="hidden" name="massaction" value="'.$massaction.'">';
511
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
512
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
513
+	print '<input type="hidden" name="page" value="'.$page.'">';
514
+	print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
515 515
 
516 516
 	$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'&fk_job='.((int) $fk_job), '', $permissiontoadd);
517 517
 
518
-	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
518
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
519 519
 
520 520
 	// Add code for pre mass action (confirmation or email presend form)
521 521
 	$topicmail = "SendPositionRef";
522 522
 	$modelmail = "position";
523 523
 	$objecttmp = new Position($db);
524
-	$trackid = 'xxxx' . $object->id;
525
-	include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
524
+	$trackid = 'xxxx'.$object->id;
525
+	include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
526 526
 
527 527
 	if ($search_all) {
528 528
 		foreach ($fieldstosearchall as $key => $val) {
529 529
 			$fieldstosearchall[$key] = $langs->trans($val);
530 530
 		}
531
-		print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>';
531
+		print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
532 532
 	}
533 533
 
534 534
 	$moreforfilter = '';
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
556 556
 
557 557
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
558
-	print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
558
+	print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
559 559
 
560 560
 	// Fields title search
561 561
 	// --------------------------------------------------------------------
@@ -563,35 +563,35 @@  discard block
 block discarded – undo
563 563
 	foreach ($object->fields as $key => $val) {
564 564
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
565 565
 		if ($key == 'status') {
566
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
566
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
567 567
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
568
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
568
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
569 569
 		} elseif (in_array($val['type'], array('timestamp'))) {
570
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
570
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
571 571
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
572
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
572
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
573 573
 		}
574
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
575
-			print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
574
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
575
+			print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
576 576
 			if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
577
-				print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
577
+				print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
578 578
 			} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
579 579
 				print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
580 580
 			} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
581
-				print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
581
+				print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
582 582
 			} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
583 583
 				print '<div class="nowrap">';
584
-				print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
584
+				print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
585 585
 				print '</div>';
586 586
 				print '<div class="nowrap">';
587
-				print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
587
+				print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
588 588
 				print '</div>';
589 589
 			}
590 590
 			print '</td>';
591 591
 		}
592 592
 	}
593 593
 	// Extra fields
594
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
594
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
595 595
 
596 596
 	// Fields from hook
597 597
 	$parameters = array('arrayfields' => $arrayfields);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	$searchpicto = $form->showFilterButtons();
603 603
 	print $searchpicto;
604 604
 	print '</td>';
605
-	print '</tr>' . "\n";
605
+	print '</tr>'."\n";
606 606
 
607 607
 
608 608
 	// Fields title label
@@ -611,27 +611,27 @@  discard block
 block discarded – undo
611 611
 	foreach ($object->fields as $key => $val) {
612 612
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
613 613
 		if ($key == 'status') {
614
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
614
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
615 615
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
616
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
616
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
617 617
 		} elseif (in_array($val['type'], array('timestamp'))) {
618
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
618
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
619 619
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
620
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
620
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
621 621
 		}
622
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
623
-			print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
622
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
623
+			print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
624 624
 		}
625 625
 	}
626 626
 	// Extra fields
627
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
627
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
628 628
 	// Hook fields
629 629
 	$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
630 630
 	$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
631 631
 	print $hookmanager->resPrint;
632 632
 	// Action column
633
-	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
634
-	print '</tr>' . "\n";
633
+	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
634
+	print '</tr>'."\n";
635 635
 
636 636
 	// Detect if we need a fetch on each output line
637 637
 	$needToFetchEachLine = 0;
@@ -663,24 +663,24 @@  discard block
 block discarded – undo
663 663
 		foreach ($object->fields as $key => $val) {
664 664
 			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
665 665
 			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
666
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
666
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
667 667
 			} elseif ($key == 'status') {
668
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
668
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
669 669
 			}
670 670
 
671 671
 			if (in_array($val['type'], array('timestamp'))) {
672
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
672
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
673 673
 			} elseif ($key == 'ref') {
674
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
674
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
675 675
 			}
676 676
 
677 677
 			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
678
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
678
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
679 679
 			}
680 680
 			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
681 681
 
682
-			if (!empty($arrayfields['t.' . $key]['checked'])) {
683
-				print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>';
682
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
683
+				print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
684 684
 				if ($key == 'status') {
685 685
 					print $object->getLibStatut(5);
686 686
 				} elseif ($key == 'rowid') {
@@ -694,20 +694,20 @@  discard block
 block discarded – undo
694 694
 				}
695 695
 				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
696 696
 					if (!$i) {
697
-						$totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
697
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
698 698
 					}
699 699
 					if (!isset($totalarray['val'])) {
700 700
 						$totalarray['val'] = array();
701 701
 					}
702
-					if (!isset($totalarray['val']['t.' . $key])) {
703
-						$totalarray['val']['t.' . $key] = 0;
702
+					if (!isset($totalarray['val']['t.'.$key])) {
703
+						$totalarray['val']['t.'.$key] = 0;
704 704
 					}
705
-					$totalarray['val']['t.' . $key] += $object->$key;
705
+					$totalarray['val']['t.'.$key] += $object->$key;
706 706
 				}
707 707
 			}
708 708
 		}
709 709
 		// Extra fields
710
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
710
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
711 711
 		// Fields from hook
712 712
 		$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
713 713
 		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -719,20 +719,20 @@  discard block
 block discarded – undo
719 719
 			if (in_array($object->id, $arrayofselected)) {
720 720
 				$selected = 1;
721 721
 			}
722
-			print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
722
+			print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
723 723
 		}
724 724
 		print '</td>';
725 725
 		if (!$i) {
726 726
 			$totalarray['nbfield']++;
727 727
 		}
728 728
 
729
-		print '</tr>' . "\n";
729
+		print '</tr>'."\n";
730 730
 
731 731
 		$i++;
732 732
 	}
733 733
 
734 734
 	// Show total line
735
-	include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
735
+	include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
736 736
 
737 737
 	// If no record found
738 738
 	if ($num == 0) {
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 				$colspan++;
743 743
 			}
744 744
 		}
745
-		print '<tr><td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("NoRecordFound") . '</td></tr>';
745
+		print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
746 746
 	}
747 747
 
748 748
 
@@ -752,10 +752,10 @@  discard block
 block discarded – undo
752 752
 	$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
753 753
 	print $hookmanager->resPrint;
754 754
 
755
-	print '</table>' . "\n";
756
-	print '</div>' . "\n";
755
+	print '</table>'."\n";
756
+	print '</div>'."\n";
757 757
 
758
-	print '</form>' . "\n";
758
+	print '</form>'."\n";
759 759
 
760 760
 	if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
761 761
 		$hidegeneratedfilelistifempty = 1;
@@ -763,11 +763,11 @@  discard block
 block discarded – undo
763 763
 			$hidegeneratedfilelistifempty = 0;
764 764
 		}
765 765
 
766
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
766
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
767 767
 		$formfile = new FormFile($db);
768 768
 
769 769
 		// Show list of available documents
770
-		$urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
770
+		$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
771 771
 		$urlsource .= str_replace('&amp;', '&', $param);
772 772
 
773 773
 		$filedir = $diroutputmassaction;
@@ -790,22 +790,22 @@  discard block
 block discarded – undo
790 790
 {
791 791
 	global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
792 792
 
793
-	$action 	 = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
793
+	$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
794 794
 	$massaction  = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
795 795
 	$show_files  = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
796
-	$confirm 	 = GETPOST('confirm', 'alpha'); // Result of a confirmation
797
-	$cancel 	 = GETPOST('cancel', 'alpha'); // We click on a Cancel button
798
-	$toselect 	 = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
796
+	$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
797
+	$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
798
+	$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
799 799
 	$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positionlist'; // To manage different context of search
800 800
 	$optioncss 	 = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
801
-	$id 		 = GETPOST('id', 'int');
802
-	$fk_job 	 = GETPOST('fk_job', 'int');
801
+	$id = GETPOST('id', 'int');
802
+	$fk_job = GETPOST('fk_job', 'int');
803 803
 
804 804
 	// Load variable for pagination
805 805
 	$limit 	     = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
806 806
 	$sortfield   = GETPOST('sortfield', 'aZ09comma');
807 807
 	$sortorder   = GETPOST('sortorder', 'aZ09comma');
808
-	$page 	     = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
808
+	$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
809 809
 	if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
810 810
 		// If $page is not defined, or '' or -1 or if we click on clear filters
811 811
 		$page = 0;
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 	$object = new Position($db);
819 819
 
820 820
 	$extrafields = new ExtraFields($db);
821
-	$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
821
+	$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
822 822
 	$hookmanager->initHooks(array('positiontablist')); // Note that conf->hooks_modules contains array
823 823
 
824 824
 	// Fetch optionals attributes and labels
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
 
830 830
 	// Default sort order (if not yet defined by previous GETPOST)
831 831
 	if (!$sortfield) {
832
-		reset($object->fields);                    // Reset is required to avoid key() to return null.
833
-		$sortfield = "t." . key($object->fields); // Set here default search field. By default 1st field in definition.
832
+		reset($object->fields); // Reset is required to avoid key() to return null.
833
+		$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
834 834
 	}
835 835
 	if (!$sortorder) {
836 836
 		$sortorder = "ASC";
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
 	$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
841 841
 	$search = array();
842 842
 	foreach ($object->fields as $key => $val) {
843
-		if (GETPOST('search_' . $key, 'alpha') !== '') {
844
-			$search[$key] = GETPOST('search_' . $key, 'alpha');
843
+		if (GETPOST('search_'.$key, 'alpha') !== '') {
844
+			$search[$key] = GETPOST('search_'.$key, 'alpha');
845 845
 		}
846 846
 		if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
847
-			$search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
848
-			$search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
847
+			$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
848
+			$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
849 849
 		}
850 850
 	}
851 851
 
@@ -853,7 +853,7 @@  discard block
 block discarded – undo
853 853
 	$fieldstosearchall = array();
854 854
 	foreach ($object->fields as $key => $val) {
855 855
 		if (!empty($val['searchall'])) {
856
-			$fieldstosearchall['t.' . $key] = $val['label'];
856
+			$fieldstosearchall['t.'.$key] = $val['label'];
857 857
 		}
858 858
 	}
859 859
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 		// If $val['visible']==0, then we never show the field
864 864
 		if (!empty($val['visible'])) {
865 865
 			$visible = (int) dol_eval($val['visible'], 1, 1, '1');
866
-			$arrayfields['t.' . $key] = array(
866
+			$arrayfields['t.'.$key] = array(
867 867
 				'label' => $val['label'],
868 868
 				'checked' => (($visible < 0) ? 0 : 1),
869 869
 				'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 		}
874 874
 	}
875 875
 	// Extra fields
876
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
876
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
877 877
 
878 878
 	$object->fields = dol_sort_array($object->fields, 'position');
879 879
 	$arrayfields = dol_sort_array($arrayfields, 'position');
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	// Add fields from extrafields
901 901
 	if (!empty($extrafields->attributes[$object->table_element]['label'])) {
902 902
 		foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
903
-			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : '');
903
+			$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
904 904
 		}
905 905
 	}
906 906
 	// Add fields from hooks
@@ -908,20 +908,20 @@  discard block
 block discarded – undo
908 908
 	$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
909 909
 	$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
910 910
 	$sql = preg_replace('/,\s*$/', '', $sql);
911
-	$sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
911
+	$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
912 912
 	if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
913
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
913
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
914 914
 	}
915 915
 	// Add table from hooks
916 916
 	$parameters = array();
917 917
 	$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
918 918
 	$sql .= $hookmanager->resPrint;
919 919
 	if ($object->ismultientitymanaged == 1) {
920
-		$sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")";
920
+		$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
921 921
 	} else {
922 922
 		$sql .= " WHERE 1 = 1";
923 923
 	}
924
-	$sql .= " AND t.fk_job =  " . ((int) $fk_job) . " ";
924
+	$sql .= " AND t.fk_job =  ".((int) $fk_job)." ";
925 925
 
926 926
 	foreach ($search as $key => $val) {
927 927
 		if (array_key_exists($key, $object->fields)) {
@@ -943,10 +943,10 @@  discard block
 block discarded – undo
943 943
 				$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
944 944
 				if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
945 945
 					if (preg_match('/_dtstart$/', $key)) {
946
-						$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
946
+						$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
947 947
 					}
948 948
 					if (preg_match('/_dtend$/', $key)) {
949
-						$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
949
+						$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
950 950
 					}
951 951
 				}
952 952
 			}
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 	}
958 958
 	//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
959 959
 	// Add where from extra fields
960
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
960
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
961 961
 	// Add where from hooks
962 962
 	$parameters = array();
963 963
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1014,33 +1014,33 @@  discard block
 block discarded – undo
1014 1014
 	if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
1015 1015
 		$obj = $db->fetch_object($resql);
1016 1016
 		$id = $obj->rowid;
1017
-		header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id);
1017
+		header("Location: ".dol_buildpath('/hrm/position.php', 1).'?id='.$id);
1018 1018
 		exit;
1019 1019
 	}
1020 1020
 
1021 1021
 	$arrayofselected = is_array($toselect) ? $toselect : array();
1022 1022
 
1023
-	$param = 'fk_job=' . $fk_job;
1023
+	$param = 'fk_job='.$fk_job;
1024 1024
 	if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
1025
-		$param .= '&contextpage=' . urlencode($contextpage);
1025
+		$param .= '&contextpage='.urlencode($contextpage);
1026 1026
 	}
1027 1027
 	if ($limit > 0 && $limit != $conf->liste_limit) {
1028
-		$param .= '&limit=' . urlencode($limit);
1028
+		$param .= '&limit='.urlencode($limit);
1029 1029
 	}
1030 1030
 	foreach ($search as $key => $val) {
1031 1031
 		if (is_array($search[$key]) && count($search[$key])) {
1032 1032
 			foreach ($search[$key] as $skey) {
1033
-				$param .= '&search_' . $key . '[]=' . urlencode($skey);
1033
+				$param .= '&search_'.$key.'[]='.urlencode($skey);
1034 1034
 			}
1035 1035
 		} else {
1036
-			$param .= '&search_' . $key . '=' . urlencode($search[$key]);
1036
+			$param .= '&search_'.$key.'='.urlencode($search[$key]);
1037 1037
 		}
1038 1038
 	}
1039 1039
 	if ($optioncss != '') {
1040
-		$param .= '&optioncss=' . urlencode($optioncss);
1040
+		$param .= '&optioncss='.urlencode($optioncss);
1041 1041
 	}
1042 1042
 	// Add $param from extra fields
1043
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
1043
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1044 1044
 	// Add $param from hooks
1045 1045
 	$parameters = array();
1046 1046
 	$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1054,42 +1054,42 @@  discard block
 block discarded – undo
1054 1054
 		//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1055 1055
 	);
1056 1056
 	if ($permissiontodelete) {
1057
-		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
1057
+		$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
1058 1058
 	}
1059 1059
 	if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
1060 1060
 		$arrayofmassactions = array();
1061 1061
 	}
1062 1062
 	$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1063 1063
 
1064
-	print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n";
1064
+	print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?fk_job='.$fk_job.'">'."\n";
1065 1065
 	if ($optioncss != '') {
1066
-		print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
1066
+		print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1067 1067
 	}
1068
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
1068
+	print '<input type="hidden" name="token" value="'.newToken().'">';
1069 1069
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1070 1070
 	print '<input type="hidden" name="action" value="list">';
1071
-	print '<input type="hidden" name="massaction" value="' . $massaction . '">';
1072
-	print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
1073
-	print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
1074
-	print '<input type="hidden" name="page" value="' . $page . '">';
1075
-	print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
1071
+	print '<input type="hidden" name="massaction" value="'.$massaction.'">';
1072
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1073
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1074
+	print '<input type="hidden" name="page" value="'.$page.'">';
1075
+	print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
1076 1076
 
1077 1077
 	$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/position.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'&fk_job='.((int) $fk_job), '', $permissiontoadd);
1078 1078
 
1079
-	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
1079
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
1080 1080
 
1081 1081
 	// Add code for pre mass action (confirmation or email presend form)
1082 1082
 	$topicmail = "SendPositionRef";
1083 1083
 	$modelmail = "position";
1084 1084
 	$objecttmp = new Position($db);
1085
-	$trackid = 'xxxx' . $object->id;
1086
-	include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
1085
+	$trackid = 'xxxx'.$object->id;
1086
+	include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1087 1087
 
1088 1088
 	if ($search_all) {
1089 1089
 		foreach ($fieldstosearchall as $key => $val) {
1090 1090
 			$fieldstosearchall[$key] = $langs->trans($val);
1091 1091
 		}
1092
-		print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>';
1092
+		print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
1093 1093
 	}
1094 1094
 
1095 1095
 	$moreforfilter = '';
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
1117 1117
 
1118 1118
 	print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
1119
-	print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
1119
+	print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1120 1120
 
1121 1121
 
1122 1122
 	// Fields title search
@@ -1125,35 +1125,35 @@  discard block
 block discarded – undo
1125 1125
 	foreach ($object->fields as $key => $val) {
1126 1126
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1127 1127
 		if ($key == 'status') {
1128
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1128
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1129 1129
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1130
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1130
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1131 1131
 		} elseif (in_array($val['type'], array('timestamp'))) {
1132
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1132
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1133 1133
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
1134
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1134
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
1135 1135
 		}
1136
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
1137
-			print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
1136
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
1137
+			print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
1138 1138
 			if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
1139
-				print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
1139
+				print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
1140 1140
 			} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
1141 1141
 				print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
1142 1142
 			} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
1143
-				print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
1143
+				print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
1144 1144
 			} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
1145 1145
 				print '<div class="nowrap">';
1146
-				print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1146
+				print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1147 1147
 				print '</div>';
1148 1148
 				print '<div class="nowrap">';
1149
-				print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1149
+				print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1150 1150
 				print '</div>';
1151 1151
 			}
1152 1152
 			print '</td>';
1153 1153
 		}
1154 1154
 	}
1155 1155
 	// Extra fields
1156
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
1156
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1157 1157
 
1158 1158
 	// Fields from hook
1159 1159
 	$parameters = array('arrayfields' => $arrayfields);
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 	$searchpicto = $form->showFilterButtons();
1165 1165
 	print $searchpicto;
1166 1166
 	print '</td>';
1167
-	print '</tr>' . "\n";
1167
+	print '</tr>'."\n";
1168 1168
 
1169 1169
 
1170 1170
 	// Fields title label
@@ -1173,27 +1173,27 @@  discard block
 block discarded – undo
1173 1173
 	foreach ($object->fields as $key => $val) {
1174 1174
 		$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1175 1175
 		if ($key == 'status') {
1176
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1176
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1177 1177
 		} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1178
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1178
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
1179 1179
 		} elseif (in_array($val['type'], array('timestamp'))) {
1180
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1180
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1181 1181
 		} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
1182
-			$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1182
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
1183 1183
 		}
1184
-		if (!empty($arrayfields['t.' . $key]['checked'])) {
1185
-			print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
1184
+		if (!empty($arrayfields['t.'.$key]['checked'])) {
1185
+			print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
1186 1186
 		}
1187 1187
 	}
1188 1188
 	// Extra fields
1189
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
1189
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1190 1190
 	// Hook fields
1191 1191
 	$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
1192 1192
 	$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1193 1193
 	print $hookmanager->resPrint;
1194 1194
 	// Action column
1195
-	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
1196
-	print '</tr>' . "\n";
1195
+	print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
1196
+	print '</tr>'."\n";
1197 1197
 
1198 1198
 	// Detect if we need a fetch on each output line
1199 1199
 	$needToFetchEachLine = 0;
@@ -1225,24 +1225,24 @@  discard block
 block discarded – undo
1225 1225
 		foreach ($object->fields as $key => $val) {
1226 1226
 			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
1227 1227
 			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
1228
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1228
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
1229 1229
 			} elseif ($key == 'status') {
1230
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'center';
1230
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
1231 1231
 			}
1232 1232
 
1233 1233
 			if (in_array($val['type'], array('timestamp'))) {
1234
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1234
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1235 1235
 			} elseif ($key == 'ref') {
1236
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
1236
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
1237 1237
 			}
1238 1238
 
1239 1239
 			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
1240
-				$cssforfield .= ($cssforfield ? ' ' : '') . 'right';
1240
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
1241 1241
 			}
1242 1242
 			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
1243 1243
 
1244
-			if (!empty($arrayfields['t.' . $key]['checked'])) {
1245
-				print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>';
1244
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
1245
+				print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
1246 1246
 				if ($key == 'status') {
1247 1247
 					print $object->getLibStatut(5);
1248 1248
 				} elseif ($key == 'rowid') {
@@ -1256,20 +1256,20 @@  discard block
 block discarded – undo
1256 1256
 				}
1257 1257
 				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
1258 1258
 					if (!$i) {
1259
-						$totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
1259
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
1260 1260
 					}
1261 1261
 					if (!isset($totalarray['val'])) {
1262 1262
 						$totalarray['val'] = array();
1263 1263
 					}
1264
-					if (!isset($totalarray['val']['t.' . $key])) {
1265
-						$totalarray['val']['t.' . $key] = 0;
1264
+					if (!isset($totalarray['val']['t.'.$key])) {
1265
+						$totalarray['val']['t.'.$key] = 0;
1266 1266
 					}
1267
-					$totalarray['val']['t.' . $key] += $object->$key;
1267
+					$totalarray['val']['t.'.$key] += $object->$key;
1268 1268
 				}
1269 1269
 			}
1270 1270
 		}
1271 1271
 		// Extra fields
1272
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
1272
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1273 1273
 		// Fields from hook
1274 1274
 		$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1275 1275
 		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -1281,20 +1281,20 @@  discard block
 block discarded – undo
1281 1281
 			if (in_array($object->id, $arrayofselected)) {
1282 1282
 				$selected = 1;
1283 1283
 			}
1284
-			print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
1284
+			print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1285 1285
 		}
1286 1286
 		print '</td>';
1287 1287
 		if (!$i) {
1288 1288
 			$totalarray['nbfield']++;
1289 1289
 		}
1290 1290
 
1291
-		print '</tr>' . "\n";
1291
+		print '</tr>'."\n";
1292 1292
 
1293 1293
 		$i++;
1294 1294
 	}
1295 1295
 
1296 1296
 	// Show total line
1297
-	include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
1297
+	include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1298 1298
 
1299 1299
 	// If no record found
1300 1300
 	if ($num == 0) {
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 				$colspan++;
1305 1305
 			}
1306 1306
 		}
1307
-		print '<tr><td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("NoRecordFound") . '</td></tr>';
1307
+		print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1308 1308
 	}
1309 1309
 
1310 1310
 
@@ -1314,10 +1314,10 @@  discard block
 block discarded – undo
1314 1314
 	$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
1315 1315
 	print $hookmanager->resPrint;
1316 1316
 
1317
-	print '</table>' . "\n";
1318
-	print '</div>' . "\n";
1317
+	print '</table>'."\n";
1318
+	print '</div>'."\n";
1319 1319
 
1320
-	print '</form>' . "\n";
1320
+	print '</form>'."\n";
1321 1321
 
1322 1322
 	if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1323 1323
 		$hidegeneratedfilelistifempty = 1;
@@ -1325,11 +1325,11 @@  discard block
 block discarded – undo
1325 1325
 			$hidegeneratedfilelistifempty = 0;
1326 1326
 		}
1327 1327
 
1328
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
1328
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1329 1329
 		$formfile = new FormFile($db);
1330 1330
 
1331 1331
 		// Show list of available documents
1332
-		$urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
1332
+		$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1333 1333
 		$urlsource .= str_replace('&amp;', '&', $param);
1334 1334
 
1335 1335
 		$filedir = $diroutputmassaction;
Please login to merge, or discard this patch.
htdocs/hrm/position_note.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
32
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
34 34
 
35 35
 // Load translation files required by the page
36 36
 $langs->loadLangs(array('hrm', 'companies'));
Please login to merge, or discard this patch.
htdocs/hrm/position_card.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
38 38
 //dol_include_once('/hrm/position.php');
39 39
 
40 40
 // Get Parameters
41
-$action 	= GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
41
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
42 42
 $backtopage = GETPOST('backtopage', 'alpha');
43 43
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
44
-$id 	= GETPOST('id', 'int');
44
+$id = GETPOST('id', 'int');
45 45
 
46 46
 // Initialize technical objects
47 47
 $form = new Form($db);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
57 57
 $permissiontodelete = $user->rights->hrm->all->delete;
58 58
 $permissiondellink = $user->rights->hrm->all->write; // Used by the include of actions_dellink.inc.php
59
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position';
59
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position';
60 60
 
61 61
 // Security check (enable the most restrictive one)
62 62
 //if ($user->socid > 0) accessforbidden();
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 // Get parameters
74
-$id 	= GETPOST('id', 'int');
74
+$id = GETPOST('id', 'int');
75 75
 $fk_job = GETPOST('fk_job', 'int');
76 76
 
77
-$ref 	= GETPOST('ref', 'alpha');
77
+$ref = GETPOST('ref', 'alpha');
78 78
 $action = GETPOST('action', 'aZ09');
79 79
 $confirm = GETPOST('confirm', 'alpha');
80 80
 $cancel = GETPOST('cancel', 'aZ09');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 $extrafields = new ExtraFields($db);
94 94
 
95
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
95
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
96 96
 $hookmanager->initHooks(array('positioncard', 'globalcard')); // Note that conf->hooks_modules contains array
97 97
 
98 98
 // Fetch optionals attributes and labels
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 $search_all = GETPOST("search_all", 'alpha');
105 105
 $search = array();
106 106
 foreach ($object->fields as $key => $val) {
107
-	if (GETPOST('search_' . $key, 'alpha')) {
108
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
107
+	if (GETPOST('search_'.$key, 'alpha')) {
108
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
109 109
 	}
110 110
 }
111 111
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 }
115 115
 
116 116
 // Load object
117
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
117
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
118 118
 
119 119
 
120 120
 /*
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
138 138
 				$backtopage = $backurlforlist;
139 139
 			} else {
140
-				$backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__');
140
+				$backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
141 141
 			}
142 142
 		}
143 143
 	}
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	$triggermodname = 'hrm_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record
146 146
 
147 147
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
148
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
148
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
149 149
 
150 150
 	// Actions when linking object each other
151
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
151
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
152 152
 
153 153
 	// Actions when printing a doc from card
154
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
154
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
155 155
 
156 156
 	// Action to move up and down lines of object
157 157
 	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
158 158
 
159 159
 	// Action to build doc
160
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
160
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
161 161
 
162 162
 	if ($action == 'set_thirdparty' && $permissiontoadd) {
163 163
 		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	// Actions to send emails
170 170
 	$triggersendname = 'hrm_POSITION_SENTBYMAIL';
171 171
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_POSITION_TO';
172
-	$trackid = 'position' . $object->id;
173
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
172
+	$trackid = 'position'.$object->id;
173
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
174 174
 }
175 175
 
176 176
 
@@ -214,36 +214,36 @@  discard block
 block discarded – undo
214 214
 
215 215
 	// Part to edit record
216 216
 	if (($id || $ref) && $action == 'edit') {
217
-		print load_fiche_titre($langs->trans("Position"), '', 'object_' . $object->picto);
217
+		print load_fiche_titre($langs->trans("Position"), '', 'object_'.$object->picto);
218 218
 
219
-		print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">';
220
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
219
+		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
220
+		print '<input type="hidden" name="token" value="'.newToken().'">';
221 221
 		print '<input type="hidden" name="action" value="update">';
222
-		print '<input type="hidden" name="id" value="' . $object->id . '">';
222
+		print '<input type="hidden" name="id" value="'.$object->id.'">';
223 223
 
224 224
 		if ($backtopage) {
225
-			print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
225
+			print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
226 226
 		}
227 227
 		if ($backtopageforcancel) {
228
-			print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
228
+			print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
229 229
 		}
230 230
 
231 231
 		print dol_get_fiche_head();
232 232
 
233
-		print '<table class="border centpercent tableforfieldedit">' . "\n";
233
+		print '<table class="border centpercent tableforfieldedit">'."\n";
234 234
 
235 235
 		// Common attributes
236
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
236
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
237 237
 
238 238
 		// Other attributes
239
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
239
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
240 240
 
241 241
 		print '</table>';
242 242
 
243 243
 		print dol_get_fiche_end();
244 244
 
245
-		print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">';
246
-		print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
245
+		print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
246
+		print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
247 247
 		print '</div>';
248 248
 
249 249
 		print '</form>';
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 		// Confirmation to delete
264 264
 		if ($action == 'delete') {
265
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
265
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
266 266
 		}
267 267
 
268 268
 		// Call Hook formConfirm
@@ -297,18 +297,18 @@  discard block
 block discarded – undo
297 297
 		print '<div class="fichecenter">';
298 298
 		print '<div class="fichehalfleft">';
299 299
 		print '<div class="underbanner clearboth"></div>';
300
-		print '<table class="border centpercent tableforfield">' . "\n";
300
+		print '<table class="border centpercent tableforfield">'."\n";
301 301
 
302 302
 		// Common attributes
303 303
 		//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
304 304
 		//unset($object->fields['fk_project']);				// Hide field already shown in banner
305 305
 		//unset($object->fields['fk_soc']);					// Hide field already shown in banner
306
-		$object->fields['fk_user']['visible']=0; // Already in banner
307
-		$object->fields['fk_job']['visible']=0; // Already in banner
308
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
306
+		$object->fields['fk_user']['visible'] = 0; // Already in banner
307
+		$object->fields['fk_job']['visible'] = 0; // Already in banner
308
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
309 309
 
310 310
 		// Other attributes. Fields from hook formObjectOptions and Extrafields.
311
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
311
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
312 312
 
313 313
 		print '</table>';
314 314
 		print '</div>';
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
328 328
 
329 329
 
330
-		print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
330
+		print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
331 331
 
332 332
 		// Delete (need delete permission, or if draft, just need create/modify permission)
333
-		print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
333
+		print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
334 334
 	}
335 335
 }
336 336
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 //}
369 369
 
370 370
 
371
-print '</table>' . "\n";
372
-print '</div>' . "\n";
371
+print '</table>'."\n";
372
+print '</div>'."\n";
373 373
 
374
-print '</form>' . "\n";
374
+print '</form>'."\n";
375 375
 
376 376
 
377 377
 if ($action !== 'edit' && $action !== 'create') {
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 	$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/position_agenda.php?id='.$object->id);
390 390
 
391 391
 	// List of actions on element
392
-	include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
392
+	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
393 393
 	$formactions = new FormActions($db);
394
-	$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
394
+	$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
395 395
 
396 396
 	print '</div></div>';
397 397
 }
Please login to merge, or discard this patch.
htdocs/hrm/job_card.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
37 37
 
38 38
 // Load translation files required by the page
39
-$langs->loadLangs(array('hrm', 'other', 'products'));   // why products?
39
+$langs->loadLangs(array('hrm', 'other', 'products')); // why products?
40 40
 
41 41
 // Get parameters
42 42
 $id = GETPOST('id', 'int');
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search
48 48
 $backtopage = GETPOST('backtopage', 'alpha');
49 49
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
50
-$lineid   = GETPOST('lineid', 'int');
50
+$lineid = GETPOST('lineid', 'int');
51 51
 
52 52
 // Initialize technical objects
53 53
 $object = new Job($db);
54 54
 $extrafields = new ExtraFields($db);
55
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
55
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
56 56
 $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array
57 57
 
58 58
 // Fetch optionals attributes and labels
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 $search_all = GETPOST("search_all", 'alpha');
65 65
 $search = array();
66 66
 foreach ($object->fields as $key => $val) {
67
-	if (GETPOST('search_' . $key, 'alpha')) {
68
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
67
+	if (GETPOST('search_'.$key, 'alpha')) {
68
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
69 69
 	}
70 70
 }
71 71
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 }
75 75
 
76 76
 // Load object
77
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
77
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
78 78
 
79 79
 // Permissions
80 80
 $permissiontoread = $user->rights->hrm->all->read;
81 81
 $permissiontoadd  = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
82 82
 $permissiontodelete = $user->rights->hrm->all->delete;
83
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job';
83
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job';
84 84
 
85 85
 // Security check (enable the most restrictive one)
86 86
 //if ($user->socid > 0) accessforbidden();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
112 112
 				$backtopage = $backurlforlist;
113 113
 			} else {
114
-				$backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__');
114
+				$backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
115 115
 			}
116 116
 		}
117 117
 	}
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
123
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
123
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
124 124
 
125 125
 	// Actions when linking object each other
126
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
126
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
127 127
 
128 128
 	// Actions when printing a doc from card
129
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
129
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
130 130
 
131 131
 	// Action to move up and down lines of object
132 132
 	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
133 133
 
134 134
 	// Action to build doc
135
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
135
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
136 136
 
137 137
 	if ($action == 'set_thirdparty' && $permissiontoadd) {
138 138
 		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	// Actions to send emails
145 145
 	$triggersendname = 'hrm_JOB_SENTBYMAIL';
146 146
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO';
147
-	$trackid = 'job' . $object->id;
148
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
147
+	$trackid = 'job'.$object->id;
148
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
149 149
 }
150 150
 
151 151
 
@@ -181,36 +181,36 @@  discard block
 block discarded – undo
181 181
 
182 182
 // Part to create
183 183
 if ($action == 'create') {
184
-	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentities('Job')), '', 'object_' . $object->picto);
184
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentities('Job')), '', 'object_'.$object->picto);
185 185
 
186
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
187
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
186
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
187
+	print '<input type="hidden" name="token" value="'.newToken().'">';
188 188
 	print '<input type="hidden" name="action" value="add">';
189 189
 	if ($backtopage) {
190
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
190
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
191 191
 	}
192 192
 	if ($backtopageforcancel) {
193
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
193
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
194 194
 	}
195 195
 
196 196
 	print dol_get_fiche_head(array(), '');
197 197
 
198
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
198
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
199 199
 
200 200
 	// Common attributes
201
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
201
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
202 202
 
203 203
 	// Other attributes
204
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
204
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
205 205
 
206
-	print '</table>' . "\n";
206
+	print '</table>'."\n";
207 207
 
208 208
 	print dol_get_fiche_end();
209 209
 
210 210
 	print '<div class="center">';
211
-	print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">';
211
+	print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
212 212
 	print '&nbsp; ';
213
-	print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="javascript:history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage
213
+	print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
214 214
 	print '</div>';
215 215
 
216 216
 	print '</form>';
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 
221 221
 // Part to edit record
222 222
 if (($id || $ref) && $action == 'edit') {
223
-	print load_fiche_titre($langs->trans("Job"), '', 'object_' . $object->picto);
223
+	print load_fiche_titre($langs->trans("Job"), '', 'object_'.$object->picto);
224 224
 
225
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
226
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
225
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
+	print '<input type="hidden" name="token" value="'.newToken().'">';
227 227
 	print '<input type="hidden" name="action" value="update">';
228
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
228
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
229 229
 	if ($backtopage) {
230
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
230
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
231 231
 	}
232 232
 	if ($backtopageforcancel) {
233
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
233
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
234 234
 	}
235 235
 
236 236
 	print dol_get_fiche_head();
237 237
 
238
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
238
+	print '<table class="border centpercent tableforfieldedit">'."\n";
239 239
 
240 240
 	// Common attributes
241
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
241
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
242 242
 
243 243
 	// Other attributes
244
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
244
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
245 245
 
246 246
 	print '</table>';
247 247
 
248 248
 	print dol_get_fiche_end();
249 249
 
250
-	print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">';
251
-	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
250
+	print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
251
+	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
252 252
 	print '</div>';
253 253
 
254 254
 	print '</form>';
@@ -266,17 +266,17 @@  discard block
 block discarded – undo
266 266
 
267 267
 	// Confirmation to delete
268 268
 	if ($action == 'delete') {
269
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
269
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
270 270
 	}
271 271
 	// Confirmation to delete line
272 272
 	if ($action == 'deleteline') {
273
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
273
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
274 274
 	}
275 275
 	// Clone confirmation
276 276
 	if ($action == 'clone') {
277 277
 		// Create an array for form
278 278
 		$formquestion = array();
279
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
279
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
280 280
 	}
281 281
 
282 282
 	// Confirmation of action xxxx
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 			// array('type' => 'other',    'name' => 'idwarehouse',   'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
293 293
 		);
294 294
 		*/
295
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
295
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
296 296
 	}
297 297
 
298 298
 	// Call Hook formConfirm
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 
311 311
 	// Object card
312 312
 	// ------------------------------------------------------------
313
-	$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
313
+	$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
314 314
 
315 315
 	$morehtmlref = '<div class="refid">';
316
-	$morehtmlref.= $object->label;
316
+	$morehtmlref .= $object->label;
317 317
 	$morehtmlref .= '</div>';
318 318
 
319 319
 
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
330 330
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
331 331
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
332
-	$object->fields['label']['visible']=0; // Already in banner
333
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
332
+	$object->fields['label']['visible'] = 0; // Already in banner
333
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
334 334
 
335 335
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
336
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
336
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
337 337
 
338 338
 	print '</table>';
339 339
 	print '</div>';
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 		// Show object lines
353 353
 		$result = $object->getLinesArray();
354 354
 
355
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
356
-		<input type="hidden" name="token" value="' . newToken() . '">
357
-		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
355
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
356
+		<input type="hidden" name="token" value="' . newToken().'">
357
+		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
358 358
 		<input type="hidden" name="mode" value="">
359 359
 		<input type="hidden" name="page_y" value="">
360
-		<input type="hidden" name="id" value="' . $object->id . '">
360
+		<input type="hidden" name="id" value="' . $object->id.'">
361 361
 		';
362 362
 
363 363
 		if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
364
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
364
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
365 365
 		}
366 366
 
367 367
 		print '<div class="div-table-responsive-no-min">';
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	// Buttons for actions
399 399
 
400 400
 	if ($action != 'presend' && $action != 'editline') {
401
-		print '<div class="tabsAction">' . "\n";
401
+		print '<div class="tabsAction">'."\n";
402 402
 		$parameters = array();
403 403
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
404 404
 		if ($reshook < 0) {
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		if (empty($reshook)) {
409 409
 			// Back to draft
410 410
 			if ($object->status == $object::STATUS_VALIDATED) {
411
-				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd);
411
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
412 412
 			}
413 413
 
414
-			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
414
+			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
415 415
 
416 416
 			// Delete (need delete permission, or if draft, just need create/modify permission)
417
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
417
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
418 418
 		}
419
-		print '</div>' . "\n";
419
+		print '</div>'."\n";
420 420
 	}
421 421
 
422 422
 
@@ -434,12 +434,12 @@  discard block
 block discarded – undo
434 434
 		// Documents
435 435
 		if ($includedocgeneration) {
436 436
 			$objref = dol_sanitizeFileName($object->ref);
437
-			$relativepath = $objref . '/' . $objref . '.pdf';
438
-			$filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref;
439
-			$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
437
+			$relativepath = $objref.'/'.$objref.'.pdf';
438
+			$filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref;
439
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
440 440
 			$genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content
441 441
 			$delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card
442
-			print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
442
+			print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
443 443
 		}
444 444
 
445 445
 		// Show links to link elements
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
 		$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id);
455 455
 
456 456
 		// List of actions on element
457
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
457
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
458 458
 		$formactions = new FormActions($db);
459
-		$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
459
+		$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
460 460
 
461 461
 		print '</div></div>';
462 462
 	}
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	$modelmail = 'job';
466 466
 	$defaulttopic = 'InformationMessage';
467 467
 	$diroutput = $conf->hrm->dir_output;
468
-	$trackid = 'job' . $object->id;
468
+	$trackid = 'job'.$object->id;
469 469
 
470
-	include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
470
+	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
471 471
 }
472 472
 
473 473
 // End of page
Please login to merge, or discard this patch.
htdocs/hrm/skill_tab.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php';
40 40
 
41 41
 // Load translation files required by the page
42 42
 $langs->loadLangs(array('hrm', 'other'));
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array
72 72
 
73 73
 // Load object
74
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
74
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
75 75
 
76 76
 // Permissions
77 77
 $permissiontoread = $user->hasRight('hrm', 'all', 'read');
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
104 104
 				$backtopage = $backurlforlist;
105 105
 			} else {
106
-				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id=' . ($id > 0 ? $id : '__ID__');
106
+				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id='.($id > 0 ? $id : '__ID__');
107 107
 			}
108 108
 		}
109 109
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	} elseif ($action == 'saveSkill') {
132 132
 		if (!empty($TNote)) {
133 133
 			foreach ($TNote as $skillId => $rank) {
134
-				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object=' . ((int) $id) . " AND objecttype='" . $db->escape($objecttype) . "' AND fk_skill = " . ((int) $skillId)));
134
+				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.((int) $id)." AND objecttype='".$db->escape($objecttype)."' AND fk_skill = ".((int) $skillId)));
135 135
 				if (is_array($TSkills) && !empty($TSkills)) {
136 136
 					foreach ($TSkills as $tmpObj) {
137 137
 						$tmpObj->rankorder = $rank;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				}
141 141
 			}
142 142
 			setEventMessages($langs->trans("SaveLevelSkill"), null);
143
-			header("Location: " . DOL_URL_ROOT.'/hrm/skill_tab.php?id=' . $id. '&objecttype=job');
143
+			header("Location: ".DOL_URL_ROOT.'/hrm/skill_tab.php?id='.$id.'&objecttype=job');
144 144
 			exit;
145 145
 		}
146 146
 	} elseif ($action == 'confirm_deleteskill' && $confirm == 'yes') {
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 
172 172
 	// view configuration
173 173
 	if ($objecttype == 'job') {
174
-		require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
174
+		require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
175 175
 		$head = jobPrepareHead($object);
176 176
 		$listLink = dol_buildpath('/hrm/job_list.php', 1);
177 177
 	} elseif ($objecttype == "user") {
178
-		require_once DOL_DOCUMENT_ROOT . "/core/lib/usergroups.lib.php";
178
+		require_once DOL_DOCUMENT_ROOT."/core/lib/usergroups.lib.php";
179 179
 		$object->getRights();
180 180
 		$head = user_prepare_head($object);
181 181
 		$listLink = dol_buildpath('/user/list.php', 1);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	}*/
192 192
 	// Confirmation to delete line
193 193
 	if ($action == 'ask_deleteskill') {
194
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&objecttype=' . $objecttype . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
194
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&objecttype='.$objecttype.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
195 195
 	}
196 196
 	// Clone confirmation
197 197
 	/*if ($action == 'clone') {
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	// Object card
217 217
 	// ------------------------------------------------------------
218 218
 	if ($objecttype == 'job') {
219
-		$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
219
+		$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
220 220
 
221 221
 		$morehtmlref = '<div class="refid">';
222
-		$morehtmlref.= $object->label;
222
+		$morehtmlref .= $object->label;
223 223
 		$morehtmlref .= '</div>';
224 224
 
225 225
 		dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
226 226
 	} else {
227
-		$linkback = '<a href="' . $listLink . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
227
+		$linkback = '<a href="'.$listLink.'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
228 228
 
229 229
 		$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" class="refid">';
230 230
 		$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	$TAllSkills = $static_skill->fetchAll();
239 239
 
240 240
 	// Array format for multiselectarray function
241
-	$TAllSkillsFormatted=array();
241
+	$TAllSkillsFormatted = array();
242 242
 	if (!empty($TAllSkills)) {
243 243
 		foreach ($TAllSkills as $k=>$v) {
244 244
 			$TAllSkillsFormatted[$k] = $v->label;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	}
247 247
 
248 248
 	// table of skillRank linked to current object
249
-	$TSkillsJob = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object=' . ((int) $id) . " AND objecttype='" . $db->escape($objecttype) . "'"));
249
+	$TSkillsJob = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.((int) $id)." AND objecttype='".$db->escape($objecttype)."'"));
250 250
 
251 251
 	$TAlreadyUsedSkill = array();
252 252
 	if (is_array($TSkillsJob) && !empty($TSkillsJob)) {
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 		//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
267 267
 		//unset($object->fields['fk_project']);				// Hide field already shown in banner
268 268
 		//unset($object->fields['fk_soc']);					// Hide field already shown in banner
269
-		$object->fields['label']['visible']=0; // Already in banner
270
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
269
+		$object->fields['label']['visible'] = 0; // Already in banner
270
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
271 271
 
272 272
 		// Other attributes. Fields from hook formObjectOptions and Extrafields.
273
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
273
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
274 274
 	} else {
275 275
 		// Login
276 276
 		print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 		}
294 294
 		print '</tr>'."\n";
295 295
 
296
-		$object->fields['label']['visible']=0; // Already in banner
297
-		$object->fields['firstname']['visible']=0; // Already in banner
298
-		$object->fields['lastname']['visible']=0; // Already in banner
296
+		$object->fields['label']['visible'] = 0; // Already in banner
297
+		$object->fields['firstname']['visible'] = 0; // Already in banner
298
+		$object->fields['lastname']['visible'] = 0; // Already in banner
299 299
 		//include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
300 300
 
301 301
 		// Ref employee
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 
324 324
 	if ($objecttype != 'user' && $permissiontoadd) {
325 325
 		// form pour ajouter des compétences
326
-		print '<form name="addSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
327
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
328
-		print '<input type="hidden" name="id" value="' . $id . '">';
326
+		print '<form name="addSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
327
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
328
+		print '<input type="hidden" name="id" value="'.$id.'">';
329 329
 		print '<input type="hidden" name="action" value="addSkill">';
330 330
 		print '<input type="hidden" name="token" value="'.newToken().'">';
331 331
 		print '<div class="div-table-responsive-no-min">';
332 332
 		print '<table id="tablelines" class="noborder noshadow" width="100%">';
333
-		print '<tr><td style="width:90%">' . $langs->trans('AddSkill') . '</td><td style="width:10%"></td></tr>';
333
+		print '<tr><td style="width:90%">'.$langs->trans('AddSkill').'</td><td style="width:10%"></td></tr>';
334 334
 		print '<tr>';
335 335
 		print '<td>';
336 336
 		print img_picto('', 'shapes', 'class="pictofixedwidth"');
337
-		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx') . '</td>';
338
-		print '<td><input class="button reposition" type="submit" value="' . $langs->trans('Add') . '"></td>';
337
+		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx').'</td>';
338
+		print '<td><input class="button reposition" type="submit" value="'.$langs->trans('Add').'"></td>';
339 339
 		print '</tr>';
340 340
 		print '</table>';
341 341
 		print '</div>';
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	print '<div class="clearboth"></div>';
347 347
 
348 348
 	if ($objecttype != 'user' && $permissiontoadd) {
349
-		print '<form name="saveSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
350
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
351
-		print '<input type="hidden" name="id" value="' . $id . '">';
349
+		print '<form name="saveSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
350
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
351
+		print '<input type="hidden" name="id" value="'.$id.'">';
352 352
 		print '<input type="hidden" name="token" value="'.newToken().'">';
353 353
 		print '<input type="hidden" name="action" value="saveSkill">';
354 354
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	}
366 366
 	print '</tr>';
367 367
 	if (!is_array($TSkillsJob) || empty($TSkillsJob)) {
368
-		print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
368
+		print '<tr><td><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
369 369
 	} else {
370 370
 		$sk = new Skill($db);
371 371
 		foreach ($TSkillsJob as $skillElement) {
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 			if ($objecttype != 'user' && $permissiontoadd) {
385 385
 				print '<td class="linecoledit"></td>';
386 386
 				print '<td class="linecoldelete">';
387
-				print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $skillElement->fk_object . '&amp;objecttype=' . $objecttype . '&amp;action=ask_deleteskill&amp;lineid=' . $skillElement->id . '">';
387
+				print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$skillElement->fk_object.'&amp;objecttype='.$objecttype.'&amp;action=ask_deleteskill&amp;lineid='.$skillElement->id.'">';
388 388
 				print img_delete();
389 389
 				print '</a>';
390 390
 			}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	}
395 395
 
396 396
 	print '</table>';
397
-	if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>';
397
+	if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="'.$langs->trans('SaveRank').'"></td>';
398 398
 	print '</div>';
399 399
 	if ($objecttype != 'user' && $permissiontoadd) print '</form>';
400 400
 
Please login to merge, or discard this patch.
htdocs/adherents/subscription/list.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@
 block discarded – undo
256 256
 
257 257
 $param = '';
258 258
 if (!empty($mode)) {
259
-	$param .='&mode='.urlencode($mode);
259
+	$param .= '&mode='.urlencode($mode);
260 260
 }
261 261
 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
262 262
 	$param .= '&contextpage='.urlencode($contextpage);
Please login to merge, or discard this patch.
htdocs/adherents/class/adherent_type.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 				$this->amount         = $obj->amount;
505 505
 				$this->caneditamount  = $obj->caneditamount;
506 506
 				$this->mail_valid     = $obj->mail_valid;
507
-				$this->note           = $obj->note_public;	// deprecated
507
+				$this->note           = $obj->note_public; // deprecated
508 508
 				$this->note_public    = $obj->note_public;
509 509
 				$this->vote           = $obj->vote;
510 510
 
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 	 */
938 938
 	public function getKanbanView($option = '')
939 939
 	{
940
-		global $langs,$user;
940
+		global $langs, $user;
941 941
 		$return = '<div class="box-flex-item box-flex-grow-zero">';
942 942
 		$return .= '<div class="info-box info-box-sm">';
943 943
 		$return .= '<span class="info-box-icon bg-infobox-action">';
Please login to merge, or discard this patch.
htdocs/adherents/class/subscription.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 				$this->dateh          = $this->db->jdate($obj->dateh);
236 236
 				$this->datef          = $this->db->jdate($obj->datef);
237 237
 				$this->amount         = $obj->subscription;
238
-				$this->note           = $obj->note_public;	// deprecated
238
+				$this->note           = $obj->note_public; // deprecated
239 239
 				$this->note_public    = $obj->note_public;
240 240
 				$this->fk_bank        = $obj->fk_bank;
241 241
 				return 1;
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		$return .= '</span>';
522 522
 
523 523
 		$return .= '<div class="info-box-content">';
524
-		$return .= '<span class="info-box-ref">'.(property_exists($this, 'fk_adherent')? $this->fk_adherent: $this->ref ).'</span>';
524
+		$return .= '<span class="info-box-ref">'.(property_exists($this, 'fk_adherent') ? $this->fk_adherent : $this->ref).'</span>';
525 525
 		if (property_exists($this, 'dateh') || property_exists($this, 'datef')) {
526 526
 			$return .= '<br><span class="info-box-status opacitymedium">'.dol_print_date($this->dateh, 'day').' - '.dol_print_date($this->datef, 'day').'</span>';
527 527
 		}
Please login to merge, or discard this patch.