27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
42$langs->loadLangs(array(
"admin",
"receptions",
'other'));
49$action =
GETPOST(
'action',
'aZ09');
50$value =
GETPOST(
'value',
'alpha');
51$modulepart =
GETPOST(
'modulepart',
'aZ09');
53$label =
GETPOST(
'label',
'alpha');
54$scandir =
GETPOST(
'scan_dir',
'alpha');
68 $conf->global->RECEPTION_ADDON_NUMBER =
'mod_reception_beryl';
77include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
79if ($action ==
'updateMask') {
80 $maskconst =
GETPOST(
'maskconstreception',
'aZ09');
81 $maskvalue =
GETPOST(
'maskreception',
'alpha');
82 if (!empty($maskconst) && preg_match(
'/_MASK$/', $maskconst)) {
93} elseif ($action ==
'set_param') {
94 $freetext =
GETPOST(
'RECEPTION_FREE_TEXT',
'restricthtml');
101 $draft =
GETPOST(
'RECEPTION_DRAFT_WATERMARK',
'alpha');
111} elseif ($action ==
'specimen') {
112 $modele =
GETPOST(
'module',
'alpha');
115 $exp->initAsSpecimen();
120 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
121 foreach ($dirmodels as $reldir) {
122 $file =
dol_buildpath($reldir.
"core/modules/reception/doc/pdf_".$modele.
".modules.php", 0);
123 if (file_exists($file)) {
124 $classname =
"pdf_".$modele;
129 if ($classname !==
'') {
132 $module =
new $classname(
$db);
133 '@phan-var-force ModelePdfReception $module';
136 if ($module->write_file($exp, $langs) > 0) {
137 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=reception&file=SPECIMEN.pdf");
145 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
147} elseif ($action ==
'set') {
150} elseif ($action ==
'del') {
157} elseif ($action ==
'setdoc') {
162 $conf->global->RECEPTION_ADDON_PDF = $value;
170} elseif ($action ==
'setmodel') {
181$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
185llxHeader(
'', $langs->trans(
"ReceptionsSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-reception_setup');
187$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
189print
load_fiche_titre($langs->trans(
"ReceptionsSetup"), $linkback,
'title_setup');
193print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Receptions"), -1,
'reception');
199print
'<div class="div-table-responsive-no-min">';
200print
'<table class="noborder centpercent">';
201print
'<tr class="liste_titre">';
202print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
203print
'<td>'.$langs->trans(
"Description").
'</td>';
204print
'<td>'.$langs->trans(
"Example").
'</td>';
205print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
206print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
211foreach ($dirmodels as $reldir) {
215 $handle = opendir($dir);
216 if (is_resource($handle)) {
217 while (($file = readdir($handle)) !==
false) {
218 if (substr($file, 0, 14) ==
'mod_reception_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
219 $file = substr($file, 0,
dol_strlen($file) - 4);
221 require_once $dir.
'/'.$file.
'.php';
223 $module =
new $file();
224 '@phan-var-force ModelNumRefReception $module';
227 if ($module->isEnabled()) {
229 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
232 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
236 print
'<tr><td>'.$module->getName($langs).
"</td>\n";
238 print $module->info($langs);
242 print
'<td class="nowrap">';
243 $tmp = $module->getExample();
244 if (preg_match(
'/^Error/', $tmp)) {
245 $langs->load(
"errors");
246 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
247 } elseif ($tmp ==
'NotConfigured') {
248 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
254 print
'<td class="center">';
256 print
img_picto($langs->trans(
"Activated"),
'switch_on');
258 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.newToken().
'&value='.urlencode($file).(!empty($module->name) ?
'&label='.urlencode($module->name) :
'').
'">';
259 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
265 $reception->initAsSpecimen();
269 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
270 $nextval = $module->getNextValue(
$mysoc, $reception);
271 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
272 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
274 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
275 $nextval = $langs->trans($nextval);
277 $htmltooltip .= $nextval.
'<br>';
279 $htmltooltip .= $langs->trans($module->error).
'<br>';
283 print
'<td class="center">';
284 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
311$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
312$sql .=
" WHERE type = '".$db->escape($type).
"'";
313$sql .=
" AND entity = ".((int)
$conf->entity);
315$resql =
$db->query($sql);
318 $num_rows =
$db->num_rows($resql);
319 while ($i < $num_rows) {
320 $array =
$db->fetch_array($resql);
321 if (is_array($array)) {
322 array_push($def, $array[0]);
330print
'<div class="div-table-responsive-no-min">';
331print
'<table class="noborder centpercent">';
332print
'<tr class="liste_titre">';
333print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
334print
'<td>'.$langs->trans(
"Description").
'</td>';
335print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
336print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>';
337print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"ShortInfo").
'</td>';
338print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"Preview").
'</td>';
343foreach ($dirmodels as $reldir) {
344 foreach (array(
'',
'/doc') as $valdir) {
345 $realpath = $reldir.
"core/modules/reception".$valdir;
349 $handle = opendir($dir);
350 if (is_resource($handle)) {
352 while (($file = readdir($handle)) !==
false) {
358 foreach ($filelist as $file) {
359 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
360 if (file_exists($dir.
'/'.$file)) {
361 $name = substr($file, 4,
dol_strlen($file) - 16);
362 $classname = substr($file, 0,
dol_strlen($file) - 12);
364 require_once $dir.
'/'.$file;
365 $module =
new $classname(
$db);
367 '@phan-var-force ModelePdfReception $module';
370 $modulequalified = 1;
371 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
372 $modulequalified = 0;
374 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
375 $modulequalified = 0;
378 if ($modulequalified) {
379 print
'<tr><td width="100">';
380 print(empty($module->name) ? $name : $module->
name);
382 if (method_exists($module,
'info')) {
383 print $module->info($langs);
385 print $module->description;
390 if (in_array($name, $def)) {
391 print
'<td class="center">'.
"\n";
392 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
393 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
397 print
'<td class="center">'.
"\n";
398 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>';
403 print
'<td class="center">';
405 print
img_picto($langs->trans(
"Default"),
'on');
407 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>';
412 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
413 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
414 if ($module->type ==
'pdf') {
415 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
417 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
419 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
420 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
421 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
422 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
423 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
424 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
426 print
'<td class="center">';
427 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
431 print
'<td class="center">';
432 if ($module->type ==
'pdf') {
433 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>';
435 print
img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
461print
'<table class="noborder centpercent">';
462print
'<tr class="liste_titre">';
463print
"<td>".$langs->trans(
"Parameter").
"</td>\n";
477print
'<tr class="oddeven">';
478print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
480print
img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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 receptions.
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, $allowothertags=array())
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, $morecssdiv='')
Show tabs of a record.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
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.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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 information.
$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.