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',
'errors',
'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 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
124 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
126} elseif ($action ==
'set') {
129} elseif ($action ==
'del') {
136} elseif ($action ==
'setdoc') {
141 $conf->global->FICHEINTER_ADDON_PDF = $value;
149} elseif ($action ==
'setmod') {
154} elseif ($action ==
'set_FICHINTER_FREE_TEXT') {
155 $freetext =
GETPOST(
'FICHINTER_FREE_TEXT',
'restricthtml');
163 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
165 setEventMessages($langs->trans(
"Error"),
null,
'errors');
167} elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK') {
168 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
176 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
178 setEventMessages($langs->trans(
"Error"),
null,
'errors');
180} elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS') {
181 $setFichInterPrintProducts =
GETPOSTINT(
'value');
182 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", $setFichInterPrintProducts,
'yesno', 0,
'',
$conf->entity);
188 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
190 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
192} elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
193 $setFichInterUseServiceDuration =
GETPOSTINT(
'value');
194 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", $setFichInterUseServiceDuration,
'yesno', 0,
'',
$conf->entity);
200 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
202 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
204} elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
205 $setFichInterWithoutDuration =
GETPOSTINT(
'value');
206 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", $setFichInterWithoutDuration,
'yesno', 0,
'',
$conf->entity);
212 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
214 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
216} elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
217 $setFichInterDateWithoutHour =
GETPOSTINT(
'value');
218 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", $setFichInterDateWithoutHour,
'yesno', 0,
'',
$conf->entity);
224 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
226 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
228} elseif ($action ==
"set_FICHINTER_ALLOW_ONLINE_SIGN") {
229 $setFichInterAllowOnlineSign =
GETPOSTINT(
'value');
230 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_ONLINE_SIGN", $setFichInterAllowOnlineSign,
'yesno', 0,
'',
$conf->entity);
236 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
238 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
240} elseif ($action ==
"set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
241 $setFichInterAllowExternalDownload =
GETPOSTINT(
'value');
242 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", $setFichInterAllowExternalDownload,
'yesno', 0,
'',
$conf->entity);
248 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
250 setEventMessages($langs->trans(
"Error"),
null,
'mesgs');
260$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
262llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fichinter');
264$form =
new Form($db);
266$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>';
268print
load_fiche_titre($langs->trans(
"InterventionsSetup"), $linkback,
'title_setup');
273print
dol_get_fiche_head($head,
'ficheinter', $langs->trans(
"Interventions"), -1,
'intervention');
279print
'<div class="div-table-responsive-no-min">';
280print
'<table class="noborder centpercent">';
281print
'<tr class="liste_titre">';
282print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
283print
'<td>'.$langs->trans(
"Description").
'</td>';
284print
'<td>'.$langs->trans(
"Example").
'</td>';
285print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
286print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
291foreach ($dirmodels as $reldir) {
295 $handle = opendir($dir);
296 if (is_resource($handle)) {
297 while (($file = readdir($handle)) !==
false) {
298 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
302 require_once $dir.$file.
'.php';
306 '@phan-var-force ModeleNumRefFicheinter $module';
318 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
323 print
'<td class="nowrap">';
325 if (preg_match(
'/^Error/', $tmp)) {
326 $langs->load(
"errors");
327 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
328 } elseif ($tmp ==
'NotConfigured') {
329 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
335 print
'<td class="center">';
337 print img_picto($langs->trans(
"Activated"),
'switch_on');
339 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>';
344 $ficheinter->initAsSpecimen();
348 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.
$module->getVersion().
'</b><br>';
350 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
351 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
353 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
354 $nextval = $langs->trans($nextval);
356 $htmltooltip .= $nextval.
'<br>';
358 $htmltooltip .= $langs->trans(
$module->error).
'<br>';
361 print
'<td class="center">';
362 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
384printDocumentModelList(
'ficheinter',
'fichinter',
'FICHEINTER_ADDON_PDF', $langs->trans(
"TemplatePDFInterventions"), array(
385 'Logo' =>
'option_logo',
386 'PaymentMode' =>
'option_modereg',
387 'PaymentConditions' =>
'option_condreg',
388 'MultiLanguage' =>
'option_multilang',
389 'WatermarkOnDraftOrders' =>
'option_draft_watermark',
399print
'<div class="div-table-responsive-no-min">';
400print
'<table class="noborder centpercent">';
401print
'<tr class="liste_titre">';
402print
'<td>'.$langs->trans(
"Parameter").
'</td>';
403print
'<td align="center" width="60"></td>';
404print
"<td> </td>\n";
408$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
409$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
410foreach ($substitutionarray as $key => $val) {
411 $htmltext .= $key.
'<br>';
415print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
416print
'<input type="hidden" name="token" value="'.newToken().
'">';
417print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
418print
'<tr class="oddeven"><td colspan="2">';
419print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
420$variablename =
'FICHINTER_FREE_TEXT';
422 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
424 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
426 print $doleditor->Create();
428print
'</td><td class="right">';
429print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
434print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">';
435print
'<input type="hidden" name="token" value="'.newToken().
'">';
436print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
437print
'<tr class="oddeven"><td>';
438print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
440print
'<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'FICHINTER_DRAFT_WATERMARK')).
'">';
441print
'</td><td class="right">';
442print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
447print
'<tr class="oddeven">';
448print
'<td width="80%">'.$langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
449print
'<td> </td>';
450print
'<td class="center">';
451if (
$conf->use_javascript_ajax) {
452 print ajax_constantonoff(
'FICHINTER_PRINT_PRODUCTS');
455 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_PRINT_PRODUCTS&token=' .
newToken() .
'&value=0">';
456 print img_picto($langs->trans(
"Activated"),
'switch_on');
458 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_PRINT_PRODUCTS&token=' .
newToken() .
'&value=1">';
459 print img_picto($langs->trans(
"Disabled"),
'switch_off');
467print
'<tr class="oddeven">';
468print
'<td width="80%">'.$langs->trans(
"UseServicesDurationOnFichinter").
'</td>';
469print
'<td> </td>';
470print
'<td class="center">';
471if (
$conf->use_javascript_ajax) {
472 print ajax_constantonoff(
'FICHINTER_USE_SERVICE_DURATION');
475 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_USE_SERVICE_DURATION&token=' .
newToken() .
'&value=0">';
476 print img_picto($langs->trans(
"Activated"),
'switch_on');
478 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_USE_SERVICE_DURATION&token=' .
newToken() .
'&value=1">';
479 print img_picto($langs->trans(
"Disabled"),
'switch_off');
487print
'<tr class="oddeven">';
488print
'<td width="80%">'.$langs->trans(
"UseDurationOnFichinter").
'</td>';
489print
'<td> </td>';
490print
'<td class="center">';
491if (
$conf->use_javascript_ajax) {
492 print ajax_constantonoff(
'FICHINTER_WITHOUT_DURATION');
495 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_WITHOUT_DURATION&token=' .
newToken() .
'&value=0">';
496 print img_picto($langs->trans(
"Activated"),
'switch_on');
498 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_WITHOUT_DURATION&token=' .
newToken() .
'&value=1">';
499 print img_picto($langs->trans(
"Disabled"),
'switch_off');
507print
'<tr class="oddeven">';
508print
'<td width="80%">'.$langs->trans(
"UseDateWithoutHourOnFichinter").
'</td>';
509print
'<td> </td>';
510print
'<td class="center">';
511if (
$conf->use_javascript_ajax) {
512 print ajax_constantonoff(
'FICHINTER_DATE_WITHOUT_HOUR');
515 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_DATE_WITHOUT_HOUR&token=' .
newToken() .
'&value=0">';
516 print img_picto($langs->trans(
"Activated"),
'switch_on');
518 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_DATE_WITHOUT_HOUR&token=' .
newToken() .
'&value=1">';
519 print img_picto($langs->trans(
"Disabled"),
'switch_off');
527print
'<tr class="oddeven">';
528print
'<td width="80%">'.$langs->trans(
"AllowOnlineSign").
'</td>';
529print
'<td> </td>';
530print
'<td class="center">';
531if (
$conf->use_javascript_ajax) {
532 print ajax_constantonoff(
'FICHINTER_ALLOW_ONLINE_SIGN');
535 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_ONLINE_SIGN&token=' .
newToken() .
'&value=0">';
536 print img_picto($langs->trans(
"Activated"),
'switch_on');
538 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_ONLINE_SIGN&token=' .
newToken() .
'&value=1">';
539 print img_picto($langs->trans(
"Disabled"),
'switch_off');
547print
'<tr class="oddeven">';
548print
'<td width="80%">'.$langs->trans(
"AllowExternalDownload").
'</td>';
549print
'<td> </td>';
550print
'<td class="center">';
551if (
$conf->use_javascript_ajax) {
552 print ajax_constantonoff(
'FICHINTER_ALLOW_EXTERNAL_DOWNLOAD');
555 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD&token=' .
newToken() .
'&value=0">';
556 print img_picto($langs->trans(
"Activated"),
'switch_on');
558 print
'<a class="reposition" href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD&token=' .
newToken() .
'&value=1">';
559 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.
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.
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.