dolibarr  16.0.5
position.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
4  * Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
5  * Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
6  * Copyright (C) 2021 GrĂ©gory BLEMAND <gregory.blemand@atm-consulting.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
28 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
29 //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
30 //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
31 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
32 //if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
33 //if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
34 //if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
35 //if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
36 //if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
37 //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
38 //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
39 //if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
40 //if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
41 //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
42 //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
43 //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
44 //if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
45 //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
46 //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
47 
48 // Load Dolibarr environment
49 $res = 0;
50 // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
51 if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
52  $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
53 }
54 // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
55 $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
56 $tmp2 = realpath(__FILE__);
57 $i = strlen($tmp) - 1;
58 $j = strlen($tmp2) - 1;
59 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
60  $i--;
61  $j--;
62 }
63 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
64  $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
65 }
66 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
67  $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
68 }
69 // Try main.inc.php using relative path
70 if (!$res && file_exists("../main.inc.php")) {
71  $res = @include "../main.inc.php";
72 }
73 if (!$res && file_exists("../../main.inc.php")) {
74  $res = @include "../../main.inc.php";
75 }
76 if (!$res && file_exists("../../../main.inc.php")) {
77  $res = @include "../../../main.inc.php";
78 }
79 if (!$res) {
80  die("Include of main fails");
81 }
82 
83 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
84 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
85 require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
86 require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
87 require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
88 require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
89 require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
90 
91 $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
92 $backtopage = GETPOST('backtopage', 'alpha');
93 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
94 $fk_job = GETPOST('fk_job', 'int');
95 
96 // Get parameters
97 $id = GETPOST('fk_job', 'int');
98 $fk_job = GETPOST('fk_job', 'int');
99 $fk_user = GETPOST('fk_user', 'int');
100 //$start_date = date('Y-m-d', GETPOST('date_startyear', 'int').'-'.GETPOST('date_startmonth', 'int').'-'.GETPOST('date_startday', 'int'));
101 $start_date = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
102 
103 $ref = GETPOST('ref', 'alpha');
104 $confirm = GETPOST('confirm', 'alpha');
105 $cancel = GETPOST('cancel', 'aZ09');
106 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positioncard'; // To manage different context of search
107 
108 // Initialize technical objects
109 $object = new Job($db);
110 
111 $extrafields = new ExtraFields($db);
112 
113 $diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
114 $hookmanager->initHooks(array('positiontab', 'globalcard')); // Note that conf->hooks_modules contains array
115 
116 // Fetch optionals attributes and labels
117 $extrafields->fetch_name_optionals_label($object->table_element);
118 
119 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
120 
121 // Initialize array of search criterias
122 $search_all = GETPOST("search_all", 'alpha');
123 $search = array();
124 foreach ($object->fields as $key => $val) {
125  if (GETPOST('search_' . $key, 'alpha')) {
126  $search[$key] = GETPOST('search_' . $key, 'alpha');
127  }
128 }
129 
130 // Load object
131 include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
132 
133 $permissiontoread = $user->rights->hrm->all->read;
134 $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
135 $permissiontodelete = $user->rights->hrm->all->delete;
136 $upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position';
137 
138 // Security check (enable the most restrictive one)
139 //if ($user->socid > 0) accessforbidden();
140 //if ($user->socid > 0) $socid = $user->socid;
141 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
142 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
143 if (empty($conf->hrm->enabled)) accessforbidden();
144 if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
145 
146 
147 /*
148  * Actions
149  */
150 
151 $parameters = array();
152 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
153 if ($reshook < 0) {
154  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
155 }
156 
157 if (empty($reshook)) {
158  $error = 0;
159 
160  $backurlforlist = dol_buildpath('/hrm/position_list.php', 1);
161  //$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__');
162 
163  if (empty($backtopage) || ($cancel && $fk_job <= 0)) {
164  if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
165  if ($fk_job == -1 && (($action != 'add' && $action != 'create') || $cancel)) {
166  $backtopage = $backurlforlist;
167  } else {
168  if ($fk_job > 0) {
169  $backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__');
170  } else {
171  $backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=__ID__';
172  }
173  }
174  }
175  }
176 
177  $triggermodname = 'hrm_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record
178 
179  // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
180  $job = $object;
181  $object = new Position($db);
182  include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
183 }
184 
185 // Load translation files required by the page
186 $langs->loadLangs(array("hrm", "other", 'products'));
187 
188 $title = $langs->trans("Position");
189 $help_url = '';
190 llxHeader('', $title, $help_url);
191 
192 if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
193  DisplayJob($job);
195 }
196 
197 
205 function DisplayJob($object)
206 {
207  global $conf, $langs, $db, $extrafields, $hookmanager, $action, $backtopage, $backtopageforcancel, $permissiontoadd;
208 
209  /*
210  * View
211  *
212  * Put here all code to build page
213  */
214 
215  $form = new Form($db);
216  $formfile = new FormFile($db);
217  $formproject = new FormProjets($db);
218 
219  if ($backtopage) {
220  print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
221  }
222  if ($backtopageforcancel) {
223  print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
224  }
225 
226  // Part to show record
227 
228  $res = $object->fetch_optionals();
229 
230  $head = jobPrepareHead($object);
231  print dol_get_fiche_head($head, 'position', $langs->trans("Workstation"), -1, $object->picto);
232 
233  // Object card
234  // ------------------------------------------------------------
235  $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>';
236 
237  $morehtmlref = '<div class="refid">';
238  $morehtmlref.= $object->label;
239  $morehtmlref .= '</div>';
240 
241  dol_banner_tab($object, 'fk_job', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
242 
243 
244  print '<div class="fichecenter">';
245  print '<div class="fichehalfleft">';
246  print '<div class="underbanner clearboth"></div>';
247  print '<table class="border centpercent tableforfield">' . "\n";
248 
249  // Common attributes
250  //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
251  //unset($object->fields['fk_project']); // Hide field already shown in banner
252  //unset($object->fields['fk_soc']); // Hide field already shown in banner
253  $object->fields['label']['visible']=0; // Already in banner
254  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
255 
256  // Other attributes. Fields from hook formObjectOptions and Extrafields.
257  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
258 
259  print '</table>';
260  print '</div>';
261  print '</div>';
262 
263  print '<div class="clearboth"></div>';
264 
265  print dol_get_fiche_end();
266 }
267 
268 
275 {
276  global $user, $langs, $db, $conf, $extrafields, $hookmanager, $permissiontoadd, $permissiontodelete;
277 
278  require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
279  require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
280  require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
281 
282  // load hrm libraries
283  require_once __DIR__ . '/class/position.class.php';
284 
285  // for other modules
286  //dol_include_once('/othermodule/class/otherobject.class.php');
287 
288  $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
289  $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
290  $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
291  $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
292  $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
293  $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
294  $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positionlist'; // To manage different context of search
295  $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
296  $id = GETPOST('id', 'int');
297  $fk_job = GETPOST('fk_job', 'int');
298 
299  // Load variable for pagination
300  $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
301  $sortfield = GETPOST('sortfield', 'aZ09comma');
302  $sortorder = GETPOST('sortorder', 'aZ09comma');
303  $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
304  if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
305  // If $page is not defined, or '' or -1 or if we click on clear filters
306  $page = 0;
307  }
308  $offset = $limit * $page;
309  $pageprev = $page - 1;
310  $pagenext = $page + 1;
311 
312  // Initialize technical objects
313  $object = new Position($db);
314 
315  $extrafields = new ExtraFields($db);
316  $diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
317  $hookmanager->initHooks(array('positiontablist')); // Note that conf->hooks_modules contains array
318 
319  // Fetch optionals attributes and labels
320  $extrafields->fetch_name_optionals_label($object->table_element);
321  //$extrafields->fetch_name_optionals_label($object->table_element_line);
322 
323  $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
324 
325  // Default sort order (if not yet defined by previous GETPOST)
326  if (!$sortfield) {
327  reset($object->fields); // Reset is required to avoid key() to return null.
328  $sortfield = "t." . key($object->fields); // Set here default search field. By default 1st field in definition.
329  }
330  if (!$sortorder) {
331  $sortorder = "ASC";
332  }
333 
334  // Initialize array of search criterias
335  $search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
336  $search = array();
337  foreach ($object->fields as $key => $val) {
338  if (GETPOST('search_' . $key, 'alpha') !== '') {
339  $search[$key] = GETPOST('search_' . $key, 'alpha');
340  }
341  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
342  $search[$key . '_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_' . $key . '_dtstartmonth', 'int'), GETPOST('search_' . $key . '_dtstartday', 'int'), GETPOST('search_' . $key . '_dtstartyear', 'int'));
343  $search[$key . '_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_' . $key . '_dtendmonth', 'int'), GETPOST('search_' . $key . '_dtendday', 'int'), GETPOST('search_' . $key . '_dtendyear', 'int'));
344  }
345  }
346 
347  // List of fields to search into when doing a "search in all"
348  $fieldstosearchall = array();
349  foreach ($object->fields as $key => $val) {
350  if (!empty($val['searchall'])) {
351  $fieldstosearchall['t.' . $key] = $val['label'];
352  }
353  }
354 
355  // Definition of array of fields for columns
356  $arrayfields = array();
357  foreach ($object->fields as $key => $val) {
358  // If $val['visible']==0, then we never show the field
359  if (!empty($val['visible'])) {
360  $visible = (int) dol_eval($val['visible'], 1, 1, '1');
361  $arrayfields['t.' . $key] = array(
362  'label' => $val['label'],
363  'checked' => (($visible < 0) ? 0 : 1),
364  'enabled' => ($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
365  'position' => $val['position'],
366  'help' => isset($val['help']) ? $val['help'] : ''
367  );
368  }
369  }
370  // Extra fields
371  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
372 
373  $object->fields = dol_sort_array($object->fields, 'position');
374  $arrayfields = dol_sort_array($arrayfields, 'position');
375 
376  // Security check
377  if (empty($conf->hrm->enabled)) {
378  accessforbidden('Module not enabled');
379  }
380 
381  // Security check (enable the most restrictive one)
382  if ($user->socid > 0) accessforbidden();
383  //if ($user->socid > 0) accessforbidden();
384  //$socid = 0; if ($user->socid > 0) $socid = $user->socid;
385  //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
386  //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
387  //if (empty($conf->hrm->enabled)) accessforbidden();
388  //if (!$permissiontoread) accessforbidden();
389 
390 
391  /*
392  * Actions
393  */
394 
395  if (GETPOST('cancel', 'alpha')) {
396  $action = 'list';
397  $massaction = '';
398  }
399  if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
400  $massaction = '';
401  }
402 
403  $parameters = array();
404  $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
405  if ($reshook < 0) {
406  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
407  }
408 
409  if (empty($reshook)) {
410  // Selection of new fields
411  include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
412 
413  // Purge search criteria
414  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
415  foreach ($object->fields as $key => $val) {
416  $search[$key] = '';
417  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
418  $search[$key . '_dtstart'] = '';
419  $search[$key . '_dtend'] = '';
420  }
421  }
422  $toselect = array();
423  $search_array_options = array();
424  }
425  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
426  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
427  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
428  }
429 
430  // Mass actions
431  $objectclass = 'Position';
432  $objectlabel = 'Position';
433  $uploaddir = $conf->hrm->dir_output;
434  include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php';
435  }
436 
437 
438  /*
439  * View
440  */
441 
442  $form = new Form($db);
443 
444  $now = dol_now();
445 
446  //$help_url="EN:Module_Position|FR:Module_Position_FR|ES:MĂ³dulo_Position";
447  $help_url = '';
448  $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Positions"));
449  $morejs = array();
450  $morecss = array();
451 
452 
453  // Build and execute select
454  // --------------------------------------------------------------------
455  $sql = 'SELECT ';
456  $sql .= $object->getFieldList('t');
457  // Add fields from extrafields
458  if (!empty($extrafields->attributes[$object->table_element]['label'])) {
459  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
460  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef." . $key . " as options_" . $key . ', ' : '');
461  }
462  }
463  // Add fields from hooks
464  $parameters = array();
465  $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
466  $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
467  $sql = preg_replace('/,\s*$/', '', $sql);
468  $sql .= " FROM " . MAIN_DB_PREFIX . $object->table_element . " as t";
469  if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
470  $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object->table_element . "_extrafields as ef on (t.rowid = ef.fk_object)";
471  }
472  // Add table from hooks
473  $parameters = array();
474  $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
475  $sql .= $hookmanager->resPrint;
476  if ($object->ismultientitymanaged == 1) {
477  $sql .= " WHERE t.entity IN (" . getEntity($object->element) . ")";
478  } else {
479  $sql .= " WHERE 1 = 1";
480  }
481  $sql .= " AND t.fk_job = " . ((int) $fk_job) . " ";
482 
483  foreach ($search as $key => $val) {
484  if (array_key_exists($key, $object->fields)) {
485  if ($key == 'status' && $search[$key] == -1) {
486  continue;
487  }
488  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
489  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
490  if ($search[$key] == '-1' || $search[$key] === '0') {
491  $search[$key] = '';
492  }
493  $mode_search = 2;
494  }
495  if ($search[$key] != '') {
496  $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
497  }
498  } else {
499  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
500  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
501  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
502  if (preg_match('/_dtstart$/', $key)) {
503  $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
504  }
505  if (preg_match('/_dtend$/', $key)) {
506  $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
507  }
508  }
509  }
510  }
511  }
512  if ($search_all) {
513  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
514  }
515  //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
516  // Add where from extra fields
517  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
518  // Add where from hooks
519  $parameters = array();
520  $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
521  $sql .= $hookmanager->resPrint;
522 
523  /* If a group by is required
524  $sql .= " GROUP BY ";
525  foreach($object->fields as $key => $val) {
526  $sql .= "t.".$key.", ";
527  }
528  // Add fields from extrafields
529  if (!empty($extrafields->attributes[$object->table_element]['label'])) {
530  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
531  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
532  }
533  }
534  // Add where from hooks
535  $parameters = array();
536  $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
537  $sql .= $hookmanager->resPrint;
538  $sql = preg_replace('/,\s*$/', '', $sql);
539  */
540 
541  $sql .= $db->order($sortfield, $sortorder);
542 
543  // Count total nb of records
544  $nbtotalofrecords = '';
545  if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
546  $resql = $db->query($sql);
547  $nbtotalofrecords = $db->num_rows($resql);
548  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
549  $page = 0;
550  $offset = 0;
551  }
552  }
553  // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
554  if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
555  $num = $nbtotalofrecords;
556  } else {
557  if ($limit) {
558  $sql .= $db->plimit($limit + 1, $offset);
559  }
560 
561  $resql = $db->query($sql);
562  if (!$resql) {
563  dol_print_error($db);
564  exit;
565  }
566 
567  $num = $db->num_rows($resql);
568  }
569 
570  // Direct jump if only one record found
571  if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
572  $obj = $db->fetch_object($resql);
573  $id = $obj->rowid;
574  header("Location: " . dol_buildpath('/hrm/position.php', 1) . '?id=' . $id);
575  exit;
576  }
577 
578  $arrayofselected = is_array($toselect) ? $toselect : array();
579 
580  $param = 'fk_job=' . $fk_job;
581  if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
582  $param .= '&contextpage=' . urlencode($contextpage);
583  }
584  if ($limit > 0 && $limit != $conf->liste_limit) {
585  $param .= '&limit=' . urlencode($limit);
586  }
587  foreach ($search as $key => $val) {
588  if (is_array($search[$key]) && count($search[$key])) {
589  foreach ($search[$key] as $skey) {
590  $param .= '&search_' . $key . '[]=' . urlencode($skey);
591  }
592  } else {
593  $param .= '&search_' . $key . '=' . urlencode($search[$key]);
594  }
595  }
596  if ($optioncss != '') {
597  $param .= '&optioncss=' . urlencode($optioncss);
598  }
599  // Add $param from extra fields
600  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
601  // Add $param from hooks
602  $parameters = array();
603  $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
604  $param .= $hookmanager->resPrint;
605 
606  // List of mass actions available
607  $arrayofmassactions = array(
608  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
609  //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
610  //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
611  //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
612  );
613  if ($permissiontodelete) {
614  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"') . $langs->trans("Delete");
615  }
616  if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
617  $arrayofmassactions = array();
618  }
619  $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
620 
621  print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '?fk_job=' . $fk_job . '">' . "\n";
622  if ($optioncss != '') {
623  print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
624  }
625  print '<input type="hidden" name="token" value="' . newToken() . '">';
626  print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
627  print '<input type="hidden" name="action" value="list">';
628  print '<input type="hidden" name="massaction" value="' . $massaction . '">';
629  print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
630  print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
631  print '<input type="hidden" name="page" value="' . $page . '">';
632  print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
633 
634  $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);
635 
636  print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
637 
638  // Add code for pre mass action (confirmation or email presend form)
639  $topicmail = "SendPositionRef";
640  $modelmail = "position";
641  $objecttmp = new Position($db);
642  $trackid = 'xxxx' . $object->id;
643  include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
644 
645  if ($search_all) {
646  foreach ($fieldstosearchall as $key => $val) {
647  $fieldstosearchall[$key] = $langs->trans($val);
648  }
649  print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall) . '</div>';
650  }
651 
652  $moreforfilter = '';
653  /*$moreforfilter.='<div class="divsearchfield">';
654  $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
655  $moreforfilter.= '</div>';*/
656 
657  $parameters = array();
658  $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
659  if (empty($reshook)) {
660  $moreforfilter .= $hookmanager->resPrint;
661  } else {
662  $moreforfilter = $hookmanager->resPrint;
663  }
664 
665  if (!empty($moreforfilter)) {
666  print '<div class="liste_titre liste_titre_bydiv centpercent">';
667  print $moreforfilter;
668  print '</div>';
669  }
670 
671  $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
672  $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
673  $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
674 
675  print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
676  print '<table class="tagtable nobottomiftotal liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
677 
678 
679  // Fields title search
680  // --------------------------------------------------------------------
681  print '<tr class="liste_titre">';
682  foreach ($object->fields as $key => $val) {
683  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
684  if ($key == 'status') {
685  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
686  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
687  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
688  } elseif (in_array($val['type'], array('timestamp'))) {
689  $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
690  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
691  $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
692  }
693  if (!empty($arrayfields['t.' . $key]['checked'])) {
694  print '<td class="liste_titre' . ($cssforfield ? ' ' . $cssforfield : '') . '">';
695  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
696  print $form->selectarray('search_' . $key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
697  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
698  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
699  } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
700  print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '') . '">';
701  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
702  print '<div class="nowrap">';
703  print $form->selectDate($search[$key . '_dtstart'] ? $search[$key . '_dtstart'] : '', "search_" . $key . "_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
704  print '</div>';
705  print '<div class="nowrap">';
706  print $form->selectDate($search[$key . '_dtend'] ? $search[$key . '_dtend'] : '', "search_" . $key . "_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
707  print '</div>';
708  }
709  print '</td>';
710  }
711  }
712  // Extra fields
713  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
714 
715  // Fields from hook
716  $parameters = array('arrayfields' => $arrayfields);
717  $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
718  print $hookmanager->resPrint;
719  // Action column
720  print '<td class="liste_titre maxwidthsearch">';
721  $searchpicto = $form->showFilterButtons();
722  print $searchpicto;
723  print '</td>';
724  print '</tr>' . "\n";
725 
726 
727  // Fields title label
728  // --------------------------------------------------------------------
729  print '<tr class="liste_titre">';
730  foreach ($object->fields as $key => $val) {
731  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
732  if ($key == 'status') {
733  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
734  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
735  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
736  } elseif (in_array($val['type'], array('timestamp'))) {
737  $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
738  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
739  $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
740  }
741  if (!empty($arrayfields['t.' . $key]['checked'])) {
742  print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n";
743  }
744  }
745  // Extra fields
746  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
747  // Hook fields
748  $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
749  $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
750  print $hookmanager->resPrint;
751  // Action column
752  print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ') . "\n";
753  print '</tr>' . "\n";
754 
755  // Detect if we need a fetch on each output line
756  $needToFetchEachLine = 0;
757  if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
758  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
759  if (preg_match('/\$object/', $val)) {
760  $needToFetchEachLine++; // There is at least one compute field that use $object
761  }
762  }
763  }
764 
765 
766  // Loop on record
767  // --------------------------------------------------------------------
768  $i = 0;
769  $totalarray = array();
770  $totalarray['nbfield'] = 0;
771  while ($i < ($limit ? min($num, $limit) : $num)) {
772  $obj = $db->fetch_object($resql);
773  if (empty($obj)) {
774  break; // Should not happen
775  }
776 
777  // Store properties in $object
778  $object->setVarsFromFetchObj($obj);
779 
780  // Show here line of result
781  print '<tr class="oddeven">';
782  foreach ($object->fields as $key => $val) {
783  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
784  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
785  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
786  } elseif ($key == 'status') {
787  $cssforfield .= ($cssforfield ? ' ' : '') . 'center';
788  }
789 
790  if (in_array($val['type'], array('timestamp'))) {
791  $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
792  } elseif ($key == 'ref') {
793  $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap';
794  }
795 
796  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
797  $cssforfield .= ($cssforfield ? ' ' : '') . 'right';
798  }
799  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
800 
801  if (!empty($arrayfields['t.' . $key]['checked'])) {
802  print '<td' . ($cssforfield ? ' class="' . $cssforfield . '"' : '') . '>';
803  if ($key == 'status') {
804  print $object->getLibStatut(5);
805  } elseif ($key == 'rowid') {
806  print $object->getNomUrl(1);
807  } else {
808  print $object->showOutputField($val, $key, $object->$key, '');
809  }
810  print '</td>';
811  if (!$i) {
812  $totalarray['nbfield']++;
813  }
814  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
815  if (!$i) {
816  $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key;
817  }
818  if (!isset($totalarray['val'])) {
819  $totalarray['val'] = array();
820  }
821  if (!isset($totalarray['val']['t.' . $key])) {
822  $totalarray['val']['t.' . $key] = 0;
823  }
824  $totalarray['val']['t.' . $key] += $object->$key;
825  }
826  }
827  }
828  // Extra fields
829  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
830  // Fields from hook
831  $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
832  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
833  print $hookmanager->resPrint;
834  // Action column
835  print '<td class="nowrap center">';
836  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
837  $selected = 0;
838  if (in_array($object->id, $arrayofselected)) {
839  $selected = 1;
840  }
841  print '<input id="cb' . $object->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $object->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
842  }
843  print '</td>';
844  if (!$i) {
845  $totalarray['nbfield']++;
846  }
847 
848  print '</tr>' . "\n";
849 
850  $i++;
851  }
852 
853  // Show total line
854  include DOL_DOCUMENT_ROOT . '/core/tpl/list_print_total.tpl.php';
855 
856  // If no record found
857  if ($num == 0) {
858  $colspan = 1;
859  foreach ($arrayfields as $key => $val) {
860  if (!empty($val['checked'])) {
861  $colspan++;
862  }
863  }
864  print '<tr><td colspan="' . $colspan . '" class="opacitymedium">' . $langs->trans("NoRecordFound") . '</td></tr>';
865  }
866 
867 
868  $db->free($resql);
869 
870  $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
871  $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
872  print $hookmanager->resPrint;
873 
874  print '</table>' . "\n";
875  print '</div>' . "\n";
876 
877  print '</form>' . "\n";
878 
879  if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
880  $hidegeneratedfilelistifempty = 1;
881  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
882  $hidegeneratedfilelistifempty = 0;
883  }
884 
885  require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
886  $formfile = new FormFile($db);
887 
888  // Show list of available documents
889  $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
890  $urlsource .= str_replace('&amp;', '&', $param);
891 
892  $filedir = $diroutputmassaction;
893  $genallowed = $permissiontoread;
894  $delallowed = $permissiontoadd;
895 
896  print $formfile->showdocuments('massfilesarea_hrm', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
897  }
898 }
899 
900 // Part to create
901 if ($action == 'create') {
902  $object = new Position($db);
903  print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto);
904 
905  print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
906  print '<input type="hidden" name="token" value="' . newToken() . '">';
907  print '<input type="hidden" name="action" value="add">';
908  if ($backtopage) {
909  print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
910  }
911 
912  if ($backtopageforcancel) {
913  print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
914  }
915 
916  print dol_get_fiche_head(array(), '');
917 
918  print '<table class="border centpercent tableforfieldcreate">' . "\n";
919 
920  // Common attributes
921  include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
922 
923  // Other attributes
924  include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
925 
926  print '</table>' . "\n";
927 
928  print dol_get_fiche_end();
929 
930  print '<div class="center">';
931 
932  print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">';
933  print '&nbsp; ';
934  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
935  print '</div>';
936 
937  print '</form>';
938 
939  //dol_set_focus('input[name="ref"]');
940 }
941 
942 // End of page
943 llxFooter();
944 $db->close();
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
getTitleFieldOfList
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
Definition: functions.lib.php:5049
jobPrepareHead
jobPrepareHead($object)
Prepare array of tabs for Job.
Definition: hrm_job.lib.php:33
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
dol_sort_array
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
Definition: functions.lib.php:8385
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
FormProjets
Class to manage building of HTML components.
Definition: html.formprojet.class.php:30
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
DisplayPositionList
DisplayPositionList()
Show a list of positions for the current job.
Definition: position.php:274
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2046
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
DisplayJob
if($job->id > 0 &&(empty($action)||($action !='edit' && $action !='create'))) DisplayJob($object)
Show the top of the page including informations of a job.
Definition: position.php:205
FormFile
Class to offer components to list and upload files.
Definition: html.formfile.class.php:36
getEntity
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
Definition: functions.lib.php:148
Position
Class for Position.
Definition: position.class.php:36
dolGetButtonTitle
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Definition: functions.lib.php:10605
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5257
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
natural_search
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
Definition: functions.lib.php:9420
dol_eval
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
Definition: functions.lib.php:8611
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
Job
Class for Job.
Definition: job.class.php:36
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2757
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59