33require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/expedition.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
48$langs->loadLangs(array(
"admin",
"sendings",
"other"));
54$action =
GETPOST(
'action',
'alpha');
55$value =
GETPOST(
'value',
'alpha');
56$modulepart =
GETPOST(
'modulepart',
'aZ09');
58$label =
GETPOST(
'label',
'alpha');
59$scandir =
GETPOST(
'scan_dir',
'alpha');
68include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
78if ($action ==
'activate_delivery') {
81 header(
"Location: delivery.php");
83} elseif ($action ==
'disable_delivery') {
85 header(
"Location: delivery.php");
89if ($action ==
'updateMask') {
90 $maskconstdelivery =
GETPOST(
'maskconstdelivery',
'aZ09');
91 $maskdelivery =
GETPOST(
'maskdelivery',
'alpha');
95 if ($maskconstdelivery && preg_match(
'/_MASK$/', $maskconstdelivery)) {
104 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
106 setEventMessages($langs->trans(
"Error"),
null,
'errors');
110if ($action ==
'set_DELIVERY_FREE_TEXT') {
111 $free =
GETPOST(
'DELIVERY_FREE_TEXT',
'restricthtml');
119 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
121 setEventMessages($langs->trans(
"Error"),
null,
'errors');
125if ($action ==
'specimen') {
126 $modele =
GETPOST(
'module',
'alpha');
129 $sending->initAsSpecimen();
134 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
135 foreach ($dirmodels as $reldir) {
136 $file =
dol_buildpath($reldir.
"core/modules/delivery/doc/pdf_".$modele.
".modules.php", 0);
137 if (file_exists($file)) {
138 $classname =
"pdf_".$modele;
143 if ($classname !==
'') {
147 '@phan-var-force ModelePDFDeliveryOrder $module';
149 if (
$module->write_file($sending, $langs) > 0) {
150 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=delivery&file=SPECIMEN.pdf");
157 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
158 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
162if ($action ==
'set') {
166if ($action ==
'del') {
175if ($action ==
'setdoc') {
179 $conf->global->DELIVERY_ADDON_PDF = $value;
188if ($action ==
'unsetdoc') {
192 $conf->global->DELIVERY_ADDON_PDF =
'';
197if ($action ==
'setmod') {
210$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
212llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-delivery');
214$form =
new Form($db);
216$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>';
218print
load_fiche_titre($langs->trans(
"SendingsSetup"), $linkback,
'title_setup');
222print
dol_get_fiche_head($head,
'receivings', $langs->trans(
"Receivings"), -1,
'shipment');
226print
'<div class="inline-block valignmiddle">'.$langs->trans(
"DeliveriesOrderAbility").
'</div>';
228 print
' <a class="inline-block valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=activate_delivery&token='.
newToken().
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
230 print
' <a class="inline-block valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=disable_delivery&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
233print
'<br><br><span class="opacitymedium">'.info_admin($langs->trans(
"NoNeedForDeliveryReceipts"), 0, 1).
'</span>';
243 $delivery->initAsSpecimen();
245 printNumberingModuleList(
'delivery',
'mod_delivery_',
'DELIVERY_ADDON_NUMBER', $langs->trans(
"DeliveryOrderNumberingModules"), $delivery);
252 printDocumentModelList(
'delivery',
'delivery',
'DELIVERY_ADDON_PDF', $langs->trans(
"DeliveryOrderModel"), array(
'Logo' =>
'option_logo'),
false,
'', 1,
'unsetdoc');
258 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
259 print
'<input type="hidden" name="token" value="'.newToken().
'">';
260 print
'<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
262 print
'<table class="noborder centpercent">';
263 print
'<tr class="liste_titre">';
264 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
265 print
'<td align="center" width="60"></td>';
266 print
'<td width="80"> </td>';
270 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
271 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
272 foreach ($substitutionarray as $key => $val) {
273 $htmltext .= $key.
'<br>';
277 print
'<tr class="oddeven"><td colspan="2">';
278 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnDeliveryReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
279 $variablename =
'DELIVERY_FREE_TEXT';
281 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
283 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
285 print $doleditor->Create();
287 print
'</td><td class="right">';
288 print
"</td></tr>\n";
292 print
'<div class="center">';
293 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage receptions.
Class to manage a WYSIWYG editor.
if(! $sortfield) if(! $sortorder) $module
expedition_admin_prepare_head()
Return array head with list of tabs to view object information.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
pdf_getSubstitutionArray($outputlangs, $exclude=null, $object=null, $onlykey=0, $include=null)
Return array of possible substitutions for PDF content (without external module substitutions).
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.