24 require
'../main.inc.php';
25 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
30 $langs->loadLangs(array(
"admin",
"receptions",
'other'));
35 $action =
GETPOST(
'action',
'aZ09');
36 $value =
GETPOST(
'value',
'alpha');
37 $label =
GETPOST(
'label',
'alpha');
38 $scandir =
GETPOST(
'scan_dir',
'alpha');
46 if (!empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION))
49 dolibarr_set_const($db,
"MAIN_SUBMODULE_RECEPTION",
"1",
'chaine', 0,
'', $conf->entity);
52 if (empty($conf->global->RECEPTION_ADDON_NUMBER))
54 $conf->global->RECEPTION_ADDON_NUMBER =
'mod_reception_beryl';
62 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
64 if ($action ==
'updateMask')
66 $maskconst =
GETPOST(
'maskconstreception',
'alpha');
67 $maskvalue =
GETPOST(
'maskreception',
'alpha');
68 if (!empty($maskconst))
69 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
77 } elseif ($action ==
'set_param')
79 $freetext =
GETPOST(
'RECEPTION_FREE_TEXT',
'restricthtml');
80 $res =
dolibarr_set_const($db,
"RECEPTION_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
87 $draft =
GETPOST(
'RECEPTION_DRAFT_WATERMARK',
'alpha');
88 $res =
dolibarr_set_const($db,
"RECEPTION_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
99 } elseif ($action ==
'specimen')
101 $modele =
GETPOST(
'module',
'alpha');
104 $exp->initAsSpecimen();
107 $file =
''; $classname =
''; $filefound = 0;
108 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
109 foreach ($dirmodels as $reldir)
111 $file =
dol_buildpath($reldir.
"core/modules/reception/doc/pdf_".$modele.
".modules.php", 0);
112 if (file_exists($file))
115 $classname =
"pdf_".$modele;
124 $module =
new $classname($db);
126 if ($module->write_file($exp, $langs) > 0)
128 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=reception&file=SPECIMEN.pdf");
136 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
141 elseif ($action ==
'set')
144 } elseif ($action ==
'del')
149 if ($conf->global->RECEPTION_ADDON_PDF ==
"$value")
dolibarr_del_const($db,
'RECEPTION_ADDON_PDF', $conf->entity);
154 elseif ($action ==
'setdoc')
156 if (
dolibarr_set_const($db,
"RECEPTION_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity))
160 $conf->global->RECEPTION_ADDON_PDF = $value;
169 } elseif ($action ==
'setmodel')
171 dolibarr_set_const($db,
"RECEPTION_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
181 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
183 $form =
new Form($db);
185 llxHeader(
"", $langs->trans(
"ReceptionsSetup"));
187 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
192 print
dol_get_fiche_head($head,
'reception', $langs->trans(
"Receptions"), -1,
'sending');
198 print
'<table class="noborder centpercent">';
199 print
'<tr class="liste_titre">';
200 print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
201 print
'<td>'.$langs->trans(
"Description").
'</td>';
202 print
'<td>'.$langs->trans(
"Example").
'</td>';
203 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
204 print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
209 foreach ($dirmodels as $reldir)
215 $handle = opendir($dir);
216 if (is_resource($handle))
218 while (($file = readdir($handle)) !==
false)
220 if (substr($file, 0, 14) ==
'mod_reception_' && substr($file,
dol_strlen($file) - 3, 3) ==
'php')
222 $file = substr($file, 0,
dol_strlen($file) - 4);
224 require_once $dir.
'/'.$file.
'.php';
228 if ($module->isEnabled())
231 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
continue;
232 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
continue;
234 print
'<tr><td>'.$module->nom.
"</td>\n";
236 print $module->info();
240 print
'<td class="nowrap">';
241 $tmp = $module->getExample();
242 if (preg_match(
'/^Error/', $tmp)) {
243 $langs->load(
"errors");
244 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
245 } elseif ($tmp ==
'NotConfigured') print $langs->trans($tmp);
249 print '<td class="center">';
250 if ($conf->global->RECEPTION_ADDON_NUMBER == "$file")
252 print
img_picto($langs->trans(
"Activated"),
'switch_on');
254 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.
newToken().
'&value='.urlencode($file).
'&scan_dir='.$module->scandir.
'&label='.urlencode($module->name).
'">';
255 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
261 $reception->initAsSpecimen();
265 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
266 $nextval = $module->getNextValue($mysoc, $reception);
267 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
268 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
270 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured')
271 $nextval = $langs->trans($nextval);
272 $htmltooltip .= $nextval.
'<br>';
274 $htmltooltip .= $langs->trans($module->error).
'<br>';
278 print
'<td class="center">';
279 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
291 print
'</table><br>';
304 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
305 $sql .=
" WHERE type = '".$db->escape($type).
"'";
306 $sql .=
" AND entity = ".$conf->entity;
308 $resql = $db->query($sql);
312 $num_rows = $db->num_rows(
$resql);
313 while ($i < $num_rows)
315 $array = $db->fetch_array(
$resql);
316 array_push($def, $array[0]);
323 print
'<table class="noborder centpercent">';
324 print
'<tr class="liste_titre">';
325 print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
326 print
'<td>'.$langs->trans(
"Description").
'</td>';
327 print
'<td align="center" width="60">'.$langs->trans(
"Status").
'</td>';
328 print
'<td align="center" width="60">'.$langs->trans(
"Default").
'</td>';
329 print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"ShortInfo").
'</td>';
330 print
'<td align="center" width="80" class="nowrap">'.$langs->trans(
"Preview").
'</td>';
335 foreach ($dirmodels as $reldir)
337 foreach (array(
'',
'/doc') as $valdir)
339 $realpath = $reldir.
"core/modules/reception".$valdir;
344 $handle = opendir($dir);
345 if (is_resource($handle))
347 while (($file = readdir($handle)) !==
false)
354 foreach ($filelist as $file)
356 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file))
358 if (file_exists($dir.
'/'.$file))
360 $name = substr($file, 4,
dol_strlen($file) - 16);
361 $classname = substr($file, 0,
dol_strlen($file) - 12);
363 require_once $dir.
'/'.$file;
364 $module =
new $classname($db);
366 $modulequalified = 1;
367 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
368 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
370 if ($modulequalified)
372 print
'<tr><td width="100">';
373 print (empty($module->name) ? $name : $module->name);
375 if (method_exists($module,
'info')) print $module->info($langs);
376 else print $module->description;
380 if (in_array($name, $def))
382 print
'<td class="center">'.
"\n";
383 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.$name.
'">';
384 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
388 print
'<td class="center">'.
"\n";
389 print
'<a class="reposition" 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>';
394 print
'<td class="center">';
395 if ($conf->global->RECEPTION_ADDON_PDF == $name)
397 print
img_picto($langs->trans(
"Default"),
'on');
399 print
'<a class="reposition" 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>';
404 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
405 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
406 if ($module->type ==
'pdf')
408 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
410 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
412 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
413 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
414 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
415 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
416 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
417 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
419 print
'<td class="center">';
420 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
424 print
'<td class="center">';
425 if ($module->type ==
'pdf')
427 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>';
429 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
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.
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.
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)
Class to manage receptions.
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 ...
reception_admin_prepare_head()
Return array head with list of tabs to view object informations.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.