dolibarr 25.0.0-alpha
custom_prompt.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-2026 Frédéric France <frederic.france@free.fr>
5 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
6 * Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php';
37require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
38require_once DOL_DOCUMENT_ROOT."/ai/lib/ai.lib.php";
39require_once DOL_DOCUMENT_ROOT."/core/class/html.formai.class.php";
40
41$langs->loadLangs(array("admin", "website", "other"));
42
43$arrayofaifeatures = getListOfAIFeatures();
44$arrayofai = getListOfAIServices();
45
46// Parameters
47$action = GETPOST('action', 'aZ09');
48$backtopage = GETPOST('backtopage', 'alpha');
49$cancel = GETPOST('cancel', 'alpha');
50$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
51
52$functioncode = GETPOST('functioncode', 'alpha');
53$pre_prompt = GETPOST('prePrompt');
54$post_prompt = GETPOST('postPrompt');
55$blacklists = GETPOST('blacklists');
56$test = GETPOST('test');
57$key = (string) GETPOST('key', 'alpha');
58
59if (empty($action)) {
60 $action = 'edit';
61}
62
63$error = 0;
64$setupnotempty = 0;
65
66// Access control
67if (!$user->admin) {
69}
70if (!isModEnabled('ai')) {
71 accessforbidden('Module AI not activated.');
72}
73
74// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
75$useFormSetup = 1;
76
77if (!class_exists('FormSetup')) {
78 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
79}
80
81$form = new Form($db);
82$formSetup = new FormSetup($db);
83$aiservice = getDolGlobalString('AI_API_SERVICE', 'chatgpt');
84
85// Setup conf for AI model
86$formSetup->formHiddenInputs['action'] = "updatefeaturemodel";
87foreach ($arrayofaifeatures as $featurekey => $feature) {
88 $newfeaturekey = $featurekey;
89 if (preg_match('/^text/', $featurekey)) {
90 $newfeaturekey = 'textgeneration';
91 }
92 $item = $formSetup->newItem('AI_API_'.strtoupper($aiservice).'_MODEL_'.$feature["function"]); // Name of constant must end with _KEY so it is encrypted when saved into database.
93 if (!empty($arrayofai[$aiservice][$newfeaturekey]['default']) && $arrayofai[$aiservice][$newfeaturekey]['default'] != 'na') {
94 $item->nameText = '<span class="valignmiddle">'.$langs->trans("AI_API_MODEL_".$feature["function"]).' </span><span class="opacitymedium valignmiddle">('.$langs->trans("Default").' = '.$arrayofai[$aiservice][$newfeaturekey]['default'].')</span>';
95 if (!empty($arrayofai[$aiservice][$newfeaturekey]['examples'])) {
96 $htmltooltip = $langs->trans("Example").': '.$arrayofai[$aiservice][$newfeaturekey]['examples'];
97 $item->nameText .= $form->textwithpicto('', $htmltooltip);
98 }
99 } else {
100 $item->nameText = $langs->trans("AI_API_MODEL_".$feature["function"]).' <span class="opacitymedium">('.$langs->trans("None").')</span>';
101 }
102 $item->cssClass = 'minwidth500 input';
103}
104
105$setupnotempty += count($formSetup->items);
106
107$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
108
109
110/*
111 * Actions
112 */
113
114// get all configs in const AI
115
116$currentConfigurationsJson = getDolGlobalString('AI_CONFIGURATIONS_PROMPT');
117$currentConfigurations = json_decode($currentConfigurationsJson, true);
118
119if ($action == 'updatefeaturemodel' && !empty($user->admin)) {
120 $formSetup->saveConfFromPost();
121 $action = 'edit';
122}
123
124if ($action == 'update' && $cancel) {
125 $action = 'edit';
126}
127
128if ($action == 'update' && !$cancel && !$test) {
129 $error = 0;
130 if (empty($functioncode)) {
131 $error++;
132 setEventMessages($langs->trans('ErrorInputRequired'), null, 'errors');
133 }
134 if (!is_array($currentConfigurations)) {
135 $currentConfigurations = [];
136 }
137
138 $blacklistArray = array_filter(array_map('trim', explode(',', $blacklists)));
139
140 if (empty($functioncode) || (empty($pre_prompt) && empty($post_prompt) && empty($blacklists))) {
141 if (isset($currentConfigurations[$functioncode])) {
142 unset($currentConfigurations[$functioncode]);
143 }
144 } else {
145 $currentConfigurations[$functioncode] = [
146 'prePrompt' => $pre_prompt,
147 'postPrompt' => $post_prompt,
148 'blacklists' => $blacklistArray,
149 ];
150 }
151
152 $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
153 $result = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
154 if (!$error) {
155 if ($result) {
156 header("Location: ".$_SERVER['PHP_SELF']);
157 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
158 exit;
159 } else {
160 setEventMessages($langs->trans("ErrorUpdating"), null, 'errors');
161 }
162 }
163
164 $action = 'edit';
165}
166
167// Update entry
168if ($action == 'updatePrompts' && !$test) {
169 $blacklistArray = array_filter(array_map('trim', explode(',', $blacklists)));
170
171 $currentConfigurations[$key] = [
172 'prePrompt' => $pre_prompt,
173 'postPrompt' => $post_prompt,
174 'blacklists' => $blacklistArray,
175 ];
176
177 $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
178 $result = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
179 if (!$error) {
180 $action = 'edit';
181 if ($result) {
182 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
183 } else {
184 setEventMessages($langs->trans("ErrorUpdating"), null, 'errors');
185 }
186 }
187}
188
189// Test entry
190if ($action == 'updatePrompts' && $test) {
191 $action = 'edit';
192}
193
194// Delete entry
195if ($action == 'confirm_deleteproperty' && GETPOST('confirm') == 'yes') {
196 if (isset($currentConfigurations[$key])) {
197 unset($currentConfigurations[$key]);
198
199 $newConfigurationsJson = json_encode($currentConfigurations, JSON_UNESCAPED_UNICODE);
200 $res = dolibarr_set_const($db, 'AI_CONFIGURATIONS_PROMPT', $newConfigurationsJson, 'chaine', 0, '', $conf->entity);
201 if ($res) {
202 header("Location: ".$_SERVER['PHP_SELF']);
203 setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
204 exit;
205 } else {
206 setEventMessages($langs->trans("NoRecordDeleted"), null, 'errors');
207 }
208 }
209}
210
211
212/*
213 * View
214 */
215
216$formai = new FormAI($db);
217
218$help_url = '';
219$title = "AiSetup";
220
221llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-ai page-admin_custom_prompt');
222
223$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>';
224
225print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
226
227// Configuration header
228$head = aiAdminPrepareHead();
229print dol_get_fiche_head($head, 'custom', $langs->trans($title), -1, "ai");
230
231$newcardbutton = dolGetButtonTitle($langs->trans('NewCustomPrompt'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', 1);
232/*
233$newbutton = '<a href="'.$_SERVER["PHP_SELF"].'?action=create" title="'.$langs->trans("NewCustomPrompt").'">';
234$newbutton .= img_picto('', 'add');
235$newbutton .= '</a>';
236*/
237
238print load_fiche_titre($langs->trans("AIPromptForFeatures", $arrayofai[$aiservice]['label']), $newcardbutton, '');
239
240
241if ($action == 'deleteproperty') {
242 $formconfirm = $form->formconfirm(
243 $_SERVER["PHP_SELF"].'?key='.urlencode(GETPOST('key', 'alpha')),
244 $langs->trans('Delete'),
245 $langs->trans('ConfirmDeleteSetup', GETPOST('key', 'alpha')),
246 'confirm_deleteproperty',
247 '',
248 0,
249 1
250 );
251 print $formconfirm;
252}
253
254if ($action == 'create') {
255 $out = '<div class="addcustomprompt">';
256
257 $out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
258 $out .= '<input type="hidden" name="token" value="'.newToken().'">';
259 $out .= '<input type="hidden" name="action" value="update">';
260
261
262 $out .= '<table class="noborder centpercent">';
263 $out .= '<thead>';
264 $out .= '<tr class="liste_titre">';
265 $out .= '<td>'.$langs->trans('NewCustomPrompt').'</td>';
266 $out .= '<td></td>';
267 $out .= '</tr>';
268 $out .= '</thead>';
269
270 $out .= '<tbody>';
271 $out .= '<tr class="oddeven">';
272 $out .= '<td class="col-setup-title titlefield">';
273 $out .= '<span id="module" class="spanforparamtooltip">'.$langs->trans("Feature").'</span>';
274 $out .= '</td>';
275 $out .= '<td>';
276 // Combo list of AI features
277 $out .= '<select name="functioncode" id="functioncode" class="flat minwidth500">';
278 $out .= '<option>&nbsp;</option>';
279 foreach ($arrayofaifeatures as $featurekey => $feature) {
280 $labelhtml = $langs->trans($arrayofaifeatures[$featurekey]['label']).($arrayofaifeatures[$featurekey]['status'] == 'notused' ? ' <span class="opacitymedium">('.$langs->trans("NotYetAvailable").')</span>' : "");
281 $labeltext = $langs->trans($arrayofaifeatures[$featurekey]['label']);
282 $out .= '<option value="'.dol_escape_js($featurekey).'" data-html="'.dol_escape_htmltag($labelhtml).'">'.dol_escape_htmltag($labeltext).'</option>';
283 }
284 $out .= '</select>';
285 $out .= ajax_combobox("functioncode");
286 $out .= '<script type="text/javascript">
287 jQuery(document).ready(function() {
288 jQuery("#functioncode").on("change", function() {
289 console.log("We change value of ai function");
290 var changedValue = $(this).val();
291 console.log(changedValue);
292 var arrayplaceholder = {';
293 foreach ($arrayofaifeatures as $featurekey => $feature) {
294 $out .= dol_escape_js($featurekey).': \''.dol_escape_js(empty($feature['placeholder']) ? '' : $feature['placeholder']).'\',';
295 }
296 $out .= '}
297 jQuery("#prePromptInput'.dol_escape_js($key).'").val(arrayplaceholder[changedValue]);
298 });
299 });
300 </script>
301 ';
302
303 $out .= '</td>';
304 $out .= '</tr>';
305
306 $out .= '<tr class="oddeven">';
307 $out .= '<td class="col-setup-title">';
308 $out .= '<span id="prePrompt" class="spanforparamtooltip">';
309 $out .= $form->textwithpicto($langs->trans("Pre-Prompt"), $langs->trans("Pre-PromptHelp"));
310 $out .= '</span>';
311 $out .= '</td>';
312 $out .= '<td>';
313 $out .= '<textarea class="flat minwidth500 quatrevingtpercent" id="prePromptInput'.$key.'" name="prePrompt" rows="2"></textarea>';
314 $out .= '</td>';
315 $out .= '</tr>';
316 $out .= '<tr class="oddeven">';
317 $out .= '<td class="col-setup-title">';
318 $out .= '<span id="postPrompt" class="spanforparamtooltip">';
319 $out .= $form->textwithpicto($langs->trans("Post-Prompt"), $langs->trans("Post-PromptHelp"));
320 $out .= '</span>';
321 $out .= '</td>';
322 $out .= '<td>';
323 $out .= '<textarea class="flat minwidth500 quatrevingtpercent" id="postPromptInput" name="postPrompt" rows="2"></textarea>';
324 $out .= '</td>';
325 $out .= '</tr>';
326 $out .= '<tr class="oddeven">';
327 $out .= '<td class="col-setup-title">';
328 $out .= '<span id="blacklists" class="spanforparamtooltip">';
329 $out .= $form->textwithpicto($langs->trans("BlackListWords"), $langs->trans("BlackListWordsAIHelp").'.<br>'.$langs->trans("BlackListWordsHelp"));
330 $out .= '</span>';
331 $out .= '</td>';
332 $out .= '<td>';
333 $out .= '<input type="text" class="flat minwidth500 quatrevingtpercent" id="blacklistsInput" name="blacklists">';
334 $out .= '</td>';
335 $out .= '</tr>';
336 $out .= '</tbody>';
337 $out .= '</table>';
338
339 $out .= $form->buttonsSaveCancel("Add", "");
340 $out .= '</form>';
341
342 $out .= "<br>";
343 $out .= "<br>";
344
345 $out .= '</div>';
346
347 print $out;
348}
349
350if ($action == 'edit' || $action == 'create' || $action == 'deleteproperty') {
351 $out = '';
352
353 if (empty($currentConfigurations)) {
354 if ($action != 'create') {
355 print '<!-- no custom prompt-->'."\n";
356 print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
357 print '<br>';
358 print '<br>';
359 }
360 print '<br>';
361 } else {
362 print '<br>';
363
364 foreach ($currentConfigurations as $confkey => $config) {
365 if (!empty($confkey) && !preg_match('/^[a-z]+$/i', $confkey)) { // Ignore empty saved setup
366 continue;
367 }
368
369 $out .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
370 $out .= '<input type="hidden" name="token" value="'.newToken().'">';
371 $out .= '<input type="hidden" name="key" value="'.$confkey.'" />';
372 $out .= '<input type="hidden" name="action" value="updatePrompts">';
373 $out .= '<input type="hidden" name="page_y" value="">';
374
375 $out .= '<table class="noborder centpercent">';
376 $out .= '<thead>';
377 $out .= '<tr class="liste_titre">';
378 $out .= '<td class="titlefield">'.$arrayofaifeatures[$confkey]['picto'].' '.$langs->trans($arrayofaifeatures[$confkey]['label']);
379 $out .= '<a class="deletefielda reposition marginleftonly right" href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&token='.newToken().'&key='.urlencode($confkey).'">'.img_delete().'</a>';
380 $out .= '</td>';
381 $out .= '<td></td>';
382 $out .= '</tr>';
383 $out .= '</thead>';
384 $out .= '<tbody>';
385
386 $out .= '<tr class="oddeven">';
387 $out .= '<td class="col-setup-title">';
388 $out .= '<span id="prePrompt" class="spanforparamtooltip">'.$langs->trans("Pre-Prompt").'</span>';
389 $out .= '</td>';
390 $out .= '<td>';
391 $out .= '<textarea class="flat minwidth500 quatrevingtpercent" id="prePromptInput_'.$confkey.'" name="prePrompt" rows="2">'.$config['prePrompt'].'</textarea>';
392 $out .= '</td>';
393 $out .= '</tr>';
394
395 $out .= '<tr class="oddeven">';
396 $out .= '<td class="col-setup-title">';
397 $out .= '<span id="postPrompt" class="spanforparamtooltip">'.$langs->trans("Post-Prompt").'</span>';
398 $out .= '</td>';
399 $out .= '<td>';
400 $out .= '<textarea class="flat minwidth500 quatrevingtpercent" id="postPromptInput_'.$confkey.'" name="postPrompt" rows="2">'.$config['postPrompt'].'</textarea>';
401 $out .= '</td>';
402 $out .= '</tr>';
403
404 $out .= '<tr id="fichetwothirdright-'.$confkey.'" class="oddeven">';
405 $out .= '<td>'.$form->textwithpicto($langs->trans("BlackListWords"), $langs->trans("BlackListWordsHelp")).'</td>';
406 $out .= '<td>';
407 $out .= '<input type="text" class="flat minwidth500 quatrevingtpercent" id="blacklist_'.$confkey.'" name="blacklists" value="'.(isset($config['blacklists']) ? implode(', ', (array) $config['blacklists']) : '').'">';
408 $out .= '</td>';
409 $out .= '</tr>';
410
411 $out .= '<tr>';
412 $out .= '<td>'.$langs->trans("Test").'</td>';
413 $out .= '<td>';
414
415 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
416 $formmail = new FormMail($db);
417 $formmail->withaiprompt = 'html'; // set format
418
419 $showlinktoai = $confkey; // 'textgenerationemail', 'textgenerationwebpage', 'imagegeneration', ...
420 $showlinktoailabel = $langs->trans("ToTest");
421 $htmlname = $confkey;
422 $onlyenhancements = $confkey;
423 $showlinktolayout = 0;
424
425 // Fill $out
426 include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
427
428 $out .= '<div id="'.$htmlname.'"></div>';
429
430 $out .= '</td>';
431 $out .= '</tr>';
432
433 $out .= '</tbody>';
434 $out .= '</table>';
435
436 $out .= '<center><input type="submit" class="button small submitBtn reposition" name="modify" data-index="'.$confkey.'" value="'.dol_escape_htmltag($langs->trans("Save")).'"/></center>';
437
438 $out .= '</form>';
439
440 $out .= '<br><br>';
441 }
442 }
443
444 print $out;
445
446 print '<br>';
447}
448
449// Custom models
450if ($action == 'edit' || $action == 'create' || $action == 'deleteproperty') {
451 print load_fiche_titre($langs->trans("AIModelForFeature", $arrayofai[$aiservice]['label']), '', '');
452
453 print $formSetup->generateOutput(true);
454}
455
456
457if (empty($setupnotempty)) {
458 print '<br>'.$langs->trans("NothingToSetup");
459}
460
461
462// Datalist of the provider's available model ids (fed by ajax/list_models.php,
463// cached 1h server-side): every *_MODEL_* text input gets autocompletion, which
464// avoids typos in the seven free-text model fields. The fields stay plain free
465// text (a datalist only suggests, never constrains — required for local AI
466// providers with no model-listing API, where this whole block is a no-op).
467// Active check: a saved model absent from the provider's current list gets a
468// warning picto — warn only, never block, since a listing can be incomplete
469// (aliases, fine-tunes) while the value still works.
470print '<datalist id="ai-model-ids"></datalist>'."\n";
471print '<script nonce="'.getNonce().'">
472fetch("'.dol_buildpath('/ai/ajax/list_models.php', 1).'").then(function (r) { return r.json(); }).then(function (j) {
473 if (!j || !j.models || !j.models.length) return;
474 var dl = document.getElementById("ai-model-ids");
475 j.models.forEach(function (id) { var o = document.createElement("option"); o.value = id; dl.appendChild(o); });
476 document.querySelectorAll("input[name*=\'_MODEL_\']").forEach(function (i) {
477 i.setAttribute("list", "ai-model-ids");
478 if (i.value && j.models.indexOf(i.value) < 0) {
479 var w = document.createElement("span");
480 w.className = "fas fa-exclamation-triangle pictowarning paddingleft";
481 w.title = "'.dol_escape_js($langs->trans("AIModelNotInProviderList")).'";
482 i.insertAdjacentElement("afterend", w);
483 }
484 });
485}).catch(function () {});
486</script>'."\n";
487
488// Page end
489print dol_get_fiche_end();
490
491llxFooter();
492$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).
getListOfAIFeatures()
Prepare admin pages header.
Definition ai.lib.php:37
aiAdminPrepareHead()
Prepare admin pages header.
Definition ai.lib.php:408
getListOfAIServices()
Get list of available ai services.
Definition ai.lib.php:69
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:476
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
Class to generate HTML forms for single email Usage: $formai = new FormAI($db) $formai->proprietes=1 ...
Class to manage generation of HTML components Only common components must be here.
Class to manage a HTML form to send a unitary email Usage: $formail = new FormMail($db) $formmail->pr...
This class help you create setup render.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
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:519
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:717
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)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.