25require
'../main.inc.php';
26require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
31$langs->loadLangs(array(
"admin",
"receptions",
'other'));
38$action =
GETPOST(
'action',
'aZ09');
39$value =
GETPOST(
'value',
'alpha');
40$modulepart =
GETPOST(
'modulepart',
'aZ09');
42$label =
GETPOST(
'label',
'alpha');
43$scandir =
GETPOST(
'scan_dir',
'alpha');
51if (isModEnabled(
'reception') && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) {
53 dolibarr_set_const($db,
"MAIN_SUBMODULE_RECEPTION",
"1",
'chaine', 0,
'', $conf->entity);
56if (empty($conf->global->RECEPTION_ADDON_NUMBER)) {
57 $conf->global->RECEPTION_ADDON_NUMBER =
'mod_reception_beryl';
65include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
67if ($action ==
'updateMask') {
68 $maskconst =
GETPOST(
'maskconstreception',
'aZ09');
69 $maskvalue =
GETPOST(
'maskreception',
'alpha');
70 if (!empty($maskconst) && preg_match(
'/_MASK$/', $maskconst)) {
71 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
81} elseif ($action ==
'set_param') {
82 $freetext =
GETPOST(
'RECEPTION_FREE_TEXT',
'restricthtml');
83 $res =
dolibarr_set_const($db,
"RECEPTION_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
89 $draft =
GETPOST(
'RECEPTION_DRAFT_WATERMARK',
'alpha');
90 $res =
dolibarr_set_const($db,
"RECEPTION_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
99} elseif ($action ==
'specimen') {
100 $modele =
GETPOST(
'module',
'alpha');
103 $exp->initAsSpecimen();
106 $file =
''; $classname =
''; $filefound = 0;
107 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
108 foreach ($dirmodels as $reldir) {
109 $file =
dol_buildpath($reldir.
"core/modules/reception/doc/pdf_".$modele.
".modules.php", 0);
110 if (file_exists($file)) {
112 $classname =
"pdf_".$modele;
120 $module =
new $classname($db);
122 if ($module->write_file($exp, $langs) > 0) {
123 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=reception&file=SPECIMEN.pdf");
131 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
133} elseif ($action ==
'set') {
136} elseif ($action ==
'del') {
139 if ($conf->global->RECEPTION_ADDON_PDF ==
"$value") {
143} elseif ($action ==
'setdoc') {
145 if (
dolibarr_set_const($db,
"RECEPTION_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
148 $conf->global->RECEPTION_ADDON_PDF = $value;
156} elseif ($action ==
'setmodel') {
157 dolibarr_set_const($db,
"RECEPTION_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
167$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
169$form =
new Form($db);
171llxHeader(
"", $langs->trans(
"ReceptionsSetup"));
173$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
174print
load_fiche_titre($langs->trans(
"ReceptionsSetup"), $linkback,
'title_setup');
178print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Receptions"), -1,
'reception');
184print
'<div class="div-table-responsive-no-min">';
185print
'<table class="noborder centpercent">';
186print
'<tr class="liste_titre">';
187print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
188print
'<td>'.$langs->trans(
"Description").
'</td>';
189print
'<td>'.$langs->trans(
"Example").
'</td>';
190print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
191print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
196foreach ($dirmodels as $reldir) {
200 $handle = opendir($dir);
201 if (is_resource($handle)) {
202 while (($file = readdir($handle)) !==
false) {
203 if (substr($file, 0, 14) ==
'mod_reception_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
204 $file = substr($file, 0,
dol_strlen($file) - 4);
206 require_once $dir.
'/'.$file.
'.php';
210 if ($module->isEnabled()) {
212 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
215 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
219 print
'<tr><td>'.$module->nom.
"</td>\n";
221 print $module->info();
225 print
'<td class="nowrap">';
226 $tmp = $module->getExample();
227 if (preg_match(
'/^Error/', $tmp)) {
228 $langs->load(
"errors");
229 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
230 } elseif ($tmp ==
'NotConfigured') {
231 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
237 print
'<td class="center">';
238 if ($conf->global->RECEPTION_ADDON_NUMBER ==
"$file") {
239 print
img_picto($langs->trans(
"Activated"),
'switch_on');
241 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.newToken().
'&value='.urlencode($file).(!empty($module->scandir) ?
'&scan_dir='.$module->scandir :
'').(!empty($module->name) ?
'&label='.urlencode($module->name) :
'').
'">';
242 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
248 $reception->initAsSpecimen();
252 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
253 $nextval = $module->getNextValue($mysoc, $reception);
254 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
255 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
257 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
258 $nextval = $langs->trans($nextval);
260 $htmltooltip .= $nextval.
'<br>';
262 $htmltooltip .= $langs->trans($module->error).
'<br>';
266 print
'<td class="center">';
267 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
294$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
295$sql .=
" WHERE type = '".$db->escape($type).
"'";
296$sql .=
" AND entity = ".$conf->entity;
298$resql = $db->query($sql);
301 $num_rows = $db->num_rows($resql);
302 while ($i < $num_rows) {
303 $array = $db->fetch_array($resql);
304 array_push($def, $array[0]);
311print
'<div class="div-table-responsive-no-min">';
312print
'<table class="noborder centpercent">';
313print
'<tr class="liste_titre">';
314print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
315print
'<td>'.$langs->trans(
"Description").
'</td>';
316print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
317print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>';
318print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"ShortInfo").
'</td>';
319print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"Preview").
'</td>';
324foreach ($dirmodels as $reldir) {
325 foreach (array(
'',
'/doc') as $valdir) {
326 $realpath = $reldir.
"core/modules/reception".$valdir;
330 $handle = opendir($dir);
331 if (is_resource($handle)) {
332 while (($file = readdir($handle)) !==
false) {
338 foreach ($filelist as $file) {
339 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
340 if (file_exists($dir.
'/'.$file)) {
341 $name = substr($file, 4,
dol_strlen($file) - 16);
342 $classname = substr($file, 0,
dol_strlen($file) - 12);
344 require_once $dir.
'/'.$file;
345 $module =
new $classname($db);
347 $modulequalified = 1;
348 if (isset($module->version) && $module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
349 $modulequalified = 0;
351 if (isset($module->version) && $module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
352 $modulequalified = 0;
355 if ($modulequalified) {
356 print
'<tr><td width="100">';
357 print (empty($module->name) ? $name : $module->
name);
359 if (method_exists($module,
'info')) {
360 print $module->info($langs);
362 print $module->description;
367 if (in_array($name, $def)) {
368 print
'<td class="center">'.
"\n";
369 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
370 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
374 print
'<td class="center">'.
"\n";
375 print
'<a class="reposition" 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>';
380 print
'<td class="center">';
381 if ($conf->global->RECEPTION_ADDON_PDF == $name) {
382 print
img_picto($langs->trans(
"Default"),
'on');
384 print
'<a class="reposition" 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>';
389 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
390 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
391 if ($module->type ==
'pdf') {
392 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
394 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
396 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
397 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
398 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
399 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
400 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
401 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
403 print
'<td class="center">';
404 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
408 print
'<td class="center">';
409 if ($module->type ==
'pdf') {
410 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
412 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
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 receptions.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
reception_admin_prepare_head()
Return array head with list of tabs to view object informations.
$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.