67 $this->numoffiles = 0;
96 public function form_attach_new_file($url, $title =
'', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50,
$object =
null, $options =
'', $useajax = 1, $savingdocmask =
'', $linkfiles = 1, $htmlname =
'formuserfile', $accept =
'', $sectiondir =
'', $usewithoutform = 0, $capture = 0, $disablemulti = 0, $nooutput = 0)
99 global $conf, $langs, $hookmanager;
100 $hookmanager->initHooks(array(
'formfile'));
104 dol_syslog(__METHOD__.
": using 2 for useajax is deprecated and should be not used", LOG_WARNING);
107 if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
111 if ((
getDolGlobalString(
'MAIN_USE_JQUERY_FILEUPLOAD') && $useajax) || ($useajax == 2)) {
118 return 'Feature too bugged so removed';
129 $out =
"\n\n".
'<!-- Start form attach new file --><div class="formattachnewfile">'.
"\n";
132 $title = $langs->trans(
"AttachANewFile");
134 if ($title !=
'none') {
138 if (empty($usewithoutform)) {
140 $url .= (strpos($url,
'?') ===
false ?
'?' :
'&').
'uploadform=1';
142 $out .=
'<form name="'.$htmlname.
'" id="'.$htmlname.
'" action="'.$url.
'" enctype="multipart/form-data" method="POST">'.
"\n";
144 if (empty($usewithoutform) || $usewithoutform == 2) {
145 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
146 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_dir" name="section_dir" value="'.$sectiondir.
'">'.
"\n";
147 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_id" name="section_id" value="'.$sectionid.
'">'.
"\n";
148 $out .=
'<input type="hidden" name="sortfield" value="'.GETPOST(
'sortfield',
'aZ09comma').
'">'.
"\n";
149 $out .=
'<input type="hidden" name="sortorder" value="'.GETPOST(
'sortorder',
'aZ09comma').
'">'.
"\n";
150 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
153 $out .=
'<table class="nobordernopadding centpercent">';
156 if (!empty($options)) {
157 $out .=
'<td>'.$options.
'</td>';
160 $out .=
'<td class="valignmiddle nowrap">';
163 $max = $maxfilesizearray[
'max'];
164 $maxmin = $maxfilesizearray[
'maxmin'];
165 $maxphptoshow = $maxfilesizearray[
'maxphptoshow'];
166 $maxphptoshowparam = $maxfilesizearray[
'maxphptoshowparam'];
168 $out .=
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
170 $out .=
'<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
171 $out .= ((
getDolGlobalString(
'MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ?
' name="userfile"' :
' name="userfile[]" multiple');
173 $out .= (!empty($accept) ?
' accept="'.$accept.
'"' :
' accept=""');
174 $out .= (!empty($capture) ?
' capture="capture"' :
'');
178 $langs->load(
'link');
179 $out .=
'<span class="nowraponsmartphone"><input style="margin-right: 2px;" type="checkbox" id="overwritefile" name="overwritefile" value="1"><label for="overwritefile">'.$langs->trans(
"OverwriteIfExists").
'</label></span>';
181 $out .=
'<input type="submit" class="button small reposition" name="sendit" value="'.$langs->trans(
"Upload").
'"';
187 $out .=
'<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
192 $menudolibarrsetupmax = $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Security");
193 $langs->load(
'other');
195 $out .=
info_admin($langs->trans(
"ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1);
198 $out .=
' ('.$langs->trans(
"UploadDisabled").
')';
200 $out .=
"</td></tr>";
202 if ($savingdocmask) {
204 $rename = (!
getDolGlobalString(
'MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ?
'checked' :
'');
207 if (!empty($options)) {
208 $out .=
'<td>'.$options.
'</td>';
210 $out .=
'<td valign="middle" class="nowrap">';
211 $out .=
'<input type="checkbox" '.$rename.
' class="savingdocmask" name="savingdocmask" id="savingdocmask" value="'.
dol_escape_js($savingdocmask).
'"> ';
212 $out .=
'<label class="opacitymedium small" for="savingdocmask">';
213 $out .= $langs->trans(
"SaveUploadedFileWithMask", preg_replace(
'/__file__/', $langs->transnoentitiesnoconv(
"OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv(
"OriginFileName"));
221 if (empty($usewithoutform)) {
223 if (empty($sectionid)) {
228 $out .=
"\n</div><!-- End form attach new file -->\n";
231 $out .=
"\n".
'<!-- Start form link new url --><div class="formlinknewurl">'.
"\n";
232 $langs->load(
'link');
233 $title = $langs->trans(
"LinkANewFile");
236 if (empty($usewithoutform)) {
237 $out .=
'<form name="'.$htmlname.
'_link" id="'.$htmlname.
'_link" action="'.$url.
'" method="POST">'.
"\n";
238 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
239 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_dir" name="link_section_dir" value="">'.
"\n";
240 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_id" name="link_section_id" value="'.$sectionid.
'">'.
"\n";
241 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
244 $out .=
'<div class="valignmiddle">';
245 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
247 $out .=
'<label for="link">'.$langs->trans(
"URLToLink").
':</label> ';
249 $out .=
'<input type="text" name="link" class="flat minwidth400imp" id="link" placeholder="'.dol_escape_htmltag($langs->trans(
"URLToLink")).
'">';
251 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
253 $out .=
'<label for="label">'.$langs->trans(
"Label").
':</label> ';
255 $out .=
'<input type="text" class="flat" name="label" id="label" placeholder="'.dol_escape_htmltag($langs->trans(
"Label")).
'">';
256 $out .=
'<input type="hidden" name="objecttype" value="'.$object->element.
'">';
257 $out .=
'<input type="hidden" name="objectid" value="'.$object->id.
'">';
259 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
260 $out .=
'<input type="submit" class="button small reposition" name="linkit" value="'.$langs->trans(
"ToLink").
'"';
265 if (empty($usewithoutform)) {
266 $out .=
'<div class="clearboth"></div>';
267 $out .=
'</form><br>';
270 $out .=
"\n</div><!-- End form link new url -->\n";
273 $parameters = array(
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'url' => $url,
'perm' => $perm,
'options' => $options);
274 $res = $hookmanager->executeHooks(
'formattachOptions', $parameters,
$object);
276 $out =
'<div class="'.($usewithoutform ?
'inline-block valignmiddle' :
'attacharea attacharea'.$htmlname).
'">'.$out.
'</div>';
278 $out .= $hookmanager->resPrint;
312 public function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected =
'', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param =
'', $title =
'', $buttonlabel =
'', $codelang =
'')
315 $this->numoffiles = 0;
316 print $this->
showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed, $modelselected, $allowgenifempty, $forcenomultilang, $iconPDF, $notused, $noform, $param, $title, $buttonlabel, $codelang);
317 return $this->numoffiles;
347 public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected =
'', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param =
'', $title =
'', $buttonlabel =
'', $codelang =
'', $morepicto =
'',
$object =
null, $hideifempty = 0, $removeaction =
'remove_file', $tooltipontemplatecombo =
'')
349 global $dolibarr_main_url_root;
352 if (!empty($iconPDF)) {
353 dol_syslog(__METHOD__.
": passing iconPDF parameter is deprecated", LOG_WARNING);
356 global $langs, $conf, $user, $hookmanager;
360 if (is_object($hookmanager)) {
362 'modulepart' => &$modulepart,
363 'modulesubdir' => &$modulesubdir,
364 'filedir' => &$filedir,
365 'urlsource' => &$urlsource,
366 'genallowed' => &$genallowed,
367 'delallowed' => &$delallowed,
368 'modelselected' => &$modelselected,
369 'allowgenifempty' => &$allowgenifempty,
370 'forcenomultilang' => &$forcenomultilang,
371 'noform' => &$noform,
374 'buttonlabel' => &$buttonlabel,
375 'codelang' => &$codelang,
376 'morepicto' => &$morepicto,
377 'hideifempty' => &$hideifempty,
378 'removeaction' => &$removeaction
380 $reshook = $hookmanager->executeHooks(
'showDocuments', $parameters,
$object);
388 return $hookmanager->resPrint;
391 if (!is_object($form)) {
392 $form =
new Form($this->db);
395 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
398 if (!empty($iconPDF)) {
403 if (!preg_match(
'/entity\=[0-9]+/', $param)) {
404 $param .= ($param ?
'&' :
'').
'entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity);
409 if (in_array($modulepart, array(
'contract',
'facture',
'supplier_proposal',
'propal',
'proposal',
'order',
'commande',
'expedition',
'commande_fournisseur',
'expensereport',
'delivery',
'ticket'))) {
410 $printer = ($user->hasRight(
'printing',
'read') && !empty($conf->printing->enabled));
413 $hookmanager->initHooks(array(
'formfile'));
417 if (!empty($filedir)) {
418 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
420 if ($hideifempty && empty($file_list)) {
425 $forname =
'builddoc';
430 $out .=
"\n".
'<!-- Start show_document -->'.
"\n";
433 if (preg_match(
'/massfilesarea_/', $modulepart)) {
434 $out .=
'<div id="show_files"><br></div>'.
"\n";
435 $title = $langs->trans(
"MassFilesArea").
' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans(
"Hide").
')</a>';
436 $title .=
'<script nonce="'.getNonce().
'">
437 jQuery(document).ready(function() {
438 jQuery(\'#togglemassfilesarea\').click(function() {
439 if (jQuery(\'#togglemassfilesarea\').attr(\'ref\') == "shown")
441 jQuery(\'#'.$modulepart.
'_table\').hide();
442 jQuery(\'#togglemassfilesarea\').attr("ref", "hidden");
443 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Show")).
')");
447 jQuery(\'#'.$modulepart.
'_table\').show();
448 jQuery(\'#togglemassfilesarea\').attr("ref","shown");
449 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Hide")).
')");
457 $titletoshow = $langs->trans(
"Documents");
458 if (!empty($title)) {
459 $titletoshow = ($title ==
'none' ?
'' : $title);
462 $submodulepart = $modulepart;
465 $tmp = explode(
':', $modulepart);
466 if (!empty($tmp[1])) {
467 $modulepart = $tmp[0];
468 $submodulepart = $tmp[1];
471 $addcolumforpicto = ($delallowed || $printer || $morepicto);
472 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
477 $modellist = array();
479 if ($modulepart ==
'company') {
481 if (is_array($genallowed)) {
482 $modellist = $genallowed;
484 include_once DOL_DOCUMENT_ROOT.
'/core/modules/societe/modules_societe.class.php';
487 } elseif ($modulepart ==
'propal') {
488 if (is_array($genallowed)) {
489 $modellist = $genallowed;
491 include_once DOL_DOCUMENT_ROOT.
'/core/modules/propale/modules_propale.php';
494 } elseif ($modulepart ==
'supplier_proposal') {
495 if (is_array($genallowed)) {
496 $modellist = $genallowed;
498 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
501 } elseif ($modulepart ==
'commande') {
502 if (is_array($genallowed)) {
503 $modellist = $genallowed;
505 include_once DOL_DOCUMENT_ROOT.
'/core/modules/commande/modules_commande.php';
508 } elseif ($modulepart ==
'expedition') {
509 if (is_array($genallowed)) {
510 $modellist = $genallowed;
512 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
515 } elseif ($modulepart ==
'reception') {
516 if (is_array($genallowed)) {
517 $modellist = $genallowed;
519 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
522 } elseif ($modulepart ==
'delivery') {
523 if (is_array($genallowed)) {
524 $modellist = $genallowed;
526 include_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/modules_delivery.php';
529 } elseif ($modulepart ==
'ficheinter') {
530 if (is_array($genallowed)) {
531 $modellist = $genallowed;
533 include_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
536 } elseif ($modulepart ==
'facture') {
537 if (is_array($genallowed)) {
538 $modellist = $genallowed;
540 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
543 } elseif ($modulepart ==
'contract') {
545 if (is_array($genallowed)) {
546 $modellist = $genallowed;
548 include_once DOL_DOCUMENT_ROOT.
'/core/modules/contract/modules_contract.php';
551 } elseif ($modulepart ==
'project') {
552 if (is_array($genallowed)) {
553 $modellist = $genallowed;
555 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
558 } elseif ($modulepart ==
'project_task') {
559 if (is_array($genallowed)) {
560 $modellist = $genallowed;
562 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
565 } elseif ($modulepart ==
'product') {
566 if (is_array($genallowed)) {
567 $modellist = $genallowed;
569 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product/modules_product.class.php';
572 } elseif ($modulepart ==
'product_batch') {
573 if (is_array($genallowed)) {
574 $modellist = $genallowed;
576 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product_batch/modules_product_batch.class.php';
579 } elseif ($modulepart ==
'stock') {
580 if (is_array($genallowed)) {
581 $modellist = $genallowed;
583 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_stock.php';
586 } elseif ($modulepart ==
'hrm') {
587 if (is_array($genallowed)) {
588 $modellist = $genallowed;
590 include_once DOL_DOCUMENT_ROOT.
'/core/modules/hrm/modules_evaluation.php';
593 } elseif ($modulepart ==
'movement') {
594 if (is_array($genallowed)) {
595 $modellist = $genallowed;
597 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_movement.php';
600 } elseif ($modulepart ==
'export') {
601 if (is_array($genallowed)) {
602 $modellist = $genallowed;
604 include_once DOL_DOCUMENT_ROOT.
'/core/modules/export/modules_export.php';
606 $modellist = array();
608 } elseif ($modulepart ==
'commande_fournisseur' || $modulepart ==
'supplier_order') {
609 if (is_array($genallowed)) {
610 $modellist = $genallowed;
612 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
615 } elseif ($modulepart ==
'facture_fournisseur' || $modulepart ==
'supplier_invoice') {
617 if (is_array($genallowed)) {
618 $modellist = $genallowed;
620 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
623 } elseif ($modulepart ==
'supplier_payment') {
624 if (is_array($genallowed)) {
625 $modellist = $genallowed;
627 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
630 } elseif ($modulepart ==
'remisecheque') {
631 if (is_array($genallowed)) {
632 $modellist = $genallowed;
634 include_once DOL_DOCUMENT_ROOT.
'/core/modules/cheque/modules_chequereceipts.php';
637 } elseif ($modulepart ==
'donation') {
638 if (is_array($genallowed)) {
639 $modellist = $genallowed;
641 include_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
644 } elseif ($modulepart ==
'member') {
645 if (is_array($genallowed)) {
646 $modellist = $genallowed;
648 include_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_cards.php';
651 } elseif ($modulepart ==
'agenda' || $modulepart ==
'actions') {
652 if (is_array($genallowed)) {
653 $modellist = $genallowed;
655 include_once DOL_DOCUMENT_ROOT.
'/core/modules/action/modules_action.php';
658 } elseif ($modulepart ==
'expensereport') {
659 if (is_array($genallowed)) {
660 $modellist = $genallowed;
662 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expensereport/modules_expensereport.php';
665 } elseif ($modulepart ==
'unpaid') {
667 } elseif ($modulepart ==
'user') {
668 if (is_array($genallowed)) {
669 $modellist = $genallowed;
671 include_once DOL_DOCUMENT_ROOT.
'/core/modules/user/modules_user.class.php';
674 } elseif ($modulepart ==
'usergroup') {
675 if (is_array($genallowed)) {
676 $modellist = $genallowed;
678 include_once DOL_DOCUMENT_ROOT.
'/core/modules/usergroup/modules_usergroup.class.php';
683 $file =
dol_buildpath(
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
684 if (file_exists($file)) {
685 $res = include_once $file;
688 $file =
dol_buildpath(
'/'.$modulepart.
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
689 $res = include_once $file;
692 $class =
'ModelePDF'.ucfirst($submodulepart);
694 if (class_exists($class)) {
695 $modellist = call_user_func($class.
'::liste_modeles', $this->db);
697 dol_print_error($this->db,
"Bad value for modulepart '".$modulepart.
"' in showdocuments (class ".$class.
" for Doc generation not found)");
705 if (empty($buttonlabel)) {
706 $buttonlabel = $langs->trans(
'Generate');
709 if ($conf->browser->layout ==
'phone') {
710 $urlsource .=
'#'.$forname.
'_form';
712 if (empty($noform)) {
713 $out .=
'<form action="'.$urlsource.
'" id="'.$forname.
'_form" method="post">';
715 $out .=
'<input type="hidden" name="action" value="builddoc">';
716 $out .=
'<input type="hidden" name="page_y" value="">';
717 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
720 $out .=
'<div class="div-table-responsive-no-min">';
721 $out .=
'<table class="liste formdoc noborder centpercent">';
723 $out .=
'<tr class="liste_titre">';
724 $addcolumforpicto = ($delallowed || $printer || $morepicto);
725 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
728 $out .=
'<th colspan="'.$colspan.
'" class="formdoc liste_titre maxwidthonsmartphone center">';
731 if (!empty($modellist)) {
733 $out .=
'<span class="hideonsmartphone">'.$langs->trans(
'Model').
' </span>';
734 if (is_array($modellist) && count($modellist) == 1) {
735 $arraykeys = array_keys($modellist);
736 $modelselected = $arraykeys[0];
738 $morecss =
'minwidth75 maxwidth200';
739 if ($conf->browser->layout ==
'phone') {
740 $morecss =
'maxwidth100';
742 $out .= $form->selectarray(
'model', $modellist, $modelselected, $showempty, 0, 0,
'', 0, 0, 0,
'', $morecss, 1,
'', 0, 0);
776 if ($conf->use_javascript_ajax) {
779 $out .= $form->textwithpicto(
'', $tooltipontemplatecombo, 1,
'help',
'marginrightonly', 0, 3,
'', 0);
781 $out .=
'<div class="float">'.$langs->trans(
"Files").
'</div>';
785 if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) &&
getDolGlobalInt(
'MAIN_MULTILANGS') && !$forcenomultilang && (!empty($modellist) || $showempty)) {
786 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
788 $defaultlang = ($codelang && $codelang !=
'auto') ? $codelang : $langs->getDefaultLang();
789 $morecss =
'maxwidth150';
790 if ($conf->browser->layout ==
'phone') {
791 $morecss =
'maxwidth100';
793 $out .= $formadmin->select_language($defaultlang,
'lang_id', 0,
null, 0, 0, 0, $morecss);
799 $genbutton =
'<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.
'_generatebutton" name="'.$forname.
'_generatebutton"';
800 $genbutton .=
' type="submit" value="'.$buttonlabel.
'"';
801 if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
802 $genbutton .=
' disabled';
805 if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
806 $langs->load(
"errors");
807 $genbutton .=
' '.img_warning($langs->transnoentitiesnoconv(
"WarningNoDocumentModelActivated"));
809 if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
812 if (empty($modellist) && !$showempty && $modulepart !=
'unpaid') {
818 if (!empty($hookmanager->hooks[
'formfile'])) {
819 foreach ($hookmanager->hooks[
'formfile'] as $module) {
820 if (method_exists($module,
'formBuilddocLineOptions')) {
829 $parameters = array(
'colspan' => ($colspan + $colspanmore),
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart' => $modulepart);
830 if (is_object($hookmanager)) {
831 $reshook = $hookmanager->executeHooks(
'formBuilddocOptions', $parameters, $GLOBALS[
'object']);
832 $out .= $hookmanager->resPrint;
837 if (!empty($filedir)) {
838 $link_list = array();
840 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
841 $link =
new Link($this->db);
842 $sortfield = $sortorder =
null;
843 $res = $link->fetchAll($link_list,
$object->element,
$object->id, $sortfield, $sortorder);
846 $out .=
'<!-- html.formfile::showdocuments -->'.
"\n";
849 if ((!empty($file_list) || !empty($link_list) || preg_match(
'/^massfilesarea/', $modulepart))
852 $out .=
'<div class="titre">'.$titletoshow.
'</div>'.
"\n";
853 $out .=
'<div class="div-table-responsive-no-min">';
854 $out .=
'<table class="noborder centpercent" id="'.$modulepart.
'_table">'.
"\n";
858 if (is_array($file_list)) {
862 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
863 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
871 if (!empty($sortfield) && !empty($sortorder)) {
876 foreach ($file_list as $file) {
878 $relativepath = $file[
"name"];
880 $relativepath = $modulesubdir.
"/".$file[
"name"];
882 if ($modulepart ==
'export') {
883 $relativepath = $file[
"name"];
886 $out .=
'<tr class="oddeven">';
888 $documenturl = DOL_URL_ROOT.
'/document.php';
889 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
894 $imgpreview = $this->
showPreview($file, $modulepart, $relativepath, 0, $param);
896 $out .=
'<td class="minwidth200 tdoverflowmax300">';
898 $out .=
'<span class="spanoverflow widthcentpercentminusx valignmiddle">';
900 $out .=
'<span class="spanoverflow">';
902 $out .=
'<a class="documentdownload paddingright" ';
904 $out .=
'target="_blank" ';
906 $out .=
'href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
909 if (preg_match(
'/text/', $mime)) {
910 $out .=
' target="_blank" rel="noopener noreferrer"';
912 $out .=
' title="'.dol_escape_htmltag($file[
"name"]).
'"';
914 $out .=
img_mime($file[
"name"], $langs->trans(
"File").
': '.$file[
"name"]);
917 $out .=
'</span>'.
"\n";
922 $size = (!empty($file[
'size']) ? $file[
'size'] :
dol_filesize($filedir.
"/".$file[
"name"]));
923 $out .=
'<td class="nowraponall right">'.dol_print_size($size, 1, 1).
'</td>';
926 $date = (!empty($file[
'date']) ? $file[
'date'] :
dol_filemtime($filedir.
"/".$file[
"name"]));
927 $out .=
'<td class="nowrap right">'.dol_print_date($date,
'dayhour',
'tzuser').
'</td>';
930 $out .=
'<td class="nowraponall">';
931 if (!empty($file[
'share'])) {
933 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
934 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
940 if (!empty($file[
'share'])) {
941 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
943 if ($forcedownload) {
944 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
947 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
949 $out .=
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
950 $out .=
'<input type="text" class="quatrevingtpercentminusx width75 nopadding small" id="downloadlink'.$file[
'rowid'].
'" name="downloadexternallink" title="'.
dol_escape_htmltag($langs->trans(
"FileSharedViaALink")).
'" value="'.
dol_escape_htmltag($fulllink).
'">';
958 if ($delallowed || $printer || $morepicto) {
959 $out .=
'<td class="right nowraponall">';
961 $tmpurlsource = preg_replace(
'/#[a-zA-Z0-9_]*$/',
'', $urlsource);
962 $out .=
'<a class="reposition" href="'.$tmpurlsource.((strpos($tmpurlsource,
'?') ===
false) ?
'?' :
'&').
'action='.urlencode($removeaction).
'&token='.
newToken().
'&file='.urlencode($relativepath);
963 $out .= ($param ?
'&'.$param :
'');
966 $out .=
'">'.img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
969 $out .=
'<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource,
'?') ?
'&' :
'?').
'action=print_file&token='.
newToken().
'&printer='.urlencode($modulepart).
'&file='.urlencode($relativepath);
970 $out .= ($param ?
'&'.$param :
'');
971 $out .=
'">'.img_picto($langs->trans(
"PrintFile", $relativepath),
'printer.png').
'</a>';
974 $morepicto = preg_replace(
'/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto);
980 if (is_object($hookmanager)) {
981 $addcolumforpicto = ($delallowed || $printer || $morepicto);
982 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
984 $parameters = array(
'colspan' => ($colspan + $colspanmore),
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart' => $modulepart,
'relativepath' => $relativepath);
985 $res = $hookmanager->executeHooks(
'formBuilddocLineOptions', $parameters, $file);
987 $out .= $hookmanager->resPrint;
990 $out = $hookmanager->resPrint;
998 if (is_array($link_list)) {
1001 foreach ($link_list as $file) {
1002 $out .=
'<tr class="oddeven">';
1003 $out .=
'<td colspan="'.$colspan.
'" class="maxwidhtonsmartphone">';
1004 $out .=
'<a data-ajax="false" href="'.$file->url.
'" target="_blank" rel="noopener noreferrer">';
1005 $out .= $file->label;
1008 $out .=
'<td class="right">';
1012 $out .=
'<td></td>';
1013 if ($delallowed || $printer || $morepicto) {
1014 $out .=
'<td></td>';
1016 $out .=
'</tr>'.
"\n";
1018 $this->numoffiles++;
1021 if (count($file_list) == 0 && count($link_list) == 0 && $headershown) {
1022 $out .=
'<tr><td colspan="'.(3 + ($addcolumforpicto ? 1 : 0)).
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>'.
"\n";
1028 $out .=
"</table>\n";
1031 if (empty($noform)) {
1032 $out .=
'</form>'.
"\n";
1036 $out .=
'<!-- End show_document -->'.
"\n";
1039 jQuery(document).ready(function() {
1040 var selectedValue = $(".selectformat").val();
1042 if (selectedValue === "excel2007" || selectedValue === "tsv") {
1043 $(".forhide").prop("disabled", true).hide();
1045 $(".forhide").prop("disabled", false).show();
1066 public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter =
'', $morecss =
'valignmiddle', $allfiles = 0)
1068 global $conf, $langs;
1070 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1073 $this->infofiles = array(
'nboffiles' => 0,
'extensions' => array(),
'files' => array());
1078 if (isModEnabled(
'multicompany')) {
1080 preg_match(
'/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,
'/').
'$/', $filedir, $regs);
1081 $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1);
1086 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/');
1088 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/').
'\.';
1090 $file_list =
dol_dir_list($filedir,
'files', 0, $filterforfilesearch,
'\.meta$|\.png$');
1094 $out .=
'<!-- html.formfile::getDocumentsLink -->'.
"\n";
1095 if (!empty($file_list)) {
1096 $out =
'<dl class="dropdown inline-block">
1097 <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto(
'',
'listlight',
'', 0, 0, 0,
'', $morecss).
'</a></dt>
1098 <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
1104 foreach ($file_list as $file) {
1106 if ($filter && !preg_match(
'/'.$filter.
'/i', $file[
"name"])) {
1112 $relativepath = $file[
"name"];
1113 if ($modulesubdir) {
1114 $relativepath = $modulesubdir.
"/".$file[
"name"];
1117 if ($modulepart ==
'donation') {
1118 $relativepath =
get_exdir($modulesubdir, 2, 0, 0,
null,
'donation').$file[
"name"];
1120 if ($modulepart ==
'export') {
1121 $relativepath = $file[
"name"];
1124 $this->infofiles[
'nboffiles']++;
1125 $this->infofiles[
'files'][] = $file[
'fullname'];
1126 $ext = pathinfo($file[
'name'], PATHINFO_EXTENSION);
1127 if (empty($this->infofiles[
'extensions'][$ext])) {
1128 $this->infofiles[
'extensions'][$ext] = 1;
1130 $this->infofiles[
'extensions'][$ext]++;
1134 if (!empty($conf->use_javascript_ajax) && ($conf->browser->layout !=
'phone')) {
1136 if ($tmparray && $tmparray[
'url']) {
1137 $tmpout .=
'<li><a href="'.$tmparray[
'url'].
'"'.($tmparray[
'css'] ?
' class="'.$tmparray[
'css'].
'"' :
'').($tmparray[
'mime'] ?
' mime="'.$tmparray[
'mime'].
'"' :
'').($tmparray[
'target'] ?
' target="'.$tmparray[
'target'].
'"' :
'').
'>';
1139 $tmpout .=
'<i class="fa fa-search-plus paddingright" style="color: gray"></i>';
1140 $tmpout .= $langs->trans(
"Preview").
' '.$ext.
'</a></li>';
1145 $tmpout .=
'<li class="nowrap"><a class="pictopreview nowrap" ';
1147 $tmpout .=
'target="_blank" ';
1149 $tmpout .=
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart.
'&entity='.$entity.
'&file='.urlencode($relativepath).
'"';
1151 if (preg_match(
'/text/', $mime)) {
1152 $tmpout .=
' target="_blank" rel="noopener noreferrer"';
1155 $tmpout .=
img_mime($relativepath, $file[
"name"]);
1156 $tmpout .= $langs->trans(
"Download").
' '.$ext;
1157 $tmpout .=
'</a></li>'.
"\n";
1160 $out .=
'</ul></div></dd>
1208 public function list_of_documents($filearray,
$object, $modulepart, $param =
'', $forcedownload = 0, $relativepath =
'', $permonobject = 1, $useinecm = 0, $textifempty =
'', $maxlength = 0, $title =
'', $url =
'', $showrelpart = 0, $permtoeditline = -1, $upload_dir =
'', $sortfield =
'', $sortorder =
'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1, $moreattrondiv =
'')
1211 global $user, $conf, $langs, $hookmanager, $form;
1212 global $sortfield, $sortorder, $maxheightmini;
1213 global $dolibarr_main_url_root;
1215 if ($disablecrop == -1) {
1218 if (in_array($modulepart, array(
'bank',
'bom',
'expensereport',
'facture',
'facture_fournisseur',
'holiday',
'medias',
'member',
'mrp',
'project',
'product',
'produit',
'propal',
'service',
'societe',
'tax',
'tax-vat',
'ticket',
'user'))) {
1224 if (empty($relativepath)) {
1226 if (!empty(
$object->element) &&
$object->element ==
'invoice_supplier') {
1229 if (!empty(
$object->element) &&
$object->element ==
'project_task') {
1230 $relativepath =
'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
1234 if (
getDolGlobalInt(
'PRODUCT_USE_OLD_PATH_FOR_PHOTO') && isset($filearray[0]) && $filearray[0][
'level1name'] ==
'photos') {
1235 $relativepath = preg_replace(
'/^.*\/produit\//',
'', $filearray[0][
'path']).
'/';
1241 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $upload_dir);
1242 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1248 $hookmanager->initHooks(array(
'formfile'));
1249 $parameters = array(
1250 'filearray' => $filearray,
1251 'modulepart' => $modulepart,
1253 'forcedownload' => $forcedownload,
1254 'relativepath' => $relativepath,
1255 'relativedir' => $relativedir,
1256 'permtodelete' => $permonobject,
1257 'useinecm' => $useinecm,
1258 'textifempty' => $textifempty,
1259 'maxlength' => $maxlength,
1263 $reshook = $hookmanager->executeHooks(
'showFilesList', $parameters,
$object);
1265 if (!empty($reshook)) {
1268 if (!is_object($form)) {
1269 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
1270 $form =
new Form($this->db);
1273 if (!preg_match(
'/&id=/', $param) && isset(
$object->id)) {
1274 $param .=
'&id='.$object->id;
1276 $relativepathwihtoutslashend = preg_replace(
'/\/$/',
'', $relativepath);
1277 if ($relativepathwihtoutslashend) {
1278 $param .=
'&file='.urlencode($relativepathwihtoutslashend);
1281 if ($permtoeditline < 0) {
1282 $permtoeditline = 0;
1283 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1285 $permtoeditline = 1;
1288 $permtoeditline = 1;
1293 $permtoeditline = 0;
1298 if ((empty($useinecm) || $useinecm == 3 || $useinecm == 6) && $title !=
'none') {
1299 print
load_fiche_titre($title ? $title : $langs->trans(
"AttachedFiles"),
'',
'file-upload', 0,
'',
'table-list-of-attached-files');
1302 $url = $_SERVER[
"PHP_SELF"];
1305 print
'<!-- html.formfile::list_of_documents -->'.
"\n";
1306 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1307 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?'.$param.
'" method="POST">';
1308 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1309 print
'<input type="hidden" name="action" value="renamefile">';
1310 print
'<input type="hidden" name="id" value="'.(is_object(
$object) ?
$object->id :
'').
'">';
1311 print
'<input type="hidden" name="modulepart" value="'.$modulepart.
'">';
1314 print
'<div class="div-table-responsive-no-min"'.($moreattrondiv ?
' '.$moreattrondiv :
'').
'>';
1315 print
'<table id="tablelines" class="centpercent liste noborder nobottom">'.
"\n";
1317 if (!empty($addfilterfields)) {
1318 print
'<tr class="liste_titre nodrag nodrop">';
1319 print
'<td><input type="search_doc_ref" value="'.dol_escape_htmltag(
GETPOST(
'search_doc_ref',
'alpha')).
'"></td>';
1322 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1327 if (empty($disablemove) && count($filearray) > 1) {
1338 if ($sortfield && $sortorder) {
1343 print
'<tr class="liste_titre nodrag nodrop">';
1348 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1355 if (empty($disablemove) && count($filearray) > 1) {
1360 $nboffiles = count($filearray);
1361 if ($nboffiles > 0) {
1362 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
1368 $parametersByDefault = array(
1369 'modulepart' => $modulepart,
1370 'relativepath' => $relativepath,
1371 'permtoedit' => $permtoeditline,
1372 'permonobject' => $permonobject,
1374 foreach ($filearray as $key => $file) {
1375 if ($file[
'name'] !=
'.' && $file[
'name'] !=
'..' && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1376 if (array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) {
1377 $lastrowid = $filearray[$key][
'rowid'];
1382 $modulepart = ($file[
'modulepart'] ?? $parametersByDefault[
'modulepart']);
1383 $relativepath = ($file[
'relativepath'] ?? $parametersByDefault[
'relativepath']);
1384 $permtoeditline = ($file[
'permtoedit'] ?? $parametersByDefault[
'permtoedit']);
1385 $permonobject = ($file[
'permonobject'] ?? $parametersByDefault[
'permonobject']);
1388 if (empty($relativepath) || empty($modulepart)) {
1389 $filepath = $file[
'level1name'].
'/'.$file[
'name'];
1391 $filepath = $relativepath.$file[
'name'];
1393 if (empty($modulepart)) {
1394 $modulepart = basename(dirname($file[
'path']));
1396 if (empty($relativepath)) {
1397 $relativepath = preg_replace(
'/\/(.+)/',
'', $filepath) .
'/';
1402 print
'<!-- Line list_of_documents '.$key.
' relativepath = '.$relativepath.
' -->'.
"\n";
1405 print
'<!-- In database: position='.(array_key_exists(
'position', $filearray[$key]) ? $filearray[$key][
'position'] : 0).
' -->'.
"\n";
1406 print
'<tr class="oddeven" id="row-'.((array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) ? $filearray[$key][
'rowid'] :
'AFTER'.$lastrowid.
'POS'.($i + 1)).
'">';
1410 print
'<td class="minwith200 tdoverflowmax500" title="'.dolPrintHTMLForAttribute($file[
'name']).
'">';
1414 print
'<a class="paddingright valignmiddle" ';
1416 print
'target="_blank" ';
1418 print
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart;
1419 if ($forcedownload) {
1420 print
'&attachment=1';
1422 if (!empty(
$object->entity)) {
1423 print
'&entity='.$object->entity;
1425 print
'&file='.urlencode($filepath);
1427 print
img_mime($file[
'name'], $file[
'name'].
' ('.
dol_print_size($file[
'size'], 0, 0).
')',
'inline-block valignmiddle paddingright');
1428 if ($showrelpart == 1) {
1429 print $relativepath;
1435 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $file[
'name'] == basename(
GETPOST(
'urlfile',
'alpha')) && dirname($filepath) == dirname(
GETPOST(
'urlfile',
'alpha'))) {
1437 $section_dir = dirname(
GETPOST(
'urlfile',
'alpha'));
1438 if (!preg_match(
'/\/$/', $section_dir)) {
1439 $section_dir .=
'/';
1441 print
'<input type="hidden" name="section_dir" value="'.$section_dir.
'">';
1442 print
'<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file[
'name']).
'">';
1443 print
'<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file[
'name']).
'">';
1446 $filenametoshow = preg_replace(
'/\.noexe$/',
'', $file[
'name']);
1452 print $this->
showPreview($file, $modulepart, $filepath, 0,
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity));
1460 print
'<td class="right nowraponall">';
1461 if ($sizetoshow == $sizetoshowbytes) {
1464 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
1469 print
'<td class="center nowraponall">'.dol_print_date($file[
'date'],
"dayhour",
"tzuser").
'</td>';
1472 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1473 $fileinfo = pathinfo($file[
'name']);
1474 print
'<td class="center">';
1476 if ($useinecm == 5 || $useinecm == 6) {
1490 $urlforhref =
getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension']), 1,
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity));
1491 if (empty($urlforhref)) {
1492 $urlforhref = DOL_URL_ROOT.
'/viewimage.php?modulepart='.urlencode($modulepart).
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity).
'&file='.urlencode($relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension']));
1493 print
'<a href="'.$urlforhref.
'" class="aphoto" target="_blank" rel="noopener noreferrer">';
1495 print
'<a href="'.$urlforhref[
'url'].
'" class="'.$urlforhref[
'css'].
'" target="'.$urlforhref[
'target'].
'" mime="'.$urlforhref[
'mime'].
'">';
1497 print
'<img class="photo maxwidth200 shadow valignmiddle"';
1498 if ($useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1499 print
' height="20"';
1502 print
' style="max-height: 24px"';
1504 print
' src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.urlencode($modulepart).
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity).
'&file='.urlencode($relativepath.$smallfile);
1505 if (!empty($filearray[$key][
'date'])) {
1506 print
'&cache='.urlencode((
string) $filearray[$key][
'date']);
1508 print
'" title="">';
1515 print
'<td class="center">';
1516 if ($relativedir && $filearray[$key][
'rowid'] > 0) {
1518 print
'<label for="idshareenabled'.$key.
'">'.$langs->trans(
"FileSharedViaALink").
'</label> ';
1519 print
'<input class="inline-block" type="checkbox" id="idshareenabled'.$key.
'" name="shareenabled"'.($file[
'share'] ?
' checked="checked"' :
'').
' /> ';
1521 if ($file[
'share']) {
1523 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1524 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1530 if (!empty($file[
'share'])) {
1531 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
1533 if ($forcedownload) {
1534 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
1537 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
1539 print
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
1540 print
'<input type="text" class="quatrevingtpercent minwidth200imp nopadding small" id="downloadlink'.$filearray[$key][
'rowid'].
'" name="downloadexternallink" title="'.
dol_escape_htmltag($langs->trans(
"FileSharedViaALink")).
'" value="'.
dol_escape_htmltag($fulllink).
'">';
1552 print
'<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
1553 if ($useinecm == 1 || $useinecm == 5) {
1555 $newparam = preg_replace(
'/&file=.*$/',
'', $param);
1556 $backtopage = DOL_URL_ROOT.
'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam;
1557 print
'<a class="editfielda editfilelink" href="'.DOL_URL_ROOT.
'/ecm/file_card.php?urlfile='.urlencode($file[
'name']).$param.
'&backtopage='.urlencode($backtopage).
'" rel="'.urlencode($file[
'name']).
'">'.
img_edit(
'default', 0,
'class="paddingrightonly"').
'</a>';
1560 if (empty($useinecm) || $useinecm == 2 || $useinecm == 3 || $useinecm == 6) {
1561 $newmodulepart = $modulepart;
1562 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1563 $newmodulepart =
'produit|service';
1566 if ($permtoeditline) {
1567 $moreparaminurl =
'';
1569 $moreparaminurl .=
'&id='.$object->id;
1570 } elseif (
GETPOST(
'website',
'alpha')) {
1571 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1574 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1575 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1578 if (!preg_match(
'/\.webp$/i', $file[
'name'])) {
1579 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1580 print
'<a href="'.DOL_URL_ROOT.
'/ecm/index_medias.php?action=confirmconvertimgwebp&token='.
newToken().
'§ion_dir='.urlencode($relativepath).
'&filetoregenerate='.urlencode($fileinfo[
'basename']).
'&module='.$modulepart.$param.$moreparaminurl.
'" title="'.
dol_escape_htmltag($langs->trans(
"GenerateChosenImgWebp")).
'">'.
img_picto(
'',
'images',
'class="flip marginrightonly"').
'</a>';
1581 } elseif ($modulepart ==
'medias' &&
GETPOST(
'website')) {
1582 print
'<a href="'.DOL_URL_ROOT.
'/website/index.php?action=confirmconvertimgwebp&token='.
newToken().
'§ion_dir='.urlencode($relativepath).
'&filetoregenerate='.urlencode($fileinfo[
'basename']).
'&module='.$modulepart.$param.$moreparaminurl.
'" title="'.
dol_escape_htmltag($langs->trans(
"GenerateChosenImgWebp")).
'">'.
img_picto(
'',
'images',
'class="flip marginrightonly"').
'</a>';
1588 if ($permtoeditline) {
1590 $moreparaminurl =
'';
1592 $moreparaminurl .=
'&id='.$object->id;
1593 } elseif (
GETPOST(
'website',
'alpha')) {
1594 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1597 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1598 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1601 print
'<a class="editfielda" href="'.DOL_URL_ROOT.
'/core/photos_resize.php?modulepart='.urlencode($newmodulepart).$moreparaminurl.
'&file='.urlencode($relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension'])).
'" title="'.
dol_escape_htmltag($langs->trans(
"ResizeOrCrop")).
'">'.
img_picto($langs->trans(
"ResizeOrCrop"),
'resize',
'class="paddingrightonly"').
'</a>';
1605 if ($permtoeditline) {
1606 $paramsectiondir = (in_array($modulepart, array(
'medias',
'ecm')) ?
'§ion_dir='.urlencode($relativepath) :
'');
1607 print
'<a class="editfielda reposition editfilelink" href="'.(($useinecm == 1 || $useinecm == 5) ?
'#' : ($url.
'?action=editfile&token='.
newToken().
'&urlfile='.urlencode($filepath).$paramsectiondir.$param)).
'" rel="'.$filepath.
'">'.
img_edit(
'default', 0,
'class="paddingrightonly"').
'</a>';
1611 if ($permonobject) {
1613 if (!empty($conf->dol_use_jmobile)) {
1616 if (empty($conf->use_javascript_ajax)) {
1622 print
'<a href="'.((($useinecm && $useinecm != 3 && $useinecm != 6) && $useajax) ?
'#' : ($url.
'?action=deletefile&token='.
newToken().
'&urlfile='.urlencode($filepath).$param)).
'" class="reposition deletefilelink" rel="'.$filepath.
'">'.
img_delete().
'</a>';
1626 if (empty($disablemove) && count($filearray) > 1) {
1627 if ($nboffiles > 1 && $conf->browser->layout !=
'phone') {
1628 print
'<td class="linecolmove tdlineupdown center">';
1630 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&rowid='.
$object->id.
'">'.
img_up(
'default', 0,
'imgupforline').
'</a>';
1632 if ($i < ($nboffiles - 1)) {
1633 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&rowid='.
$object->id.
'">'.
img_down(
'default', 0,
'imgdownforline').
'</a>';
1637 print
'<td'.(($conf->browser->layout !=
'phone') ?
' class="linecolmove tdlineupdown center"' :
' class="linecolmove center"').
'>';
1642 print
'<td class="right">';
1643 print
'<input type="hidden" name="ecmfileid" value="'.(empty($filearray[$key][
'rowid']) ?
'' : $filearray[$key][
'rowid']).
'">';
1644 print
'<input type="submit" class="button button-save smallpaddingimp" name="renamefilesave" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
1645 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
1647 if (empty($disablemove) && count($filearray) > 1) {
1648 print
'<td class="right"></td>';
1656 if ($nboffiles == 0) {
1658 if (empty($disablemove) && count($filearray) > 1) {
1661 print
'<tr class="oddeven"><td colspan="'.$colspan.
'">';
1662 if (empty($textifempty)) {
1663 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
1665 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
1673 if ($nboflines > 1 && is_object(
$object)) {
1674 if (!empty($conf->use_javascript_ajax) && $permtoeditline) {
1675 $table_element_line =
'ecm_files';
1676 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
1682 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1710 public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath =
'', $permissiontodelete = 1, $useinecm = 0, $textifempty =
'', $maxlength = 0, $url =
'', $addfilterfields = 0)
1713 global $conf, $langs, $hookmanager, $form;
1714 global $sortfield, $sortorder;
1715 global $search_doc_ref;
1716 global $dolibarr_main_url_root;
1718 dol_syslog(get_class($this).
'::list_of_autoecmfiles upload_dir='.$upload_dir.
' modulepart='.$modulepart);
1721 if (empty($useinecm) || $useinecm == 6) {
1725 $url = $_SERVER[
"PHP_SELF"];
1728 if (!empty($addfilterfields)) {
1729 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'">';
1730 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1731 print
'<input type="hidden" name="module" value="'.$modulepart.
'">';
1734 print
'<div class="div-table-responsive-no-min">';
1735 print
'<table width="100%" class="noborder">'.
"\n";
1737 if (!empty($addfilterfields)) {
1738 print
'<tr class="liste_titre nodrag nodrop">';
1739 print
'<td class="liste_titre"></td>';
1740 print
'<td class="liste_titre"><input type="text" class="maxwidth100onsmartphone" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1741 print
'<td class="liste_titre"></td>';
1742 print
'<td class="liste_titre"></td>';
1744 print
'<td class="liste_titre right">';
1745 $searchpicto = $form->showFilterButtons();
1751 print
'<tr class="liste_titre">';
1752 $sortref =
"fullname";
1753 if ($modulepart ==
'invoice_supplier') {
1754 $sortref =
'level1name';
1764 $object_instance =
null;
1765 if ($modulepart ==
'company') {
1766 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
1767 $object_instance =
new Societe($this->db);
1768 } elseif ($modulepart ==
'invoice') {
1769 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1770 $object_instance =
new Facture($this->db);
1771 } elseif ($modulepart ==
'invoice_supplier') {
1772 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1774 } elseif ($modulepart ==
'propal') {
1775 include_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
1776 $object_instance =
new Propal($this->db);
1777 } elseif ($modulepart ==
'supplier_proposal') {
1778 include_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
1780 } elseif ($modulepart ==
'order') {
1781 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
1782 $object_instance =
new Commande($this->db);
1783 } elseif ($modulepart ==
'order_supplier') {
1784 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
1786 } elseif ($modulepart ==
'contract') {
1787 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
1788 $object_instance =
new Contrat($this->db);
1789 } elseif ($modulepart ==
'product') {
1790 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1791 $object_instance =
new Product($this->db);
1792 } elseif ($modulepart ==
'tax') {
1793 include_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
1795 } elseif ($modulepart ==
'tax-vat') {
1796 include_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
1797 $object_instance =
new Tva($this->db);
1798 } elseif ($modulepart ==
'salaries') {
1799 include_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
1800 $object_instance =
new Salary($this->db);
1801 } elseif ($modulepart ==
'project') {
1802 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1803 $object_instance =
new Project($this->db);
1804 } elseif ($modulepart ==
'project_task') {
1805 include_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
1806 $object_instance =
new Task($this->db);
1807 } elseif ($modulepart ==
'fichinter') {
1808 include_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
1809 $object_instance =
new Fichinter($this->db);
1810 } elseif ($modulepart ==
'user') {
1811 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
1812 $object_instance =
new User($this->db);
1813 } elseif ($modulepart ==
'expensereport') {
1814 include_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1816 } elseif ($modulepart ==
'holiday') {
1817 include_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
1818 $object_instance =
new Holiday($this->db);
1819 } elseif ($modulepart ==
'recruitment-recruitmentcandidature') {
1820 include_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
1822 } elseif ($modulepart ==
'banque') {
1823 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1824 $object_instance =
new Account($this->db);
1825 } elseif ($modulepart ==
'chequereceipt') {
1826 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
1828 } elseif ($modulepart ==
'mrp-mo') {
1829 include_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
1830 $object_instance =
new Mo($this->db);
1832 $parameters = array(
'modulepart' => $modulepart);
1833 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1834 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1835 if (array_key_exists(
'classpath', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classpath'])) {
1837 if (array_key_exists(
'classname', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classname'])) {
1838 if (class_exists($hookmanager->resArray[
'classname'])) {
1839 $tmpclassname = $hookmanager->resArray[
'classname'];
1840 $object_instance =
new $tmpclassname($this->db);
1851 $relativepathfromroot = preg_replace(
'/'.preg_quote(DOL_DATA_ROOT.
'/',
'/').
'/',
'', $upload_dir);
1852 if ($relativepathfromroot) {
1856 if ($sortfield && $sortorder) {
1857 $filearray =
dol_sort_array($filearray, $sortfield, $sortorder, 1);
1863 foreach ($filearray as $key => $file) {
1864 if (!is_dir($file[
'name'])
1865 && $file[
'name'] !=
'.'
1866 && $file[
'name'] !=
'..'
1867 && $file[
'name'] !=
'CVS'
1868 && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1870 $relativefile = preg_replace(
'/'.preg_quote($upload_dir.
'/',
'/').
'/',
'', $file[
'fullname']);
1878 if ($modulepart ==
'company' || $modulepart ==
'tax' || $modulepart ==
'tax-vat' || $modulepart ==
'salaries') {
1879 preg_match(
'/(\d+)\/[^\/]+$/', $relativefile, $reg);
1880 $id = (isset($reg[1]) ? $reg[1] :
'');
1881 } elseif ($modulepart ==
'invoice_supplier') {
1882 preg_match(
'/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
1883 $ref = (isset($reg[1]) ? $reg[1] :
'');
1884 if (is_numeric($ref)) {
1888 } elseif ($modulepart ==
'user') {
1890 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1891 $id = (isset($reg[1]) ? $reg[1] :
'');
1892 } elseif ($modulepart ==
'project_task') {
1894 $reg = explode(
"/", $relativefile);
1895 $ref = (isset($reg[1]) ? $reg[1] :
'');
1896 } elseif (in_array($modulepart, array(
1899 'supplier_proposal',
1908 'recruitment-recruitmentcandidature',
1913 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1914 $ref = (isset($reg[1]) ? $reg[1] :
'');
1916 $parameters = array(
'modulepart' => $modulepart,
'fileinfo' => $file);
1917 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1918 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1919 if (array_key_exists(
'ref', $hookmanager->resArray) && !empty($hookmanager->resArray[
'ref'])) {
1920 $ref = $hookmanager->resArray[
'ref'];
1922 if (array_key_exists(
'id', $hookmanager->resArray) && !empty($hookmanager->resArray[
'id'])) {
1923 $id = $hookmanager->resArray[
'id'];
1929 if (!
$id && !$ref) {
1934 if (!empty($conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref])) {
1940 if (is_object($object_instance)) {
1941 $object_instance->id = 0;
1942 $object_instance->ref =
'';
1944 $result = $object_instance->fetch(
$id);
1946 if (!($result = $object_instance->fetch(0, $ref))) {
1952 $result = $object_instance->fetchOneLike($ref);
1959 $conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref] = clone $object_instance;
1963 $conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref] =
'notfound';
1964 unset($filearray[$key]);
1968 if ($found <= 0 || !is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref])) {
1972 print
'<!-- Line list_of_autoecmfiles key='.$key.
' -->'.
"\n";
1973 print
'<tr class="oddeven">';
1975 if ($found > 0 && is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref])) {
1976 $tmpobject = $conf->cache[
'modulepartobject'][$modulepart.
'_'.
$id.
'_'.$ref];
1978 print $tmpobject->getNomUrl(1,
'document');
1983 print $langs->trans(
"ObjectDeleted", (
$id ?
$id : $ref));
2001 print
'target="_blank" ';
2003 print
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.urlencode($modulepart);
2004 if ($forcedownload) {
2005 print
'&attachment=1';
2007 print
'&file='.urlencode($relativefile).
'">';
2014 print $this->
showPreview($file, $modulepart, $file[
'relativename']);
2021 print
'<td class="right nowraponall">';
2022 if ($sizetoshow == $sizetoshowbytes) {
2025 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
2030 print
'<td class="center">'.dol_print_date($file[
'date'],
"dayhour").
'</td>';
2033 print
'<td class="right">';
2034 if (!empty($file[
'share'])) {
2036 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
2037 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
2043 if (!empty($file[
'share'])) {
2044 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
2046 if ($forcedownload) {
2047 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
2050 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
2052 print
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
' ';
2053 print
'<input type="text" class="quatrevingtpercent width100 nopadding nopadding small" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).
'">';
2067 if (count($filearray) == 0) {
2068 print
'<tr class="oddeven"><td colspan="5">';
2069 if (empty($textifempty)) {
2070 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
2072 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
2079 if (!empty($addfilterfields)) {
2082 return count($filearray);
2096 public function listOfLinks(
$object, $permissiontodelete = 1, $action =
null, $selected =
null, $param =
'')
2098 global $user, $conf, $langs, $user;
2099 global $sortfield, $sortorder;
2101 $langs->load(
"link");
2103 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
2104 $link =
new Link($this->db);
2106 if ($sortfield ==
"name") {
2107 $sortfield =
"label";
2108 } elseif ($sortfield ==
"date") {
2109 $sortfield =
"datea";
2113 $res = $link->fetchAll($links,
$object->element,
$object->id, $sortfield, $sortorder);
2114 $param .= (isset(
$object->id) ?
'&id='.$object->id :
'');
2116 print
'<!-- listOfLinks -->'.
"\n";
2119 print
load_fiche_titre($langs->trans(
"LinkedFiles"),
'',
'link', 0,
'',
'table-list-of-links');
2121 print
'<form action="'.$_SERVER[
'PHP_SELF'].($param ?
'?'.$param :
'').
'" method="POST">';
2122 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2124 print
'<table class="liste noborder nobottom centpercent">';
2125 print
'<tr class="liste_titre">';
2127 $langs->trans(
"Links"),
2128 $_SERVER[
'PHP_SELF'],
2149 $langs->trans(
"Date"),
2150 $_SERVER[
'PHP_SELF'],
2161 $_SERVER[
'PHP_SELF'],
2172 $nboflinks = count($links);
2173 if ($nboflinks > 0) {
2174 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2177 foreach ($links as $link) {
2178 print
'<tr class="oddeven">';
2180 if ($action ==
'update' && $selected === $link->id) {
2182 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2183 print
'<input type="hidden" name="linkid" value="'.$link->id.
'">';
2184 print
'<input type="hidden" name="action" value="confirm_updateline">';
2185 print $langs->trans(
'Link').
': <input type="text" name="link" value="'.$link->url.
'">';
2188 print $langs->trans(
'Label').
': <input type="text" name="label" value="'.
dol_escape_htmltag($link->label).
'">';
2190 print
'<td class="center">'.dol_print_date(
dol_now(),
"dayhour",
"tzuser").
'</td>';
2191 print
'<td class="right"></td>';
2192 print
'<td class="right">';
2193 print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2194 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2199 print
'<a data-ajax="false" href="'.$link->url.
'" target="_blank" rel="noopener noreferrer">';
2203 print
'<td class="right"></td>';
2204 print
'<td class="center">'.dol_print_date($link->datea,
"dayhour",
"tzuser").
'</td>';
2205 print
'<td class="center"></td>';
2206 print
'<td class="right">';
2207 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=update&linkid='.$link->id.$param.
'&token='.
newToken().
'" class="editfilelink editfielda reposition" >'.
img_edit().
'</a>';
2208 if ($permissiontodelete) {
2209 print
' <a class="deletefilelink reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=deletelink&token='.
newToken().
'&linkid='.((int) $link->id).$param.
'">'.
img_delete().
'</a>';
2217 if ($nboflinks == 0) {
2218 print
'<tr class="oddeven"><td colspan="5">';
2219 print
'<span class="opacitymedium">'.$langs->trans(
"NoLinkFound").
'</span>';
2240 public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param =
'')
2242 global $langs, $conf;
2245 if ($conf->browser->layout !=
'phone' && !empty($conf->use_javascript_ajax)) {
2247 if (count($urladvancedpreview)) {
2248 $out .=
'<a class="pictopreview '.$urladvancedpreview[
'css'].
'" href="'.$urladvancedpreview[
'url'].
'"'.(empty($urladvancedpreview[
'mime']) ?
'' :
' mime="'.$urladvancedpreview[
'mime'].
'"').
' '.(empty($urladvancedpreview[
'target']) ?
'' :
' target="'.$urladvancedpreview[
'target'].
'"').
'>';
2250 if (empty($ruleforpicto)) {
2252 $out .=
'<span class="fa fa-search-plus pictofixedwidth" style="color: gray"></span>';
2254 $out .=
img_mime($relativepath, $langs->trans(
'Preview').
' '.$file[
'name'],
'pictofixedwidth');
2258 if ($ruleforpicto < 0) {
2259 $out .=
img_picto(
'',
'generic',
'', 0, 0, 0,
'',
'paddingright pictofixedwidth');
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class to manage bank accounts.
Class for managing the social charges.
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
Class of the module paid holiday.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage proposals.
Class for RecruitmentCandidature.
Class to manage cheque delivery receipts.
Class to manage salary payments.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage price ask supplier.
Class to manage VAT - Value-added tax (also known in French as TVA - Taxe sur la valeur ajoutée)
Class to manage Dolibarr users.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
dol_is_file($pathoffile)
Return if path is a file.
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.
completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
Complete $filearray with data from database.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
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_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_now($mode='auto')
Return date for now.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getImageFileNameForSize($file, $extName, $extImgTarget='')
Return the filename of file to get the thumbs.
getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0, $param='')
Return URL we can use for advanced preview links.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
getMaxFileSizeArray()
Return the max allowed for file upload.