34require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
38require_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)) {
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 !==
'') {
112 $module =
new $classname($db);
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");
124 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
126} elseif ($action ==
'set') {
129} elseif ($action ==
'del') {
132 if (
$conf->global->FICHEINTER_ADDON_PDF ==
"$value") {
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');
167} elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK') {
168 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
180} elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS') {
181 $val =
GETPOST(
'FICHINTER_PRINT_PRODUCTS',
'alpha');
182 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
193} elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
194 $val =
GETPOST(
'FICHINTER_USE_SERVICE_DURATION',
'alpha');
195 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
206} elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
207 $val =
GETPOST(
'FICHINTER_WITHOUT_DURATION',
'alpha');
208 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
219} elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
220 $val =
GETPOST(
'FICHINTER_DATE_WITHOUT_HOUR',
'alpha');
221 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
232} elseif ($action ==
"set_FICHINTER_ALLOW_ONLINE_SIGN") {
233 $val =
GETPOST(
'FICHINTER_ALLOW_ONLINE_SIGN',
'alpha');
234 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_ONLINE_SIGN", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
245} elseif ($action ==
"set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") {
246 $val =
GETPOST(
'FICHINTER_ALLOW_EXTERNAL_DOWNLOAD',
'alpha');
247 $res =
dolibarr_set_const($db,
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD", ($val ==
'on' ? 1 : 0),
'bool', 0,
'',
$conf->entity);
266$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
268llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fichinter');
270$form =
new Form($db);
272$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
273print
load_fiche_titre($langs->trans(
"InterventionsSetup"), $linkback,
'title_setup');
278print
dol_get_fiche_head($head,
'ficheinter', $langs->trans(
"Interventions"), -1,
'intervention');
284print
'<div class="div-table-responsive-no-min">';
285print
'<table class="noborder centpercent">';
286print
'<tr class="liste_titre">';
287print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
288print
'<td>'.$langs->trans(
"Description").
'</td>';
289print
'<td>'.$langs->trans(
"Example").
'</td>';
290print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
291print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
296foreach ($dirmodels as $reldir) {
300 $handle = opendir($dir);
301 if (is_resource($handle)) {
302 while (($file = readdir($handle)) !==
false) {
303 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg)) {
305 $classname = substr($file, 4);
307 require_once $dir.$file.
'.php';
309 $module =
new $file();
311 '@phan-var-force ModeleNumRefFicheinter $module';
313 if ($module->isEnabled()) {
315 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
318 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
323 print
'<tr class="oddeven"><td>'.$module->getName($langs).
"</td><td>\n";
324 print $module->info($langs);
328 print
'<td class="nowrap">';
329 $tmp = $module->getExample();
330 if (preg_match(
'/^Error/', $tmp)) {
331 $langs->load(
"errors");
332 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
333 } elseif ($tmp ==
'NotConfigured') {
334 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
340 print
'<td class="center">';
341 if (
$conf->global->FICHEINTER_ADDON == $classname) {
342 print
img_picto($langs->trans(
"Activated"),
'switch_on');
344 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>';
349 $ficheinter->initAsSpecimen();
353 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
354 $nextval = $module->getNextValue($mysoc, $ficheinter);
355 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
356 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
358 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
359 $nextval = $langs->trans($nextval);
361 $htmltooltip .= $nextval.
'<br>';
363 $htmltooltip .= $langs->trans($module->error).
'<br>';
366 print
'<td class="center">';
367 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
395$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
396$sql .=
" WHERE type = '".$db->escape($type).
"'";
397$sql .=
" AND entity = ".$conf->entity;
398$resql = $db->query($sql);
401 $num_rows = $db->num_rows($resql);
402 while ($i < $num_rows) {
403 $array = $db->fetch_array($resql);
404 if (is_array($array)) {
405 array_push($def, $array[0]);
414print
'<div class="div-table-responsive-no-min">';
415print
'<table class="noborder centpercent">';
416print
'<tr class="liste_titre">';
417print
'<td>'.$langs->trans(
"Name").
'</td>';
418print
'<td>'.$langs->trans(
"Description").
'</td>';
419print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
420print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
421print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
422print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
427foreach ($dirmodels as $reldir) {
428 $realpath = $reldir.
"core/modules/fichinter/doc";
432 $handle = opendir($dir);
433 if (is_resource($handle)) {
435 while (($file = readdir($handle)) !==
false) {
441 foreach ($filelist as $file) {
442 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
443 if (file_exists($dir.
'/'.$file)) {
444 $name = substr($file, 4,
dol_strlen($file) - 16);
445 $classname = substr($file, 0,
dol_strlen($file) - 12);
447 require_once $dir.
'/'.$file;
448 $module =
new $classname($db);
450 '@phan-var-force ModelePDFFicheinter $module';
452 $modulequalified = 1;
453 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
454 $modulequalified = 0;
456 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
457 $modulequalified = 0;
460 if ($modulequalified) {
461 print
'<tr class="oddeven"><td width="100">';
462 print(empty($module->name) ? $name : $module->
name);
464 if (method_exists($module,
'info')) {
465 print $module->info($langs);
467 print $module->description;
472 if (in_array($name, $def)) {
473 print
"<td align=\"center\">\n";
474 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">';
475 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
479 print
"<td align=\"center\">\n";
480 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>';
485 print
"<td align=\"center\">";
486 if (
$conf->global->FICHEINTER_ADDON_PDF ==
"$name") {
487 print
img_picto($langs->trans(
"Default"),
'on');
489 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>';
494 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
495 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
496 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
497 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
499 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
500 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
501 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
502 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
503 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
504 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
505 print
'<td class="center">';
506 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
510 print
'<td class="center">';
511 if ($module->type ==
'pdf') {
512 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
514 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
537print
'<div class="div-table-responsive-no-min">';
538print
'<table class="noborder centpercent">';
539print
'<tr class="liste_titre">';
540print
'<td>'.$langs->trans(
"Parameter").
'</td>';
541print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
542print
"<td> </td>\n";
546$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
547$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
548foreach ($substitutionarray as $key => $val) {
549 $htmltext .= $key.
'<br>';
553print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
554print
'<input type="hidden" name="token" value="'.newToken().
'">';
555print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
556print
'<tr class="oddeven"><td colspan="2">';
557print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
558$variablename =
'FICHINTER_FREE_TEXT';
560 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
562 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
564 print $doleditor->Create();
566print
'</td><td class="right">';
567print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
572print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
573print
'<input type="hidden" name="token" value="'.newToken().
'">';
574print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
575print
'<tr class="oddeven"><td>';
576print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
578print
'<input class="flat minwidth200" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'FICHINTER_DRAFT_WATERMARK')).
'">';
579print
'</td><td class="right">';
580print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
584print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
585print
'<input type="hidden" name="token" value="'.newToken().
'">';
586print
'<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
587print
'<tr class="oddeven"><td>';
588print $langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
589print
'<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
594print
'</td><td class="right">';
595print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
599print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
600print
'<input type="hidden" name="token" value="'.newToken().
'">';
601print
'<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
602print
'<tr class="oddeven">';
604print $langs->trans(
"UseServicesDurationOnFichinter");
606print
'<td class="center">';
607print
'<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.(getDolGlobalString(
"FICHINTER_USE_SERVICE_DURATION") ?
' checked' :
'').
'>';
609print
'<td class="right">';
610print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
615print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
616print
'<input type="hidden" name="token" value="'.newToken().
'">';
617print
'<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
618print
'<tr class="oddeven">';
620print $langs->trans(
"UseDurationOnFichinter");
622print
'<td class="center">';
623print
'<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.(getDolGlobalString(
"FICHINTER_WITHOUT_DURATION") ?
' checked' :
'').
'>';
625print
'<td class="right">';
626print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
631print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
632print
'<input type="hidden" name="token" value="'.newToken().
'">';
633print
'<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
634print
'<tr class="oddeven">';
636print $langs->trans(
"UseDateWithoutHourOnFichinter");
638print
'<td class="center">';
639print
'<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.(getDolGlobalString(
"FICHINTER_DATE_WITHOUT_HOUR") ?
' checked' :
'').
'>';
641print
'<td class="right">';
642print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
647print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
648print
'<input type="hidden" name="token" value="'.newToken().
'">';
649print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_ONLINE_SIGN">';
650print
'<tr class="oddeven">';
652print $langs->trans(
"AllowOnlineSign");
654print
'<td class="center">';
655print
'<input type="checkbox" name="FICHINTER_ALLOW_ONLINE_SIGN"'.(getDolGlobalString(
"FICHINTER_ALLOW_ONLINE_SIGN") ?
' checked' :
'').
'>';
657print
'<td class="right">';
658print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
663print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
664print
'<input type="hidden" name="token" value="'.newToken().
'">';
665print
'<input type="hidden" name="action" value="set_FICHINTER_ALLOW_EXTERNAL_DOWNLOAD">';
666print
'<tr class="oddeven">';
668print $langs->trans(
"AllowExternalDownload");
670print
'<td class="center">';
671print
'<input type="checkbox" name="FICHINTER_ALLOW_EXTERNAL_DOWNLOAD"'.(getDolGlobalString(
"FICHINTER_ALLOW_EXTERNAL_DOWNLOAD") ?
' checked' :
'').
'>';
673print
'<td class="right">';
674print
'<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($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.
fichinter_admin_prepare_head()
Return array head with list of tabs to view object information.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
Show picto whatever it's its name (generic function)
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.