33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/expedition.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
49$langs->loadLangs(array(
"admin",
"sendings",
"other"));
55$action =
GETPOST(
'action',
'alpha');
56$value =
GETPOST(
'value',
'alpha');
57$modulepart =
GETPOST(
'modulepart',
'aZ09');
59$label =
GETPOST(
'label',
'alpha');
60$scandir =
GETPOST(
'scan_dir',
'alpha');
69include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
79if ($action ==
'activate_delivery') {
82 header(
"Location: delivery.php");
84} elseif ($action ==
'disable_delivery') {
86 header(
"Location: delivery.php");
90if ($action ==
'updateMask') {
91 $maskconstdelivery =
GETPOST(
'maskconstdelivery',
'aZ09');
92 $maskdelivery =
GETPOST(
'maskdelivery',
'alpha');
96 if ($maskconstdelivery && preg_match(
'/_MASK$/', $maskconstdelivery)) {
105 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
107 setEventMessages($langs->trans(
"Error"),
null,
'errors');
111if ($action ==
'set_DELIVERY_FREE_TEXT') {
112 $free =
GETPOST(
'DELIVERY_FREE_TEXT',
'restricthtml');
120 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
122 setEventMessages($langs->trans(
"Error"),
null,
'errors');
126if ($action ==
'specimen') {
127 $modele =
GETPOST(
'module',
'alpha');
130 $sending->initAsSpecimen();
135 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
136 foreach ($dirmodels as $reldir) {
137 $file =
dol_buildpath($reldir.
"core/modules/delivery/doc/pdf_".$modele.
".modules.php", 0);
138 if (file_exists($file)) {
139 $classname =
"pdf_".$modele;
144 if ($classname !==
'') {
148 '@phan-var-force ModelePDFDeliveryOrder $module';
150 if (
$module->write_file($sending, $langs) > 0) {
151 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=delivery&file=SPECIMEN.pdf");
158 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
159 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
163if ($action ==
'set') {
167if ($action ==
'del') {
176if ($action ==
'setdoc') {
180 $conf->global->DELIVERY_ADDON_PDF = $value;
190if ($action ==
'setmod') {
203$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
205llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-delivery');
207$form =
new Form($db);
209$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>';
211print
load_fiche_titre($langs->trans(
"SendingsSetup"), $linkback,
'title_setup');
215print
dol_get_fiche_head($head,
'receivings', $langs->trans(
"Receivings"), -1,
'shipment');
219print
'<div class="inline-block valignmiddle">'.$langs->trans(
"DeliveriesOrderAbility").
'</div>';
221 print
' <a class="inline-block valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=activate_delivery&token='.
newToken().
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
223 print
' <a class="inline-block valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=disable_delivery&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
226print
'<br><br><span class="opacitymedium">'.info_admin($langs->trans(
"NoNeedForDeliveryReceipts"), 0, 1).
'</span>';
236 $delivery->initAsSpecimen();
238 printNumberingModuleList(
'delivery',
'mod_delivery_',
'DELIVERY_ADDON_NUMBER', $langs->trans(
"DeliveryOrderNumberingModules"), $delivery);
245 printDocumentModelList(
'delivery',
'delivery',
'DELIVERY_ADDON_PDF', $langs->trans(
"DeliveryOrderModel"), array(
246 'Logo' =>
'option_logo',
253 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
254 print
'<input type="hidden" name="token" value="'.newToken().
'">';
255 print
'<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
257 print
'<table class="noborder centpercent">';
258 print
'<tr class="liste_titre">';
259 print
'<td>'.$langs->trans(
"Parameter").
'</td>';
260 print
'<td align="center" width="60"></td>';
261 print
'<td width="80"> </td>';
265 $substitutionarray[
'__(AnyTranslationKey)__'] = $langs->trans(
"Translation");
266 $htmltext =
'<i>'.$langs->trans(
"AvailableVariables").
':<br>';
267 foreach ($substitutionarray as $key => $val) {
268 $htmltext .= $key.
'<br>';
272 print
'<tr class="oddeven"><td colspan="2">';
273 print $form->textwithpicto($langs->trans(
"FreeLegalTextOnDeliveryReceipts"), $langs->trans(
"AddCRIfTooLong").
'<br><br>'.$htmltext, 1,
'help',
'', 0, 2,
'freetexttooltip').
'<br>';
274 $variablename =
'DELIVERY_FREE_TEXT';
276 print
'<textarea name="'.$variablename.
'" class="flat" cols="120">'.
getDolGlobalString($variablename).
'</textarea>';
278 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
280 print $doleditor->Create();
282 print
'</td><td class="right">';
283 print
"</td></tr>\n";
287 print
'<div class="center">';
288 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.
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.