35require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
50$langs->loadLangs(array(
'admin',
'interventions',
'other'));
56$action =
GETPOST(
'action',
'aZ09');
57$value =
GETPOST(
'value',
'alpha');
58$modulepart =
GETPOST(
'modulepart',
'aZ09');
60$label =
GETPOST(
'label',
'alpha');
61$scandir =
GETPOST(
'scan_dir',
'alpha');
70include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
72if ($action ==
'updateMask') {
73 $maskconst =
GETPOST(
'maskconst',
'aZ09');
74 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
78 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
87 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
89 setEventMessages($langs->trans(
"Error"),
null,
'errors');
91} elseif ($action ==
'specimen') {
92 $modele =
GETPOST(
'module',
'alpha');
95 $inter->initAsSpecimen();
100 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
101 foreach ($dirmodels as $reldir) {
102 $file =
dol_buildpath($reldir.
"core/modules/fichinter/doc/pdf_".$modele.
".modules.php", 0);
103 if (file_exists($file)) {
104 $classname =
"pdf_".$modele;
109 if ($classname !==
'') {
113 '@phan-var-force ModelePDFFicheinter $module';
115 if (
$module->write_file($inter, $langs) > 0) {
116 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
123 $langs->load(
'errors');
124 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
125 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
127} elseif ($action ==
'set') {
130} elseif ($action ==
'del') {
137} elseif ($action ==
'setdoc') {
142 $conf->global->FICHEINTER_ADDON_PDF = $value;
150} elseif ($action ==
'setmod') {
155} elseif ($action ==
'set_FICHINTER_FREE_TEXT') {
156 $freetext =
GETPOST(
'FICHINTER_FREE_TEXT',
'restricthtml');
164 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
166 setEventMessages($langs->trans(
"Error"),
null,
'errors');
168} elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK') {
169 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
177 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
179 setEventMessages($langs->trans(
"Error"),
null,
'errors');
181} elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS') {
182 $setFichInterPrintProducts =
GETPOSTINT(
'value');
183 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", $setFichInterPrintProducts,
'yesno', 0,
'',
$conf->entity);
189 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
191 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
193} elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
194 $setFichInterUseServiceDuration =
GETPOSTINT(
'value');
195 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", $setFichInterUseServiceDuration,
'yesno', 0,
'',
$conf->entity);
201 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
203 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
205} elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
206 $setFichInterWithoutDuration =
GETPOSTINT(
'value');
207 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", $setFichInterWithoutDuration,
'yesno', 0,
'',
$conf->entity);
213 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
215 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
217} elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
218 $setFichInterDateWithoutHour =
GETPOSTINT(
'value');
219 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", $setFichInterDateWithoutHour,
'yesno', 0,
'',
$conf->entity);
225 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
227 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
229} elseif ($action ==
"set_FICHINTER_ALLOW_ONLINE_SIGN") {
230 $setFichInterAllowOnlineSign =
GETPOSTINT(
'value');
231 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_ONLINE_SIGN", $setFichInterAllowOnlineSign,
'yesno', 0,
'',
$conf->entity);
237 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
239 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
241} elseif ($action ==
"set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
242 $setFichInterAllowExternalDownload =
GETPOSTINT(
'value');
243 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", $setFichInterAllowExternalDownload,
'yesno', 0,
'',
$conf->entity);
249 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
251 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
261$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
263llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fichinter');
265$form =
new Form($db);
267$linkback =
'<a href="'.dolBuildUrl(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>';
269print
load_fiche_titre($langs->trans(
"InterventionsSetup"), $linkback,
'title_setup');
274print
dol_get_fiche_head($head,
'ficheinter', $langs->trans(
"Interventions"), -1,
'intervention');
280print
'<div class="div-table-responsive-no-min">';
281print
'<table class="noborder centpercent">';
282print
'<tr class="liste_titre">';
283print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
284print
'<td>'.$langs->trans(
"Description").
'</td>';
285print
'<td>'.$langs->trans(
"Example").
'</td>';
286print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
287print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
292$arrayofmodules = array();
294foreach ($dirmodels as $reldir) {
298 $handle = opendir($dir);
299 if (is_resource($handle)) {
300 while (($file = readdir($handle)) !==
false) {
301 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
304 require_once $dir.$file.
'.php';
308 '@phan-var-force ModeleNumRefFicheinter $module';
320'@phan-var-force ModeleNumRefFicheinter[] $arrayofmodules';
322foreach ($arrayofmodules as
$module) {
334 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
339 print
'<td class="nowrap">';
341 if (preg_match(
'/^Error/', $tmp)) {
342 $langs->load(
"errors");
343 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
344 } elseif ($tmp ==
'NotConfigured') {
345 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
351 print
'<td class="center">';
353 print img_picto($langs->trans(
"Activated"),
'switch_on');
355 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.urlencode($classname).
'" alt="'.$langs->trans(
"Default").
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
360 $ficheinter->initAsSpecimen();
364 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
366 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
367 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
369 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
370 $langs->load(
'errors');
371 $nextval = $langs->trans($nextval);
373 $htmltooltip .= $nextval.
'<br>';
375 $langs->load(
'errors');
376 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
379 print
'<td class="center">';
380 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
397printDocumentModelList(
'ficheinter',
'fichinter',
'FICHEINTER_ADDON_PDF', $langs->trans(
"TemplatePDFInterventions"), array(
398 'Logo' =>
'option_logo',
399 'PaymentMode' =>
'option_modereg',
400 'PaymentConditions' =>
'option_condreg',
401 'MultiLanguage' =>
'option_multilang',
402 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
412print
'<div class="div-table-responsive-no-min">';
413print
'<table class="noborder centpercent">';
414print
'<tr class="liste_titre">';
415print
'<td>'.$langs->trans(
"Parameter").
'</td>';
416print
'<td align="center" width="60"></td>';
417print
"<td> </td>\n";
421$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
422$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
423foreach ($substitutionarray as $key => $val) {
424 $htmltext .= $key.
'<br>';
428print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
429print
'<input type="hidden" name="token" value="'.newToken().
'">';
430print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
431print
'<tr class="oddeven"><td colspan="2">';
432print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
433$variablename =
'FICHINTER_FREE_TEXT';
435 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
437 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
439 print $doleditor->Create();
441print
'</td><td class="right">';
442print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
447print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">';
448print
'<input type="hidden" name="token" value="'.newToken().
'">';
449print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
450print
'<tr class="oddeven"><td>';
451print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
453print
'<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'FICHINTER_DRAFT_WATERMARK')).
'">';
454print
'</td><td class="right">';
455print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
460print
'<tr class="oddeven">';
461print
'<td width="80%">'.$langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
462print
'<td> </td>';
463print
'<td class="center">';
464if (
$conf->use_javascript_ajax) {
465 print ajax_constantonoff(
'FICHINTER_PRINT_PRODUCTS');
468 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_PRINT_PRODUCTS&token=' .
newToken() .
'&value=0">';
469 print img_picto($langs->trans(
"Activated"),
'switch_on');
471 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_PRINT_PRODUCTS&token=' .
newToken() .
'&value=1">';
472 print img_picto($langs->trans(
"Disabled"),
'switch_off');
480print
'<tr class="oddeven">';
481print
'<td width="80%">'.$langs->trans(
"UseServicesDurationOnFichinter").
'</td>';
482print
'<td> </td>';
483print
'<td class="center">';
484if (
$conf->use_javascript_ajax) {
485 print ajax_constantonoff(
'FICHINTER_USE_SERVICE_DURATION');
488 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_USE_SERVICE_DURATION&token=' .
newToken() .
'&value=0">';
489 print img_picto($langs->trans(
"Activated"),
'switch_on');
491 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_USE_SERVICE_DURATION&token=' .
newToken() .
'&value=1">';
492 print img_picto($langs->trans(
"Disabled"),
'switch_off');
500print
'<tr class="oddeven">';
501print
'<td width="80%">'.$langs->trans(
"UseDurationOnFichinter").
'</td>';
502print
'<td> </td>';
503print
'<td class="center">';
504if (
$conf->use_javascript_ajax) {
505 print ajax_constantonoff(
'FICHINTER_WITHOUT_DURATION');
508 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_WITHOUT_DURATION&token=' .
newToken() .
'&value=0">';
509 print img_picto($langs->trans(
"Activated"),
'switch_on');
511 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_WITHOUT_DURATION&token=' .
newToken() .
'&value=1">';
512 print img_picto($langs->trans(
"Disabled"),
'switch_off');
520print
'<tr class="oddeven">';
521print
'<td width="80%">'.$langs->trans(
"UseDateWithoutHourOnFichinter").
'</td>';
522print
'<td> </td>';
523print
'<td class="center">';
524if (
$conf->use_javascript_ajax) {
525 print ajax_constantonoff(
'FICHINTER_DATE_WITHOUT_HOUR');
528 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_DATE_WITHOUT_HOUR&token=' .
newToken() .
'&value=0">';
529 print img_picto($langs->trans(
"Activated"),
'switch_on');
531 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_DATE_WITHOUT_HOUR&token=' .
newToken() .
'&value=1">';
532 print img_picto($langs->trans(
"Disabled"),
'switch_off');
540print
'<tr class="oddeven">';
541print
'<td width="80%">'.$langs->trans(
"AllowOnlineSign").
'</td>';
542print
'<td> </td>';
543print
'<td class="center">';
544if (
$conf->use_javascript_ajax) {
545 print ajax_constantonoff(
'FICHINTER_ALLOW_ONLINE_SIGN');
548 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_ONLINE_SIGN&token=' .
newToken() .
'&value=0">';
549 print img_picto($langs->trans(
"Activated"),
'switch_on');
551 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_ONLINE_SIGN&token=' .
newToken() .
'&value=1">';
552 print img_picto($langs->trans(
"Disabled"),
'switch_off');
560print
'<tr class="oddeven">';
561print
'<td width="80%">'.$langs->trans(
"AllowExternalDownload").
'</td>';
562print
'<td> </td>';
563print
'<td class="center">';
564if (
$conf->use_javascript_ajax) {
565 print ajax_constantonoff(
'FICHINTER_ALLOW_EXTERNAL_DOWNLOAD');
568 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD&token=' .
newToken() .
'&value=0">';
569 print img_picto($langs->trans(
"Activated"),
'switch_on');
571 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD&token=' .
newToken() .
'&value=1">';
572 print img_picto($langs->trans(
"Disabled"),
'switch_off');
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
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.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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 a WYSIWYG editor.
if(! $sortfield) if(! $sortorder) $module
fichinter_admin_prepare_head()
Return array head with list of tabs to view object information.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
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_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.