48require_once
'../main.inc.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
59 $langs->setDefaultLang(
GETPOST(
'lang',
'aZ09'));
62$langs->loadLangs(array(
"main",
"other"));
64$action =
GETPOST(
'action',
'aZ09');
65$modulepart =
GETPOST(
'modulepart',
'aZ09');
75 header(
"Location: ".$urlforuploadpage);
79if ($action ==
'uploadfile') {
82 $module = $arrayobject[
'module'];
83 $element = $arrayobject[
'element'];
84 $dir_output = $arrayobject[
'dir_output'];
85 $dir_temp = $arrayobject[
'dir_temp'];
87 $permlevel1 = $element;
88 if ($module ==
'fournisseur') {
89 $permlevel1 =
'facture';
92 $permissiontoadd = $user->hasRight($module, $permlevel1,
'read');
93 $upload_dir = $dir_temp.
'/import';
94 $forceFullTextIndexation =
'1';
99 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
107$form =
new Form($db);
110if (empty($dolibarr_nocache) &&
GETPOSTINT(
'cache')) {
111 header(
'Cache-Control: max-age='.
GETPOSTINT(
'cache').
', public');
113 header(
'Expires: '.gmdate(
'D, d M Y H:i:s',
dol_now(
'gmt') +
GETPOSTINT(
'cache')).
' GMT');
115 header(
'Pragma: token=public');
118 header(
'Cache-Control: no-cache');
121$title = $langs->trans(
"UploadFile");
125$head =
'<!-- Upload file -->'.
"\n";
127$arrayofcss = array();
129llxHeader(
'', $title, $help_url,
'', 0, 0, $arrayofjs, $arrayofcss,
'',
'mod-upload page-card');
136$hookmanager->initHooks(array(
'uploadform'));
142$uploadform =
'<div class="display-flex">';
144if (isModEnabled(
'supplier_invoice')) {
145 $langs->load(
"bills");
147 <div id="supplierinvoice" class="flex-item flex-item-uploadfile">'.img_picto(
'',
'bill',
'class="fa-2x"').
'<br>
148 <div>'.$langs->trans(
"SupplierInvoice").
'<br><br>';
150 $uploadform .=
img_picto(
'',
'company',
'class="pictofixedwidth"');
151 $uploadform .= $form->select_company(
GETPOSTINT(
'socid'),
'socid',
'statut=0', $langs->transnoentitiesnoconv(
"Supplier"));
153 $uploadform .=
'<br><br>
154 <small>('.$langs->trans(
"OrClickToSelectAFile").
')</small>
159if (isModEnabled(
'salaries')) {
160 $langs->load(
"salaries");
162 <div id="userpayroll" class="flex-item flex-item-uploadfile">'.img_picto(
'',
'salary',
'class="fa-2x"').
'<br>
163 <div>'.$langs->trans(
"UserPaySlip").
'<br>
164 <small>('.$langs->trans(
"OrClickToSelectAFile").
')</small>
169$uploadform .=
'</div>';
173$parameters = array(
'uploadform' => $uploadform);
174$reshook = $hookmanager->executeHooks(
'printUploadForm', $parameters);
175if (empty($reshook)) {
176 $uploadform .= $hookmanager->resPrint;
178 $uploadform = $hookmanager->resPrint;
181$uploadform .=
'<br>';
186print
"<!-- Begin UploadForm -->\n";
187print
'<form id="uploadform" enctype="multipart/form-data" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
188print
'<input type="hidden" name="token" value="'.newToken().
'">';
189print
'<input type="hidden" name="action" value="uploadfile">';
190print
'<input type="hidden" name="sendit" value="1">';
191print
'<input type="hidden" name="modulepart" id="modulepart" value="">';
193print
'<div class="center"><div class="center" style="padding: 30px;">';
194print
'<style>.menu_titre { padding-top: 7px; }</style>';
195print
'<div id="blockupload" class="center">'.
"\n";
200$accept =
'.pdf, image';
206$max = $maxfilesizearray[
'max'];
207$maxmin = $maxfilesizearray[
'maxmin'];
208$maxphptoshow = $maxfilesizearray[
'maxphptoshow'];
209$maxphptoshowparam = $maxfilesizearray[
'maxphptoshowparam'];
212 $out .=
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
214$out .=
'<input class="hideobject" type="file" id="fileInput"';
216$out .= ((
getDolGlobalString(
'MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ?
' name="userfile"' :
' name="userfile[]" multiple');
220$out .= (!empty($accept) ?
' accept="'.$accept.
'"' :
' accept=""');
222$out .= (!empty($capture) ?
' capture="capture"' :
'');
229$(document).ready(function() {
230 jQuery('#supplierinvoice').on('click', function(event) {
231 console.log('Click on link to open input file');
233 $('#modulepart').val('invoice_supplier');
234 $('#fileInput').click();
237 jQuery('#userpayroll').on('click', function(event) {
238 console.log('Click on link to open input file');
240 $('#modulepart').val('salary');
241 $('#fileInput').click();
244 jQuery('#search_socid').on('click', function(event) {
245 event.stopPropagation();
246 console.log('Avoid to open the input select');
249 jQuery('#fileInput').on('change', function() {
250 console.log('A file was selected, we submit the form');
251 $('#uploadform').submit();
260print
"\n<!-- End UploadForm -->\n";
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_now($mode='auto')
Return date for now.
getElementProperties($elementType)
Get an array with properties of an element.
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.
getMaxFileSizeArray()
Return the max allowed for file upload.