dolibarr  17.0.4
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005-2021 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
6  * Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
7  * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
28 // Load Dolibarr environment
29 require '../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34 
35 // Defini si peux lire/modifier utilisateurs et permisssions
36 $canreadperms = ($user->admin || $user->hasRight("user", "user", "read"));
37 $caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
38 $candisableperms = ($user->admin || $user->hasRight("user", "user", "delete"));
39 $feature2 = 'user';
40 
41 // Advanced permissions
42 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
43  $canreadperms = ($user->admin || $user->hasRight("user", "group_advance", "read"));
44  $caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
45  $candisableperms = ($user->admin || $user->hasRight("user", "group_advance", "delete"));
46  $feature2 = 'group_advance';
47 }
48 
49 // Load translation files required by page
50 $langs->loadLangs(array('users', 'other'));
51 
52 $id = GETPOST('id', 'int');
53 $action = GETPOST('action', 'aZ09');
54 $cancel = GETPOST('cancel', 'aZ09');
55 $confirm = GETPOST('confirm', 'alpha');
56 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search
57 $backtopage = GETPOST('backtopage', 'alpha');
58 
59 $userid = GETPOST('user', 'int');
60 
61 $object = new Usergroup($db);
62 $extrafields = new ExtraFields($db);
63 // fetch optionals attributes and labels
64 $extrafields->fetch_name_optionals_label($object->table_element);
65 
66 // Load object
67 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
68 $object->getrights();
69 
70 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
71 $hookmanager->initHooks(array('groupcard', 'globalcard'));
72 
73 // Security check
74 $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2);
75 
76 // Users/Groups management only in master entity if transverse mode
77 if (isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
79 }
80 
81 
86 $parameters = array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms);
87 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
88 if ($reshook < 0) {
89  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
90 }
91 
92 if (empty($reshook)) {
93  $backurlforlist = DOL_URL_ROOT.'/user/group/list.php';
94 
95  if (empty($backtopage) || ($cancel && empty($id))) {
96  if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
97  if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
98  $backtopage = $backurlforlist;
99  } else {
100  $backtopage = DOL_URL_ROOT.'/user/group/card.php?id='.($id > 0 ? $id : '__ID__');
101  }
102  }
103  }
104 
105  if ($cancel) {
106  header("Location: ".$backtopage);
107  exit;
108  }
109 
110  // Action remove group
111  if ($action == 'confirm_delete' && $confirm == "yes") {
112  if ($caneditperms) {
113  $object->fetch($id);
114  $object->delete($user);
115  header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1");
116  exit;
117  } else {
118  $langs->load("errors");
119  setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
120  }
121  }
122 
123  // Action add group
124  if ($action == 'add') {
125  if ($caneditperms) {
126  if (!GETPOST("nom", "alphanohtml")) {
127  setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
128  $action = "create"; // Go back to create page
129  } else {
130  $object->name = GETPOST("nom", 'alphanohtml');
131  $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml')));
132 
133  // Fill array 'array_options' with data from add form
134  $ret = $extrafields->setOptionalsFromPost(null, $object);
135  if ($ret < 0) {
136  $error++;
137  }
138 
139  if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
140  $object->entity = 0;
141  } else {
142  if ($conf->entity == 1 && $user->admin && !$user->entity) { // Same permissions test than the one used to show the combo of entities into the form
143  $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity;
144  } else {
145  $object->entity = $conf->entity;
146  }
147  }
148 
149  $db->begin();
150 
151  $id = $object->create();
152 
153  if ($id > 0) {
154  $db->commit();
155 
156  header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
157  exit;
158  } else {
159  $db->rollback();
160 
161  $langs->load("errors");
162  setEventMessages($langs->trans("ErrorGroupAlreadyExists", $object->name), null, 'errors');
163  $action = "create"; // Go back to create page
164  }
165  }
166  } else {
167  $langs->load("errors");
168  setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
169  }
170  }
171 
172  // Add/Remove user into group
173  if ($action == 'adduser' || $action == 'removeuser') {
174  if ($caneditperms) {
175  if ($userid > 0) {
176  $object->fetch($id);
177  $object->oldcopy = clone $object;
178 
179  $edituser = new User($db);
180  $edituser->fetch($userid);
181  if ($action == 'adduser') {
182  $result = $edituser->SetInGroup($object->id, $object->entity);
183  }
184  if ($action == 'removeuser') {
185  $result = $edituser->RemoveFromGroup($object->id, $object->entity);
186  }
187 
188  if ($result > 0) {
189  header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
190  exit;
191  } else {
192  setEventMessages($edituser->error, $edituser->errors, 'errors');
193  }
194  }
195  } else {
196  $langs->load("errors");
197  setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
198  }
199  }
200 
201 
202  if ($action == 'update') {
203  if ($caneditperms) {
204  $db->begin();
205 
206  $object->fetch($id);
207 
208  $object->oldcopy = clone $object;
209 
210  $object->name = GETPOST("nom", 'alphanohtml');
211  $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'restricthtml')));
212 
213  // Fill array 'array_options' with data from add form
214  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
215  if ($ret < 0) {
216  $error++;
217  }
218 
219  if (isModEnabled('multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
220  $object->entity = 0;
221  } elseif (GETPOSTISSET("entity")) {
222  $object->entity = GETPOST("entity", "int");
223  }
224 
225  $ret = $object->update();
226 
227  if ($ret >= 0 && !count($object->errors)) {
228  setEventMessages($langs->trans("GroupModified"), null, 'mesgs');
229  $db->commit();
230  } else {
231  setEventMessages($object->error, $object->errors, 'errors');
232  $db->rollback();
233  }
234  } else {
235  $langs->load("errors");
236  setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs');
237  }
238  }
239 
240  // Actions to build doc
241  $upload_dir = $conf->user->dir_output.'/usergroups';
242  $permissiontoadd = $user->hasRight("user", "user", "write");
243  include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
244 }
245 
246 
247 /*
248  * View
249  */
250 $title = $object->name.' - '.$langs->trans("Card");
251 if ($action == 'create') {
252  $title = $langs->trans("NewGroup");
253 }
254 $help_url = "";
255 llxHeader('', $title, $help_url);
256 
257 
258 $form = new Form($db);
259 $fuserstatic = new User($db);
260 $form = new Form($db);
261 $formfile = new FormFile($db);
262 
263 if ($action == 'create') {
264  print load_fiche_titre($langs->trans("NewGroup"), '', 'object_group');
265 
266  dol_set_focus('#nom');
267 
268  print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
269  print '<input type="hidden" name="token" value="'.newToken().'">';
270  print '<input type="hidden" name="action" value="add">';
271  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
272 
273  print dol_get_fiche_head('', '', '', 0, '');
274 
275  print '<table class="border centpercent tableforfieldcreate">';
276 
277  // Multicompany
278  if (isModEnabled('multicompany') && is_object($mc)) {
279  if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
280  print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
281  print "<td>".$mc->select_entities($conf->entity);
282  print "</td></tr>\n";
283  } else {
284  print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
285  }
286  }
287 
288  // Common attributes
289  include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
290 
291  // Other attributes
292  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
293 
294  print "</table>\n";
295 
296  print dol_get_fiche_end();
297 
298  print '<div class="center">';
299  print '<input class="button" name="add" value="'.$langs->trans("CreateGroup").'" type="submit">';
300  print ' &nbsp; ';
301  print '<input class="button button-cancel" value="'.$langs->trans("Cancel").'" name="cancel" type="submit">';
302  print '</div>';
303 
304  print "</form>";
305 } else {
306  /* ************************************************************************** */
307  /* */
308  /* Visu et edition */
309  /* */
310  /* ************************************************************************** */
311  if ($id) {
312  $res = $object->fetch_optionals();
313 
314  $head = group_prepare_head($object);
315  $title = $langs->trans("Group");
316 
317  /*
318  * Confirmation suppression
319  */
320  if ($action == 'delete') {
321  print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id, $langs->trans("DeleteAGroup"), $langs->trans("ConfirmDeleteGroup", $object->name), "confirm_delete", '', 0, 1);
322  }
323 
324  /*
325  * Fiche en mode visu
326  */
327 
328  if ($action != 'edit') {
329  print dol_get_fiche_head($head, 'group', $title, -1, 'group');
330 
331  $linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
332 
333  dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
334 
335  print '<div class="fichecenter">';
336  print '<div class="fichehalfleft">';
337  print '<div class="underbanner clearboth"></div>';
338 
339  print '<table class="border centpercent tableforfield">';
340 
341  // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
342  if (!empty($conf->mutlicompany->enabled)) {
343  print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
344  print '<td class="valeur">'.dol_escape_htmltag($object->name);
345  if (empty($object->entity)) {
346  print img_picto($langs->trans("GlobalGroup"), 'redstar');
347  }
348  print "</td></tr>\n";
349  }
350 
351  // Multicompany
352  if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
353  $mc->getInfo($object->entity);
354  print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
355  print '<td class="valeur">'.dol_escape_htmltag($mc->label);
356  print "</td></tr>\n";
357  }
358 
359  unset($object->fields['nom']); // Name already displayed in banner
360 
361  // Common attributes
362  $keyforbreak = '';
363  include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
364 
365  // Other attributes
366  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
367 
368  print '</table>';
369  print '</div>';
370  print '</div>';
371 
372  print '<div class="clearboth"></div>';
373 
374  print dol_get_fiche_end();
375 
376 
377  /*
378  * Action bar
379  */
380  print '<div class="tabsAction">';
381 
382  $parameters = array();
383  $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
384  if ($reshook < 0) {
385  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
386  }
387 
388  if ($caneditperms) {
389  print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
390  }
391 
392  if ($candisableperms) {
393  print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("DeleteGroup").'</a>';
394  }
395 
396  print "</div>\n";
397 
398  // List users in group
399 
400  print load_fiche_titre($langs->trans("ListOfUsersInGroup"), '', 'user');
401 
402  // On selectionne les users qui ne sont pas deja dans le groupe
403  $exclude = array();
404 
405  if (!empty($object->members)) {
406  foreach ($object->members as $useringroup) {
407  $exclude[] = $useringroup->id;
408  }
409  }
410 
411  // Other form for add user to group
412  $parameters = array('caneditperms' => $caneditperms, 'exclude' => $exclude);
413  $reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
414  print $hookmanager->resPrint;
415 
416  if (empty($reshook)) {
417  if ($caneditperms) {
418  print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
419  print '<input type="hidden" name="token" value="'.newToken().'">';
420  print '<input type="hidden" name="action" value="adduser">';
421  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
422  print '<table class="noborder centpercent">'."\n";
423  print '<tr class="liste_titre"><td class="titlefield liste_titre">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
424  print '<td class="liste_titre">';
425  print $form->select_dolusers('', 'user', 1, $exclude, 0, '', '', $object->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500');
426  print ' &nbsp; ';
427  print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
428  print '<input type="submit" class="button buttongen button-add" value="'.$langs->trans("Add").'">';
429  print '</td></tr>'."\n";
430  print '</table>';
431  print '</div>';
432  print '</form>'."\n";
433  //print '<br>';
434  }
435 
436  /*
437  * Group members
438  */
439 
440  print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
441  print '<table class="noborder centpercent">';
442  print '<tr class="liste_titre">';
443  print '<td class="liste_titre">'.$langs->trans("Login").'</td>';
444  print '<td class="liste_titre">'.$langs->trans("Lastname").'</td>';
445  print '<td class="liste_titre">'.$langs->trans("Firstname").'</td>';
446  print '<td class="liste_titre center" width="5">'.$langs->trans("Status").'</td>';
447  print '<td class="liste_titre right" width="5">&nbsp;</td>';
448  print "</tr>\n";
449 
450  if (!empty($object->members)) {
451  foreach ($object->members as $useringroup) {
452  print '<tr class="oddeven">';
453  print '<td class="tdoverflowmax150">';
454  print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login');
455  if (isModEnabled('multicompany') && $useringroup->admin && empty($useringroup->entity)) {
456  print img_picto($langs->trans("SuperAdministrator"), 'redstar');
457  } elseif ($useringroup->admin) {
458  print img_picto($langs->trans("Administrator"), 'star');
459  }
460  print '</td>';
461  print '<td>'.$useringroup->lastname.'</td>';
462  print '<td>'.$useringroup->firstname.'</td>';
463  print '<td class="center">'.$useringroup->getLibStatut(5).'</td>';
464  print '<td class="right">';
465  if (!empty($user->admin)) {
466  print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&token='.newToken().'&user='.$useringroup->id.'">';
467  print img_picto($langs->trans("RemoveFromGroup"), 'unlink');
468  print '</a>';
469  } else {
470  print "-";
471  }
472  print "</td></tr>\n";
473  }
474  } else {
475  print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
476  }
477  print "</table>";
478  print '</div>';
479  }
480 
481  print "<br>";
482 
483  print '<div class="fichecenter"><div class="fichehalfleft">';
484 
485  /*
486  * Generated documents
487  */
488 
489  $filename = dol_sanitizeFileName($object->ref);
490  $filedir = $conf->user->dir_output."/usergroups/".dol_sanitizeFileName($object->ref);
491  $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
492  $genallowed = $user->hasRight("user", "user", "write");
493  $delallowed = $user->hasRight("user", "user", "delete");
494 
495  $somethingshown = $formfile->showdocuments('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $mysoc->default_lang);
496 
497  // Show links to link elements
498  $linktoelem = $form->showLinkToObjectBlock($object, null, null);
499  $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
500 
501  print '</div><div class="fichehalfright">';
502 
503  // List of actions on element
504  /*include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
505  $formactions = new FormActions($db);
506  $somethingshown = $formactions->showactions($object, 'usergroup', $socid, 1);*/
507 
508  print '</div></div>';
509  }
510 
511  /*
512  * Fiche en mode edition
513  */
514 
515  if ($action == 'edit' && $caneditperms) {
516  print '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="updategroup" enctype="multipart/form-data">';
517  print '<input type="hidden" name="token" value="'.newToken().'">';
518  print '<input type="hidden" name="action" value="update">';
519  print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
520  print '<input type="hidden" name="id" value="'.$object->id.'">';
521 
522  print dol_get_fiche_head($head, 'group', $title, 0, 'group');
523 
524  print '<table class="border centpercent tableforfieldedit">'."\n";
525 
526  // Multicompany
527  if (isModEnabled('multicompany') && is_object($mc)) {
528  if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
529  print "<tr>".'<td class="tdtop">'.$langs->trans("Entity").'</td>';
530  print "<td>".$mc->select_entities($object->entity);
531  print "</td></tr>\n";
532  } else {
533  print '<input type="hidden" name="entity" value="'.$conf->entity.'" />';
534  }
535  }
536 
537  // Common attributes
538  include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
539 
540  // Other attributes
541  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
542 
543  print '</table>';
544 
545  print dol_get_fiche_end();
546 
547  print $form->buttonsSaveCancel();
548 
549  print '</form>';
550  }
551  }
552 }
553 
554 // End of page
555 llxFooter();
556 $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 Dolibarr users.
Definition: user.class.php:47
$parameters
Actions.
Definition: card.php:79
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.
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_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
group_prepare_head($object)
Prepare array with list of tabs.