34require
'../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/expedition.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
50$langs->loadLangs(array(
"admin",
"sendings",
"other"));
56$action =
GETPOST(
'action',
'aZ09');
57$value =
GETPOST(
'value',
'alpha');
58$modulepart =
GETPOST(
'modulepart',
'aZ09');
60$label =
GETPOST(
'label',
'alpha');
61$scandir =
GETPOST(
'scan_dir',
'alpha');
65 $conf->global->EXPEDITION_ADDON_NUMBER =
'mod_expedition_safor';
74include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
76if ($action ==
'updateMask') {
77 $maskconst =
GETPOST(
'maskconstexpedition',
'aZ09');
78 $maskvalue =
GETPOST(
'maskexpedition',
'alpha');
79 if (!empty($maskconst) && preg_match(
'/_MASK$/', $maskconst)) {
80 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
90} elseif ($action ==
'set_param') {
91 $freetext =
GETPOST(
'SHIPPING_FREE_TEXT',
'restricthtml');
92 $res =
dolibarr_set_const($db,
"SHIPPING_FREE_TEXT", $freetext,
'chaine', 0,
'', $conf->entity);
98 $draft =
GETPOST(
'SHIPPING_DRAFT_WATERMARK',
'alpha');
99 $res =
dolibarr_set_const($db,
"SHIPPING_DRAFT_WATERMARK", trim($draft),
'chaine', 0,
'', $conf->entity);
108} elseif ($action ==
'specimen') {
109 $modele =
GETPOST(
'module',
'alpha');
112 $exp->initAsSpecimen();
117 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
118 foreach ($dirmodels as $reldir) {
119 $file =
dol_buildpath($reldir.
"core/modules/expedition/doc/pdf_".$modele.
".modules.php", 0);
120 if (file_exists($file)) {
121 $classname =
"pdf_".$modele;
126 if ($classname !==
'') {
129 $module =
new $classname($db);
130 '@phan-var-force ModelePdfExpedition $module';
132 if ($module->write_file($exp, $langs) > 0) {
133 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=expedition&file=SPECIMEN.pdf");
141 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
143} elseif ($action ==
'set') {
146} elseif ($action ==
'del') {
153} elseif ($action ==
'setdoc') {
155 if (
dolibarr_set_const($db,
"EXPEDITION_ADDON_PDF", $value,
'chaine', 0,
'', $conf->entity)) {
158 $conf->global->EXPEDITION_ADDON_PDF = $value;
166} elseif ($action ==
'setmodel') {
167 dolibarr_set_const($db,
"EXPEDITION_ADDON_NUMBER", $value,
'chaine', 0,
'', $conf->entity);
175$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
177$form =
new Form($db);
179llxHeader(
"", $langs->trans(
"SendingsSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-expedition');
181$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>';
183print
load_fiche_titre($langs->trans(
"SendingsSetup"), $linkback,
'title_setup');
187print
dol_get_fiche_head($head,
'shipment', $langs->trans(
"Sendings"), -1,
'shipment');
193print
'<table class="noborder centpercent">';
194print
'<tr class="liste_titre">';
195print
'<td width="100">'.$langs->trans(
"Name").
'</td>';
196print
'<td>'.$langs->trans(
"Description").
'</td>';
197print
'<td>'.$langs->trans(
"Example").
'</td>';
198print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
199print
'<td class="center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
204foreach ($dirmodels as $reldir) {
208 $handle = opendir($dir);
209 if (is_resource($handle)) {
210 while (($file = readdir($handle)) !==
false) {
211 if (preg_match(
'/^mod_expedition_([a-z0-9_]*)\.php$/', $file)) {
212 $file = substr($file, 0,
dol_strlen($file) - 4);
214 require_once $dir.$file.
'.php';
216 $module =
new $file();
217 '@phan-var-force ModelNumRefExpedition $module';
219 if ($module->isEnabled()) {
221 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
224 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
228 print
'<tr><td>'.$module->name.
"</td>\n";
230 print $module->info($langs);
234 print
'<td class="nowrap">';
235 $tmp = $module->getExample();
236 if (preg_match(
'/^Error/', $tmp)) {
237 $langs->load(
"errors");
238 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
239 } elseif ($tmp ==
'NotConfigured') {
240 print
'<span class="opacitymedium">'.$langs->trans($tmp).
'</span>';
246 print
'<td class="center">';
248 print
img_picto($langs->trans(
"Activated"),
'switch_on');
250 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=setmodel&token='.
newToken().
'&value='.urlencode($file).
'&label='.urlencode($module->name).
'">';
251 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
257 $expedition->initAsSpecimen();
261 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
262 $nextval = $module->getNextValue(
$mysoc, $expedition);
263 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
264 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
266 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
267 $nextval = $langs->trans($nextval);
269 $htmltooltip .= $nextval.
'<br>';
271 $htmltooltip .= $langs->trans($module->error).
'<br>';
275 print
'<td class="center">';
276 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
301$sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
302$sql .=
" WHERE type = '".$db->escape($type).
"'";
303$sql .=
" AND entity = ".((int) $conf->entity);
305$resql = $db->query($sql);
308 $num_rows = $db->num_rows($resql);
309 while ($i < $num_rows) {
310 $array = $db->fetch_array($resql);
311 if (is_array($array)) {
312 array_push($def, $array[0]);
320print
'<table class="noborder centpercent">';
321print
'<tr class="liste_titre">';
322print
'<td width="140">'.$langs->trans(
"Name").
'</td>';
323print
'<td>'.$langs->trans(
"Description").
'</td>';
324print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
325print
'<td class="center" width="60">'.$langs->trans(
"Default").
'</td>';
326print
'<td class="nowrap center" width="80">'.$langs->trans(
"ShortInfo").
'</td>';
327print
'<td class="nowrap center" width="80" >'.$langs->trans(
"Preview").
'</td>';
332foreach ($dirmodels as $reldir) {
333 foreach (array(
'',
'/doc') as $valdir) {
334 $dir =
dol_buildpath($reldir.
"core/modules/expedition".$valdir);
337 $handle = opendir($dir);
338 if (is_resource($handle)) {
340 while (($file = readdir($handle)) !==
false) {
346 foreach ($filelist as $file) {
347 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
348 if (file_exists($dir.
'/'.$file)) {
349 $name = substr($file, 4,
dol_strlen($file) - 16);
350 $classname = substr($file, 0,
dol_strlen($file) - 12);
352 require_once $dir.
'/'.$file;
353 $module =
new $classname($db);
355 '@phan-var-force ModelePdfExpedition $module';
357 $modulequalified = 1;
358 if ($module->version ==
'development' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2) {
359 $modulequalified = 0;
361 if ($module->version ==
'experimental' &&
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1) {
362 $modulequalified = 0;
365 if ($modulequalified) {
366 print
'<tr><td width="100">';
367 print(empty($module->name) ? $name : $module->
name);
369 if (method_exists($module,
'info')) {
370 print $module->info($langs);
372 print $module->description;
377 if (in_array($name, $def)) {
378 print
'<td class="center">'.
"\n";
379 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
380 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
384 print
'<td class="center">'.
"\n";
385 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>';
390 print
'<td class="center">';
392 print
img_picto($langs->trans(
"Default"),
'on');
394 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>';
399 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
400 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
401 if ($module->type ==
'pdf') {
402 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
404 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
405 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
406 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentMode").
': '.
yn($module->option_modereg, 1, 1);
407 $htmltooltip .=
'<br>'.$langs->trans(
"PaymentConditions").
': '.
yn($module->option_condreg, 1, 1);
408 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
409 $htmltooltip .=
'<br>'.$langs->trans(
"WatermarkOnDraftOrders").
': '.
yn($module->option_draft_watermark, 1, 1);
411 print
'<td class="center">';
412 print $form->textwithpicto(
'', $htmltooltip, 1,
'info');
416 print
'<td class="center">';
417 if ($module->type ==
'pdf') {
418 print
'<a href="'.dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'specimen',
'module' => $name,
'scan_dir' => $module->scandir,
'label' => $module->name],
true).
'">'.
img_object($langs->trans(
"Preview"),
'pdf').
'</a>';
420 print
img_object($langs->transnoentitiesnoconv(
"PreviewNotAvailable"),
'generic');
443print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
444print
'<input type="hidden" name="token" value="'.newToken().
'">';
445print
'<input type="hidden" name="action" value="set_param">';
447print
'<table class="noborder centpercent">';
448print
'<tr class="liste_titre">';
449print
"<td>".$langs->trans(
"Parameter").
"</td>\n";
453print
'<tr class="oddeven">';
454print
'<td>'.$langs->trans(
'SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
457print ajax_constantonoff(
'SHIPPING_DISPLAY_STOCK_ENTRY_DATE');
460print
'<tr class="oddeven">';
461print
'<td>'.$langs->trans(
'SHIPPING_SELL_EAT_BY_DATE_PRE_SELECT_EARLIEST');
464print ajax_constantonoff(
'SHIPPING_SELL_EAT_BY_DATE_PRE_SELECT_EARLIEST');
468$substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
469$htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
470foreach ($substitutionarray as $key => $val) {
471 $htmltext .= $key.
'<br>';
475print
'<tr><td colspan="2">';
476print $form->textwithpicto($langs->trans(
"FreeLegalTextOnShippings"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
477$variablename =
'SHIPPING_FREE_TEXT';
479 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
481 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
483 print $doleditor->Create();
488print $form->textwithpicto($langs->trans(
"WatermarkOnDraftContractCards"), $htmltext, 1,
'help',
'', 0, 2,
'watermarktooltip');
490print
'<input class="flat minwidth200" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.dol_escape_htmltag(
getDolGlobalString(
'SHIPPING_DRAFT_WATERMARK')).
'">';
494print
'<tr class="oddeven">';
495print
'<td>'.$langs->trans(
"AllowOnLineSign");
498print ajax_constantonoff(
'EXPEDITION_ALLOW_ONLINESIGN', array(),
null, 0, 0, 0, 2, 0, 1,
'',
'',
'inline-block', 0, $langs->transnoentitiesnoconv(
"WarningOnlineSignature",
'https://www.dolistore.com'));
502print
'<tr class="oddeven">';
503print
'<td>'.$langs->trans(
"DontPrefillShipmentQty");
506print ajax_constantonoff(
'SHIPMENT_DONT_PREFILL_QTY', array(),
null, 0, 0, 0, 2, 0, 1,
'',
'',
'inline-block', 0,
'');
511print
'<tr class="oddeven">';
512print
'<td>'.img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"Notifications").
'</td>';
514print $langs->trans(
"YouMayFindNotificationsFeaturesIntoModuleNotification");
518print
'<tr class="oddeven">';
519print
'<td>'.img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"MoreOptionsRelatedToPDF").
'</td>';
521print
img_picto(
'',
'url',
'class="pictofixedwidth"').
'<a href="'.DOL_URL_ROOT.
'/admin/pdf_other.php">'.$langs->trans(
"SeeInPDFSetupPage").
'</a>';
526print $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.
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 a WYSIWYG editor.
expedition_admin_prepare_head()
Return array head with list of tabs to view object information.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
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.