32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
39$langs->loadLangs(array(
'admin',
'errors',
'interventions',
'other'));
45$action =
GETPOST(
'action',
'aZ09');
46$value =
GETPOST(
'value',
'alpha');
47$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$label =
GETPOST(
'label',
'alpha');
50$scandir =
GETPOST(
'scan_dir',
'alpha');
58include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
60if ($action ==
'updateMask') {
61 $maskconst =
GETPOST(
'maskconst',
'aZ09');
62 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
63 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
64 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
76} elseif ($action ==
'specimen') {
77 $modele =
GETPOST(
'module',
'alpha');
80 $inter->initAsSpecimen();
86 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
87 foreach ($dirmodels as $reldir) {
88 $file =
dol_buildpath($reldir.
"core/modules/fichinter/doc/pdf_".$modele.
".modules.php", 0);
89 if (file_exists($file)) {
91 $classname =
"pdf_".$modele;
99 $module =
new $classname($db);
101 if ($module->write_file($inter, $langs) > 0) {
102 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
110 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
112} elseif ($action ==
'set') {
115} elseif ($action ==
'del') {
118 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$value") {
122} elseif ($action ==
'setdoc') {
124 if (
dolibarr_set_const($db,
"FICHEINTER_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
127 $conf->global->FICHEINTER_ADDON_PDF = $value;
135} elseif ($action ==
'setmod') {
140} elseif ($action ==
'set_FICHINTER_FREE_TEXT') {
141 $freetext =
GETPOST(
'FICHINTER_FREE_TEXT',
'restricthtml');
142 $res =
dolibarr_set_const($db,
"FICHINTER_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
153} elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK') {
154 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
155 $res =
dolibarr_set_const($db,
"FICHINTER_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
166} elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS') {
167 $val =
GETPOST(
'FICHINTER_PRINT_PRODUCTS',
'alpha');
168 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
179} elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
180 $val =
GETPOST(
'FICHINTER_USE_SERVICE_DURATION',
'alpha');
181 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
192} elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
193 $val =
GETPOST(
'FICHINTER_WITHOUT_DURATION',
'alpha');
194 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
205} elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
206 $val =
GETPOST(
'FICHINTER_DATE_WITHOUT_HOUR',
'alpha');
207 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
218} elseif ($action ==
"set_FICHINTER_ALLOW_ONLINE_SIGN") {
219 $val =
GETPOST(
'FICHINTER_ALLOW_ONLINE_SIGN',
'alpha');
220 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_ONLINE_SIGN", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
231} elseif ($action ==
"set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
232 $val =
GETPOST(
'FICHINTER_ALLOW_EXTERNAL_DOWNLOAD',
'alpha');
233 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
252$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
256$form =
new Form($db);
258$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
259print
load_fiche_titre($langs->trans(
"InterventionsSetup"), $linkback,
'title_setup');
264print
dol_get_fiche_head($head,
'ficheinter', $langs->trans(
"Interventions"), -1,
'intervention');
270print
'<div class="div-table-responsive-no-min">';
271print
'<table class="noborder centpercent">';
272print
'<tr class="liste_titre">';
273print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
274print
'<td>'.$langs->trans(
"Description").
'</td>';
275print
'<td>'.$langs->trans(
"Example").
'</td>';
276print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
277print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
282foreach ($dirmodels as $reldir) {
286 $handle = opendir($dir);
287 if (is_resource($handle)) {
288 while (($file = readdir($handle)) !==
false) {
289 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
291 $classname = substr($file, 4);
293 require_once $dir.$file.
'.php';
295 $module =
new $file();
297 if ($module->isEnabled()) {
299 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
302 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
307 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
308 print $module->info($langs);
312 print
'<td class="nowrap">';
313 $tmp = $module->getExample();
314 if (preg_match(
'/^Error/', $tmp)) {
315 $langs->load(
"errors");
316 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
317 } elseif ($tmp ==
'NotConfigured') {
318 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
324 print
'<td class="center">';
325 if ($conf->global->FICHEINTER_ADDON == $classname) {
326 print
img_picto($langs->trans(
"Activated"),
'switch_on');
328 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>';
333 $ficheinter->initAsSpecimen();
337 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
338 $nextval = $module->getNextValue($mysoc, $ficheinter);
339 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
340 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
342 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
343 $nextval = $langs->trans($nextval);
345 $htmltooltip .= $nextval.
'<br>';
347 $htmltooltip .= $langs->trans($module->error).
'<br>';
350 print
'<td class="center">';
351 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
379$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
380$sql .=
" WHERE type = '".$db->escape($type).
"'";
381$sql .=
" AND entity = ".$conf->entity;
382$resql = $db->query($sql);
385 $num_rows = $db->num_rows($resql);
386 while ($i < $num_rows) {
387 $array = $db->fetch_array($resql);
388 array_push($def, $array[0]);
396print
'<div class="div-table-responsive-no-min">';
397print
'<table class="noborder centpercent">';
398print
'<tr class="liste_titre">';
399print
'<td>'.$langs->trans(
"Name").
'</td>';
400print
'<td>'.$langs->trans(
"Description").
'</td>';
401print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
402print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
403print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
404print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
409foreach ($dirmodels as $reldir) {
410 $realpath = $reldir.
"core/modules/fichinter/doc";
414 $handle = opendir($dir);
415 if (is_resource($handle)) {
416 while (($file = readdir($handle)) !==
false) {
422 foreach ($filelist as $file) {
423 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
424 if (file_exists($dir.
'/'.$file)) {
425 $name = substr($file, 4,
dol_strlen($file) - 16);
426 $classname = substr($file, 0,
dol_strlen($file) - 12);
428 require_once $dir.
'/'.$file;
429 $module =
new $classname($db);
431 $modulequalified = 1;
432 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
433 $modulequalified = 0;
435 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
436 $modulequalified = 0;
439 if ($modulequalified) {
440 print
'<tr class="oddeven"><td width="100">';
441 print(empty($module->name) ? $name : $module->
name);
443 if (method_exists($module,
'info')) {
444 print $module->info($langs);
446 print $module->description;
451 if (in_array($name, $def)) {
452 print
"<td align=\"center\">\n";
453 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">';
454 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
458 print
"<td align=\"center\">\n";
459 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
464 print
"<td align=\"center\">";
465 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$name") {
466 print
img_picto($langs->trans(
"Default"),
'on');
468 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
473 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
474 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
475 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
476 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
478 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
479 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
480 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
481 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
482 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
483 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
484 print
'<td class="center">';
485 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
489 print
'<td class="center">';
490 if ($module->type ==
'pdf') {
491 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
493 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
516print
'<div class="div-table-responsive-no-min">';
517print
'<table class="noborder centpercent">';
518print
'<tr class="liste_titre">';
519print
'<td>'.$langs->trans(
"Parameter").
'</td>';
520print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
521print
"<td> </td>\n";
525$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
526$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
527foreach ($substitutionarray as $key => $val) {
528 $htmltext .= $key.
'<br>';
532print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
533print
'<input type="hidden" name="token" value="'.newToken().
'">';
534print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
535print
'<tr class="oddeven"><td colspan="2">';
536print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
537$variablename =
'FICHINTER_FREE_TEXT';
539 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
541 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
543 print $doleditor->Create();
545print
'</td><td class="right">';
546print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
551print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
552print
'<input type="hidden" name="token" value="'.newToken().
'">';
553print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
554print
'<tr class="oddeven"><td>';
555print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
557print
'<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'FICHINTER_DRAFT_WATERMARK')).
'">';
558print
'</td><td class="right">';
559print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
563print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
564print
'<input type="hidden" name="token" value="'.newToken().
'">';
565print
'<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
566print
'<tr class="oddeven"><td>';
567print $langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
568print
'<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
573print
'</td><td class="right">';
574print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
578print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
579print
'<input type="hidden" name="token" value="'.newToken().
'">';
580print
'<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
581print
'<tr class="oddeven">';
583print $langs->trans(
"UseServicesDurationOnFichinter");
585print
'<td class="center">';
586print
'<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString(
"FICHINTER_USE_SERVICE_DURATION") ?
' checked' :
'').
'>';
588print
'<td class="right">';
589print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
594print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
595print
'<input type="hidden" name="token" value="'.newToken().
'">';
596print
'<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
597print
'<tr class="oddeven">';
599print $langs->trans(
"UseDurationOnFichinter");
601print
'<td class="center">';
602print
'<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString(
"FICHINTER_WITHOUT_DURATION") ?
' checked' :
'').
'>';
604print
'<td class="right">';
605print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
610print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
611print
'<input type="hidden" name="token" value="'.newToken().
'">';
612print
'<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
613print
'<tr class="oddeven">';
615print $langs->trans(
"UseDateWithoutHourOnFichinter");
617print
'<td class="center">';
618print
'<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString(
"FICHINTER_DATE_WITHOUT_HOUR") ?
' checked' :
'').
'>';
620print
'<td class="right">';
621print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
626print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
627print
'<input type="hidden" name="token" value="'.newToken().
'">';
628print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
629print
'<tr class="oddeven">';
631print $langs->trans(
"AllowOnlineSign");
633print
'<td class="center">';
634print
'<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString(
"FICHINTER_ALLOW_ONLINE_SIGN") ?
' checked' :
'').
'>';
636print
'<td class="right">';
637print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
642print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
643print
'<input type="hidden" name="token" value="'.newToken().
'">';
644print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
645print
'<tr class="oddeven">';
647print $langs->trans(
"AllowExternalDownload");
649print
'<td class="center">';
650print
'<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString(
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ?
' checked' :
'').
'>';
652print
'<td class="right">';
653print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
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.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage interventions.
fichinter_admin_prepare_head()
Return array head with list of tabs to view object informations.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.