dolibarr  18.0.0-beta
perms.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
6  * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
7  * Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
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 if (!defined('CSRFCHECK_WITH_TOKEN')) {
29  define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
30 }
31 
32 // Load Dolibarr environment
33 require '../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
38 
39 // Load translation files required by page
40 $langs->loadLangs(array('users', 'admin'));
41 
42 $id = GETPOST('id', 'int');
43 $action = GETPOST('action', 'aZ09');
44 $confirm = GETPOST('confirm', 'alpha');
45 $module = GETPOST('module', 'alpha');
46 $rights = GETPOST('rights', 'int');
47 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupperms'; // To manage different context of search
48 
49 if (!isset($id) || empty($id)) {
51 }
52 
53 // Define if user can read permissions
54 $canreadperms = ($user->admin || $user->hasRight("user", "user", "read"));
55 // Define if user can modify group permissions
56 $caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
57 // Advanced permissions
58 $advancedpermsactive = false;
59 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
60  $advancedpermsactive = true;
61  $canreadperms = ($user->admin || ($user->hasRight("user", "group_advance", "read") && $user->hasRight("user", "group_advance", "readperms")));
62  $caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
63 }
64 
65 // Security check
66 //$result = restrictedArea($user, 'user', $id, 'usergroup', '');
67 if (!$canreadperms) {
69 }
70 
71 $object = new Usergroup($db);
72 $object->fetch($id);
73 $object->getrights();
74 
75 $entity = $conf->entity;
76 
77 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
78 $hookmanager->initHooks(array('groupperms', 'globalcard'));
79 
80 
85 $parameters = array();
86 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
87 if ($reshook < 0) {
88  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
89 }
90 
91 if (empty($reshook)) {
92  if ($action == 'addrights' && $caneditperms) {
93  $editgroup = new Usergroup($db);
94  $result = $editgroup->fetch($object->id);
95  if ($result > 0) {
96  $result = $editgroup->addrights($rights, $module, '', $entity);
97  if ($result < 0) {
98  setEventMessages($editgroup->error, $editgroup->errors, 'errors');
99  }
100  } else {
101  dol_print_error($db);
102  }
103 
104  $user->clearrights();
105  $user->getrights();
106  }
107 
108  if ($action == 'delrights' && $caneditperms) {
109  $editgroup = new Usergroup($db);
110  $result = $editgroup->fetch($id);
111  if ($result > 0) {
112  $result = $editgroup->delrights($rights, $module, '', $entity);
113  if ($result < 0) {
114  setEventMessages($editgroup->error, $editgroup->errors, 'errors');
115  }
116  } else {
117  dol_print_error($db);
118  }
119 
120  $user->clearrights();
121  $user->getrights();
122  }
123 }
124 
125 
126 /*
127  * View
128  */
129 
130 $form = new Form($db);
131 
132 $title = $object->name." - ".$langs->trans('Permissions');
133 $help_url = '';
134 llxHeader('', $title, $help_url);
135 
136 if ($object->id > 0) {
137  $head = group_prepare_head($object);
138  $title = $langs->trans("Group");
139  print dol_get_fiche_head($head, 'rights', $title, -1, 'group');
140 
141  // Charge les modules soumis a permissions
142  $modules = array();
143  $modulesdir = dolGetModulesDirs();
144 
145  $db->begin();
146 
147  foreach ($modulesdir as $dir) {
148  $handle = @opendir(dol_osencode($dir));
149  if (is_resource($handle)) {
150  while (($file = readdir($handle)) !== false) {
151  if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
152  $modName = substr($file, 0, dol_strlen($file) - 10);
153 
154  if ($modName) {
155  include_once $dir.$file;
156  $objMod = new $modName($db);
157  // Load all lang files of module
158  if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
159  foreach ($objMod->langfiles as $domain) {
160  $langs->load($domain);
161  }
162  }
163  // Load all permissions
164  if ($objMod->rights_class) {
165  $ret = $objMod->insert_permissions(0, $entity);
166  $modules[$objMod->rights_class] = $objMod;
167  }
168  }
169  }
170  }
171  }
172  }
173 
174  $db->commit();
175 
176  // Read permissions of group
177  $permsgroupbyentity = array();
178 
179  $sql = "SELECT DISTINCT r.id, r.libelle, r.module, gr.entity";
180  $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
181  $sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr";
182  $sql .= " WHERE gr.fk_id = r.id";
183  $sql .= " AND gr.entity = ".((int) $entity);
184  $sql .= " AND gr.fk_usergroup = ".((int) $object->id);
185 
186  dol_syslog("get user perms", LOG_DEBUG);
187  $result = $db->query($sql);
188  if ($result) {
189  $num = $db->num_rows($result);
190  $i = 0;
191  while ($i < $num) {
192  $obj = $db->fetch_object($result);
193  if (!isset($permsgroupbyentity[$obj->entity])) {
194  $permsgroupbyentity[$obj->entity] = array();
195  }
196  array_push($permsgroupbyentity[$obj->entity], $obj->id);
197  $i++;
198  }
199  $db->free($result);
200  } else {
201  dol_print_error($db);
202  }
203 
204  /*
205  * Part to add/remove permissions
206  */
207 
208  $linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
209 
210  dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
211 
212  print '<div class="fichecenter">';
213  print '<div class="underbanner clearboth"></div>';
214 
215 
216  print '<table class="border centpercent tableforfield">';
217 
218  // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
219  if (!empty($conf->mutlicompany->enabled)) {
220  print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
221  print '<td colspan="2">'.$object->name;
222  if (!$object->entity) {
223  print img_picto($langs->trans("GlobalGroup"), 'redstar');
224  }
225  print "</td></tr>\n";
226  }
227 
228  // Note
229  print '<tr><td class="titlefield tdtop">'.$langs->trans("Description").'</td>';
230  print '<td class="valeur sensiblehtmlcontent">';
231  print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note));
232  print '</td>';
233  print "</tr>\n";
234 
235  print '</table><br>';
236 
237  if ($user->admin) {
238  print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
239  }
240 
241  $parameters = array();
242  $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
243  if ($reshook < 0) {
244  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
245  }
246 
247  print "\n";
248  print '<div class="div-table-responsive-no-min">';
249  print '<table class="noborder centpercent">';
250  print '<tr class="liste_titre">';
251  print '<td>'.$langs->trans("Module").'</td>';
252  if ($caneditperms) {
253  print '<td class="center nowrap">';
254  print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("All")."</a>";
255  print '/';
256  print '<a class="reposition commonlink" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."</a>";
257  print '</td>';
258  } else {
259  print '<td></td>';
260  }
261  print '<td class="center" width="24"></td>';
262  //print '<td>'.$langs->trans("Permissions").'</td>';
263  print '<td class="center"></td>';
264 
265  print '<td class="right nowrap">';
266  print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
267  print ' | ';
268  print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
269  print '</td>';
270  print '</tr>'."\n";
271 
272  $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
273  $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
274  $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
275  $sql .= " AND r.entity = ".((int) $entity);
276  if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
277  $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
278  }
279  $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
280 
281  $result = $db->query($sql);
282  if ($result) {
283  $num = $db->num_rows($result);
284  $i = 0;$j = 0;
285  $oldmod = '';
286 
287  $cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
288  $cookietohidegrouparray = explode(',', $cookietohidegroup);
289 
290  while ($i < $num) {
291  $obj = $db->fetch_object($result);
292 
293  // If line is for a module that does not exist anymore (absent of includes/module), we ignore it
294  if (empty($modules[$obj->module])) {
295  $i++;
296  continue;
297  }
298 
299  $objMod = $modules[$obj->module];
300 
301  if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
302  $ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
303  } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
304  $ishidden = 1;
305  } else {
306  $ishidden = 0;
307  }
308  $isexpanded = ! $ishidden;
309 
310  // Break found, it's a new module to catch
311  if (isset($obj->module) && ($oldmod <> $obj->module)) {
312  $oldmod = $obj->module;
313 
314  $j++;
315  if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
316  $ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
317  } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
318  $ishidden = 1;
319  } else {
320  $ishidden = 0;
321  }
322  $isexpanded = ! $ishidden;
323  // Break detected, we get objMod
324  $objMod = $modules[$obj->module];
325  $picto = ($objMod->picto ? $objMod->picto : 'generic');
326 
327  // Show break line
328  print '<tr class="oddeven trforbreakperms" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
329  // Picto and label of module
330  print '<td class="maxwidthonsmartphone tdoverflowonsmartphone tdforbreakperms" data-hide-perms="'.$obj->module.'">';
331  print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
332  print '<a name="'.$objMod->getName().'"></a>';
333  print '</td>';
334  // Permission and tick (2 columns)
335  if ($caneditperms) {
336  print '<td class="center wraponsmartphone">';
337  print '<span class="permtohide_'.$obj->module.'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
338  print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
339  print ' / ';
340  print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
341  print '</span>';
342  print '</td>';
343  print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'">';
344  print '</td>';
345  } else {
346  print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
347  print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
348  }
349  // Description of permission (2 columns)
350  print '<td class="tdforbreakperms" data-hide-perms="'.$obj->module.'"></td>';
351  print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.$obj->module.'">';
352  print '<div class="switchfolderperms folderperms_'.$obj->module.'"'.($isexpanded ? ' style="display:none;"' : '').'>';
353  print img_picto('', 'folder', 'class="marginright"');
354  print '</div>';
355  print '<div class="switchfolderperms folderopenperms_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
356  print img_picto('', 'folder-open', 'class="marginright"');
357  print '</div>';
358  print '</td>'; //Add picto + / - when open en closed
359  print '</tr>'."\n";
360  }
361 
362  print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
363  print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
364 
365 
366  // Picto and label of module
367  print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
368  print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
369  //print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
370  print '</td>';
371 
372  // Permission and tick (2 columns)
373  if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
374  if (in_array($obj->id, $permsgroupbyentity[$entity])) {
375  // Own permission by group
376  if ($caneditperms) {
377  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes">';
378  //print img_edit_remove($langs->trans("Remove"));
379  print img_picto($langs->trans("Remove"), 'switch_on');
380  print '</a></td>';
381  }
382  print '<td class="center nowrap">';
383  print img_picto($langs->trans("Active"), 'tick');
384  print '</td>';
385  } else {
386  // Do not own permission
387  if ($caneditperms) {
388  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes">';
389  //print img_edit_add($langs->trans("Add"));
390  print img_picto($langs->trans("Add"), 'switch_off');
391  print '</a></td>';
392  }
393  print '<td>&nbsp;</td>';
394  }
395  } else {
396  // Do not own permission
397  if ($caneditperms) {
398  print '<td class="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&token='.newToken().'">';
399  //print img_edit_add($langs->trans("Add"));
400  print img_picto($langs->trans("Add"), 'switch_off');
401  print '</a></td>';
402  } else {
403  print '<td>&nbsp;</td>';
404  }
405  print '<td>&nbsp;</td>';
406  }
407 
408  // Description of permission (2 columns)
409  $permlabel = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
410  print '<td>';
411  print $permlabel;
412  if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
413  if (preg_match('/_advance$/', $obj->perms)) {
414  print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
415  }
416  }
417  print '</td>';
418 
419  // Permission id
420  if ($user->admin) {
421  print '<td class="right">';
422  $htmltext = $langs->trans("ID").': '.$obj->id;
423  $htmltext .= '<br>'.$langs->trans("Permission").': user->rights->'.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '');
424  print $form->textwithpicto('', $htmltext);
425  //print '<span class="opacitymedium">'.$obj->id.'</span>';
426  print '</td>';
427  } else {
428  print '<td>&nbsp;</td>';
429  }
430 
431  print '</tr>'."\n";
432 
433  $i++;
434  }
435  }
436  print '</table>';
437  print '</div>';
438 
439  print '<script>';
440  print '$(".tdforbreakperms:not(.alink)").on("click", function(){
441  console.log("Click on tdforbreakperms");
442  moduletohide = $(this).data("hide-perms");
443  j = $(this).data("j");
444  if ($("#idforbreakperms_"+moduletohide).val() == 1) {
445  console.log("idforbreakperms_"+moduletohide+" has value hidden=1");
446  $(".trtohide_"+moduletohide).show();
447  $(".permtoshow_"+moduletohide).hide();
448  $(".permtohide_"+moduletohide).show();
449  $(".folderperms_"+moduletohide).hide();
450  $(".folderopenperms_"+moduletohide).show();
451  $("#idforbreakperms_"+moduletohide).val("0");
452  } else {
453  console.log("idforbreakperms_"+moduletohide+" has value hidden=0");
454  $(".trtohide_"+moduletohide).hide();
455  $(".folderopenperms_"+moduletohide).hide();
456  $(".folderperms_"+moduletohide).show();
457  $(".permtoshow_"+moduletohide).show();
458  $(".permtohide_"+moduletohide).hide();
459  $("#idforbreakperms_"+moduletohide).val("1");
460  }
461 
462  // Now rebuild the value for cookie
463  var hideuserperm="";
464  $(".trforbreakperms").each(function(index) {
465  //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
466  if ($("input[data-j="+(index+1)+"]").val() == 1) {
467  hideuserperm=hideuserperm+","+(index+1);
468  }
469  });
470  // set cookie by js
471  date = new Date(); date.setTime(date.getTime()+(30*86400000));
472  if (hideuserperm) {
473  console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
474  document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
475  } else {
476  console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
477  document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
478  }
479  });';
480 
481  // Button expand / collapse all
482  print '$(".showallperms").on("click", function(){
483  console.log("Click on showallperms");
484 
485  console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
486  document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
487  $(".tdforbreakperms").each( function(){
488  moduletohide = $(this).data("hide-perms");
489  //console.log(moduletohide);
490  if ($("#idforbreakperms_"+moduletohide).val() != 0) {
491  $(this).trigger("click"); // emulate the click, so the cooki will be resaved
492  }
493  })
494  });
495 
496  $(".hideallperms").on("click", function(){
497  console.log("Click on hideallperms");
498 
499  $(".tdforbreakperms").each( function(){
500  moduletohide = $(this).data("hide-perms");
501  //console.log(moduletohide);
502  if ($("#idforbreakperms_"+moduletohide).val() != 1) {
503  $(this).trigger("click"); // emulate the click, so the cooki will be resaved
504  }
505  })
506  });';
507  print "\n";
508  print '</script>';
509 
510  print '<style>';
511  print '.switchfolderperms{
512  cursor: pointer;
513  }';
514  print '</style>';
515  print '</div>';
516 
517  $parameters = array();
518  $reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
519  if ($reshook < 0) {
520  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
521  }
522 
523  print dol_get_fiche_end();
524 }
525 
526 // End of page
527 llxFooter();
528 $db->close();
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Definition: functions.lib.php:1594
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
dol_osencode
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
Definition: functions.lib.php:9026
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:607
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:5096
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2196
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:4125
llxHeader
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
$parameters
$parameters
Actions.
Definition: perms.php:85
$sql
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') && $user->hasRight('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)) $sql
Social contributions to pay.
Definition: index.php:746
group_prepare_head
group_prepare_head($object)
Prepare array with list of tabs.
Definition: usergroups.lib.php:205
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1732
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
Definition: functions.lib.php:8644
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3987
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:5052
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11620
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2168
dolGetModulesDirs
dolGetModulesDirs($subdir='')
Return list of modules directories.
Definition: functions2.lib.php:80
dol_get_fiche_head
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.
Definition: functions.lib.php:1970
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:507
dol_string_onlythesehtmltags
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array())
Clean a string to keep only desirable HTML tags.
Definition: functions.lib.php:7105
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4462
dol_htmlentitiesbr
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
Definition: functions.lib.php:7440
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
Definition: security.lib.php:1152