Completed
Branch develop (152428)
by
unknown
12:41
created
htdocs/workstation/workstation_list.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 $langs->loadLangs(array('mrp', 'other'));
38 38
 
39 39
 $action      = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ...
40
-$massaction  = GETPOST('massaction', 'alpha');                                   // The bulk action (combo box choice into lists)
41
-$show_files  = GETPOST('show_files', 'int');                                    // Show files area generated by bulk actions ?
42
-$confirm     = GETPOST('confirm', 'alpha');                                    // Result of a confirmation
43
-$cancel      = GETPOST('cancel', 'alpha');                                    // We click on a Cancel button
44
-$toselect    = GETPOST('toselect', 'array');                                 // Array of ids of elements selected into a list
40
+$massaction  = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
41
+$show_files  = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
42
+$confirm     = GETPOST('confirm', 'alpha'); // Result of a confirmation
43
+$cancel      = GETPOST('cancel', 'alpha'); // We click on a Cancel button
44
+$toselect    = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
45 45
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
46
-$backtopage  = GETPOST('backtopage', 'alpha');                                                   // Go back to a dedicated page
47
-$optioncss   = GETPOST('optioncss', 'aZ');                                                      // Option for the css output (always '' except when 'print')
48
-$mode       = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
46
+$backtopage  = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
47
+$optioncss   = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
48
+$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
49 49
 
50 50
 $id = GETPOST('id', 'int');
51 51
 $ref = GETPOST('ref', 'alpha');
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 $object = new Workstation($db);
68 68
 $extrafields = new ExtraFields($db);
69 69
 $diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id;
70
-$hookmanager->initHooks(array('workstationlist'));         // Note that conf->hooks_modules contains array
70
+$hookmanager->initHooks(array('workstationlist')); // Note that conf->hooks_modules contains array
71 71
 
72 72
 // Fetch optionals attributes and labels
73 73
 $extrafields->fetch_name_optionals_label($object->table_element);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 // Default sort order (if not yet defined by previous GETPOST)
79 79
 if (!$sortfield) {
80
-	reset($object->fields);					// Reset is required to avoid key() to return null.
80
+	reset($object->fields); // Reset is required to avoid key() to return null.
81 81
 	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
82 82
 }
83 83
 if (!$sortorder) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				$search[$key.'_dtend'] = '';
190 190
 			}
191 191
 		}
192
-		$groups = $resources=array();
192
+		$groups = $resources = array();
193 193
 		$toselect = array();
194 194
 		$search_array_options = array();
195 195
 	}
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
246 246
 }
247 247
 if (!empty($groups)) {
248
-	$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
248
+	$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'workstation_workstation_usergroup wug ON (wug.fk_workstation = t.rowid)';
249 249
 }
250 250
 if (!empty($resources)) {
251
-	$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
251
+	$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'workstation_workstation_resource wr ON (wr.fk_workstation = t.rowid)';
252 252
 }
253 253
 // Add table from hooks
254 254
 $parameters = array();
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 
297 297
 // usergroups
298 298
 if (!empty($groups)) {
299
-	$sql.= ' AND wug.fk_usergroup IN('.$db->sanitize(implode(',', $groups)).')';
299
+	$sql .= ' AND wug.fk_usergroup IN('.$db->sanitize(implode(',', $groups)).')';
300 300
 }
301 301
 
302 302
 // resources
303 303
 if (!empty($resources)) {
304
-	$sql.= ' AND wr.fk_resource IN('.$db->sanitize(implode(',', $resources)).')';
304
+	$sql .= ' AND wr.fk_resource IN('.$db->sanitize(implode(',', $resources)).')';
305 305
 }
306 306
 
307 307
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
311 311
 $sql .= $hookmanager->resPrint;
312 312
 
313
-$sql.= " GROUP BY ";
313
+$sql .= " GROUP BY ";
314 314
 foreach ($object->fields as $key => $val) {
315 315
 	$sql .= "t.".$db->escape($key).", ";
316 316
 }
317 317
 // Add fields from extrafields
318
-if (! empty($extrafields->attributes[$object->table_element]['label'])) {
318
+if (!empty($extrafields->attributes[$object->table_element]['label'])) {
319 319
 	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
320 320
 		$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
321 321
 	}
322 322
 }
323 323
 // Add groupby from hooks
324 324
 $parameters = array();
325
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object);    // Note that $action and $object may have been modified by hook
325
+$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
326 326
 $sql .= $hookmanager->resPrint;
327 327
 $sql = preg_replace('/,\s*$/', '', $sql);
328 328
 
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
598 598
 		$cssforfield .= ($cssforfield ? ' ' : '').'right';
599 599
 	}
600
-	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
600
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
601 601
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
602 602
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
603 603
 		$totalarray['nbfield']++;
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
 
607 607
 // usergroups
608 608
 if (!empty($arrayfields['wug.fk_usergroup']['checked'])) {
609
-	print getTitleFieldOfList($arrayfields['wug.fk_usergroup']['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '') . "\n";
609
+	print getTitleFieldOfList($arrayfields['wug.fk_usergroup']['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
610 610
 }
611 611
 
612 612
 // resources
613 613
 if (!empty($arrayfields['wr.fk_resource']['checked'])) {
614
-	print getTitleFieldOfList($arrayfields['wr.fk_resource']['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '') . "\n";
614
+	print getTitleFieldOfList($arrayfields['wr.fk_resource']['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, '')."\n";
615 615
 }
616 616
 
617 617
 // Extra fields
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
 	if ($mode == 'kanban') {
662 662
 		if ($i == 0) {
663
-			print '<tr class="trkanban"><td colspan="'.($savnbfield+1).'">';
663
+			print '<tr class="trkanban"><td colspan="'.($savnbfield + 1).'">';
664 664
 			print '<div class="box-flex-container kanban">';
665 665
 		}
666 666
 		// Output Kanban
@@ -757,11 +757,11 @@  discard block
 block discarded – undo
757 757
 			foreach ($object->usergroups as $id_group) {
758 758
 				$g = new UserGroup($db);
759 759
 				$g->fetch($id_group);
760
-				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>';
760
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">'.$g->getNomUrl(1, '', 0, 'categtextwhite').'</li>';
761 761
 			}
762 762
 
763 763
 			print '<td class="minwidth300imp nowraponall">';
764
-			print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
764
+			print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
765 765
 			print '</td>';
766 766
 		}
767 767
 
@@ -776,11 +776,11 @@  discard block
 block discarded – undo
776 776
 			foreach ($object->resources as $id_resource) {
777 777
 				$r = new Dolresource($db);
778 778
 				$r->fetch($id_resource);
779
-				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>';
779
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories'.($cssforli ? ' '.$cssforli : '').'" style="background: #bbb">'.$r->getNomUrl(1, '', '', 0, 'categtextwhite').'</li>';
780 780
 			}
781 781
 
782 782
 			print '<td class="minwidth300imp">';
783
-			print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
783
+			print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
784 784
 			print '</td>';
785 785
 		}
786 786
 
Please login to merge, or discard this patch.
htdocs/workstation/class/workstation.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
99 99
 	 */
100
-	public $fields=array(
100
+	public $fields = array(
101 101
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
102 102
 		'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
103 103
 		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object", 'csslist'=>'nowraponall'),
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 		'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
112 112
 		'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>512, 'notnull'=>-1, 'visible'=>-2,),
113 113
 		'nb_operators_required' => array('type'=>'integer', 'label'=>'NbOperatorsRequired', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'),
114
-		'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'),
114
+		'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp', 'label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'),
115 115
 		'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'),
116 116
 		'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'),),
117 117
 	);
118 118
 	public $rowid;
119 119
 	public $ref;
120 120
 	public $label;
121
-	public $type;	// HUMAN, MACHINE, ...
121
+	public $type; // HUMAN, MACHINE, ...
122 122
 
123 123
 	public $date_creation;
124 124
 	public $tms;
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		// Usergroups
458 458
 		$groups = GETPOST('groups', 'array:int');
459 459
 		WorkstationUserGroup::deleteAllGroupsOfWorkstation($this->id);
460
-		$this->usergroups=array();
460
+		$this->usergroups = array();
461 461
 
462 462
 		foreach ($groups as $id_group) {
463 463
 			$ws_usergroup = new WorkstationUserGroup($this->db);
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 		// Resources
471 471
 		$resources = GETPOST('resources', 'array:int');
472 472
 		WorkstationResource::deleteAllResourcesOfWorkstation($this->id);
473
-		$this->resources=array();
473
+		$this->resources = array();
474 474
 		if (!empty($resources)) {
475 475
 			foreach ($resources as $id_resource) {
476 476
 				$ws_resource = new WorkstationResource($this->db);
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 		if (getDolGlobalString('WORKSTATION_WORKSTATION_ADDON')) {
841 841
 			$mybool = false;
842 842
 
843
-			$file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON') . ".php";
843
+			$file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON').".php";
844 844
 			$classname = $conf->global->WORKSTATION_WORKSTATION_ADDON;
845 845
 
846 846
 			// Include file with class
Please login to merge, or discard this patch.
htdocs/workstation/workstation_card.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 	$dol_openinpopup = $tmpbacktopagejsfields[0];
55 55
 }
56 56
 
57
-$groups	    = GETPOST('groups', 'array:int');
58
-$resources	= GETPOST('resources', 'array:int');
57
+$groups = GETPOST('groups', 'array:int');
58
+$resources = GETPOST('resources', 'array:int');
59 59
 //$lineid   = GETPOST('lineid', 'int');
60 60
 
61 61
 // Initialize technical objects
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 
89 89
 // Permissions
90 90
 $permissiontoread = $user->hasRight('workstation', 'workstation', 'read');
91
-$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
91
+$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
92 92
 $permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DISABLED);
93
-$permissionnote = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_setnotes.inc.php
94
-$permissiondellink = $user->hasRight('workstation', 'workstation', 'write');      // Used by the include of actions_dellink.inc.php
93
+$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php
94
+$permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php
95 95
 
96 96
 $upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1];
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  */
106 106
 
107 107
 $parameters = array();
108
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);   // Note that $action and $object may have been modified by some hooks
108
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
109 109
 if ($reshook < 0) {
110 110
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
111 111
 }
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		}
126 126
 	}
127 127
 
128
-	$triggermodname = 'WORKSTATION_WORKSTATION_MODIFY';    // Name of trigger action code to execute when we modify record
128
+	$triggermodname = 'WORKSTATION_WORKSTATION_MODIFY'; // Name of trigger action code to execute when we modify record
129 129
 
130 130
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
131 131
 	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 		$g = new UserGroup($db);
413 413
 		foreach ($object->usergroups as $id_group) {
414 414
 			$g->fetch($id_group);
415
-			$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>';
415
+			$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$g->getNomUrl(1, '', 0, 'categtextwhite').'</li>';
416 416
 		}
417 417
 
418
-		print '<tr><td>' . $langs->trans('Groups') . '</td><td>';
419
-		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
418
+		print '<tr><td>'.$langs->trans('Groups').'</td><td>';
419
+		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
420 420
 		print '</td></tr>';
421 421
 	}
422 422
 
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 		$r = new Dolresource($db);
427 427
 		foreach ($object->resources as $id_resource) {
428 428
 			$r->fetch($id_resource);
429
-			$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>';
429
+			$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$r->getNomUrl(1, '', '', 0, 'categtextwhite').'</li>';
430 430
 		}
431 431
 
432
-		print '<tr><td>' . $langs->trans('Machines') . '</td><td>';
433
-		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
432
+		print '<tr><td>'.$langs->trans('Machines').'</td><td>';
433
+		print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
434 434
 		print '</td></tr>';
435 435
 	}
436 436
 
Please login to merge, or discard this patch.