dolibarr 25.0.0-alpha
server_mcp.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2022 Alice Adminson <aadminson@example.com>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 * Coryright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 * Copyright (C) 2026 Nick Fragoulis
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
29require '../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
39require_once DOL_DOCUMENT_ROOT . "/core/class/html.form.class.php";
40require_once DOL_DOCUMENT_ROOT . "/core/class/doleditor.class.php";
41require_once DOL_DOCUMENT_ROOT . "/ai/lib/ai.lib.php";
42require_once DOL_DOCUMENT_ROOT . "/core/lib/functions2.lib.php";
43require_once DOL_DOCUMENT_ROOT . "/core/lib/security.lib.php";
44
45
46$langs->loadLangs(array("admin", "website", "other"));
47
48// Access control
49if (!$user->admin) {
51}
52if (!isModEnabled('ai')) {
53 accessforbidden('Module AI not activated.');
54}
55
56// Parameters
57$action = GETPOST('action', 'aZ09');
58$backtopage = GETPOST('backtopage', 'alpha');
59
60
65// Main Settings
66if ($action == 'update') {
67 $error = 0;
68
69 if (GETPOSTISSET('AI_ASK_FOR_CONFIRMATION')) {
70 $res = dolibarr_set_const($db, "AI_ASK_FOR_CONFIRMATION", GETPOSTINT("AI_ASK_FOR_CONFIRMATION"), 'int', 0, '', $conf->entity);
71 if ($res <= 0) $error++;
72 }
73
74 if (GETPOSTISSET('AI_LOG_RETENTION')) {
75 $res = dolibarr_set_const($db, "AI_LOG_RETENTION", GETPOST("AI_LOG_RETENTION"), 'int', 0, '', $conf->entity);
76 if ($res <= 0) {
77 $error++;
78 }
79 }
80
81 if (GETPOSTISSET('AI_DEFAULT_INPUT_MODE')) {
82 $res = dolibarr_set_const($db, "AI_DEFAULT_INPUT_MODE", GETPOST("AI_DEFAULT_INPUT_MODE"), 'chaine', 0, '', $conf->entity);
83 if ($res <= 0) {
84 $error++;
85 }
86 }
87
88 if (GETPOSTISSET('AI_INTENT_PROMPT')) {
89 $res = dolibarr_set_const($db, "AI_INTENT_PROMPT", GETPOST("AI_INTENT_PROMPT"), 'chaine', 0, '', $conf->entity);
90 if ($res <= 0) {
91 $error++;
92 }
93 }
94
95 if ($error) {
96 setEventMessages($langs->trans("ErrorSavingSettings"), null, 'errors');
97 } else {
98 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
99 }
100
101 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home");
102 exit;
103}
104
105// Test connection
106if ($action == 'test_provider') {
107 $service = GETPOST('service_key', 'aZ09');
108 if ($service) {
109 $credential = getDolGlobalString('AI_API_' . strtoupper($service) . '_KEY');
110 $url = getDolGlobalString('AI_API_' . strtoupper($service) . '_URL');
111
112 // Decrypt if needed
113 if (preg_match('/^crypted:/', $credential)) {
114 $credential = dol_decode(substr($credential, 8));
115 } elseif (preg_match('/^dolcrypt:/', $credential)) {
116 $credential = dolDecrypt($credential, '');
117 }
118
119 // Only proceed if the key is valid (decrypted or not encrypted)
120 if ($credential !== null) {
121 $res = testAIConnection($service, $credential, $url);
122
123 if ($res['success']) {
124 setEventMessages($langs->trans("ConnectionSuccessful") . $res['message'], null, 'mesgs');
125 } else {
126 setEventMessages($langs->trans("ConnectionFailed") . $res['message'], null, 'errors');
127 }
128 }
129 }
130}
131
132// External Access Settings
133if ($action == 'update_external') {
134 $error = 0;
135
136 $user_id = GETPOSTINT("AI_MCP_USER_ID");
137 if (GETPOSTISSET('AI_MCP_USER_ID')) {
138 if ($user_id > 0) {
139 $res = dolibarr_set_const($db, "AI_MCP_USER_ID", $user_id, 'int', 0, '', $conf->entity);
140 } else {
141 $res = dolibarr_del_const($db, "AI_MCP_USER_ID", $conf->entity);
142 }
143 if ($res < 0) {
144 $error++;
145 }
146 }
147
148 // Checkbox has its own form, flagged by a hidden field because an unchecked checkbox is not posted
149 if (GETPOSTISSET('AI_MCP_BEHIND_BASIC_AUTH_FORM')) {
150 $res = dolibarr_set_const($db, "AI_MCP_BEHIND_BASIC_AUTH", GETPOSTINT("AI_MCP_BEHIND_BASIC_AUTH"), 'int', 0, '', $conf->entity);
151 if ($res < 0) {
152 $error++;
153 }
154 }
155
156 if ($error) {
157 setEventMessages($langs->trans("ErrorSavingSettings"), null, 'errors');
158 } else {
159 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
160 }
161
162 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home");
163 exit;
164}
165
166// Generate New API Key
167if ($action == 'generate_key') {
168 $newKey = dolGetRandomBytes(64);
169
170 if (empty($newKey)) {
171 setEventMessages($langs->trans("KeyGenerationFailed"), null, 'errors');
172 } else {
173 if (dolibarr_set_const($db, 'AI_MCP_API_KEY', $newKey, 'chaine', 0, '', $conf->entity) > 0) {
174 setEventMessages($langs->trans("KeyGenerationSuccessfull"), null, 'mesgs');
175 } else {
176 setEventMessages($langs->trans("KeySaveFailed"), null, 'errors');
177 }
178 }
179}
180
181
182/*
183 * VIEW
184 */
185
187$title = "AiSetup";
188
189llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-ai page-admin');
190
191$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';
192
193print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
194
195
196$head = aiAdminPrepareHead();
197print dol_get_fiche_head($head, 'servermcp', "MCP Server", -1, "ai");
198
199//print '<span class="opacitymedium">' . $langs->trans("ConfigHelp") . '</span><br><br>';
200
201$form = new Form($db);
202
203// Load Current Values
204$apiKey = getDolGlobalString('AI_MCP_API_KEY');
205
206// Default Prompt Logic
207$defaultPromptText = " ROLE: Dolibarr ERP AI.
208GOAL: Map user intent to specific JSON commands.
209
210CONSTRAINTS:
2111. OUTPUT: Single valid JSON object ONLY. No Markdown. No text.
212 Format: {\"tool\": \"tool_name\", \"arguments\": {\"argument_name\": \"argument_value\", ...}}
2132. TOOLS: Use ONLY provided tools. If no tool or thirdparty fits, you must first use 'respond_to_user' to inform user.
2143. ARGS: strict adherence to schema. Do not invent parameters.
2154. MISSING INFO: If a required argument (like an ID) is missing, use 'ask_for_clarification'.
2165. SAFETY: For DELETE/UPDATE actions, you MUST use 'ask_for_confirmation'.";
217
218$currentPrompt = getDolGlobalString('AI_INTENT_PROMPT', $defaultPromptText);
219
220// Settings
221print '<div class="neutral">';
222//print '<table class="noborder centpercent">';
223
224// Enable/Disable
225//print '<tr class="oddeven">';
226//print '<td class="titlefield" width="30%">'
227print $form->textwithpicto($langs->trans('EnableMCPServer'), $langs->trans('DisableMCPAI'));
228//print '</td>';
229//print '<td>';
230print ' &nbsp; ';
231print ajax_constantonoff('AI_MCP_ENABLED', array(), null, 0, 0, 1);
232//print ' <span class="opacitymedium">' . $langs->trans('DisableMCPAI') . '</span>';
233//print '</td>';
234//print '</tr>';
235
236//print '</table>';
237print '</div>';
238
239print '<br>';
240print '<br>';
241
242if (getDolGlobalString('AI_MCP_ENABLED')) {
243 /*
244 print load_fiche_titre($langs->trans("PrivateModeTitle"), '', 'fas fa-lock');
245
246 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
247 print '<input type="hidden" name="token" value="'.newToken().'">';
248 print '<input type="hidden" name="action" value="update">';
249
250 print '<div class="div-table-responsive-no-min">';
251 print '<table class="noborder centpercent">';
252
253 // Input Mode
254 print '<tr class="oddeven">';
255 print '<td>';
256 print $form->textwithpicto('Default Interface', $langs->trans("InputMethodHelp"));
257 print '</td>';
258 print '<td>';
259 $input_modes = [
260 'text' => $langs->trans('OptionTextOnly'),
261 'native' => $langs->trans('OptionCloudFast') . ' - ' . $langs->trans('OptionCloudFasthelp'),
262 'whisper' => $langs->trans('OptionWhisperLocal') . ' - ' . $langs->trans('OptionWhisperLocalhelp')
263 ];
264 print $form->selectarray('AI_DEFAULT_INPUT_MODE', $input_modes, getDolGlobalString('AI_DEFAULT_INPUT_MODE'), 0, 0, 0);
265 print '</td>';
266 print '</tr>';
267
268 // Enhanced Privacy control
269 print '<tr class="oddeven">';
270 print '<td>' . $langs->trans('ObfuscatePIIData') . '</td>';
271 print '<td>';
272 print ajax_constantonoff('AI_PRIVACY_REDACTION');
273 print ' &nbsp; <span class="opacitymedium">' . $langs->trans("RedactionHelp") . '</span>';
274 print '</td>';
275 print '</tr>';
276
277 // Confirmation Level
278 print '<tr class="oddeven">';
279 print '<td>' . $form->textwithpicto($langs->trans("AskConfirmation"), $langs->trans("AskConfirmationHelp")).'</td>';
280 print '<td>';
281 $confirmation_options = [
282 '0' => $langs->trans("ConfirmNever"),
283 '1' => $langs->trans("ConfirmWriteOnly"),
284 '2' => $langs->trans("ConfirmAlways")
285 ];
286 print $form->selectarray('AI_ASK_FOR_CONFIRMATION', $confirmation_options, getDolGlobalInt('AI_ASK_FOR_CONFIRMATION', 1), 0, 0, 0);
287 print '</td>';
288 print '</tr>';
289
290 // Logging
291 print '<tr class="oddeven">';
292 print '<td>' . $langs->trans('EnableLogging') . '</td>';
293 print '<td>';
294 print ajax_constantonoff('AI_LOG_REQUESTS');
295 print ' &nbsp; <a href="' . DOL_URL_ROOT . '/ai/admin/log_viewer.php" target="_blank" style="padding-top: 4px; padding-bottom: 4px;">'.$langs->trans("ViewLogs").'</a>';
296 print '</td>';
297 print '</tr>';
298
299 print '<tr class="oddeven">';
300 print '<td>' . $langs->trans("LogRetention") . '</td>';
301 print '<td><input class="width50" type="number" name="AI_LOG_RETENTION" value="' . getDolGlobalInt('AI_LOG_RETENTION', 30) . '"> (0 = Forever)</td>';
302 print '</tr>';
303
304 // System Prompt
305 print '<tr class="oddeven">';
306 print '<td colspan="2">';
307 print '<strong>' . $langs->trans("SystemPrompt") . '</strong><br>';
308 print '<span class="opacitymedium small">' . $langs->trans("SystemPromptHelp") . '</span><br>';
309 $doleditor = new DolEditor('AI_INTENT_PROMPT', $currentPrompt, '', 250, 'dolibarr_notes', 'In', false, false, true, ROWS_8, '90%');
310 $doleditor->Create();
311 print '</td>';
312 print '</tr>';
313
314 print '</table>';
315 print '</div>';
316
317 print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
318 print '</form>';
319
320 print '<br>';
321 print '<br>';
322
323 // AI Provider Config and Connection testing
324 $services = getListOfAIServices();
325 $currentService = getDolGlobalString('AI_API_SERVICE');
326
327 print load_fiche_titre($langs->trans("AIProviderConfigTitle"), '', 'fa fa-plug');
328
329 if ((string) $currentService == '-1') {
330 print '<div class="warning">'.$langs->trans("NoAIProviderSelected").' <a href="'.dol_buildpath('/ai/admin/setup.php', 1).'">'.$langs->trans("ConfigureHere").'</a></div>';
331 } else {
332 print '<div class="div-table-responsive-no-min">';
333 print '<table class="noborder centpercent">';
334
335 print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("AIProvider").'</td><td>'.$services[$currentService]['label'].'</td></tr>';
336
337 $prefix = 'AI_API_'.strtoupper($currentService);
338 $modelVal = getDolGlobalString($prefix.'_MODEL_TEXT', $services[$currentService]['textgeneration']['default']);
339
340 print '<tr class="oddeven"><td>'.$langs->trans("AI_API_MODEL").'</td><td>'.$modelVal.'</td></tr>';
341 print '</table></div>';
342
343 print '<div class="center">';
344
345 if ($currentService && $currentService !== '-1') {
346 print ' <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=test_provider&token='.newToken().'&service_key='.$currentService.'" class="button">Test Connection</a>';
347 }
348
349 print '</div>';
350 }
351
352 print '<br><br>';
353 */
354
355 // External Access Configuration
356 print load_fiche_titre($langs->trans("AiMcpExternalAccess"), '', 'fas fa-lock-open');
357
358 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
359 print '<input type="hidden" name="token" value="'.newToken().'">';
360 print '<input type="hidden" name="action" value="update_external">';
361
362 print '<div class="div-table-responsive-no-min">';
363 print '<table class="noborder centpercent">';
364
365 // Service User
366 print '<tr class="oddeven">';
367 print '<td class="fieldrequired">Service User '.img_picto($langs->trans("UserPermissionsTooltip"), 'info').'</td>';
368 print '<td>';
369 print '<div style="display: flex; align-items: center;">';
370 // Use -1 when not set, so select_dolusers() does not preselect the current user
371 print $form->select_dolusers(getDolGlobalInt('AI_MCP_USER_ID', -1), 'AI_MCP_USER_ID', 1);
372 print ' <input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Save").'" style="margin-left: 20px;">';
373 print '</div>';
374 print '<span class="opacitymedium small">' . $langs->trans("DedicatedUserRecommendation") . '</span>';
375 print '</td>';
376 print '</tr>';
377
378 // API Key
379 print '<tr class="oddeven">';
380 print '<td class="fieldrequired">MCP API Key</td>';
381 print '<td>';
382 if ($apiKey) {
383 print '<input type="text" id="apikey" value="'.$apiKey.'" readonly style="width:400px; padding:6px; background:#f4f4f4; border:1px solid #ccc; color:#555;">';
384 print ' <a href="'.$_SERVER["PHP_SELF"].'?action=generate_key&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("Generate")).'">'.img_picto($langs->transnoentities("Generate"), 'refresh', 'class="linkobject paddingleft"').'</a>';
385 } else {
386 print '<span class="opacitymedium">' . $langs->trans("NoKeyWarning") . '</span>';
387 print ' <a href="' . $_SERVER["PHP_SELF"] . '?action=generate_key&token=' . newToken() . '" title="' . dol_escape_htmltag($langs->trans("Generate")) . '">' . img_picto($langs->transnoentities("Generate"), 'refresh', 'class="linkobject paddingleft"') . '</a>';
388 }
389 print '</td>';
390 print '</tr>';
391
392 $endpoint = dol_buildpath('/ai/server/mcp_server.php', 3);
393 // Name of the MCP server in the configuration examples: the database name, restricted to safe chars for a command line
394 $mcpservername = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $conf->db->name);
395 // Name of the environment variable holding the key, suffixed with the database name so several instances can share the same .env file
396 $mcpapikeyenvname = 'DOLIBARR_MCP_API_KEY_'.dol_strtoupper(preg_replace('/[^a-zA-Z0-9_]/', '_', $conf->db->name));
397
398 print '<tr class="oddeven">';
399 print '<td>MCP Endpoint URL</td>';
400 print '<td>';
401 print '<input type="text" id="endpoint" value="'.$endpoint.'" readonly style="width:600px; border:none; background:transparent;">';
402 print '</td>';
403 print '</tr>';
404
405 print '</table>';
406 print '</div>';
407
408 print '</form>';
409
410 // Configuration Examples
411 print '<br>';
412 print '<div style="background:#fcfcfc; border:1px solid #eee; padding:15px; border-radius:5px;">';
413
414 // Server behind a HTTP Basic authentication: the Authorization header is then taken, so the key goes into the DOLAPIKEY header
415 $behindbasicauth = getDolGlobalInt('AI_MCP_BEHIND_BASIC_AUTH');
416 $basicauthplaceholder = 'BASE64_OF_LOGIN:PASSWORD';
417 // If this page is itself behind the Basic authentication, reuse the credentials sent by the browser to fill the examples
418 $basicauthvalue = $basicauthplaceholder;
419 $authheader = empty($_SERVER['HTTP_AUTHORIZATION']) ? (empty($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) ? '' : $_SERVER['REDIRECT_HTTP_AUTHORIZATION']) : $_SERVER['HTTP_AUTHORIZATION'];
420 $reg = array();
421 if (preg_match('/^Basic\s+([a-zA-Z0-9+\/=]+)$/i', $authheader, $reg)) {
422 $basicauthvalue = $reg[1];
423 } elseif (!empty($_SERVER['PHP_AUTH_USER'])) {
424 $basicauthvalue = base64_encode($_SERVER['PHP_AUTH_USER'].':'.(empty($_SERVER['PHP_AUTH_PW']) ? '' : $_SERVER['PHP_AUTH_PW']));
425 }
426 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
427 print '<input type="hidden" name="token" value="'.newToken().'">';
428 print '<input type="hidden" name="action" value="update_external">';
429 print '<input type="hidden" name="AI_MCP_BEHIND_BASIC_AUTH_FORM" value="1">';
430 print '<input type="checkbox" id="AI_MCP_BEHIND_BASIC_AUTH" name="AI_MCP_BEHIND_BASIC_AUTH" value="1"'.($behindbasicauth ? ' checked' : '').' onchange="this.form.submit();">';
431 print ' <label for="AI_MCP_BEHIND_BASIC_AUTH">'.$form->textwithpicto($langs->trans("MCPServerBehindBasicAuth"), $langs->trans("MCPServerBehindBasicAuthHelp", $basicauthplaceholder)).'</label>';
432 print '</form>';
433 print '<br>';
434
435 // Command line to declare the MCP server into Mistral Vibe, the key being read from its .env file
436 print '<strong>' . $langs->trans("MistralVibeConfig") . '</strong><br>';
437 print '<pre style="background:#333; color:#fff; padding:10px; border-radius:4px; overflow:auto; margin-top:10px; white-space: break-spaces;">';
438 if ($behindbasicauth) {
439 echo htmlspecialchars('vibe mcp add '.$mcpservername.' --url '.$endpoint.' --transport streamable-http --header \'Authorization=Basic '.$basicauthvalue.'\' --header \'DOLAPIKEY='.($apiKey ? $apiKey : "YOUR_KEY_HERE").'\'');
440 } else {
441 echo htmlspecialchars('vibe mcp add '.$mcpservername.' --url '.$endpoint.' --transport streamable-http --api-key-env '.$mcpapikeyenvname."\n\n");
442 echo htmlspecialchars($langs->transnoentitiesnoconv("MistralVibeConfigEnv", '~/.vibe/.env')."\n");
443 echo htmlspecialchars($mcpapikeyenvname.'="'.($apiKey ? $apiKey : "YOUR_KEY_HERE").'"');
444 }
445 print '</pre>';
446
447 // Command line to declare the MCP server into Claude Code
448 print '<br><strong>' . $langs->trans("ClaudeCodeConfig") . '</strong><br>';
449 print '<pre style="background:#333; color:#fff; padding:10px; border-radius:4px; overflow:auto; margin-top:10px; white-space: break-spaces;">';
450 if ($behindbasicauth) {
451 echo htmlspecialchars('claude mcp add --transport http '.$mcpservername.' '.$endpoint.' --header "Authorization: Basic '.$basicauthvalue.'" --header "DOLAPIKEY: '.($apiKey ? $apiKey : "YOUR_KEY_HERE").'"');
452 } else {
453 echo htmlspecialchars('claude mcp add --transport http '.$mcpservername.' '.$endpoint.' --header "Authorization: Bearer '.($apiKey ? $apiKey : "YOUR_KEY_HERE").'"');
454 }
455 print '</pre>';
456
457 print '<br><strong>' . $langs->trans("ClaudeDesktopConfig") . '</strong><br>';
458 print '<pre style="background:#333; color:#fff; padding:10px; border-radius:4px; overflow:auto; margin-top:10px; white-space: break-spaces;">';
459 echo htmlspecialchars('
460 {
461 "mcpServers": {
462 "'.$mcpservername.'": {
463 "command": "node",
464 "args": ["/path/to/mcp-bridge.js"],
465 "env": {
466 "DOLIBARR_URL": "'.$endpoint.'",
467 "DOLIBARR_API_KEY": "'.($apiKey ? $apiKey : "YOUR_KEY_HERE").'"
468 }
469 }
470 }
471 }');
472 print '</pre>';
473 print '</div>';
474}
475
476print dol_get_fiche_end();
477
478llxFooter();
479$db->close();
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
testAIConnection(string $service, string $key, string $url)
Tests the connection to an AI service using its API key and URL by sending message "Hello".
Definition ai.lib.php:213
aiAdminPrepareHead()
Prepare admin pages header.
Definition ai.lib.php:548
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage generation of HTML components Only common components must be here.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:542
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:740
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
dolGetRandomBytes($length)
Return a string of random bytes (hexa string) with length = $length for cryptographic purposes.
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dolDecrypt($chain, $key='', $patterntotest='')
Decode a string with a symmetric encryption.
if( $action=='update') if($action=='test_provider') if( $action=='update_external') if($action=='generate_key') $help_url
ACTIONS.