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();
83 $file =
''; $classname =
''; $filefound = 0;
84 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
85 foreach ($dirmodels as $reldir) {
86 $file =
dol_buildpath($reldir.
"core/modules/fichinter/doc/pdf_".$modele.
".modules.php", 0);
87 if (file_exists($file)) {
89 $classname =
"pdf_".$modele;
97 $module =
new $classname($db);
99 if ($module->write_file($inter, $langs) > 0) {
100 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
108 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
110} elseif ($action ==
'set') {
113} elseif ($action ==
'del') {
116 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$value") {
120} elseif ($action ==
'setdoc') {
122 if (
dolibarr_set_const($db,
"FICHEINTER_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
125 $conf->global->FICHEINTER_ADDON_PDF = $value;
133} elseif ($action ==
'setmod') {
138} elseif ($action ==
'set_FICHINTER_FREE_TEXT') {
139 $freetext =
GETPOST(
'FICHINTER_FREE_TEXT',
'restricthtml');
140 $res =
dolibarr_set_const($db,
"FICHINTER_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
151} elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK') {
152 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
153 $res =
dolibarr_set_const($db,
"FICHINTER_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
164} elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS') {
165 $val =
GETPOST(
'FICHINTER_PRINT_PRODUCTS',
'alpha');
166 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
177} elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
178 $val =
GETPOST(
'FICHINTER_USE_SERVICE_DURATION',
'alpha');
179 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
190} elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
191 $val =
GETPOST(
'FICHINTER_WITHOUT_DURATION',
'alpha');
192 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
203} elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
204 $val =
GETPOST(
'FICHINTER_DATE_WITHOUT_HOUR',
'alpha');
205 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
216} elseif ($action ==
"set_FICHINTER_ALLOW_ONLINE_SIGN") {
217 $val =
GETPOST(
'FICHINTER_ALLOW_ONLINE_SIGN',
'alpha');
218 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_ONLINE_SIGN", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
229} elseif ($action ==
"set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
230 $val =
GETPOST(
'FICHINTER_ALLOW_EXTERNAL_DOWNLOAD',
'alpha');
231 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
250$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
254$form =
new Form($db);
256$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
257print
load_fiche_titre($langs->trans(
"InterventionsSetup"), $linkback,
'title_setup');
262print
dol_get_fiche_head($head,
'ficheinter', $langs->trans(
"Interventions"), -1,
'intervention');
268print
'<div class="div-table-responsive-no-min">';
269print
'<table class="noborder centpercent">';
270print
'<tr class="liste_titre">';
271print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
272print
'<td>'.$langs->trans(
"Description").
'</td>';
273print
'<td>'.$langs->trans(
"Example").
'</td>';
274print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
275print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
280foreach ($dirmodels as $reldir) {
284 $handle = opendir($dir);
285 if (is_resource($handle)) {
286 while (($file = readdir($handle)) !==
false) {
287 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
289 $classname = substr($file, 4);
291 require_once $dir.$file.
'.php';
295 if ($module->isEnabled()) {
297 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
300 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
305 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
306 print $module->info();
310 print
'<td class="nowrap">';
311 $tmp = $module->getExample();
312 if (preg_match(
'/^Error/', $tmp)) {
313 $langs->load(
"errors");
314 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
315 } elseif ($tmp ==
'NotConfigured') {
316 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
322 print
'<td class="center">';
323 if ($conf->global->FICHEINTER_ADDON == $classname) {
324 print
img_picto($langs->trans(
"Activated"),
'switch_on');
326 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>';
331 $ficheinter->initAsSpecimen();
335 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
336 $nextval = $module->getNextValue($mysoc, $ficheinter);
337 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
338 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
340 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
341 $nextval = $langs->trans($nextval);
343 $htmltooltip .= $nextval.
'<br>';
345 $htmltooltip .= $langs->trans($module->error).
'<br>';
348 print
'<td class="center">';
349 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
377$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
378$sql .=
" WHERE type = '".$db->escape($type).
"'";
379$sql .=
" AND entity = ".$conf->entity;
380$resql = $db->query($sql);
383 $num_rows = $db->num_rows($resql);
384 while ($i < $num_rows) {
385 $array = $db->fetch_array($resql);
386 array_push($def, $array[0]);
394print
'<div class="div-table-responsive-no-min">';
395print
'<table class="noborder centpercent">';
396print
'<tr class="liste_titre">';
397print
'<td>'.$langs->trans(
"Name").
'</td>';
398print
'<td>'.$langs->trans(
"Description").
'</td>';
399print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
400print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
401print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
402print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
407foreach ($dirmodels as $reldir) {
408 $realpath = $reldir.
"core/modules/fichinter/doc";
412 $handle = opendir($dir);
413 if (is_resource($handle)) {
414 while (($file = readdir($handle)) !==
false) {
420 foreach ($filelist as $file) {
421 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
422 if (file_exists($dir.
'/'.$file)) {
423 $name = substr($file, 4,
dol_strlen($file) - 16);
424 $classname = substr($file, 0,
dol_strlen($file) - 12);
426 require_once $dir.
'/'.$file;
427 $module =
new $classname($db);
429 $modulequalified = 1;
430 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
431 $modulequalified = 0;
433 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
434 $modulequalified = 0;
437 if ($modulequalified) {
438 print
'<tr class="oddeven"><td width="100">';
439 print (empty($module->name) ? $name : $module->
name);
441 if (method_exists($module,
'info')) {
442 print $module->info($langs);
444 print $module->description;
449 if (in_array($name, $def)) {
450 print
"<td align=\"center\">\n";
451 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">';
452 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
456 print
"<td align=\"center\">\n";
457 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>';
462 print
"<td align=\"center\">";
463 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$name") {
464 print
img_picto($langs->trans(
"Default"),
'on');
466 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>';
471 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
472 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
473 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
474 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
476 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
477 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
478 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
479 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
480 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
481 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
482 print
'<td class="center">';
483 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
487 print
'<td class="center">';
488 if ($module->type ==
'pdf') {
489 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
491 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
514print
'<div class="div-table-responsive-no-min">';
515print
'<table class="noborder centpercent">';
516print
'<tr class="liste_titre">';
517print
'<td>'.$langs->trans(
"Parameter").
'</td>';
518print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
519print
"<td> </td>\n";
523$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
524$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
525foreach ($substitutionarray as $key => $val) {
526 $htmltext .= $key.
'<br>';
530print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
531print
'<input type="hidden" name="token" value="'.newToken().
'">';
532print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
533print
'<tr class="oddeven"><td colspan="2">';
534print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
535$variablename =
'FICHINTER_FREE_TEXT';
536if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
537 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
539 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
541 print $doleditor->Create();
543print
'</td><td class="right">';
544print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
549print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
550print
'<input type="hidden" name="token" value="'.newToken().
'">';
551print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
552print
'<tr class="oddeven"><td>';
553print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
555print
'<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'FICHINTER_DRAFT_WATERMARK')).
'">';
556print
'</td><td class="right">';
557print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
561print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
562print
'<input type="hidden" name="token" value="'.newToken().
'">';
563print
'<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
564print
'<tr class="oddeven"><td>';
565print $langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
566print
'<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
571print
'</td><td class="right">';
572print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
576print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
577print
'<input type="hidden" name="token" value="'.newToken().
'">';
578print
'<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
579print
'<tr class="oddeven">';
581print $langs->trans(
"UseServicesDurationOnFichinter");
583print
'<td class="center">';
584print
'<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString(
"FICHINTER_USE_SERVICE_DURATION") ?
' checked' :
'').
'>';
586print
'<td class="right">';
587print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
592print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
593print
'<input type="hidden" name="token" value="'.newToken().
'">';
594print
'<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
595print
'<tr class="oddeven">';
597print $langs->trans(
"UseDurationOnFichinter");
599print
'<td class="center">';
600print
'<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString(
"FICHINTER_WITHOUT_DURATION") ?
' checked' :
'').
'>';
602print
'<td class="right">';
603print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
608print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
609print
'<input type="hidden" name="token" value="'.newToken().
'">';
610print
'<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
611print
'<tr class="oddeven">';
613print $langs->trans(
"UseDateWithoutHourOnFichinter");
615print
'<td class="center">';
616print
'<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString(
"FICHINTER_DATE_WITHOUT_HOUR") ?
' checked' :
'').
'>';
618print
'<td class="right">';
619print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
624print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
625print
'<input type="hidden" name="token" value="'.newToken().
'">';
626print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
627print
'<tr class="oddeven">';
629print $langs->trans(
"AllowOnlineSign");
631print
'<td class="center">';
632print
'<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString(
"FICHINTER_ALLOW_ONLINE_SIGN") ?
' checked' :
'').
'>';
634print
'<td class="right">';
635print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
640print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
641print
'<input type="hidden" name="token" value="'.newToken().
'">';
642print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
643print
'<tr class="oddeven">';
645print $langs->trans(
"AllowExternalDownload");
647print
'<td class="center">';
648print
'<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString(
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ?
' checked' :
'').
'>';
650print
'<td class="right">';
651print
'<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.
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.