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