57 $this->numoffiles = 0;
86 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)
89 global $conf, $langs, $hookmanager;
90 $hookmanager->initHooks(array(
'formfile'));
94 dol_syslog(__METHOD__.
": using 2 for useajax is deprecated and should be not used", LOG_WARNING);
97 if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
101 if ((
getDolGlobalString(
'MAIN_USE_JQUERY_FILEUPLOAD') && $useajax) || ($useajax == 2)) {
108 return 'Feature too bugged so removed';
119 $out =
"\n\n".
'<!-- Start form attach new file --><div class="formattachnewfile">'.
"\n";
122 $title = $langs->trans(
"AttachANewFile");
124 if ($title !=
'none') {
128 if (empty($usewithoutform)) {
130 $url .= (strpos($url,
'?') ===
false ?
'?' :
'&').
'uploadform=1';
132 $out .=
'<form name="'.$htmlname.
'" id="'.$htmlname.
'" action="'.$url.
'" enctype="multipart/form-data" method="POST">'.
"\n";
134 if (empty($usewithoutform) || $usewithoutform == 2) {
135 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
136 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_dir" name="section_dir" value="'.$sectiondir.
'">'.
"\n";
137 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_id" name="section_id" value="'.$sectionid.
'">'.
"\n";
138 $out .=
'<input type="hidden" name="sortfield" value="'.GETPOST(
'sortfield',
'aZ09comma').
'">'.
"\n";
139 $out .=
'<input type="hidden" name="sortorder" value="'.GETPOST(
'sortorder',
'aZ09comma').
'">'.
"\n";
140 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
143 $out .=
'<table class="nobordernopadding centpercent">';
146 if (!empty($options)) {
147 $out .=
'<td>'.$options.
'</td>';
150 $out .=
'<td class="valignmiddle nowrap">';
153 $max = $maxfilesizearray[
'max'];
154 $maxmin = $maxfilesizearray[
'maxmin'];
155 $maxphptoshow = $maxfilesizearray[
'maxphptoshow'];
156 $maxphptoshowparam = $maxfilesizearray[
'maxphptoshowparam'];
158 $out .=
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
160 $out .=
'<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
161 $out .= ((
getDolGlobalString(
'MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ?
' name="userfile"' :
' name="userfile[]" multiple');
163 $out .= (!empty($accept) ?
' accept="'.$accept.
'"' :
' accept=""');
164 $out .= (!empty($capture) ?
' capture="capture"' :
'');
168 $langs->load(
'link');
169 $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>';
171 $out .=
'<input type="submit" class="button small reposition" name="sendit" value="'.$langs->trans(
"Upload").
'"';
177 $out .=
'<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
182 $menudolibarrsetupmax = $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Security");
183 $langs->load(
'other');
185 $out .=
info_admin($langs->trans(
"ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1);
188 $out .=
' ('.$langs->trans(
"UploadDisabled").
')';
190 $out .=
"</td></tr>";
192 if ($savingdocmask) {
194 $rename = (!
getDolGlobalString(
'MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ?
'checked' :
'');
197 if (!empty($options)) {
198 $out .=
'<td>'.$options.
'</td>';
200 $out .=
'<td valign="middle" class="nowrap">';
201 $out .=
'<input type="checkbox" '.$rename.
' class="savingdocmask" name="savingdocmask" id="savingdocmask" value="'.
dol_escape_js($savingdocmask).
'"> ';
202 $out .=
'<label class="opacitymedium small" for="savingdocmask">';
203 $out .= $langs->trans(
"SaveUploadedFileWithMask", preg_replace(
'/__file__/', $langs->transnoentitiesnoconv(
"OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv(
"OriginFileName"));
211 if (empty($usewithoutform)) {
213 if (empty($sectionid)) {
218 $out .=
"\n</div><!-- End form attach new file -->\n";
221 $out .=
"\n".
'<!-- Start form link new url --><div class="formlinknewurl">'.
"\n";
222 $langs->load(
'link');
223 $title = $langs->trans(
"LinkANewFile");
226 if (empty($usewithoutform)) {
227 $out .=
'<form name="'.$htmlname.
'_link" id="'.$htmlname.
'_link" action="'.$url.
'" method="POST">'.
"\n";
228 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
229 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_dir" name="link_section_dir" value="">'.
"\n";
230 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_id" name="link_section_id" value="'.$sectionid.
'">'.
"\n";
231 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
234 $out .=
'<div class="valignmiddle">';
235 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
237 $out .=
'<label for="link">'.$langs->trans(
"URLToLink").
':</label> ';
239 $out .=
'<input type="text" name="link" class="flat minwidth400imp" id="link" placeholder="'.dol_escape_htmltag($langs->trans(
"URLToLink")).
'">';
241 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
243 $out .=
'<label for="label">'.$langs->trans(
"Label").
':</label> ';
245 $out .=
'<input type="text" class="flat" name="label" id="label" placeholder="'.dol_escape_htmltag($langs->trans(
"Label")).
'">';
246 $out .=
'<input type="hidden" name="objecttype" value="'.$object->element.
'">';
247 $out .=
'<input type="hidden" name="objectid" value="'.$object->id.
'">';
249 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
250 $out .=
'<input type="submit" class="button small reposition" name="linkit" value="'.$langs->trans(
"ToLink").
'"';
255 if (empty($usewithoutform)) {
256 $out .=
'<div class="clearboth"></div>';
257 $out .=
'</form><br>';
260 $out .=
"\n</div><!-- End form link new url -->\n";
263 $parameters = array(
'socid'=>(isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id'=>(isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'url'=>$url,
'perm'=>$perm,
'options'=>$options);
264 $res = $hookmanager->executeHooks(
'formattachOptions', $parameters, $object);
266 $out =
'<div class="'.($usewithoutform ?
'inline-block valignmiddle' :
'attacharea attacharea'.$htmlname).
'">'.$out.
'</div>';
268 $out .= $hookmanager->resPrint;
302 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 =
'')
305 $this->numoffiles = 0;
306 print $this->
showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed, $modelselected, $allowgenifempty, $forcenomultilang, $iconPDF, $notused, $noform, $param, $title, $buttonlabel, $codelang);
307 return $this->numoffiles;
337 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 =
'')
339 global $dolibarr_main_url_root;
342 if (!empty($iconPDF)) {
343 dol_syslog(__METHOD__.
": passing iconPDF parameter is deprecated", LOG_WARNING);
346 global $langs, $conf, $user, $hookmanager;
350 if (is_object($hookmanager)) {
352 'modulepart'=>&$modulepart,
353 'modulesubdir'=>&$modulesubdir,
354 'filedir'=>&$filedir,
355 'urlsource'=>&$urlsource,
356 'genallowed'=>&$genallowed,
357 'delallowed'=>&$delallowed,
358 'modelselected'=>&$modelselected,
359 'allowgenifempty'=>&$allowgenifempty,
360 'forcenomultilang'=>&$forcenomultilang,
364 'buttonlabel'=>&$buttonlabel,
365 'codelang'=>&$codelang,
366 'morepicto'=>&$morepicto,
367 'hideifempty'=>&$hideifempty,
368 'removeaction'=>&$removeaction
370 $reshook = $hookmanager->executeHooks(
'showDocuments', $parameters, $object);
378 return $hookmanager->resPrint;
381 if (!is_object($form)) {
382 $form =
new Form($this->db);
385 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
388 if (!empty($iconPDF)) {
393 if (!preg_match(
'/entity\=[0-9]+/', $param)) {
394 $param .= ($param ?
'&' :
'').
'entity='.(empty($object->entity) ? $conf->entity : $object->entity);
399 if (in_array($modulepart, array(
'contract',
'facture',
'supplier_proposal',
'propal',
'proposal',
'order',
'commande',
'expedition',
'commande_fournisseur',
'expensereport',
'delivery',
'ticket'))) {
400 $printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled)) ?
true :
false;
403 $hookmanager->initHooks(array(
'formfile'));
407 if (!empty($filedir)) {
408 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
410 if ($hideifempty && empty($file_list)) {
415 $forname =
'builddoc';
420 $out .=
"\n".
'<!-- Start show_document -->'.
"\n";
423 if (preg_match(
'/massfilesarea_/', $modulepart)) {
424 $out .=
'<div id="show_files"><br></div>'.
"\n";
425 $title = $langs->trans(
"MassFilesArea").
' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans(
"Hide").
')</a>';
426 $title .=
'<script nonce="'.getNonce().
'">
427 jQuery(document).ready(function() {
428 jQuery(\'#togglemassfilesarea\').click(function() {
429 if (jQuery(\'#togglemassfilesarea\').attr(\'ref\') == "shown")
431 jQuery(\'#'.$modulepart.
'_table\').hide();
432 jQuery(\'#togglemassfilesarea\').attr("ref", "hidden");
433 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Show")).
')");
437 jQuery(\'#'.$modulepart.
'_table\').show();
438 jQuery(\'#togglemassfilesarea\').attr("ref","shown");
439 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Hide")).
')");
447 $titletoshow = $langs->trans(
"Documents");
448 if (!empty($title)) {
449 $titletoshow = ($title ==
'none' ?
'' : $title);
452 $submodulepart = $modulepart;
455 $tmp = explode(
':', $modulepart);
456 if (!empty($tmp[1])) {
457 $modulepart = $tmp[0];
458 $submodulepart = $tmp[1];
461 $addcolumforpicto = ($delallowed || $printer || $morepicto);
462 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
467 $modellist = array();
469 if ($modulepart ==
'company') {
471 if (is_array($genallowed)) {
472 $modellist = $genallowed;
474 include_once DOL_DOCUMENT_ROOT.
'/core/modules/societe/modules_societe.class.php';
477 } elseif ($modulepart ==
'propal') {
478 if (is_array($genallowed)) {
479 $modellist = $genallowed;
481 include_once DOL_DOCUMENT_ROOT.
'/core/modules/propale/modules_propale.php';
484 } elseif ($modulepart ==
'supplier_proposal') {
485 if (is_array($genallowed)) {
486 $modellist = $genallowed;
488 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
491 } elseif ($modulepart ==
'commande') {
492 if (is_array($genallowed)) {
493 $modellist = $genallowed;
495 include_once DOL_DOCUMENT_ROOT.
'/core/modules/commande/modules_commande.php';
498 } elseif ($modulepart ==
'expedition') {
499 if (is_array($genallowed)) {
500 $modellist = $genallowed;
502 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
505 } elseif ($modulepart ==
'reception') {
506 if (is_array($genallowed)) {
507 $modellist = $genallowed;
509 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
512 } elseif ($modulepart ==
'delivery') {
513 if (is_array($genallowed)) {
514 $modellist = $genallowed;
516 include_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/modules_delivery.php';
519 } elseif ($modulepart ==
'ficheinter') {
520 if (is_array($genallowed)) {
521 $modellist = $genallowed;
523 include_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
526 } elseif ($modulepart ==
'facture') {
527 if (is_array($genallowed)) {
528 $modellist = $genallowed;
530 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
533 } elseif ($modulepart ==
'contract') {
535 if (is_array($genallowed)) {
536 $modellist = $genallowed;
538 include_once DOL_DOCUMENT_ROOT.
'/core/modules/contract/modules_contract.php';
541 } elseif ($modulepart ==
'project') {
542 if (is_array($genallowed)) {
543 $modellist = $genallowed;
545 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
548 } elseif ($modulepart ==
'project_task') {
549 if (is_array($genallowed)) {
550 $modellist = $genallowed;
552 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
555 } elseif ($modulepart ==
'product') {
556 if (is_array($genallowed)) {
557 $modellist = $genallowed;
559 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product/modules_product.class.php';
562 } elseif ($modulepart ==
'product_batch') {
563 if (is_array($genallowed)) {
564 $modellist = $genallowed;
566 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product_batch/modules_product_batch.class.php';
569 } elseif ($modulepart ==
'stock') {
570 if (is_array($genallowed)) {
571 $modellist = $genallowed;
573 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_stock.php';
576 } elseif ($modulepart ==
'hrm') {
577 if (is_array($genallowed)) {
578 $modellist = $genallowed;
580 include_once DOL_DOCUMENT_ROOT.
'/core/modules/hrm/modules_evaluation.php';
583 } elseif ($modulepart ==
'movement') {
584 if (is_array($genallowed)) {
585 $modellist = $genallowed;
587 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_movement.php';
590 } elseif ($modulepart ==
'export') {
591 if (is_array($genallowed)) {
592 $modellist = $genallowed;
594 include_once DOL_DOCUMENT_ROOT.
'/core/modules/export/modules_export.php';
596 $modellist = array();
598 } elseif ($modulepart ==
'commande_fournisseur' || $modulepart ==
'supplier_order') {
599 if (is_array($genallowed)) {
600 $modellist = $genallowed;
602 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
605 } elseif ($modulepart ==
'facture_fournisseur' || $modulepart ==
'supplier_invoice') {
607 if (is_array($genallowed)) {
608 $modellist = $genallowed;
610 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
613 } elseif ($modulepart ==
'supplier_payment') {
614 if (is_array($genallowed)) {
615 $modellist = $genallowed;
617 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
620 } elseif ($modulepart ==
'remisecheque') {
621 if (is_array($genallowed)) {
622 $modellist = $genallowed;
624 include_once DOL_DOCUMENT_ROOT.
'/core/modules/cheque/modules_chequereceipts.php';
627 } elseif ($modulepart ==
'donation') {
628 if (is_array($genallowed)) {
629 $modellist = $genallowed;
631 include_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
634 } elseif ($modulepart ==
'member') {
635 if (is_array($genallowed)) {
636 $modellist = $genallowed;
638 include_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_cards.php';
641 } elseif ($modulepart ==
'agenda' || $modulepart ==
'actions') {
642 if (is_array($genallowed)) {
643 $modellist = $genallowed;
645 include_once DOL_DOCUMENT_ROOT.
'/core/modules/action/modules_action.php';
648 } elseif ($modulepart ==
'expensereport') {
649 if (is_array($genallowed)) {
650 $modellist = $genallowed;
652 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expensereport/modules_expensereport.php';
655 } elseif ($modulepart ==
'unpaid') {
657 } elseif ($modulepart ==
'user') {
658 if (is_array($genallowed)) {
659 $modellist = $genallowed;
661 include_once DOL_DOCUMENT_ROOT.
'/core/modules/user/modules_user.class.php';
664 } elseif ($modulepart ==
'usergroup') {
665 if (is_array($genallowed)) {
666 $modellist = $genallowed;
668 include_once DOL_DOCUMENT_ROOT.
'/core/modules/usergroup/modules_usergroup.class.php';
673 $file =
dol_buildpath(
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
674 if (file_exists($file)) {
675 $res = include_once $file;
678 $file =
dol_buildpath(
'/'.$modulepart.
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
679 $res = include_once $file;
682 $class =
'ModelePDF'.ucfirst($submodulepart);
684 if (class_exists($class)) {
685 $modellist = call_user_func($class.
'::liste_modeles', $this->db);
687 dol_print_error($this->db,
"Bad value for modulepart '".$modulepart.
"' in showdocuments (class ".$class.
" for Doc generation not found)");
695 if (empty($buttonlabel)) {
696 $buttonlabel = $langs->trans(
'Generate');
699 if ($conf->browser->layout ==
'phone') {
700 $urlsource .=
'#'.$forname.
'_form';
702 if (empty($noform)) {
703 $out .=
'<form action="'.$urlsource.
'" id="'.$forname.
'_form" method="post">';
705 $out .=
'<input type="hidden" name="action" value="builddoc">';
706 $out .=
'<input type="hidden" name="page_y" value="">';
707 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
710 $out .=
'<div class="div-table-responsive-no-min">';
711 $out .=
'<table class="liste formdoc noborder centpercent">';
713 $out .=
'<tr class="liste_titre">';
714 $addcolumforpicto = ($delallowed || $printer || $morepicto);
715 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
718 $out .=
'<th colspan="'.$colspan.
'" class="formdoc liste_titre maxwidthonsmartphone center">';
721 if (!empty($modellist)) {
723 $out .=
'<span class="hideonsmartphone">'.$langs->trans(
'Model').
' </span>';
724 if (is_array($modellist) && count($modellist) == 1) {
725 $arraykeys = array_keys($modellist);
726 $modelselected = $arraykeys[0];
728 $morecss =
'minwidth75 maxwidth200';
729 if ($conf->browser->layout ==
'phone') {
730 $morecss =
'maxwidth100';
732 $out .= $form->selectarray(
'model', $modellist, $modelselected, $showempty, 0, 0,
'', 0, 0, 0,
'', $morecss, 1,
'', 0, 0);
766 if ($conf->use_javascript_ajax) {
769 $out .= $form->textwithpicto(
'', $tooltipontemplatecombo, 1,
'help',
'marginrightonly', 0, 3,
'', 0);
771 $out .=
'<div class="float">'.$langs->trans(
"Files").
'</div>';
775 if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) &&
getDolGlobalInt(
'MAIN_MULTILANGS') && !$forcenomultilang && (!empty($modellist) || $showempty)) {
776 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
778 $defaultlang = ($codelang && $codelang !=
'auto') ? $codelang : $langs->getDefaultLang();
779 $morecss =
'maxwidth150';
780 if ($conf->browser->layout ==
'phone') {
781 $morecss =
'maxwidth100';
783 $out .= $formadmin->select_language($defaultlang,
'lang_id', 0,
null, 0, 0, 0, $morecss);
789 $genbutton =
'<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.
'_generatebutton" name="'.$forname.
'_generatebutton"';
790 $genbutton .=
' type="submit" value="'.$buttonlabel.
'"';
791 if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
792 $genbutton .=
' disabled';
795 if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
796 $langs->load(
"errors");
797 $genbutton .=
' '.img_warning($langs->transnoentitiesnoconv(
"WarningNoDocumentModelActivated"));
799 if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
802 if (empty($modellist) && !$showempty && $modulepart !=
'unpaid') {
808 if (!empty($hookmanager->hooks[
'formfile'])) {
809 foreach ($hookmanager->hooks[
'formfile'] as $module) {
810 if (method_exists($module,
'formBuilddocLineOptions')) {
819 $parameters = array(
'colspan'=>($colspan + $colspanmore),
'socid'=>(isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id'=>(isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart'=>$modulepart);
820 if (is_object($hookmanager)) {
821 $reshook = $hookmanager->executeHooks(
'formBuilddocOptions', $parameters, $GLOBALS[
'object']);
822 $out .= $hookmanager->resPrint;
827 if (!empty($filedir)) {
828 $link_list = array();
829 if (is_object($object)) {
830 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
831 $link =
new Link($this->db);
832 $sortfield = $sortorder =
null;
833 $res = $link->fetchAll($link_list, $object->element, $object->id, $sortfield, $sortorder);
836 $out .=
'<!-- html.formfile::showdocuments -->'.
"\n";
839 if ((!empty($file_list) || !empty($link_list) || preg_match(
'/^massfilesarea/', $modulepart))
842 $out .=
'<div class="titre">'.$titletoshow.
'</div>'.
"\n";
843 $out .=
'<div class="div-table-responsive-no-min">';
844 $out .=
'<table class="noborder centpercent" id="'.$modulepart.
'_table">'.
"\n";
848 if (is_array($file_list)) {
852 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
853 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
861 if (!empty($sortfield) && !empty($sortorder)) {
866 foreach ($file_list as $file) {
868 $relativepath = $file[
"name"];
870 $relativepath = $modulesubdir.
"/".$file[
"name"];
872 if ($modulepart ==
'export') {
873 $relativepath = $file[
"name"];
876 $out .=
'<tr class="oddeven">';
878 $documenturl = DOL_URL_ROOT.
'/document.php';
879 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
880 $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
884 $imgpreview = $this->
showPreview($file, $modulepart, $relativepath, 0, $param);
886 $out .=
'<td class="minwidth200 tdoverflowmax300">';
888 $out .=
'<span class="spanoverflow widthcentpercentminusx valignmiddle">';
890 $out .=
'<span class="spanoverflow">';
892 $out .=
'<a class="documentdownload paddingright" href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
895 if (preg_match(
'/text/', $mime)) {
896 $out .=
' target="_blank" rel="noopener noreferrer"';
898 $out .=
' title="'.dol_escape_htmltag($file[
"name"]).
'"';
900 $out .=
img_mime($file[
"name"], $langs->trans(
"File").
': '.$file[
"name"]);
903 $out .=
'</span>'.
"\n";
908 $size = (!empty($file[
'size']) ? $file[
'size'] :
dol_filesize($filedir.
"/".$file[
"name"]));
909 $out .=
'<td class="nowraponall right" title="'.dolPrintHTML($size.
' '.$langs->trans(
"Bytes")).
'">'.
dol_print_size($size, 1, 1).
'</td>';
912 $date = (!empty($file[
'date']) ? $file[
'date'] :
dol_filemtime($filedir.
"/".$file[
"name"]));
913 $out .=
'<td class="nowrap right">'.dol_print_date($date,
'dayhour',
'tzuser').
'</td>';
916 $out .=
'<td class="nowraponall">';
917 if (!empty($file[
'share'])) {
919 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
920 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
926 if (!empty($file[
'share'])) {
927 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
929 if ($forcedownload) {
930 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
933 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
935 $out .=
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
936 $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).
'">';
944 if ($delallowed || $printer || $morepicto) {
945 $out .=
'<td class="right nowraponall">';
947 $tmpurlsource = preg_replace(
'/#[a-zA-Z0-9_]*$/',
'', $urlsource);
948 $out .=
'<a class="reposition" href="'.$tmpurlsource.((strpos($tmpurlsource,
'?') ===
false) ?
'?' :
'&').
'action='.urlencode($removeaction).
'&token='.newToken().
'&file='.urlencode($relativepath);
949 $out .= ($param ?
'&'.$param :
'');
952 $out .=
'">'.img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
955 $out .=
'<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource,
'?') ?
'&' :
'?').
'action=print_file&token='.newToken().
'&printer='.urlencode($modulepart).
'&file='.urlencode($relativepath);
956 $out .= ($param ?
'&'.$param :
'');
957 $out .=
'">'.img_picto($langs->trans(
"PrintFile", $relativepath),
'printer.png').
'</a>';
960 $morepicto = preg_replace(
'/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto);
966 if (is_object($hookmanager)) {
967 $addcolumforpicto = ($delallowed || $printer || $morepicto);
968 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
970 $parameters = array(
'colspan'=>($colspan + $colspanmore),
'socid'=>(isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id'=>(isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart'=>$modulepart,
'relativepath'=>$relativepath);
971 $res = $hookmanager->executeHooks(
'formBuilddocLineOptions', $parameters, $file);
973 $out .= $hookmanager->resPrint;
976 $out = $hookmanager->resPrint;
984 if (is_array($link_list)) {
987 foreach ($link_list as $file) {
988 $out .=
'<tr class="oddeven">';
989 $out .=
'<td colspan="'.$colspan.
'" class="maxwidhtonsmartphone">';
990 $out .=
'<a data-ajax="false" href="'.$file->url.
'" target="_blank" rel="noopener noreferrer">';
991 $out .= $file->label;
994 $out .=
'<td class="right">';
999 if ($delallowed || $printer || $morepicto) {
1000 $out .=
'<td></td>';
1002 $out .=
'</tr>'.
"\n";
1004 $this->numoffiles++;
1007 if (count($file_list) == 0 && count($link_list) == 0 && $headershown) {
1008 $out .=
'<tr><td colspan="'.(3 + ($addcolumforpicto ? 1 : 0)).
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>'.
"\n";
1014 $out .=
"</table>\n";
1017 if (empty($noform)) {
1018 $out .=
'</form>'.
"\n";
1022 $out .=
'<!-- End show_document -->'.
"\n";
1025 jQuery(document).ready(function() {
1026 var selectedValue = $(".selectformat").val();
1028 if (selectedValue === "excel2007" || selectedValue === "tsv") {
1029 $(".forhide").prop("disabled", true).hide();
1031 $(".forhide").prop("disabled", false).show();
1052 public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter =
'', $morecss =
'valignmiddle', $allfiles = 0)
1054 global $conf, $langs;
1056 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1059 $this->infofiles = array(
'nboffiles'=>0,
'extensions'=>array(),
'files'=>array());
1064 if (isModEnabled(
'multicompany')) {
1066 preg_match(
'/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,
'/').
'$/', $filedir, $regs);
1067 $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1);
1072 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/');
1074 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/').
'\.';
1076 $file_list =
dol_dir_list($filedir,
'files', 0, $filterforfilesearch,
'\.meta$|\.png$');
1080 $out .=
'<!-- html.formfile::getDocumentsLink -->'.
"\n";
1081 if (!empty($file_list)) {
1082 $out =
'<dl class="dropdown inline-block">
1083 <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto(
'',
'listlight',
'', 0, 0, 0,
'', $morecss).
'</a></dt>
1084 <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
1090 foreach ($file_list as $file) {
1092 if ($filter && !preg_match(
'/'.$filter.
'/i', $file[
"name"])) {
1098 $relativepath = $file[
"name"];
1099 if ($modulesubdir) {
1100 $relativepath = $modulesubdir.
"/".$file[
"name"];
1103 if ($modulepart ==
'donation') {
1104 $relativepath =
get_exdir($modulesubdir, 2, 0, 0,
null,
'donation').$file[
"name"];
1106 if ($modulepart ==
'export') {
1107 $relativepath = $file[
"name"];
1110 $this->infofiles[
'nboffiles']++;
1111 $this->infofiles[
'files'][] = $file[
'fullname'];
1112 $ext = pathinfo($file[
"name"], PATHINFO_EXTENSION);
1113 if (empty($this->infofiles[$ext])) {
1114 $this->infofiles[
'extensions'][$ext] = 1;
1116 $this->infofiles[
'extensions'][$ext]++;
1120 if (!empty($conf->use_javascript_ajax) && ($conf->browser->layout !=
'phone')) {
1122 if ($tmparray && $tmparray[
'url']) {
1123 $tmpout .=
'<li><a href="'.$tmparray[
'url'].
'"'.($tmparray[
'css'] ?
' class="'.$tmparray[
'css'].
'"' :
'').($tmparray[
'mime'] ?
' mime="'.$tmparray[
'mime'].
'"' :
'').($tmparray[
'target'] ?
' target="'.$tmparray[
'target'].
'"' :
'').
'>';
1125 $tmpout .=
'<i class="fa fa-search-plus paddingright" style="color: gray"></i>';
1126 $tmpout .= $langs->trans(
"Preview").
' '.$ext.
'</a></li>';
1131 $tmpout .=
'<li class="nowrap"><a class="pictopreview nowrap" href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart.
'&entity='.$entity.
'&file='.urlencode($relativepath).
'"';
1133 if (preg_match(
'/text/', $mime)) {
1134 $tmpout .=
' target="_blank" rel="noopener noreferrer"';
1137 $tmpout .=
img_mime($relativepath, $file[
"name"]);
1138 $tmpout .= $langs->trans(
"Download").
' '.$ext;
1139 $tmpout .=
'</a></li>'.
"\n";
1142 $out .=
'</ul></div></dd>
1192 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 =
'', $noCreateEcmFile = 0)
1195 global $user, $conf, $langs, $hookmanager, $form;
1196 global $sortfield, $sortorder, $maxheightmini;
1197 global $dolibarr_main_url_root;
1199 if ($disablecrop == -1) {
1202 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'))) {
1208 if (empty($relativepath)) {
1210 if (!empty($object->element) && $object->element ==
'invoice_supplier') {
1211 $relativepath =
get_exdir($object->id, 2, 0, 0, $object,
'invoice_supplier').$relativepath;
1213 if (!empty($object->element) && $object->element ==
'project_task') {
1214 $relativepath =
'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
1218 if (
getDolGlobalInt(
'PRODUCT_USE_OLD_PATH_FOR_PHOTO') && isset($filearray[0]) && $filearray[0][
'level1name'] ==
'photos') {
1219 $relativepath = preg_replace(
'/^.*\/produit\//',
'', $filearray[0][
'path']).
'/';
1225 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $upload_dir);
1226 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1231 $hookmanager->initHooks(array(
'formfile'));
1232 $parameters = array(
1233 'filearray' => $filearray,
1234 'modulepart'=> $modulepart,
1236 'forcedownload' => $forcedownload,
1237 'relativepath' => $relativepath,
1238 'relativedir' => $relativedir,
1239 'permtodelete' => $permonobject,
1240 'useinecm' => $useinecm,
1241 'textifempty' => $textifempty,
1242 'maxlength' => $maxlength,
1246 $reshook = $hookmanager->executeHooks(
'showFilesList', $parameters, $object);
1248 if (!empty($reshook)) {
1251 if (!is_object($form)) {
1252 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
1253 $form =
new Form($this->db);
1256 if (!preg_match(
'/&id=/', $param) && isset($object->id)) {
1257 $param .=
'&id='.$object->id;
1259 $relativepathwihtoutslashend = preg_replace(
'/\/$/',
'', $relativepath);
1260 if ($relativepathwihtoutslashend) {
1261 $param .=
'&file='.urlencode($relativepathwihtoutslashend);
1264 if ($permtoeditline < 0) {
1265 $permtoeditline = 0;
1266 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1268 $permtoeditline = 1;
1271 $permtoeditline = 1;
1276 $permtoeditline = 0;
1281 if ((empty($useinecm) || $useinecm == 6) && $title !=
'none') {
1282 print
load_fiche_titre($title ? $title : $langs->trans(
"AttachedFiles"),
'',
'file-upload', 0,
'',
'table-list-of-attached-files');
1285 $url = $_SERVER[
"PHP_SELF"];
1288 print
'<!-- html.formfile::list_of_documents -->'.
"\n";
1289 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1290 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?'.$param.
'" method="POST">';
1291 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1292 print
'<input type="hidden" name="action" value="renamefile">';
1293 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
1294 print
'<input type="hidden" name="modulepart" value="'.$modulepart.
'">';
1297 print
'<div class="div-table-responsive-no-min"'.($moreattrondiv ?
' '.$moreattrondiv :
'').
'>';
1298 print
'<table id="tablelines" class="centpercent liste noborder nobottom">'.
"\n";
1300 if (!empty($addfilterfields)) {
1301 print
'<tr class="liste_titre nodrag nodrop">';
1302 print
'<td><input type="search_doc_ref" value="'.dol_escape_htmltag(
GETPOST(
'search_doc_ref',
'alpha')).
'"></td>';
1305 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1310 if (empty($disablemove) && count($filearray) > 1) {
1321 if ($sortfield && $sortorder) {
1326 print
'<tr class="liste_titre nodrag nodrop">';
1331 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1338 if (empty($disablemove) && count($filearray) > 1) {
1343 $nboffiles = count($filearray);
1344 if ($nboffiles > 0) {
1345 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
1351 foreach ($filearray as $key => $file) {
1352 if ($file[
'name'] !=
'.'
1353 && $file[
'name'] !=
'..'
1354 && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1355 if (array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) {
1356 $lastrowid = $filearray[$key][
'rowid'];
1358 $filepath = $relativepath.$file[
'name'];
1362 print
'<!-- Line list_of_documents '.$key.
' relativepath = '.$relativepath.
' -->'.
"\n";
1365 print
'<!-- In database: position='.(array_key_exists(
'position', $filearray[$key]) ? $filearray[$key][
'position'] : 0).
' -->'.
"\n";
1366 print
'<tr class="oddeven" id="row-'.((array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) ? $filearray[$key][
'rowid'] :
'AFTER'.$lastrowid.
'POS'.($i + 1)).
'">';
1370 print
'<td class="minwith200 tdoverflowmax500">';
1374 print
'<a class="paddingright valignmiddle" href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart;
1375 if ($forcedownload) {
1376 print
'&attachment=1';
1378 if (!empty($object->entity)) {
1379 print
'&entity='.$object->entity;
1381 print
'&file='.urlencode($filepath);
1383 print
img_mime($file[
'name'], $file[
'name'].
' ('.
dol_print_size($file[
'size'], 0, 0).
')',
'inline-block valignmiddle paddingright');
1384 if ($showrelpart == 1) {
1385 print $relativepath;
1388 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $file[
'name'] == basename(
GETPOST(
'urlfile',
'alpha'))) {
1390 $section_dir = dirname(
GETPOST(
'urlfile',
'alpha'));
1391 if (!preg_match(
'/\/$/', $section_dir)) {
1392 $section_dir .=
'/';
1394 print
'<input type="hidden" name="section_dir" value="'.$section_dir.
'">';
1395 print
'<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file[
'name']).
'">';
1396 print
'<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file[
'name']).
'">';
1399 $filenametoshow = preg_replace(
'/\.noexe$/',
'', $file[
'name']);
1405 print $this->
showPreview($file, $modulepart, $filepath, 0,
'&entity='.(empty($object->entity) ? $conf->entity : $object->entity));
1413 print
'<td class="right nowraponall">';
1414 if ($sizetoshow == $sizetoshowbytes) {
1417 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
1422 print
'<td class="center nowraponall">'.dol_print_date($file[
'date'],
"dayhour",
"tzuser").
'</td>';
1425 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1426 $fileinfo = pathinfo($file[
'name']);
1427 print
'<td class="center">';
1429 if ($useinecm == 5 || $useinecm == 6) {
1439 $urlforhref =
getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension']), 1,
'&entity='.(empty($object->entity) ? $conf->entity : $object->entity));
1440 if (empty($urlforhref)) {
1441 $urlforhref = DOL_URL_ROOT.
'/viewimage.php?modulepart='.$modulepart.
'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).
'&file='.urlencode($relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension']));
1442 print
'<a href="'.$urlforhref.
'" class="aphoto" target="_blank" rel="noopener noreferrer">';
1444 print
'<a href="'.$urlforhref[
'url'].
'" class="'.$urlforhref[
'css'].
'" target="'.$urlforhref[
'target'].
'" mime="'.$urlforhref[
'mime'].
'">';
1446 print
'<img class="photo maxwidth200 shadow valignmiddle" height="'.(($useinecm == 4 || $useinecm == 5 || $useinecm == 6) ?
'20' : $maxheightmini).
'" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.$modulepart.
'&entity='.(empty($object->entity) ? $conf->entity : $object->entity).
'&file='.urlencode($relativepath.$smallfile).
'" title="">';
1455 print
'<td class="center">';
1456 if ($relativedir && $filearray[$key][
'rowid'] > 0) {
1458 print
'<label for="idshareenabled'.$key.
'">'.$langs->trans(
"FileSharedViaALink").
'</label> ';
1459 print
'<input class="inline-block" type="checkbox" id="idshareenabled'.$key.
'" name="shareenabled"'.($file[
'share'] ?
' checked="checked"' :
'').
' /> ';
1461 if ($file[
'share']) {
1463 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1464 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1470 if (!empty($file[
'share'])) {
1471 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
1473 if ($forcedownload) {
1474 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
1477 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
1479 print
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
1480 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).
'">';
1492 print
'<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
1493 if ($useinecm == 1 || $useinecm == 5) {
1495 $newparam = preg_replace(
'/&file=.*$/',
'', $param);
1496 $backtopage = DOL_URL_ROOT.
'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam;
1497 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>';
1500 if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) {
1501 $newmodulepart = $modulepart;
1502 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1503 $newmodulepart =
'produit|service';
1506 if ($permtoeditline) {
1507 $moreparaminurl =
'';
1508 if (!empty($object->id) && $object->id > 0) {
1509 $moreparaminurl .=
'&id='.$object->id;
1510 } elseif (
GETPOST(
'website',
'alpha')) {
1511 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1514 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1515 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1518 if (!preg_match(
'/\.webp$/i', $file[
'name'])) {
1519 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1520 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>';
1521 } elseif ($modulepart ==
'medias' &&
GETPOST(
'website')) {
1522 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>';
1528 if ($permtoeditline) {
1530 $moreparaminurl =
'';
1531 if (!empty($object->id) && $object->id > 0) {
1532 $moreparaminurl .=
'&id='.$object->id;
1533 } elseif (
GETPOST(
'website',
'alpha')) {
1534 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1537 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1538 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1541 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>';
1545 if ($permtoeditline) {
1546 $paramsectiondir = (in_array($modulepart, array(
'medias',
'ecm')) ?
'§ion_dir='.urlencode($relativepath) :
'');
1547 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>';
1551 if ($permonobject) {
1553 if (!empty($conf->dol_use_jmobile)) {
1556 if (empty($conf->use_javascript_ajax)) {
1562 print
'<a href="'.((($useinecm && $useinecm != 6) && $useajax) ?
'#' : ($url.
'?action=deletefile&token='.newToken().
'&urlfile='.urlencode($filepath).$param)).
'" class="reposition deletefilelink" rel="'.$filepath.
'">'.
img_delete().
'</a>';
1566 if (empty($disablemove) && count($filearray) > 1) {
1567 if ($nboffiles > 1 && $conf->browser->layout !=
'phone') {
1568 print
'<td class="linecolmove tdlineupdown center">';
1570 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=up&rowid='.$object->id.
'">'.
img_up(
'default', 0,
'imgupforline').
'</a>';
1572 if ($i < ($nboffiles - 1)) {
1573 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=down&rowid='.$object->id.
'">'.
img_down(
'default', 0,
'imgdownforline').
'</a>';
1577 print
'<td'.(($conf->browser->layout !=
'phone') ?
' class="linecolmove tdlineupdown center"' :
' class="linecolmove center"').
'>';
1582 print
'<td class="right">';
1583 print
'<input type="hidden" name="ecmfileid" value="'.$filearray[$key][
'rowid'].
'">';
1584 print
'<input type="submit" class="button button-save smallpaddingimp" name="renamefilesave" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
1585 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
1587 if (empty($disablemove) && count($filearray) > 1) {
1588 print
'<td class="right"></td>';
1596 if ($nboffiles == 0) {
1598 if (empty($disablemove) && count($filearray) > 1) {
1601 print
'<tr class="oddeven"><td colspan="'.$colspan.
'">';
1602 if (empty($textifempty)) {
1603 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
1605 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
1613 if ($nboflines > 1 && is_object($object)) {
1614 if (!empty($conf->use_javascript_ajax) && $permtoeditline) {
1615 $table_element_line =
'ecm_files';
1616 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
1622 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1650 public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath =
'', $permissiontodelete = 1, $useinecm = 0, $textifempty =
'', $maxlength = 0, $url =
'', $addfilterfields = 0)
1653 global $conf, $langs, $hookmanager, $form;
1654 global $sortfield, $sortorder;
1655 global $search_doc_ref;
1656 global $dolibarr_main_url_root;
1658 dol_syslog(get_class($this).
'::list_of_autoecmfiles upload_dir='.$upload_dir.
' modulepart='.$modulepart);
1661 if (empty($useinecm) || $useinecm == 6) {
1665 $url = $_SERVER[
"PHP_SELF"];
1668 if (!empty($addfilterfields)) {
1669 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'">';
1670 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1671 print
'<input type="hidden" name="module" value="'.$modulepart.
'">';
1674 print
'<div class="div-table-responsive-no-min">';
1675 print
'<table width="100%" class="noborder">'.
"\n";
1677 if (!empty($addfilterfields)) {
1678 print
'<tr class="liste_titre nodrag nodrop">';
1679 print
'<td class="liste_titre"></td>';
1680 print
'<td class="liste_titre"><input type="text" class="maxwidth100onsmartphone" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1681 print
'<td class="liste_titre"></td>';
1682 print
'<td class="liste_titre"></td>';
1684 print
'<td class="liste_titre right">';
1685 $searchpicto = $form->showFilterButtons();
1691 print
'<tr class="liste_titre">';
1692 $sortref =
"fullname";
1693 if ($modulepart ==
'invoice_supplier') {
1694 $sortref =
'level1name';
1704 $object_instance =
null;
1705 if ($modulepart ==
'company') {
1706 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
1707 $object_instance =
new Societe($this->db);
1708 } elseif ($modulepart ==
'invoice') {
1709 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1710 $object_instance =
new Facture($this->db);
1711 } elseif ($modulepart ==
'invoice_supplier') {
1712 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1714 } elseif ($modulepart ==
'propal') {
1715 include_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
1716 $object_instance =
new Propal($this->db);
1717 } elseif ($modulepart ==
'supplier_proposal') {
1718 include_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
1720 } elseif ($modulepart ==
'order') {
1721 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
1722 $object_instance =
new Commande($this->db);
1723 } elseif ($modulepart ==
'order_supplier') {
1724 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
1726 } elseif ($modulepart ==
'contract') {
1727 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
1728 $object_instance =
new Contrat($this->db);
1729 } elseif ($modulepart ==
'product') {
1730 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1731 $object_instance =
new Product($this->db);
1732 } elseif ($modulepart ==
'tax') {
1733 include_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
1735 } elseif ($modulepart ==
'tax-vat') {
1736 include_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
1737 $object_instance =
new Tva($this->db);
1738 } elseif ($modulepart ==
'salaries') {
1739 include_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
1740 $object_instance =
new Salary($this->db);
1741 } elseif ($modulepart ==
'project') {
1742 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1743 $object_instance =
new Project($this->db);
1744 } elseif ($modulepart ==
'project_task') {
1745 include_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
1746 $object_instance =
new Task($this->db);
1747 } elseif ($modulepart ==
'fichinter') {
1748 include_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
1749 $object_instance =
new Fichinter($this->db);
1750 } elseif ($modulepart ==
'user') {
1751 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
1752 $object_instance =
new User($this->db);
1753 } elseif ($modulepart ==
'expensereport') {
1754 include_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1756 } elseif ($modulepart ==
'holiday') {
1757 include_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
1758 $object_instance =
new Holiday($this->db);
1759 } elseif ($modulepart ==
'recruitment-recruitmentcandidature') {
1760 include_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
1762 } elseif ($modulepart ==
'banque') {
1763 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1764 $object_instance =
new Account($this->db);
1765 } elseif ($modulepart ==
'chequereceipt') {
1766 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
1768 } elseif ($modulepart ==
'mrp-mo') {
1769 include_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
1770 $object_instance =
new Mo($this->db);
1772 $parameters = array(
'modulepart'=>$modulepart);
1773 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1774 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1775 if (array_key_exists(
'classpath', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classpath'])) {
1777 if (array_key_exists(
'classname', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classname'])) {
1778 if (class_exists($hookmanager->resArray[
'classname'])) {
1779 $tmpclassname = $hookmanager->resArray[
'classname'];
1780 $object_instance =
new $tmpclassname($this->db);
1791 $relativepathfromroot = preg_replace(
'/'.preg_quote(DOL_DATA_ROOT.
'/',
'/').
'/',
'', $upload_dir);
1792 if ($relativepathfromroot) {
1796 if ($sortfield && $sortorder) {
1797 $filearray =
dol_sort_array($filearray, $sortfield, $sortorder, 1);
1803 foreach ($filearray as $key => $file) {
1804 if (!is_dir($file[
'name'])
1805 && $file[
'name'] !=
'.'
1806 && $file[
'name'] !=
'..'
1807 && $file[
'name'] !=
'CVS'
1808 && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1810 $relativefile = preg_replace(
'/'.preg_quote($upload_dir.
'/',
'/').
'/',
'', $file[
'fullname']);
1818 if ($modulepart ==
'company' || $modulepart ==
'tax' || $modulepart ==
'tax-vat' || $modulepart ==
'salaries') {
1819 preg_match(
'/(\d+)\/[^\/]+$/', $relativefile, $reg);
1820 $id = (isset($reg[1]) ? $reg[1] :
'');
1821 } elseif ($modulepart ==
'invoice_supplier') {
1822 preg_match(
'/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
1823 $ref = (isset($reg[1]) ? $reg[1] :
'');
1824 if (is_numeric($ref)) {
1828 } elseif ($modulepart ==
'user') {
1830 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1831 $id = (isset($reg[1]) ? $reg[1] :
'');
1832 } elseif ($modulepart ==
'project_task') {
1834 $reg = explode(
"/", $relativefile);
1835 $ref = (isset($reg[1]) ? $reg[1] :
'');
1836 } elseif (in_array($modulepart, array(
1839 'supplier_proposal',
1848 'recruitment-recruitmentcandidature',
1853 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1854 $ref = (isset($reg[1]) ? $reg[1] :
'');
1856 $parameters = array(
'modulepart'=>$modulepart,
'fileinfo'=>$file);
1857 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1858 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1859 if (array_key_exists(
'ref', $hookmanager->resArray) && !empty($hookmanager->resArray[
'ref'])) {
1860 $ref = $hookmanager->resArray[
'ref'];
1862 if (array_key_exists(
'id', $hookmanager->resArray) && !empty($hookmanager->resArray[
'id'])) {
1863 $id = $hookmanager->resArray[
'id'];
1869 if (!$id && !$ref) {
1874 if (!empty($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1880 if (is_object($object_instance)) {
1881 $object_instance->id = 0;
1882 $object_instance->ref =
'';
1884 $result = $object_instance->fetch($id);
1886 if (!($result = $object_instance->fetch(
'', $ref))) {
1892 $result = $object_instance->fetchOneLike($ref);
1899 $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref] = clone $object_instance;
1903 $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref] =
'notfound';
1904 unset($filearray[$key]);
1908 if ($found <= 0 || !is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1912 print
'<!-- Line list_of_autoecmfiles key='.$key.
' -->'.
"\n";
1913 print
'<tr class="oddeven">';
1915 if ($found > 0 && is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1916 $tmpobject = $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref];
1918 print $tmpobject->getNomUrl(1,
'document');
1923 print $langs->trans(
"ObjectDeleted", ($id ? $id : $ref));
1939 print
'<a href="'.DOL_URL_ROOT.
'/document.php?modulepart='.urlencode($modulepart);
1940 if ($forcedownload) {
1941 print
'&attachment=1';
1943 print
'&file='.urlencode($relativefile).
'">';
1945 print
dol_trunc($file[
'name'], $maxlength,
'middle');
1950 print $this->
showPreview($file, $modulepart, $file[
'relativename']);
1957 print
'<td class="right nowraponall">';
1958 if ($sizetoshow == $sizetoshowbytes) {
1961 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
1966 print
'<td class="center">'.dol_print_date($file[
'date'],
"dayhour").
'</td>';
1969 print
'<td class="right">';
1970 if (!empty($file[
'share'])) {
1972 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1973 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1979 if (!empty($file[
'share'])) {
1980 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
1982 if ($forcedownload) {
1983 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
1986 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
1988 print
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
' ';
1989 print
'<input type="text" class="quatrevingtpercent width100 nopadding nopadding small" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).
'">';
2003 if (count($filearray) == 0) {
2004 print
'<tr class="oddeven"><td colspan="5">';
2005 if (empty($textifempty)) {
2006 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
2008 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
2015 if (!empty($addfilterfields)) {
2018 return count($filearray);
2032 public function listOfLinks($object, $permissiontodelete = 1, $action =
null, $selected =
null, $param =
'')
2034 global $user, $conf, $langs, $user;
2035 global $sortfield, $sortorder;
2037 $langs->load(
"link");
2039 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
2040 $link =
new Link($this->db);
2042 if ($sortfield ==
"name") {
2043 $sortfield =
"label";
2044 } elseif ($sortfield ==
"date") {
2045 $sortfield =
"datea";
2049 $res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
2050 $param .= (isset($object->id) ?
'&id='.$object->id :
'');
2052 print
'<!-- listOfLinks -->'.
"\n";
2055 print
load_fiche_titre($langs->trans(
"LinkedFiles"),
'',
'link', 0,
'',
'table-list-of-links');
2057 print
'<form action="'.$_SERVER[
'PHP_SELF'].($param ?
'?'.$param :
'').
'" method="POST">';
2058 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2060 print
'<table class="liste noborder nobottom centpercent">';
2061 print
'<tr class="liste_titre">';
2063 $langs->trans(
"Links"),
2064 $_SERVER[
'PHP_SELF'],
2085 $langs->trans(
"Date"),
2086 $_SERVER[
'PHP_SELF'],
2097 $_SERVER[
'PHP_SELF'],
2108 $nboflinks = count($links);
2109 if ($nboflinks > 0) {
2110 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2113 foreach ($links as $link) {
2114 print
'<tr class="oddeven">';
2116 if ($action ==
'update' && $selected === $link->id) {
2118 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2119 print
'<input type="hidden" name="linkid" value="'.$link->id.
'">';
2120 print
'<input type="hidden" name="action" value="confirm_updateline">';
2121 print $langs->trans(
'Link').
': <input type="text" name="link" value="'.$link->url.
'">';
2124 print $langs->trans(
'Label').
': <input type="text" name="label" value="'.
dol_escape_htmltag($link->label).
'">';
2126 print
'<td class="center">'.dol_print_date(
dol_now(),
"dayhour",
"tzuser").
'</td>';
2127 print
'<td class="right"></td>';
2128 print
'<td class="right">';
2129 print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2130 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2135 print
'<a data-ajax="false" href="'.$link->url.
'" target="_blank" rel="noopener noreferrer">';
2139 print
'<td class="right"></td>';
2140 print
'<td class="center">'.dol_print_date($link->datea,
"dayhour",
"tzuser").
'</td>';
2141 print
'<td class="center"></td>';
2142 print
'<td class="right">';
2143 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=update&linkid='.$link->id.$param.
'&token='.newToken().
'" class="editfilelink editfielda reposition" >'.
img_edit().
'</a>';
2144 if ($permissiontodelete) {
2145 print
' <a class="deletefilelink reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=deletelink&token='.newToken().
'&linkid='.((int) $link->id).$param.
'">'.
img_delete().
'</a>';
2153 if ($nboflinks == 0) {
2154 print
'<tr class="oddeven"><td colspan="5">';
2155 print
'<span class="opacitymedium">'.$langs->trans(
"NoLinkFound").
'</span>';
2176 public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param =
'')
2178 global $langs, $conf;
2181 if ($conf->browser->layout !=
'phone' && !empty($conf->use_javascript_ajax)) {
2183 if (count($urladvancedpreview)) {
2184 $out .=
'<a class="pictopreview '.$urladvancedpreview[
'css'].
'" href="'.$urladvancedpreview[
'url'].
'"'.(empty($urladvancedpreview[
'mime']) ?
'' :
' mime="'.$urladvancedpreview[
'mime'].
'"').
' '.(empty($urladvancedpreview[
'target']) ?
'' :
' target="'.$urladvancedpreview[
'target'].
'"').
'>';
2186 if (empty($ruleforpicto)) {
2188 $out .=
'<span class="fa fa-search-plus pictofixedwidth" style="color: gray"></span>';
2190 $out .=
img_mime($relativepath, $langs->trans(
'Preview').
' '.$file[
'name'],
'pictofixedwidth');
2194 if ($ruleforpicto < 0) {
2195 $out .=
img_picto(
'',
'generic',
'',
false, 0, 0,
'',
'paddingright pictofixedwidth');
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.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
Class to manage predefined suppliers products.
Class to manage customers orders.
Class to manage contracts.
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage interventions.
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 models generation.
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($dbs, $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 models.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation models.
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 models.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
static liste_modeles($dbs, $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.
Put here description of your class.
Class to manage Dolibarr users.
completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $noCreateEcmFile=0)
Complete $filearray with data from database.
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($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_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formated size.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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_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 dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier 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.