32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/expedition.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
39$langs->loadLangs(array(
"admin",
"sendings",
"deliveries",
"other"));
45$action =
GETPOST(
'action',
'aZ09');
46$value =
GETPOST(
'value',
'alpha');
47$modulepart =
GETPOST(
'modulepart',
'aZ09');
49$label =
GETPOST(
'label',
'alpha');
50$scandir =
GETPOST(
'scan_dir',
'alpha');
54 $conf->global->EXPEDITION_ADDON_NUMBER =
'mod_expedition_safor';
62include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
64if ($action ==
'updateMask') {
65 $maskconst =
GETPOST(
'maskconstexpedition',
'aZ09');
66 $maskvalue =
GETPOST(
'maskexpedition',
'alpha');
67 if (!empty($maskconst) && preg_match(
'/_MASK$/', $maskconst)) {
68 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
78} elseif ($action ==
'set_param') {
79 $freetext =
GETPOST(
'SHIPPING_FREE_TEXT',
'restricthtml');
80 $res =
dolibarr_set_const($db,
"SHIPPING_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
86 $draft =
GETPOST(
'SHIPPING_DRAFT_WATERMARK',
'alpha');
87 $res =
dolibarr_set_const($db,
"SHIPPING_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
96} elseif ($action ==
'specimen') {
97 $modele =
GETPOST(
'module',
'alpha');
100 $exp->initAsSpecimen();
106 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
107 foreach ($dirmodels as $reldir) {
108 $file =
dol_buildpath($reldir.
"core/modules/expedition/doc/pdf_".$modele.
".modules.php", 0);
109 if (file_exists($file)) {
111 $classname =
"pdf_".$modele;
119 $module =
new $classname($db);
121 if ($module->write_file($exp, $langs) > 0) {
122 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=expedition&file=SPECIMEN.pdf");
130 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
132} elseif ($action ==
'set') {
135} elseif ($action ==
'del') {
142} elseif ($action ==
'setdoc') {
144 if (
dolibarr_set_const($db,
"EXPEDITION_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
147 $conf->global->EXPEDITION_ADDON_PDF = $value;
155} elseif ($action ==
'setmodel') {
156 dolibarr_set_const($db,
"EXPEDITION_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
164$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
166$form =
new Form($db);
168llxHeader(
"", $langs->trans(
"SendingsSetup"));
170$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
171print
load_fiche_titre($langs->trans(
"SendingsSetup"), $linkback,
'title_setup');
175print
dol_get_fiche_head($head,
'shipment', $langs->trans(
"Sendings"), -1,
'shipment');
181print
'<table class="noborder centpercent">';
182print
'<tr class="liste_titre">';
183print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
184print
'<td>'.$langs->trans(
"Description").
'</td>';
185print
'<td>'.$langs->trans(
"Example").
'</td>';
186print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
187print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
192foreach ($dirmodels as $reldir) {
196 $handle = opendir($dir);
197 if (is_resource($handle)) {
198 while (($file = readdir($handle)) !==
false) {
199 if (preg_match(
'/^mod_expedition_([a-z0-9_]*)\.php$/', $file)) {
200 $file = substr($file, 0,
dol_strlen($file) - 4);
202 require_once $dir.$file.
'.php';
204 $module =
new $file();
206 if ($module->isEnabled()) {
208 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
211 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
215 print
'<tr><td>'.$module->name.
"</td>\n";
217 print $module->info($langs);
221 print
'<td class="nowrap">';
222 $tmp = $module->getExample();
223 if (preg_match(
'/^Error/', $tmp)) {
224 $langs->load(
"errors");
225 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
226 } elseif ($tmp ==
'NotConfigured') {
227 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
233 print
'<td class="center">';
234 if ($conf->global->EXPEDITION_ADDON_NUMBER ==
"$file") {
235 print
img_picto($langs->trans(
"Activated"),
'switch_on');
237 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.newToken().
'&value='.urlencode($file).
'&label='.urlencode($module->name).
'">';
238 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
244 $expedition->initAsSpecimen();
248 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
249 $nextval = $module->getNextValue($mysoc, $expedition);
250 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
251 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
253 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
254 $nextval = $langs->trans($nextval);
256 $htmltooltip .= $nextval.
'<br>';
258 $htmltooltip .= $langs->trans($module->error).
'<br>';
262 print
'<td class="center">';
263 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
288$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
289$sql .=
" WHERE type = '".$db->escape($type).
"'";
290$sql .=
" AND entity = ".$conf->entity;
292$resql = $db->query($sql);
295 $num_rows = $db->num_rows($resql);
296 while ($i < $num_rows) {
297 $array = $db->fetch_array($resql);
298 array_push($def, $array[0]);
305print
'<table class="noborder centpercent">';
306print
'<tr class="liste_titre">';
307print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
308print
'<td>'.$langs->trans(
"Description").
'</td>';
309print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
310print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
311print
'<td class="nowrap center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
312print
'<td class="nowrap center" width="80" >'.$langs->trans(
"Preview").
'</td>';
317foreach ($dirmodels as $reldir) {
318 foreach (array(
'',
'/doc') as $valdir) {
319 $dir =
dol_buildpath($reldir.
"core/modules/expedition".$valdir);
322 $handle = opendir($dir);
323 if (is_resource($handle)) {
324 while (($file = readdir($handle)) !==
false) {
330 foreach ($filelist as $file) {
331 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
332 if (file_exists($dir.
'/'.$file)) {
333 $name = substr($file, 4,
dol_strlen($file) - 16);
334 $classname = substr($file, 0,
dol_strlen($file) - 12);
336 require_once $dir.
'/'.$file;
337 $module =
new $classname($db);
339 $modulequalified = 1;
340 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
341 $modulequalified = 0;
343 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
344 $modulequalified = 0;
347 if ($modulequalified) {
348 print
'<tr><td width="100">';
349 print(empty($module->name) ? $name : $module->
name);
351 if (method_exists($module,
'info')) {
352 print $module->info($langs);
354 print $module->description;
359 if (in_array($name, $def)) {
360 print
'<td class="center">'.
"\n";
361 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.newToken().
'&value='.urlencode($name).
'">';
362 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
366 print
'<td class="center">'.
"\n";
367 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>';
372 print
'<td class="center">';
374 print
img_picto($langs->trans(
"Default"),
'on');
376 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>';
381 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
382 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
383 if ($module->type ==
'pdf') {
384 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
386 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
387 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
388 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
389 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
390 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
391 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
393 print
'<td class="center">';
394 print $form->textwithpicto(
'', $htmltooltip, 1, 0);
398 print
'<td class="center">';
399 if ($module->type ==
'pdf') {
400 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>';
402 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
419print
'<table class="noborder centpercent">';
420print
'<tr class="liste_titre">';
421print
'<td width="100">'.$langs->trans(
'Name').
'</td>';
423print
'<td class="center" width="60">'.$langs->trans(
'Status').
'</td>';
427print
'<tr class="oddeven">';
428print
'<td>'.$langs->trans(
'SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
430print
'<td class="center" width="20"> </td>';
431print
'<td class="center" >';
432print ajax_constantonoff(
'SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
445print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
446print
'<input type="hidden" name="token" value="'.newToken().
'">';
447print
'<input type="hidden" name="action" value="set_param">';
449print
"<table class=\"noborder\" width=\"100%\">";
450print
"<tr class=\"liste_titre\">";
451print
"<td>".$langs->trans(
"Parameter").
"</td>\n";
455$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
456$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
457foreach ($substitutionarray as $key => $val) {
458 $htmltext .= $key.
'<br>';
463print $form->textwithpicto($langs->trans(
"FreeLegalTextOnShippings"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
464$variablename =
'SHIPPING_FREE_TEXT';
466 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
468 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
470 print $doleditor->Create();
475print $form->textwithpicto($langs->trans(
"WatermarkOnDraftContractCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip').
'<br>';
476print
'<input class="flat minwidth200" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'SHIPPING_DRAFT_WATERMARK')).
'">';
481print $form->buttonsSaveCancel(
"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()
Empty header.
Class to manage a WYSIWYG editor.
Class to manage shipments.
expedition_admin_prepare_head()
Return array head with list of tabs to view object informations.
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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.