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