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.
'/comm/propal/class/propal.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/propal.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",
"propal"));
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');
71include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
74if ($action ==
"update") {
75 if (GETPOSTISSET(
'MAIN_PDF_ADD_TERMSOFSALE_PROPAL')) {
78 if (GETPOSTISSET(
'MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
83 if ($_FILES[
'termsofsale'][
"name"]) {
84 if (!preg_match(
'/(\.pdf)$/i', $_FILES[
'termsofsale'][
"name"])) {
85 $langs->load(
"errors");
88 $dirforterms =
$conf->propal->dir_output.
'/';
89 $original_file = $_FILES[
'termsofsale'][
"name"];
90 $result =
dol_move_uploaded_file($_FILES[
'termsofsale'][
"tmp_name"], $dirforterms.$original_file, 1, 0, $_FILES[
'termsofsale'][
'error']);
99 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mainmenu=home&leftmenu=setup");
104if ($action ==
'removetermsofsale') {
106 $file =
$conf->propal->dir_output.
'/'.$filename;
108 if ($filename !=
'') {
118$form =
new Form($db);
121$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
123llxHeader(
'', $langs->trans(
"PropalSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-propal');
127$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
128print
load_fiche_titre($langs->trans(
"PropalSetup"), $linkback,
'title_setup');
134print
'<form enctype="multipart/form-data" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
135print
'<input type="hidden" name="token" value="'.newToken().
'">';
136print
'<input type="hidden" name="action" value="update">';
138print
'<div class="div-table-responsive-no-min">';
139print
'<table summary="more" class="noborder centpercent">';
140print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameter").
'</td><td width="200px"></td></tr>';
142print
'<tr class="oddeven"><td>';
143print $form->textwithpicto($langs->trans(
"MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), $langs->trans(
"PdfAddTermOfSaleHelp"));
145if (
$conf->use_javascript_ajax) {
146 print ajax_constantonoff(
'MAIN_PDF_ADD_TERMSOFSALE_PROPAL', array(),
null, 0, 0, 1);
148 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
149 print $form->selectarray(
"MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval,
$conf->global->MAIN_PDF_ADD_TERMSOFSALE_PROPAL);
153print
'<tr class="oddeven"><td>';
154print $form->textwithpicto($langs->trans(
"MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans(
"RandomlySelectedIfSeveral"));
156if (
$conf->use_javascript_ajax) {
157 print ajax_constantonoff(
'MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
159 $arrval = array(
'0' => $langs->trans(
"No"),
'1' => $langs->trans(
"Yes"));
160 print $form->selectarray(
"MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval,
$conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
167if (empty(
$conf->use_javascript_ajax)) {
168 print
'<center><input type="submit" class="button button-edit reposition" value="'.$langs->trans(
"Save").
'"></center>';
174 print
load_fiche_titre($langs->trans(
"FileToConcatToGeneratedPDF"),
'',
'file');
176 print
'<div class="div-table-responsive-no-min">';
177 print
'<table summary="more" class="noborder centpercent">';
178 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameters").
'</td><td width="200px"></td></tr>';
181 $tooltiptermsofsale = $langs->trans(
'AvailableFormats').
' : pdf';
183 $tooltiptermsofsale .= ($maxfilesizearray[
'maxmin'] > 0) ?
'<br>'.$langs->trans(
'MaxSize').
' : '.$maxfilesizearray[
'maxmin'].
' '.$langs->trans(
'Kb') :
'';
184 $documenturl = DOL_URL_ROOT.
'/document.php';
185 if (isset(
$conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
186 $documenturl =
$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
188 $modulepart =
'propal';
190 print
'<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans(
"FileToConcatToGeneratedPDF"), $tooltiptermsofsale).
'</label></td><td>';
191 print
'<div class="centpercent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
192 print
'<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="termsofsale" id="termsofsale" accept="application/pdf">';
195 if (file_exists(
$conf->propal->dir_output.
'/'.$termofsale)) {
197 print
'<div class="inline-block valignmiddle marginrightonly"><a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($termofsale).
'">'.$termofsale.
'</a>'.$formfile->showPreview($file[0], $modulepart, $termofsale, 0,
'');
198 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>';
206 print
'<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.
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...
propal_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.