31 require
'../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fichinter.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
38 $langs->loadLangs(array(
'admin',
'errors',
'interventions',
'other'));
42 $action =
GETPOST(
'action',
'aZ09');
43 $value =
GETPOST(
'value',
'alpha');
44 $label =
GETPOST(
'label',
'alpha');
45 $scandir =
GETPOST(
'scan_dir',
'alpha');
53 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
55 if ($action ==
'updateMask')
57 $maskconst =
GETPOST(
'maskconst',
'alpha');
58 $maskvalue =
GETPOST(
'maskvalue',
'alpha');
59 if ($maskconst) $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
61 if (!($res > 0)) $error++;
69 } elseif ($action ==
'specimen')
71 $modele =
GETPOST(
'module',
'alpha');
74 $inter->initAsSpecimen();
77 $file =
''; $classname =
''; $filefound = 0;
78 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
79 foreach ($dirmodels as $reldir)
81 $file =
dol_buildpath($reldir.
"core/modules/fichinter/doc/pdf_".$modele.
".modules.php", 0);
82 if (file_exists($file))
85 $classname =
"pdf_".$modele;
94 $module =
new $classname($db);
96 if ($module->write_file($inter, $langs) > 0)
98 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
106 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
111 elseif ($action ==
'set')
114 } elseif ($action ==
'del')
119 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$value")
dolibarr_del_const($db,
'FICHEINTER_ADDON_PDF', $conf->entity);
124 elseif ($action ==
'setdoc')
126 if (
dolibarr_set_const($db,
"FICHEINTER_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity))
130 $conf->global->FICHEINTER_ADDON_PDF = $value;
139 } elseif ($action ==
'setmod')
145 } elseif ($action ==
'set_FICHINTER_FREE_TEXT')
147 $freetext =
GETPOST(
'FICHINTER_FREE_TEXT',
'restricthtml');
148 $res =
dolibarr_set_const($db,
"FICHINTER_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
150 if (!($res > 0)) $error++;
158 } elseif ($action ==
'set_FICHINTER_DRAFT_WATERMARK')
160 $draft =
GETPOST(
'FICHINTER_DRAFT_WATERMARK',
'alpha');
161 $res =
dolibarr_set_const($db,
"FICHINTER_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
163 if (!($res > 0)) $error++;
171 } elseif ($action ==
'set_FICHINTER_PRINT_PRODUCTS')
173 $val =
GETPOST(
'FICHINTER_PRINT_PRODUCTS',
'alpha');
174 $res =
dolibarr_set_const($db,
"FICHINTER_PRINT_PRODUCTS", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
176 if (!($res > 0)) $error++;
184 } elseif ($action ==
'set_FICHINTER_USE_SERVICE_DURATION') {
185 $val =
GETPOST(
'FICHINTER_USE_SERVICE_DURATION',
'alpha');
186 $res =
dolibarr_set_const($db,
"FICHINTER_USE_SERVICE_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
197 } elseif ($action ==
'set_FICHINTER_WITHOUT_DURATION') {
198 $val =
GETPOST(
'FICHINTER_WITHOUT_DURATION',
'alpha');
199 $res =
dolibarr_set_const($db,
"FICHINTER_WITHOUT_DURATION", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
210 } elseif ($action ==
'set_FICHINTER_DATE_WITHOUT_HOUR') {
211 $val =
GETPOST(
'FICHINTER_DATE_WITHOUT_HOUR',
'alpha');
212 $res =
dolibarr_set_const($db,
"FICHINTER_DATE_WITHOUT_HOUR", ($val ==
'on' ? 1 : 0),
'bool', 0,
'', $conf->entity);
231 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
235 $form =
new Form($db);
237 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
249 print '<table class="noborder centpercent">';
250 print
'<tr class="liste_titre">';
251 print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
252 print
'<td>'.$langs->trans(
"Description").
'</td>';
253 print
'<td>'.$langs->trans(
"Example").
'</td>';
254 print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
255 print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
260 foreach ($dirmodels as $reldir)
266 $handle = opendir($dir);
267 if (is_resource($handle))
269 while (($file = readdir($handle)) !==
false)
271 if (preg_match(
'/^(mod_.*)\.php$/i', $file, $reg))
274 $classname = substr($file, 4);
276 require_once $dir.$file.
'.php';
280 if ($module->isEnabled())
283 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
284 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
287 print
'<tr class="oddeven"><td>'.$module->nom.
"</td><td>\n";
288 print $module->info();
292 print
'<td class="nowrap">';
293 $tmp = $module->getExample();
294 if (preg_match(
'/^Error/', $tmp)) {
295 $langs->load(
"errors");
296 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
297 } elseif ($tmp ==
'NotConfigured') print $langs->trans($tmp);
301 print '<td class="center">';
302 if ($conf->global->FICHEINTER_ADDON == $classname)
304 print
img_picto($langs->trans(
"Activated"),
'switch_on');
306 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&value='.$classname.
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
311 $ficheinter->initAsSpecimen();
315 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
316 $nextval = $module->getNextValue($mysoc, $ficheinter);
317 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
318 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
320 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured')
321 $nextval = $langs->trans($nextval);
322 $htmltooltip .= $nextval.
'<br>';
324 $htmltooltip .= $langs->trans($module->error).
'<br>';
327 print
'<td class="center">';
328 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
340 print
'</table><br>';
350 $type =
'ficheinter';
353 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
354 $sql .=
" WHERE type = '".$db->escape($type).
"'";
355 $sql .=
" AND entity = ".$conf->entity;
356 $resql = $db->query($sql);
360 $num_rows = $db->num_rows(
$resql);
361 while ($i < $num_rows)
363 $array = $db->fetch_array(
$resql);
364 array_push($def, $array[0]);
372 print
'<table class="noborder centpercent">';
373 print
'<tr class="liste_titre">';
374 print
'<td>'.$langs->trans(
"Name").
'</td>';
375 print
'<td>'.$langs->trans(
"Description").
'</td>';
376 print
'<td align="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
377 print
'<td align="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
378 print
'<td align="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
379 print
'<td align="center" width="80">'.$langs->trans(
"Preview").
'</td>';
384 foreach ($dirmodels as $reldir)
386 $realpath = $reldir.
"core/modules/fichinter/doc";
391 $handle = opendir($dir);
392 if (is_resource($handle))
394 while (($file = readdir($handle)) !==
false)
401 foreach ($filelist as $file)
403 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file))
405 if (file_exists($dir.
'/'.$file))
407 $name = substr($file, 4,
dol_strlen($file) - 16);
408 $classname = substr($file, 0,
dol_strlen($file) - 12);
410 require_once $dir.
'/'.$file;
411 $module =
new $classname($db);
413 $modulequalified = 1;
414 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
415 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
417 if ($modulequalified)
419 print
'<tr class="oddeven"><td width="100">';
420 print (empty($module->name) ? $name : $module->name);
422 if (method_exists($module,
'info')) print $module->info($langs);
423 else print $module->description;
427 if (in_array($name, $def))
429 print
"<td align=\"center\">\n";
430 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">';
431 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
435 print
"<td align=\"center\">\n";
436 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
441 print
"<td align=\"center\">";
442 if ($conf->global->FICHEINTER_ADDON_PDF ==
"$name")
444 print
img_picto($langs->trans(
"Default"),
'on');
446 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&value='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
451 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
452 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
453 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
454 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
456 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
457 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
458 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
459 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
460 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
461 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
462 print
'<td class="center">';
463 print $form->textwithpicto(
'', $htmltooltip, -1, 0);
467 print
'<td class="center">';
468 if ($module->type ==
'pdf')
470 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
472 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
493 print
'<table class="noborder centpercent">';
494 print
'<tr class="liste_titre">';
495 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
496 print
'<td align="center" width="60">'.$langs->trans(
"Value").
'</td>';
497 print
"<td> </td>\n";
501 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
502 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
503 foreach ($substitutionarray as $key => $val) $htmltext .= $key.
'<br>';
506 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
507 print
'<input type="hidden" name="token" value="'.newToken().
'">';
508 print
'<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
509 print
'<tr class="oddeven"><td colspan="2">';
510 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnInterventions"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
511 $variablename =
'FICHINTER_FREE_TEXT';
512 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
514 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.$conf->global->$variablename.
'</textarea>';
516 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
517 $doleditor =
new DolEditor($variablename, $conf->global->$variablename,
'', 80,
'dolibarr_notes');
518 print $doleditor->Create();
520 print
'</td><td class="right">';
521 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
522 print
"</td></tr>\n";
526 print
"<form method=\"post\" action=\"".$_SERVER[
"PHP_SELF"].
"\">";
527 print
'<input type="hidden" name="token" value="'.newToken().
'">';
528 print
"<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
529 print
'<tr class="oddeven"><td>';
530 print $form->textwithpicto($langs->trans(
"WatermarkOnDraftInterventionCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
532 print
'<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.
'">';
533 print
'</td><td class="right">';
534 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
535 print
"</td></tr>\n";
538 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
539 print
'<input type="hidden" name="token" value="'.newToken().
'">';
540 print
'<input type="hidden" name="action" value="set_FICHINTER_PRINT_PRODUCTS">';
541 print
'<tr class="oddeven"><td>';
542 print $langs->trans(
"PrintProductsOnFichinter").
' ('.$langs->trans(
"PrintProductsOnFichinterDetails").
')</td>';
543 print
'<td align="center"><input type="checkbox" name="FICHINTER_PRINT_PRODUCTS" ';
544 if ($conf->global->FICHINTER_PRINT_PRODUCTS)
547 print
'</td><td class="right">';
548 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
549 print
"</td></tr>\n";
552 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
553 print
'<input type="hidden" name="token" value="'.newToken().
'">';
554 print
'<input type="hidden" name="action" value="set_FICHINTER_USE_SERVICE_DURATION">';
555 print
'<tr class="oddeven">';
557 print $langs->trans(
"UseServicesDurationOnFichinter");
559 print
'<td class="center">';
560 print
'<input type="checkbox" name="FICHINTER_USE_SERVICE_DURATION"'.($conf->global->FICHINTER_USE_SERVICE_DURATION ?
' checked' :
'').
'>';
562 print
'<td class="right">';
563 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
568 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
569 print
'<input type="hidden" name="token" value="'.newToken().
'">';
570 print
'<input type="hidden" name="action" value="set_FICHINTER_WITHOUT_DURATION">';
571 print
'<tr class="oddeven">';
573 print $langs->trans(
"UseDurationOnFichinter");
575 print
'<td class="center">';
576 print
'<input type="checkbox" name="FICHINTER_WITHOUT_DURATION"'.($conf->global->FICHINTER_WITHOUT_DURATION ?
' checked' :
'').
'>';
578 print
'<td class="right">';
579 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
584 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
585 print
'<input type="hidden" name="token" value="'.newToken().
'">';
586 print
'<input type="hidden" name="action" value="set_FICHINTER_DATE_WITHOUT_HOUR">';
587 print
'<tr class="oddeven">';
589 print $langs->trans(
"UseDateWithoutHourOnFichinter");
591 print
'<td class="center">';
592 print
'<input type="checkbox" name="FICHINTER_DATE_WITHOUT_HOUR"'.($conf->global->FICHINTER_DATE_WITHOUT_HOUR ?
' checked' :
'').
'>';
594 print
'<td class="right">';
595 print
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
delDocumentModel($name, $type)
Delete document model used by doc generator.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Class to manage interventions.
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).
addDocumentModel($name, $type, $label= '', $description= '')
Add document model used by doc generator.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
fichinter_admin_prepare_head()
Return array head with list of tabs to view object informations.
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0)
Return array of possible substitutions for PDF content (without external module substitutions).
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print $_SERVER["PHP_SELF"] n
Edit parameters.
Class to manage a WYSIWYG editor.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.