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.
'/commande/class/commande.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
53$langs->loadLangs(array(
"admin",
"other",
"errors",
"orders"));
59$action =
GETPOST(
'action',
'aZ09');
60$value =
GETPOST(
'value',
'alpha');
61$modulepart =
GETPOST(
'modulepart',
'aZ09');
63$label =
GETPOST(
'label',
'alpha');
64$scandir =
GETPOST(
'scan_dir',
'alpha');
66$dirforterms =
$conf->order->dir_output;
67if (!empty(
$conf->order->multidir_output[
$conf->entity])) {
68 $dirforterms =
$conf->order->multidir_output[
$conf->entity].
'/';
75include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
78if ($action ==
"update") {
79 if (GETPOSTISSET(
'MAIN_PDF_ADD_TERMSOFSALE_ORDER')) {
82 if (GETPOSTISSET(
'SALES_ORDER_SHOW_SHIPPING_ADDRESS')) {
88 if ($_FILES[
'termsofsale'][
"name"]) {
89 if (!preg_match(
'/(\.pdf)$/i', $_FILES[
'termsofsale'][
"name"])) {
90 $langs->load(
"errors");
93 $original_file = $_FILES[
'termsofsale'][
"name"];
94 $result =
dol_move_uploaded_file($_FILES[
'termsofsale'][
"tmp_name"], $dirforterms.$original_file, 1, 0, $_FILES[
'termsofsale'][
'error']);
103 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mainmenu=home&leftmenu=setup");
108if ($action ==
'removetermsofsale') {
110 $file = $dirforterms.
'/'.$filename;
112 if ($filename !=
'') {
122$form =
new Form($db);
125$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
127llxHeader(
'', $langs->trans(
"OrdersSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-order');
131$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
132print
load_fiche_titre($langs->trans(
"OrdersSetup"), $linkback,
'title_setup');
138print
'<form enctype="multipart/form-data" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
139print
'<input type="hidden" name="token" value="'.newToken().
'">';
140print
'<input type="hidden" name="action" value="update">';
142print
'<div class="div-table-responsive-no-min">';
143print
'<table summary="more" class="noborder centpercent">';
144print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameter").
'</td><td width="200px"></td></tr>';
146print
'<tr class="oddeven"><td>';
147print $form->textwithpicto($langs->trans(
"MAIN_PDF_ADD_TERMSOFSALE_ORDER"), $langs->trans(
"PdfAddTermOfSaleHelp"));
149if (
$conf->use_javascript_ajax) {
150 print ajax_constantonoff(
'MAIN_PDF_ADD_TERMSOFSALE_ORDER');
152 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
153 print $form->selectarray(
"MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval,
$conf->global->MAIN_PDF_ADD_TERMSOFSALE_ORDER);
157print
'<tr class="oddeven"><td>';
158print $form->textwithpicto($langs->trans(
"SALES_ORDER_SHOW_SHIPPING_ADDRESS"), $langs->trans(
"SALES_ORDER_SHOW_SHIPPING_ADDRESSMore"));
160if (
$conf->use_javascript_ajax) {
161 print ajax_constantonoff(
'SALES_ORDER_SHOW_SHIPPING_ADDRESS');
163 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
164 print $form->selectarray(
"SALES_ORDER_SHOW_SHIPPING_ADDRESS", $arrval,
$conf->global->SALES_ORDER_SHOW_SHIPPING_ADDRESS);
171print
load_fiche_titre($langs->trans(
"FileToConcatToGeneratedPDF"),
'',
'file');
172print
'<div class="div-table-responsive-no-min">';
173print
'<table summary="more" class="noborder centpercent">';
174print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameters").
'</td><td width="200px"></td></tr>';
177$tooltiptermsofsale = $langs->trans(
'AvailableFormats').
' : pdf';
179$tooltiptermsofsale .= ($maxfilesizearray[
'maxmin'] > 0) ?
'<br>'.$langs->trans(
'MaxSize').
' : '.$maxfilesizearray[
'maxmin'].
' '.$langs->trans(
'Kb') :
'';
180$documenturl = DOL_URL_ROOT.
'/document.php';
181if (isset(
$conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
182 $documenturl =
$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
184$modulepart =
'order';
186print
'<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans(
"FileToConcatToGeneratedPDF"), $tooltiptermsofsale).
'</label></td><td>';
187print
'<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
188print
'<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="termsofsale" id="termsofsale" accept="application/pdf">';
192 if (file_exists($dirforterms.
'/'.$termofsale)) {
193 $file =
dol_dir_list($dirforterms,
'files', 0, $termofsale);
194 print
'<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($termofsale).
'">'.$termofsale.
'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0,
'');
195 print
'<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=removetermsofsale&token='.
newToken().
'">'.
img_delete($langs->trans(
"Delete"),
'',
'marginleftonly').
'</a></div>';
204print
'<center><input type="submit" class="button button-edit reposition" value="'.$langs->trans(
"Save").
'"></center>';
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.
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.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
order_admin_prepare_head()
Return array head with list of tabs to view object information.
getMaxFileSizeArray()
Return the max allowed for file upload.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.