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