dolibarr  17.0.3
oauthlogintokens.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
4  * Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <https://www.gnu.org/licenses/>.
18  */
19 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list and $supportedoauth2array
30 require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
31 use OAuth\Common\Storage\DoliStorage;
32 
33 // Load translation files required by the page
34 $langs->loadLangs(array('admin', 'printing', 'oauth'));
35 
36 $action = GETPOST('action', 'aZ09');
37 $mode = GETPOST('mode', 'alpha');
38 $value = GETPOST('value', 'alpha');
39 $varname = GETPOST('varname', 'alpha');
40 $driver = GETPOST('driver', 'alpha');
41 
42 if (!empty($driver)) {
43  $langs->load($driver);
44 }
45 
46 if (!$mode) {
47  $mode = 'setup';
48 }
49 
50 if (!$user->admin) {
52 }
53 
54 
55 /*
56  * Action
57  */
58 
59 /*if (($mode == 'test' || $mode == 'setup') && empty($driver))
60 {
61  setEventMessages($langs->trans('PleaseSelectaDriverfromList'), null);
62  header("Location: ".$_SERVER['PHP_SELF'].'?mode=config');
63  exit;
64 }*/
65 
66 if ($action == 'setconst' && $user->admin) {
67  $error = 0;
68  $db->begin();
69 
70  $setupconstarray = GETPOST('setupdriver', 'array');
71 
72  foreach ($setupconstarray as $setupconst) {
73  //print '<pre>'.print_r($setupconst, true).'</pre>';
74 
75  $constname = dol_escape_htmltag($setupconst['varname']);
76  $constvalue = dol_escape_htmltag($setupconst['value']);
77  $consttype = dol_escape_htmltag($setupconst['type']);
78  $constnote = dol_escape_htmltag($setupconst['note']);
79 
80  $result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
81  if (!($result > 0)) {
82  $error++;
83  }
84  }
85 
86  if (!$error) {
87  $db->commit();
88  setEventMessages($langs->trans("SetupSaved"), null);
89  } else {
90  $db->rollback();
91  dol_print_error($db);
92  }
93  $action = '';
94 }
95 
96 if ($action == 'setvalue' && $user->admin) {
97  $db->begin();
98 
99  $result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
100  if (!($result > 0)) {
101  $error++;
102  }
103 
104  if (!$error) {
105  $db->commit();
106  setEventMessages($langs->trans("SetupSaved"), null);
107  } else {
108  $db->rollback();
109  dol_print_error($db);
110  }
111  $action = '';
112 }
113 
114 
115 /*
116  * View
117  */
118 
119 // Define $urlwithroot
120 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
121 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
122 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
123 
124 $form = new Form($db);
125 
126 llxHeader('', $langs->trans("TokenManager"));
127 
128 $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
129 print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup');
130 
131 $head = oauthadmin_prepare_head();
132 
133 print dol_get_fiche_head($head, 'tokengeneration', '', -1, '');
134 
135 if (GETPOST('error')) {
136  setEventMessages(GETPOST('error'), null, 'errors');
137 }
138 
139 if ($mode == 'setup' && $user->admin) {
140  print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
141 
142  // Define $listinsetup
143  foreach ($conf->global as $key => $val) {
144  if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
145  $provider = preg_replace('/_ID$/', '', $key);
146  $listinsetup[] = array(
147  $provider.'_NAME',
148  $provider.'_ID',
149  $provider.'_SECRET',
150  $provider.'_URLAUTHORIZE', // For custom oauth links
151  $provider.'_SCOPE' // For custom oauth links
152  );
153  }
154  }
155 
156  $oauthstateanticsrf = bin2hex(random_bytes(128/8));
157 
158  // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
159  foreach ($listinsetup as $key) {
160  $supported = 0;
161  $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
162  $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
163  $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
164  if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
165  $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
166  $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
167  } else {
168  $keybeforeprovider = $keyforsupportedoauth2array;
169  $keyforprovider = '';
170  }
171  $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
172  $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
173 
174 
175  $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
176 
177  $shortscope = '';
178  if (getDolGlobalString($key[4])) {
179  $shortscope = getDolGlobalString($key[4]);
180  }
181  $state = $shortscope; // TODO USe a better state
182 
183  // Define $urltorenew, $urltodelete, $urltocheckperms
184  if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
185  // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
186  // We pass this param list in to 'state' because we need it before and after the redirect.
187 
188  // Note: github does not accept csrf key inside the state parameter (only known values)
189  $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
190  $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
191  $urltocheckperms = 'https://github.com/settings/applications/';
192  } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
193  // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
194  // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
195  // We pass this key list into the param 'state' because we need it before and after the redirect.
196  $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
197  $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
198  $urltocheckperms = 'https://security.google.com/settings/security/permissions';
199  } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) {
200  $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
201  $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
202  $urltocheckperms = '';
203  } else {
204  $urltorenew = '';
205  $urltodelete = '';
206  $urltocheckperms = '';
207  }
208 
209  if ($urltorenew) {
210  $urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
211  }
212  if ($urltodelete) {
213  $urltodelete .= '&keyforprovider='.urlencode($keyforprovider);
214  }
215 
216  // Show value of token
217  $tokenobj = null;
218  // Token
219  require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
220  // Dolibarr storage
221  $storage = new DoliStorage($db, $conf, $keyforprovider);
222  try {
223  // $OAUTH_SERVICENAME is for example 'Google-keyforprovider'
224  print '<!-- '.$OAUTH_SERVICENAME.' -->'."\n";
225  $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
226  //print $storage->token.'<br>';
227  //print $tokenobj->getExtraParams()['id_token'].'<br>';
228  //print $tokenobj->getAccessToken().'<br>';
229  } catch (Exception $e) {
230  // Return an error if token not found
231  //print $e->getMessage();
232  }
233 
234  // Set other properties
235  $refreshtoken = false;
236  $expiredat = '';
237 
238  $expire = false;
239  // Is token expired or will token expire in the next 30 seconds
240  if (is_object($tokenobj)) {
241  $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
242  }
243  if ($key[1] != '' && $key[2] != '') {
244  if (is_object($tokenobj)) {
245  $refreshtoken = $tokenobj->getRefreshToken();
246 
247  $endoflife = $tokenobj->getEndOfLife();
248  if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) {
249  $expiredat = $langs->trans("Never");
250  } elseif ($endoflife == $tokenobj::EOL_UNKNOWN) {
251  $expiredat = $langs->trans("Unknown");
252  } else {
253  $expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel');
254  }
255  }
256  }
257 
258  $submit_enabled = 0;
259 
260  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&amp;driver='.$driver.'" autocomplete="off">';
261  print '<input type="hidden" name="token" value="'.newToken().'">';
262  print '<input type="hidden" name="action" value="setconst">';
263 
264  print '<div class="div-table-responsive-no-min">';
265  print '<table class="noborder centpercent">'."\n";
266 
267  // Api Name
268  $label = $langs->trans($keyforsupportedoauth2array);
269  print '<tr class="liste_titre">';
270  print '<th class="titlefieldcreate">';
271  print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
272  if ($label == $keyforsupportedoauth2array) {
273  print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
274  } else {
275  print $label;
276  }
277  if ($keyforprovider) {
278  print ' (<b>'.$keyforprovider.'</b>)';
279  } else {
280  print ' (<b>'.$langs->trans("NoName").'</b>)';
281  }
282  print '</th>';
283  print '<th></th>';
284  print '<th></th>';
285  print "</tr>\n";
286 
287  print '<tr class="oddeven">';
288  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
289  //var_dump($key);
290  print $langs->trans("OAuthIDSecret").'</td>';
291  print '<td>';
292  print '<span class="opacitymedium">'.$langs->trans("SeePreviousTab").'</span>';
293  print '</td>';
294  print '<td>';
295  print '</td>';
296  print '</tr>'."\n";
297 
298  // Scopes
299  print '<tr class="oddeven">';
300  print '<td>'.$langs->trans("Scopes").'</td>';
301  print '<td colspan="2">';
302  $currentscopes = getDolGlobalString($key[4]);
303  print $currentscopes;
304  print '</td></tr>';
305 
306  print '<tr class="oddeven">';
307  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
308  //var_dump($key);
309  print $langs->trans("IsTokenGenerated");
310  print '</td>';
311  print '<td>';
312  if (is_object($tokenobj)) {
313  print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state));
314  } else {
315  print '<span class="opacitymedium">'.$langs->trans("NoAccessToken").'</span>';
316  }
317  print '</td>';
318  print '<td width="50%">';
319  // Links to delete/checks token
320  if (is_object($tokenobj)) {
321  //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
322  if ($urltodelete) {
323  print '<a class="button smallpaddingimp" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
324  } else {
325  print '<span class="opacitymedium">'.$langs->trans('GoOnTokenProviderToDeleteToken').'</span><br>';
326  }
327  }
328  // Request remote token
329  if ($urltorenew) {
330  print '<a class="button smallpaddingimp" href="'.$urltorenew.'">'.$langs->trans('GetAccess').'</a>';
331  print $form->textwithpicto('', $langs->trans('RequestAccess'));
332  print '<br>';
333  }
334  // Check remote access
335  if ($urltocheckperms) {
336  print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
337  }
338  print '</td>';
339  print '</tr>';
340 
341  print '<tr class="oddeven">';
342  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
343  //var_dump($key);
344  print $langs->trans("Token").'</td>';
345  print '<td colspan="2">';
346 
347  if (is_object($tokenobj)) {
348  $tokentoshow = $tokenobj->getAccessToken();
349  print '<span class="" title="'.dol_escape_htmltag($tokentoshow).'">'.showValueWithClipboardCPButton($tokentoshow, 1, dol_trunc($tokentoshow, 32)).'</span><br>';
350  //print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
351  //print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
352  //var_dump($tokenobj->getExtraParams());
353  /*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
354  print ''.join(',',$tokenobj->getExtraParams());
355  print '</textarea>';*/
356  }
357  print '</td>';
358  print '</tr>'."\n";
359 
360  if (is_object($tokenobj)) {
361  // Token refresh
362  print '<tr class="oddeven">';
363  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
364  //var_dump($key);
365  print $langs->trans("TOKEN_REFRESH");
366  print '</td>';
367  print '<td colspan="2">';
368  print '<span class="" title="'.dol_escape_htmltag($refreshtoken).'">'.showValueWithClipboardCPButton($refreshtoken, 1, dol_trunc($refreshtoken, 32)).'</span>';
369  print '</td>';
370  print '</tr>';
371 
372  // Token expired
373  print '<tr class="oddeven">';
374  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
375  //var_dump($key);
376  print $langs->trans("TOKEN_EXPIRED");
377  print '</td>';
378  print '<td colspan="2">';
379  print yn($expire);
380  print '</td>';
381  print '</tr>';
382 
383  // Token expired at
384  print '<tr class="oddeven">';
385  print '<td'.(empty($key['required']) ? '' : ' class="required"').'>';
386  //var_dump($key);
387  print $langs->trans("TOKEN_EXPIRE_AT");
388  print '</td>';
389  print '<td colspan="2">';
390  print $expiredat;
391  print '</td>';
392  print '</tr>';
393  }
394 
395  print '</table>';
396  print '</div>';
397 
398  if (!empty($driver)) {
399  if ($submit_enabled) {
400  print $form->buttonsSaveCancel("Modify", '');
401  }
402  }
403 
404  print '</form>';
405  print '<br>';
406  }
407 }
408 
409 if ($mode == 'test' && $user->admin) {
410  print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
411 
412  print '<div class="div-table-responsive-no-min">';
413  print '<table class="noborder centpercent">';
414  if (!empty($driver)) {
415  require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
416  $classname = 'printing_'.$driver;
417  $langs->load($driver);
418  $printer = new $classname($db);
419  //print '<pre>'.print_r($printer, true).'</pre>';
420  if (count($printer->getlistAvailablePrinters())) {
421  if ($printer->listAvailablePrinters() == 0) {
422  print $printer->resprint;
423  } else {
424  setEventMessages($printer->error, $printer->errors, 'errors');
425  }
426  } else {
427  print $langs->trans('PleaseConfigureDriverfromList');
428  }
429  }
430 
431  print '</table>';
432  print '</div>';
433 }
434 
435 if ($mode == 'userconf' && $user->admin) {
436  print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
437 
438  print '<div class="div-table-responsive">';
439  print '<table class="noborder centpercent">';
440  print '<tr class="liste_titre">';
441  print '<th>'.$langs->trans("User").'</th>';
442  print '<th>'.$langs->trans("PrintModule").'</th>';
443  print '<th>'.$langs->trans("PrintDriver").'</th>';
444  print '<th>'.$langs->trans("Printer").'</th>';
445  print '<th>'.$langs->trans("PrinterLocation").'</th>';
446  print '<th>'.$langs->trans("PrinterId").'</th>';
447  print '<th>'.$langs->trans("NumberOfCopy").'</th>';
448  print '<th class="center">'.$langs->trans("Delete").'</th>';
449  print "</tr>\n";
450  $sql = "SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login";
451  $sql .= " FROM ".MAIN_DB_PREFIX."printing as p, ".MAIN_DB_PREFIX."user as u WHERE p.userid = u.rowid";
452  $resql = $db->query($sql);
453  while ($obj = $db->fetch_object($resql)) {
454  print '<tr class="oddeven">';
455  print '<td>'.$obj->login.'</td>';
456  print '<td>'.$obj->module.'</td>';
457  print '<td>'.$obj->driver.'</td>';
458  print '<td>'.$obj->printer_name.'</td>';
459  print '<td>'.$obj->printer_location.'</td>';
460  print '<td>'.$obj->printer_id.'</td>';
461  print '<td>'.$obj->copy.'</td>';
462  print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
463  print "</tr>\n";
464  }
465  print '</table>';
466  print '</div>';
467 }
468 
469 print dol_get_fiche_end();
470 
471 // End of page
472 llxFooter();
473 $db->close();
yn
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Definition: functions.lib.php:6677
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1493
dol_trunc
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
Definition: functions.lib.php:3949
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:70
oauthadmin_prepare_head
oauthadmin_prepare_head()
Return array of tabs to used on pages to setup cron module.
Definition: oauth.lib.php:281
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5360
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:520
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:4993
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2550
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:4024
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
Exception
showValueWithClipboardCPButton
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
Definition: functions.lib.php:11520
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1858
getDolGlobalString
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
Definition: functions.lib.php:82
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:11295
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2054
dolibarr_set_const
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:632
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:53
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8466
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:1125