58 $this->numoffiles = 0;
87 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)
90 global $conf, $langs, $hookmanager;
91 $hookmanager->initHooks(array(
'formfile'));
95 dol_syslog(__METHOD__.
": using 2 for useajax is deprecated and should be not used", LOG_WARNING);
98 if (!empty($conf->browser->layout) && $conf->browser->layout !=
'classic') {
102 if ((
getDolGlobalString(
'MAIN_USE_JQUERY_FILEUPLOAD') && $useajax) || ($useajax == 2)) {
109 return 'Feature too bugged so removed';
120 $out =
"\n\n".
'<!-- Start form attach new file --><div class="formattachnewfile">'.
"\n";
123 $title = $langs->trans(
"AttachANewFile");
125 if ($title !=
'none') {
129 if (empty($usewithoutform)) {
131 $url .= (strpos($url,
'?') ===
false ?
'?' :
'&').
'uploadform=1';
133 $out .=
'<form name="'.$htmlname.
'" id="'.$htmlname.
'" action="'.$url.
'" enctype="multipart/form-data" method="POST">'.
"\n";
135 if (empty($usewithoutform) || $usewithoutform == 2) {
136 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
137 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_dir" name="section_dir" value="'.$sectiondir.
'">'.
"\n";
138 $out .=
'<input type="hidden" id="'.$htmlname.
'_section_id" name="section_id" value="'.$sectionid.
'">'.
"\n";
139 $out .=
'<input type="hidden" name="sortfield" value="'.GETPOST(
'sortfield',
'aZ09comma').
'">'.
"\n";
140 $out .=
'<input type="hidden" name="sortorder" value="'.GETPOST(
'sortorder',
'aZ09comma').
'">'.
"\n";
141 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
144 $out .=
'<table class="nobordernopadding centpercent">';
147 if (!empty($options)) {
148 $out .=
'<td>'.$options.
'</td>';
151 $out .=
'<td class="valignmiddle nowrap">';
154 $max = $maxfilesizearray[
'max'];
155 $maxmin = $maxfilesizearray[
'maxmin'];
156 $maxphptoshow = $maxfilesizearray[
'maxphptoshow'];
157 $maxphptoshowparam = $maxfilesizearray[
'maxphptoshowparam'];
159 $out .=
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
161 $out .=
'<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
162 $out .= ((
getDolGlobalString(
'MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ?
' name="userfile"' :
' name="userfile[]" multiple');
164 $out .= (!empty($accept) ?
' accept="'.$accept.
'"' :
' accept=""');
165 $out .= (!empty($capture) ?
' capture="capture"' :
'');
169 $langs->load(
'link');
170 $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>';
172 $out .=
'<input type="submit" class="button small reposition" name="sendit" value="'.$langs->trans(
"Upload").
'"';
178 $out .=
'<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
183 $menudolibarrsetupmax = $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Security");
184 $langs->load(
'other');
186 $out .=
info_admin($langs->trans(
"ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1);
189 $out .=
' ('.$langs->trans(
"UploadDisabled").
')';
191 $out .=
"</td></tr>";
193 if ($savingdocmask) {
195 $rename = (!
getDolGlobalString(
'MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ?
'checked' :
'');
198 if (!empty($options)) {
199 $out .=
'<td>'.$options.
'</td>';
201 $out .=
'<td valign="middle" class="nowrap">';
202 $out .=
'<input type="checkbox" '.$rename.
' class="savingdocmask" name="savingdocmask" id="savingdocmask" value="'.
dol_escape_js($savingdocmask).
'"> ';
203 $out .=
'<label class="opacitymedium small" for="savingdocmask">';
204 $out .= $langs->trans(
"SaveUploadedFileWithMask", preg_replace(
'/__file__/', $langs->transnoentitiesnoconv(
"OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv(
"OriginFileName"));
212 if (empty($usewithoutform)) {
214 if (empty($sectionid)) {
219 $out .=
"\n</div><!-- End form attach new file -->\n";
222 $out .=
"\n".
'<!-- Start form link new url --><div class="formlinknewurl">'.
"\n";
223 $langs->load(
'link');
224 $title = $langs->trans(
"LinkANewFile");
227 if (empty($usewithoutform)) {
228 $out .=
'<form name="'.$htmlname.
'_link" id="'.$htmlname.
'_link" action="'.$url.
'" method="POST">'.
"\n";
229 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
230 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_dir" name="link_section_dir" value="">'.
"\n";
231 $out .=
'<input type="hidden" id="'.$htmlname.
'_link_section_id" name="link_section_id" value="'.$sectionid.
'">'.
"\n";
232 $out .=
'<input type="hidden" name="page_y" value="">'.
"\n";
235 $out .=
'<div class="valignmiddle">';
236 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
238 $out .=
'<label for="link">'.$langs->trans(
"URLToLink").
':</label> ';
240 $out .=
'<input type="text" name="link" class="flat minwidth400imp" id="link" placeholder="'.dol_escape_htmltag($langs->trans(
"URLToLink")).
'">';
242 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
244 $out .=
'<label for="label">'.$langs->trans(
"Label").
':</label> ';
246 $out .=
'<input type="text" class="flat" name="label" id="label" placeholder="'.dol_escape_htmltag($langs->trans(
"Label")).
'">';
247 $out .=
'<input type="hidden" name="objecttype" value="'.$object->element.
'">';
248 $out .=
'<input type="hidden" name="objectid" value="'.$object->id.
'">';
250 $out .=
'<div class="inline-block" style="padding-right: 10px;">';
251 $out .=
'<input type="submit" class="button small reposition" name="linkit" value="'.$langs->trans(
"ToLink").
'"';
256 if (empty($usewithoutform)) {
257 $out .=
'<div class="clearboth"></div>';
258 $out .=
'</form><br>';
261 $out .=
"\n</div><!-- End form link new url -->\n";
264 $parameters = array(
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'url' => $url,
'perm' => $perm,
'options' => $options);
265 $res = $hookmanager->executeHooks(
'formattachOptions', $parameters,
$object);
267 $out =
'<div class="'.($usewithoutform ?
'inline-block valignmiddle' :
'attacharea attacharea'.$htmlname).
'">'.$out.
'</div>';
269 $out .= $hookmanager->resPrint;
303 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 =
'')
306 $this->numoffiles = 0;
307 print $this->
showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed, $modelselected, $allowgenifempty, $forcenomultilang, $iconPDF, $notused, $noform, $param, $title, $buttonlabel, $codelang);
308 return $this->numoffiles;
338 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 =
'')
340 global $dolibarr_main_url_root;
343 if (!empty($iconPDF)) {
344 dol_syslog(__METHOD__.
": passing iconPDF parameter is deprecated", LOG_WARNING);
347 global $langs, $conf, $user, $hookmanager;
351 if (is_object($hookmanager)) {
353 'modulepart' => &$modulepart,
354 'modulesubdir' => &$modulesubdir,
355 'filedir' => &$filedir,
356 'urlsource' => &$urlsource,
357 'genallowed' => &$genallowed,
358 'delallowed' => &$delallowed,
359 'modelselected' => &$modelselected,
360 'allowgenifempty' => &$allowgenifempty,
361 'forcenomultilang' => &$forcenomultilang,
362 'noform' => &$noform,
365 'buttonlabel' => &$buttonlabel,
366 'codelang' => &$codelang,
367 'morepicto' => &$morepicto,
368 'hideifempty' => &$hideifempty,
369 'removeaction' => &$removeaction
371 $reshook = $hookmanager->executeHooks(
'showDocuments', $parameters,
$object);
379 return $hookmanager->resPrint;
382 if (!is_object($form)) {
383 $form =
new Form($this->db);
386 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
389 if (!empty($iconPDF)) {
394 if (!preg_match(
'/entity\=[0-9]+/', $param)) {
395 $param .= ($param ?
'&' :
'').
'entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity);
400 if (in_array($modulepart, array(
'contract',
'facture',
'supplier_proposal',
'propal',
'proposal',
'order',
'commande',
'expedition',
'commande_fournisseur',
'expensereport',
'delivery',
'ticket'))) {
401 $printer = ($user->hasRight(
'printing',
'read') && !empty($conf->printing->enabled)) ?
true :
false;
404 $hookmanager->initHooks(array(
'formfile'));
408 if (!empty($filedir)) {
409 $file_list =
dol_dir_list($filedir,
'files', 0,
'',
'(\.meta|_preview.*.*\.png)$',
'date', SORT_DESC);
411 if ($hideifempty && empty($file_list)) {
416 $forname =
'builddoc';
421 $out .=
"\n".
'<!-- Start show_document -->'.
"\n";
424 if (preg_match(
'/massfilesarea_/', $modulepart)) {
425 $out .=
'<div id="show_files"><br></div>'.
"\n";
426 $title = $langs->trans(
"MassFilesArea").
' <a href="" id="togglemassfilesarea" ref="shown">('.$langs->trans(
"Hide").
')</a>';
427 $title .=
'<script nonce="'.getNonce().
'">
428 jQuery(document).ready(function() {
429 jQuery(\'#togglemassfilesarea\').click(function() {
430 if (jQuery(\'#togglemassfilesarea\').attr(\'ref\') == "shown")
432 jQuery(\'#'.$modulepart.
'_table\').hide();
433 jQuery(\'#togglemassfilesarea\').attr("ref", "hidden");
434 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Show")).
')");
438 jQuery(\'#'.$modulepart.
'_table\').show();
439 jQuery(\'#togglemassfilesarea\').attr("ref","shown");
440 jQuery(\'#togglemassfilesarea\').text("('.
dol_escape_js($langs->trans(
"Hide")).
')");
448 $titletoshow = $langs->trans(
"Documents");
449 if (!empty($title)) {
450 $titletoshow = ($title ==
'none' ?
'' : $title);
453 $submodulepart = $modulepart;
456 $tmp = explode(
':', $modulepart);
457 if (!empty($tmp[1])) {
458 $modulepart = $tmp[0];
459 $submodulepart = $tmp[1];
462 $addcolumforpicto = ($delallowed || $printer || $morepicto);
463 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
468 $modellist = array();
470 if ($modulepart ==
'company') {
472 if (is_array($genallowed)) {
473 $modellist = $genallowed;
475 include_once DOL_DOCUMENT_ROOT.
'/core/modules/societe/modules_societe.class.php';
478 } elseif ($modulepart ==
'propal') {
479 if (is_array($genallowed)) {
480 $modellist = $genallowed;
482 include_once DOL_DOCUMENT_ROOT.
'/core/modules/propale/modules_propale.php';
485 } elseif ($modulepart ==
'supplier_proposal') {
486 if (is_array($genallowed)) {
487 $modellist = $genallowed;
489 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_proposal/modules_supplier_proposal.php';
492 } elseif ($modulepart ==
'commande') {
493 if (is_array($genallowed)) {
494 $modellist = $genallowed;
496 include_once DOL_DOCUMENT_ROOT.
'/core/modules/commande/modules_commande.php';
499 } elseif ($modulepart ==
'expedition') {
500 if (is_array($genallowed)) {
501 $modellist = $genallowed;
503 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expedition/modules_expedition.php';
506 } elseif ($modulepart ==
'reception') {
507 if (is_array($genallowed)) {
508 $modellist = $genallowed;
510 include_once DOL_DOCUMENT_ROOT.
'/core/modules/reception/modules_reception.php';
513 } elseif ($modulepart ==
'delivery') {
514 if (is_array($genallowed)) {
515 $modellist = $genallowed;
517 include_once DOL_DOCUMENT_ROOT.
'/core/modules/delivery/modules_delivery.php';
520 } elseif ($modulepart ==
'ficheinter') {
521 if (is_array($genallowed)) {
522 $modellist = $genallowed;
524 include_once DOL_DOCUMENT_ROOT.
'/core/modules/fichinter/modules_fichinter.php';
527 } elseif ($modulepart ==
'facture') {
528 if (is_array($genallowed)) {
529 $modellist = $genallowed;
531 include_once DOL_DOCUMENT_ROOT.
'/core/modules/facture/modules_facture.php';
534 } elseif ($modulepart ==
'contract') {
536 if (is_array($genallowed)) {
537 $modellist = $genallowed;
539 include_once DOL_DOCUMENT_ROOT.
'/core/modules/contract/modules_contract.php';
542 } elseif ($modulepart ==
'project') {
543 if (is_array($genallowed)) {
544 $modellist = $genallowed;
546 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/modules_project.php';
549 } elseif ($modulepart ==
'project_task') {
550 if (is_array($genallowed)) {
551 $modellist = $genallowed;
553 include_once DOL_DOCUMENT_ROOT.
'/core/modules/project/task/modules_task.php';
556 } elseif ($modulepart ==
'product') {
557 if (is_array($genallowed)) {
558 $modellist = $genallowed;
560 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product/modules_product.class.php';
563 } elseif ($modulepart ==
'product_batch') {
564 if (is_array($genallowed)) {
565 $modellist = $genallowed;
567 include_once DOL_DOCUMENT_ROOT.
'/core/modules/product_batch/modules_product_batch.class.php';
570 } elseif ($modulepart ==
'stock') {
571 if (is_array($genallowed)) {
572 $modellist = $genallowed;
574 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_stock.php';
577 } elseif ($modulepart ==
'hrm') {
578 if (is_array($genallowed)) {
579 $modellist = $genallowed;
581 include_once DOL_DOCUMENT_ROOT.
'/core/modules/hrm/modules_evaluation.php';
584 } elseif ($modulepart ==
'movement') {
585 if (is_array($genallowed)) {
586 $modellist = $genallowed;
588 include_once DOL_DOCUMENT_ROOT.
'/core/modules/stock/modules_movement.php';
591 } elseif ($modulepart ==
'export') {
592 if (is_array($genallowed)) {
593 $modellist = $genallowed;
595 include_once DOL_DOCUMENT_ROOT.
'/core/modules/export/modules_export.php';
597 $modellist = array();
599 } elseif ($modulepart ==
'commande_fournisseur' || $modulepart ==
'supplier_order') {
600 if (is_array($genallowed)) {
601 $modellist = $genallowed;
603 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_order/modules_commandefournisseur.php';
606 } elseif ($modulepart ==
'facture_fournisseur' || $modulepart ==
'supplier_invoice') {
608 if (is_array($genallowed)) {
609 $modellist = $genallowed;
611 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_invoice/modules_facturefournisseur.php';
614 } elseif ($modulepart ==
'supplier_payment') {
615 if (is_array($genallowed)) {
616 $modellist = $genallowed;
618 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
621 } elseif ($modulepart ==
'remisecheque') {
622 if (is_array($genallowed)) {
623 $modellist = $genallowed;
625 include_once DOL_DOCUMENT_ROOT.
'/core/modules/cheque/modules_chequereceipts.php';
628 } elseif ($modulepart ==
'donation') {
629 if (is_array($genallowed)) {
630 $modellist = $genallowed;
632 include_once DOL_DOCUMENT_ROOT.
'/core/modules/dons/modules_don.php';
635 } elseif ($modulepart ==
'member') {
636 if (is_array($genallowed)) {
637 $modellist = $genallowed;
639 include_once DOL_DOCUMENT_ROOT.
'/core/modules/member/modules_cards.php';
642 } elseif ($modulepart ==
'agenda' || $modulepart ==
'actions') {
643 if (is_array($genallowed)) {
644 $modellist = $genallowed;
646 include_once DOL_DOCUMENT_ROOT.
'/core/modules/action/modules_action.php';
649 } elseif ($modulepart ==
'expensereport') {
650 if (is_array($genallowed)) {
651 $modellist = $genallowed;
653 include_once DOL_DOCUMENT_ROOT.
'/core/modules/expensereport/modules_expensereport.php';
656 } elseif ($modulepart ==
'unpaid') {
658 } elseif ($modulepart ==
'user') {
659 if (is_array($genallowed)) {
660 $modellist = $genallowed;
662 include_once DOL_DOCUMENT_ROOT.
'/core/modules/user/modules_user.class.php';
665 } elseif ($modulepart ==
'usergroup') {
666 if (is_array($genallowed)) {
667 $modellist = $genallowed;
669 include_once DOL_DOCUMENT_ROOT.
'/core/modules/usergroup/modules_usergroup.class.php';
674 $file =
dol_buildpath(
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
675 if (file_exists($file)) {
676 $res = include_once $file;
679 $file =
dol_buildpath(
'/'.$modulepart.
'/core/modules/'.$modulepart.
'/modules_'.strtolower($submodulepart).
'.php', 0);
680 $res = include_once $file;
683 $class =
'ModelePDF'.ucfirst($submodulepart);
685 if (class_exists($class)) {
686 $modellist = call_user_func($class.
'::liste_modeles', $this->db);
688 dol_print_error($this->db,
"Bad value for modulepart '".$modulepart.
"' in showdocuments (class ".$class.
" for Doc generation not found)");
696 if (empty($buttonlabel)) {
697 $buttonlabel = $langs->trans(
'Generate');
700 if ($conf->browser->layout ==
'phone') {
701 $urlsource .=
'#'.$forname.
'_form';
703 if (empty($noform)) {
704 $out .=
'<form action="'.$urlsource.
'" id="'.$forname.
'_form" method="post">';
706 $out .=
'<input type="hidden" name="action" value="builddoc">';
707 $out .=
'<input type="hidden" name="page_y" value="">';
708 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
711 $out .=
'<div class="div-table-responsive-no-min">';
712 $out .=
'<table class="liste formdoc noborder centpercent">';
714 $out .=
'<tr class="liste_titre">';
715 $addcolumforpicto = ($delallowed || $printer || $morepicto);
716 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
719 $out .=
'<th colspan="'.$colspan.
'" class="formdoc liste_titre maxwidthonsmartphone center">';
722 if (!empty($modellist)) {
724 $out .=
'<span class="hideonsmartphone">'.$langs->trans(
'Model').
' </span>';
725 if (is_array($modellist) && count($modellist) == 1) {
726 $arraykeys = array_keys($modellist);
727 $modelselected = $arraykeys[0];
729 $morecss =
'minwidth75 maxwidth200';
730 if ($conf->browser->layout ==
'phone') {
731 $morecss =
'maxwidth100';
733 $out .= $form->selectarray(
'model', $modellist, $modelselected, $showempty, 0, 0,
'', 0, 0, 0,
'', $morecss, 1,
'', 0, 0);
767 if ($conf->use_javascript_ajax) {
770 $out .= $form->textwithpicto(
'', $tooltipontemplatecombo, 1,
'help',
'marginrightonly', 0, 3,
'', 0);
772 $out .=
'<div class="float">'.$langs->trans(
"Files").
'</div>';
776 if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) &&
getDolGlobalInt(
'MAIN_MULTILANGS') && !$forcenomultilang && (!empty($modellist) || $showempty)) {
777 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
779 $defaultlang = ($codelang && $codelang !=
'auto') ? $codelang : $langs->getDefaultLang();
780 $morecss =
'maxwidth150';
781 if ($conf->browser->layout ==
'phone') {
782 $morecss =
'maxwidth100';
784 $out .= $formadmin->select_language($defaultlang,
'lang_id', 0,
null, 0, 0, 0, $morecss);
790 $genbutton =
'<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.
'_generatebutton" name="'.$forname.
'_generatebutton"';
791 $genbutton .=
' type="submit" value="'.$buttonlabel.
'"';
792 if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
793 $genbutton .=
' disabled';
796 if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
797 $langs->load(
"errors");
798 $genbutton .=
' '.img_warning($langs->transnoentitiesnoconv(
"WarningNoDocumentModelActivated"));
800 if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
803 if (empty($modellist) && !$showempty && $modulepart !=
'unpaid') {
809 if (!empty($hookmanager->hooks[
'formfile'])) {
810 foreach ($hookmanager->hooks[
'formfile'] as $module) {
811 if (method_exists($module,
'formBuilddocLineOptions')) {
820 $parameters = array(
'colspan' => ($colspan + $colspanmore),
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart' => $modulepart);
821 if (is_object($hookmanager)) {
822 $reshook = $hookmanager->executeHooks(
'formBuilddocOptions', $parameters, $GLOBALS[
'object']);
823 $out .= $hookmanager->resPrint;
828 if (!empty($filedir)) {
829 $link_list = array();
831 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
832 $link =
new Link($this->db);
833 $sortfield = $sortorder =
null;
834 $res = $link->fetchAll($link_list,
$object->element,
$object->id, $sortfield, $sortorder);
837 $out .=
'<!-- html.formfile::showdocuments -->'.
"\n";
840 if ((!empty($file_list) || !empty($link_list) || preg_match(
'/^massfilesarea/', $modulepart))
843 $out .=
'<div class="titre">'.$titletoshow.
'</div>'.
"\n";
844 $out .=
'<div class="div-table-responsive-no-min">';
845 $out .=
'<table class="noborder centpercent" id="'.$modulepart.
'_table">'.
"\n";
849 if (is_array($file_list)) {
853 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $filedir);
854 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
862 if (!empty($sortfield) && !empty($sortorder)) {
867 foreach ($file_list as $file) {
869 $relativepath = $file[
"name"];
871 $relativepath = $modulesubdir.
"/".$file[
"name"];
873 if ($modulepart ==
'export') {
874 $relativepath = $file[
"name"];
877 $out .=
'<tr class="oddeven">';
879 $documenturl = DOL_URL_ROOT.
'/document.php';
880 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
885 $imgpreview = $this->
showPreview($file, $modulepart, $relativepath, 0, $param);
887 $out .=
'<td class="minwidth200 tdoverflowmax300">';
889 $out .=
'<span class="spanoverflow widthcentpercentminusx valignmiddle">';
891 $out .=
'<span class="spanoverflow">';
893 $out .=
'<a class="documentdownload paddingright" ';
895 $out .=
'target="_blank" ';
897 $out .=
'href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
900 if (preg_match(
'/text/', $mime)) {
901 $out .=
' target="_blank" rel="noopener noreferrer"';
903 $out .=
' title="'.dol_escape_htmltag($file[
"name"]).
'"';
905 $out .=
img_mime($file[
"name"], $langs->trans(
"File").
': '.$file[
"name"]);
908 $out .=
'</span>'.
"\n";
913 $size = (!empty($file[
'size']) ? $file[
'size'] :
dol_filesize($filedir.
"/".$file[
"name"]));
914 $out .=
'<td class="nowraponall right">'.dol_print_size($size, 1, 1).
'</td>';
917 $date = (!empty($file[
'date']) ? $file[
'date'] :
dol_filemtime($filedir.
"/".$file[
"name"]));
918 $out .=
'<td class="nowrap right">'.dol_print_date($date,
'dayhour',
'tzuser').
'</td>';
921 $out .=
'<td class="nowraponall">';
922 if (!empty($file[
'share'])) {
924 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
925 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
931 if (!empty($file[
'share'])) {
932 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
934 if ($forcedownload) {
935 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
938 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
940 $out .=
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
941 $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).
'">';
949 if ($delallowed || $printer || $morepicto) {
950 $out .=
'<td class="right nowraponall">';
952 $tmpurlsource = preg_replace(
'/#[a-zA-Z0-9_]*$/',
'', $urlsource);
953 $out .=
'<a class="reposition" href="'.$tmpurlsource.((strpos($tmpurlsource,
'?') ===
false) ?
'?' :
'&').
'action='.urlencode($removeaction).
'&token='.
newToken().
'&file='.urlencode($relativepath);
954 $out .= ($param ?
'&'.$param :
'');
957 $out .=
'">'.img_picto($langs->trans(
"Delete"),
'delete').
'</a>';
960 $out .=
'<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource,
'?') ?
'&' :
'?').
'action=print_file&token='.
newToken().
'&printer='.urlencode($modulepart).
'&file='.urlencode($relativepath);
961 $out .= ($param ?
'&'.$param :
'');
962 $out .=
'">'.img_picto($langs->trans(
"PrintFile", $relativepath),
'printer.png').
'</a>';
965 $morepicto = preg_replace(
'/__FILENAMEURLENCODED__/', urlencode($relativepath), $morepicto);
971 if (is_object($hookmanager)) {
972 $addcolumforpicto = ($delallowed || $printer || $morepicto);
973 $colspan = (4 + ($addcolumforpicto ? 1 : 0));
975 $parameters = array(
'colspan' => ($colspan + $colspanmore),
'socid' => (isset($GLOBALS[
'socid']) ? $GLOBALS[
'socid'] :
''),
'id' => (isset($GLOBALS[
'id']) ? $GLOBALS[
'id'] :
''),
'modulepart' => $modulepart,
'relativepath' => $relativepath);
976 $res = $hookmanager->executeHooks(
'formBuilddocLineOptions', $parameters, $file);
978 $out .= $hookmanager->resPrint;
981 $out = $hookmanager->resPrint;
989 if (is_array($link_list)) {
992 foreach ($link_list as $file) {
993 $out .=
'<tr class="oddeven">';
994 $out .=
'<td colspan="'.$colspan.
'" class="maxwidhtonsmartphone">';
995 $out .=
'<a data-ajax="false" href="'.$file->url.
'" target="_blank" rel="noopener noreferrer">';
996 $out .= $file->label;
999 $out .=
'<td class="right">';
1003 $out .=
'<td></td>';
1004 if ($delallowed || $printer || $morepicto) {
1005 $out .=
'<td></td>';
1007 $out .=
'</tr>'.
"\n";
1009 $this->numoffiles++;
1012 if (count($file_list) == 0 && count($link_list) == 0 && $headershown) {
1013 $out .=
'<tr><td colspan="'.(3 + ($addcolumforpicto ? 1 : 0)).
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>'.
"\n";
1019 $out .=
"</table>\n";
1022 if (empty($noform)) {
1023 $out .=
'</form>'.
"\n";
1027 $out .=
'<!-- End show_document -->'.
"\n";
1030 jQuery(document).ready(function() {
1031 var selectedValue = $(".selectformat").val();
1033 if (selectedValue === "excel2007" || selectedValue === "tsv") {
1034 $(".forhide").prop("disabled", true).hide();
1036 $(".forhide").prop("disabled", false).show();
1057 public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter =
'', $morecss =
'valignmiddle', $allfiles = 0)
1059 global $conf, $langs;
1061 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1064 $this->infofiles = array(
'nboffiles' => 0,
'extensions' => array(),
'files' => array());
1069 if (isModEnabled(
'multicompany')) {
1071 preg_match(
'/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,
'/').
'$/', $filedir, $regs);
1072 $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1);
1077 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/');
1079 $filterforfilesearch =
'^'.preg_quote(basename($modulesubdir),
'/').
'\.';
1081 $file_list =
dol_dir_list($filedir,
'files', 0, $filterforfilesearch,
'\.meta$|\.png$');
1085 $out .=
'<!-- html.formfile::getDocumentsLink -->'.
"\n";
1086 if (!empty($file_list)) {
1087 $out =
'<dl class="dropdown inline-block">
1088 <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto(
'',
'listlight',
'', 0, 0, 0,
'', $morecss).
'</a></dt>
1089 <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
1095 foreach ($file_list as $file) {
1097 if ($filter && !preg_match(
'/'.$filter.
'/i', $file[
"name"])) {
1103 $relativepath = $file[
"name"];
1104 if ($modulesubdir) {
1105 $relativepath = $modulesubdir.
"/".$file[
"name"];
1108 if ($modulepart ==
'donation') {
1109 $relativepath =
get_exdir($modulesubdir, 2, 0, 0,
null,
'donation').$file[
"name"];
1111 if ($modulepart ==
'export') {
1112 $relativepath = $file[
"name"];
1115 $this->infofiles[
'nboffiles']++;
1116 $this->infofiles[
'files'][] = $file[
'fullname'];
1117 $ext = pathinfo($file[
"name"], PATHINFO_EXTENSION);
1118 if (empty($this->infofiles[$ext])) {
1119 $this->infofiles[
'extensions'][$ext] = 1;
1121 $this->infofiles[
'extensions'][$ext]++;
1125 if (!empty($conf->use_javascript_ajax) && ($conf->browser->layout !=
'phone')) {
1127 if ($tmparray && $tmparray[
'url']) {
1128 $tmpout .=
'<li><a href="'.$tmparray[
'url'].
'"'.($tmparray[
'css'] ?
' class="'.$tmparray[
'css'].
'"' :
'').($tmparray[
'mime'] ?
' mime="'.$tmparray[
'mime'].
'"' :
'').($tmparray[
'target'] ?
' target="'.$tmparray[
'target'].
'"' :
'').
'>';
1130 $tmpout .=
'<i class="fa fa-search-plus paddingright" style="color: gray"></i>';
1131 $tmpout .= $langs->trans(
"Preview").
' '.$ext.
'</a></li>';
1136 $tmpout .=
'<li class="nowrap"><a class="pictopreview nowrap" ';
1138 $tmpout .=
'target="_blank" ';
1140 $tmpout .=
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart.
'&entity='.$entity.
'&file='.urlencode($relativepath).
'"';
1142 if (preg_match(
'/text/', $mime)) {
1143 $tmpout .=
' target="_blank" rel="noopener noreferrer"';
1146 $tmpout .=
img_mime($relativepath, $file[
"name"]);
1147 $tmpout .= $langs->trans(
"Download").
' '.$ext;
1148 $tmpout .=
'</a></li>'.
"\n";
1151 $out .=
'</ul></div></dd>
1199 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 =
'')
1202 global $user, $conf, $langs, $hookmanager, $form;
1203 global $sortfield, $sortorder, $maxheightmini;
1204 global $dolibarr_main_url_root;
1206 if ($disablecrop == -1) {
1209 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'))) {
1215 if (empty($relativepath)) {
1217 if (!empty(
$object->element) &&
$object->element ==
'invoice_supplier') {
1220 if (!empty(
$object->element) &&
$object->element ==
'project_task') {
1221 $relativepath =
'Call_not_supported_._Call_function_using_a_defined_relative_path_.';
1225 if (
getDolGlobalInt(
'PRODUCT_USE_OLD_PATH_FOR_PHOTO') && isset($filearray[0]) && $filearray[0][
'level1name'] ==
'photos') {
1226 $relativepath = preg_replace(
'/^.*\/produit\//',
'', $filearray[0][
'path']).
'/';
1232 $relativedir = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $upload_dir);
1233 $relativedir = preg_replace(
'/^[\\/]/',
'', $relativedir);
1239 $hookmanager->initHooks(array(
'formfile'));
1240 $parameters = array(
1241 'filearray' => $filearray,
1242 'modulepart' => $modulepart,
1244 'forcedownload' => $forcedownload,
1245 'relativepath' => $relativepath,
1246 'relativedir' => $relativedir,
1247 'permtodelete' => $permonobject,
1248 'useinecm' => $useinecm,
1249 'textifempty' => $textifempty,
1250 'maxlength' => $maxlength,
1254 $reshook = $hookmanager->executeHooks(
'showFilesList', $parameters,
$object);
1256 if (!empty($reshook)) {
1259 if (!is_object($form)) {
1260 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
1261 $form =
new Form($this->db);
1264 if (!preg_match(
'/&id=/', $param) && isset(
$object->id)) {
1265 $param .=
'&id='.$object->id;
1267 $relativepathwihtoutslashend = preg_replace(
'/\/$/',
'', $relativepath);
1268 if ($relativepathwihtoutslashend) {
1269 $param .=
'&file='.urlencode($relativepathwihtoutslashend);
1272 if ($permtoeditline < 0) {
1273 $permtoeditline = 0;
1274 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1276 $permtoeditline = 1;
1279 $permtoeditline = 1;
1284 $permtoeditline = 0;
1289 if ((empty($useinecm) || $useinecm == 3 || $useinecm == 6) && $title !=
'none') {
1290 print
load_fiche_titre($title ? $title : $langs->trans(
"AttachedFiles"),
'',
'file-upload', 0,
'',
'table-list-of-attached-files');
1293 $url = $_SERVER[
"PHP_SELF"];
1296 print
'<!-- html.formfile::list_of_documents -->'.
"\n";
1297 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1298 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?'.$param.
'" method="POST">';
1299 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1300 print
'<input type="hidden" name="action" value="renamefile">';
1301 print
'<input type="hidden" name="id" value="'.(is_object(
$object) ?
$object->id :
'').
'">';
1302 print
'<input type="hidden" name="modulepart" value="'.$modulepart.
'">';
1305 print
'<div class="div-table-responsive-no-min"'.($moreattrondiv ?
' '.$moreattrondiv :
'').
'>';
1306 print
'<table id="tablelines" class="centpercent liste noborder nobottom">'.
"\n";
1308 if (!empty($addfilterfields)) {
1309 print
'<tr class="liste_titre nodrag nodrop">';
1310 print
'<td><input type="search_doc_ref" value="'.dol_escape_htmltag(
GETPOST(
'search_doc_ref',
'alpha')).
'"></td>';
1313 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1318 if (empty($disablemove) && count($filearray) > 1) {
1329 if ($sortfield && $sortorder) {
1334 print
'<tr class="liste_titre nodrag nodrop">';
1339 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1346 if (empty($disablemove) && count($filearray) > 1) {
1351 $nboffiles = count($filearray);
1352 if ($nboffiles > 0) {
1353 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
1359 foreach ($filearray as $key => $file) {
1360 if ($file[
'name'] !=
'.' && $file[
'name'] !=
'..' && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1361 if (array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) {
1362 $lastrowid = $filearray[$key][
'rowid'];
1368 if (empty($relativepath) || empty($modulepart)) {
1369 $filepath = $file[
'level1name'].
'/'.$file[
'name'];
1371 $filepath = $relativepath.$file[
'name'];
1373 if (empty($modulepart)) {
1374 $modulepart = basename(dirname($file[
'path']));
1376 if (empty($relativepath)) {
1377 $relativepath = preg_replace(
'/\/(.+)/',
'', $filepath) .
'/';
1382 print
'<!-- Line list_of_documents '.$key.
' relativepath = '.$relativepath.
' -->'.
"\n";
1385 print
'<!-- In database: position='.(array_key_exists(
'position', $filearray[$key]) ? $filearray[$key][
'position'] : 0).
' -->'.
"\n";
1386 print
'<tr class="oddeven" id="row-'.((array_key_exists(
'rowid', $filearray[$key]) && $filearray[$key][
'rowid'] > 0) ? $filearray[$key][
'rowid'] :
'AFTER'.$lastrowid.
'POS'.($i + 1)).
'">';
1390 print
'<td class="minwith200 tdoverflowmax500" title="'.dolPrintHTMLForAttribute($file[
'name']).
'">';
1394 print
'<a class="paddingright valignmiddle" ';
1396 print
'target="_blank" ';
1398 print
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.$modulepart;
1399 if ($forcedownload) {
1400 print
'&attachment=1';
1402 if (!empty(
$object->entity)) {
1403 print
'&entity='.$object->entity;
1405 print
'&file='.urlencode($filepath);
1407 print
img_mime($file[
'name'], $file[
'name'].
' ('.
dol_print_size($file[
'size'], 0, 0).
')',
'inline-block valignmiddle paddingright');
1408 if ($showrelpart == 1) {
1409 print $relativepath;
1415 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $file[
'name'] == basename(
GETPOST(
'urlfile',
'alpha')) && dirname($filepath) == dirname(
GETPOST(
'urlfile',
'alpha'))) {
1417 $section_dir = dirname(
GETPOST(
'urlfile',
'alpha'));
1418 if (!preg_match(
'/\/$/', $section_dir)) {
1419 $section_dir .=
'/';
1421 print
'<input type="hidden" name="section_dir" value="'.$section_dir.
'">';
1422 print
'<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file[
'name']).
'">';
1423 print
'<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file[
'name']).
'">';
1426 $filenametoshow = preg_replace(
'/\.noexe$/',
'', $file[
'name']);
1432 print $this->
showPreview($file, $modulepart, $filepath, 0,
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity));
1440 print
'<td class="right nowraponall">';
1441 if ($sizetoshow == $sizetoshowbytes) {
1444 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
1449 print
'<td class="center nowraponall">'.dol_print_date($file[
'date'],
"dayhour",
"tzuser").
'</td>';
1452 if (empty($useinecm) || $useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1453 $fileinfo = pathinfo($file[
'name']);
1454 print
'<td class="center">';
1456 if ($useinecm == 5 || $useinecm == 6) {
1470 $urlforhref =
getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo[
'filename'].
'.'.strtolower($fileinfo[
'extension']), 1,
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity));
1471 if (empty($urlforhref)) {
1472 $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']));
1473 print
'<a href="'.$urlforhref.
'" class="aphoto" target="_blank" rel="noopener noreferrer">';
1475 print
'<a href="'.$urlforhref[
'url'].
'" class="'.$urlforhref[
'css'].
'" target="'.$urlforhref[
'target'].
'" mime="'.$urlforhref[
'mime'].
'">';
1477 print
'<img class="photo maxwidth200 shadow valignmiddle"';
1478 if ($useinecm == 4 || $useinecm == 5 || $useinecm == 6) {
1479 print
' height="20"';
1482 print
' style="max-height: 24px"';
1484 print
' src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart='.urlencode($modulepart).
'&entity='.(empty(
$object->entity) ? $conf->entity :
$object->entity).
'&file='.urlencode($relativepath.$smallfile);
1485 if (!empty($filearray[$key][
'date'])) {
1486 print
'&cache='.urlencode((
string) $filearray[$key][
'date']);
1488 print
'" title="">';
1495 print
'<td class="center">';
1496 if ($relativedir && $filearray[$key][
'rowid'] > 0) {
1498 print
'<label for="idshareenabled'.$key.
'">'.$langs->trans(
"FileSharedViaALink").
'</label> ';
1499 print
'<input class="inline-block" type="checkbox" id="idshareenabled'.$key.
'" name="shareenabled"'.($file[
'share'] ?
' checked="checked"' :
'').
' /> ';
1501 if ($file[
'share']) {
1503 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
1504 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
1510 if (!empty($file[
'share'])) {
1511 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
1513 if ($forcedownload) {
1514 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
1517 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
1519 print
'<a href="'.$fulllink.
'" target="_blank" rel="noopener">'.
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
'</a> ';
1520 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).
'">';
1532 print
'<td class="valignmiddle right actionbuttons nowraponall"><!-- action on files -->';
1533 if ($useinecm == 1 || $useinecm == 5) {
1535 $newparam = preg_replace(
'/&file=.*$/',
'', $param);
1536 $backtopage = DOL_URL_ROOT.
'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam;
1537 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>';
1540 if (empty($useinecm) || $useinecm == 2 || $useinecm == 3 || $useinecm == 6) {
1541 $newmodulepart = $modulepart;
1542 if (in_array($modulepart, array(
'product',
'produit',
'service'))) {
1543 $newmodulepart =
'produit|service';
1546 if ($permtoeditline) {
1547 $moreparaminurl =
'';
1549 $moreparaminurl .=
'&id='.$object->id;
1550 } elseif (
GETPOST(
'website',
'alpha')) {
1551 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1554 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1555 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1558 if (!preg_match(
'/\.webp$/i', $file[
'name'])) {
1559 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1560 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>';
1561 } elseif ($modulepart ==
'medias' &&
GETPOST(
'website')) {
1562 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>';
1568 if ($permtoeditline) {
1570 $moreparaminurl =
'';
1572 $moreparaminurl .=
'&id='.$object->id;
1573 } elseif (
GETPOST(
'website',
'alpha')) {
1574 $moreparaminurl .=
'&website='.GETPOST(
'website',
'alpha');
1577 if ($modulepart ==
'medias' && !
GETPOST(
'website')) {
1578 $moreparaminurl .=
'&backtourl='.urlencode(DOL_URL_ROOT.
'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.
'§ion_dir='.$relativepath);
1581 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>';
1585 if ($permtoeditline) {
1586 $paramsectiondir = (in_array($modulepart, array(
'medias',
'ecm')) ?
'§ion_dir='.urlencode($relativepath) :
'');
1587 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>';
1591 if ($permonobject) {
1593 if (!empty($conf->dol_use_jmobile)) {
1596 if (empty($conf->use_javascript_ajax)) {
1602 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>';
1606 if (empty($disablemove) && count($filearray) > 1) {
1607 if ($nboffiles > 1 && $conf->browser->layout !=
'phone') {
1608 print
'<td class="linecolmove tdlineupdown center">';
1610 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=up&rowid='.
$object->id.
'">'.
img_up(
'default', 0,
'imgupforline').
'</a>';
1612 if ($i < ($nboffiles - 1)) {
1613 print
'<a class="lineupdown" href="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=down&rowid='.
$object->id.
'">'.
img_down(
'default', 0,
'imgdownforline').
'</a>';
1617 print
'<td'.(($conf->browser->layout !=
'phone') ?
' class="linecolmove tdlineupdown center"' :
' class="linecolmove center"').
'>';
1622 print
'<td class="right">';
1623 print
'<input type="hidden" name="ecmfileid" value="'.(empty($filearray[$key][
'rowid']) ?
'' : $filearray[$key][
'rowid']).
'">';
1624 print
'<input type="submit" class="button button-save smallpaddingimp" name="renamefilesave" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
1625 print
'<input type="submit" class="button button-cancel smallpaddingimp" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
1627 if (empty($disablemove) && count($filearray) > 1) {
1628 print
'<td class="right"></td>';
1636 if ($nboffiles == 0) {
1638 if (empty($disablemove) && count($filearray) > 1) {
1641 print
'<tr class="oddeven"><td colspan="'.$colspan.
'">';
1642 if (empty($textifempty)) {
1643 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
1645 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
1653 if ($nboflines > 1 && is_object(
$object)) {
1654 if (!empty($conf->use_javascript_ajax) && $permtoeditline) {
1655 $table_element_line =
'ecm_files';
1656 include DOL_DOCUMENT_ROOT.
'/core/tpl/ajaxrow.tpl.php';
1662 if (
GETPOST(
'action',
'aZ09') ==
'editfile' && $permtoeditline) {
1690 public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath =
'', $permissiontodelete = 1, $useinecm = 0, $textifempty =
'', $maxlength = 0, $url =
'', $addfilterfields = 0)
1693 global $conf, $langs, $hookmanager, $form;
1694 global $sortfield, $sortorder;
1695 global $search_doc_ref;
1696 global $dolibarr_main_url_root;
1698 dol_syslog(get_class($this).
'::list_of_autoecmfiles upload_dir='.$upload_dir.
' modulepart='.$modulepart);
1701 if (empty($useinecm) || $useinecm == 6) {
1705 $url = $_SERVER[
"PHP_SELF"];
1708 if (!empty($addfilterfields)) {
1709 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'">';
1710 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1711 print
'<input type="hidden" name="module" value="'.$modulepart.
'">';
1714 print
'<div class="div-table-responsive-no-min">';
1715 print
'<table width="100%" class="noborder">'.
"\n";
1717 if (!empty($addfilterfields)) {
1718 print
'<tr class="liste_titre nodrag nodrop">';
1719 print
'<td class="liste_titre"></td>';
1720 print
'<td class="liste_titre"><input type="text" class="maxwidth100onsmartphone" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).
'"></td>';
1721 print
'<td class="liste_titre"></td>';
1722 print
'<td class="liste_titre"></td>';
1724 print
'<td class="liste_titre right">';
1725 $searchpicto = $form->showFilterButtons();
1731 print
'<tr class="liste_titre">';
1732 $sortref =
"fullname";
1733 if ($modulepart ==
'invoice_supplier') {
1734 $sortref =
'level1name';
1744 $object_instance =
null;
1745 if ($modulepart ==
'company') {
1746 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
1747 $object_instance =
new Societe($this->db);
1748 } elseif ($modulepart ==
'invoice') {
1749 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
1750 $object_instance =
new Facture($this->db);
1751 } elseif ($modulepart ==
'invoice_supplier') {
1752 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
1754 } elseif ($modulepart ==
'propal') {
1755 include_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
1756 $object_instance =
new Propal($this->db);
1757 } elseif ($modulepart ==
'supplier_proposal') {
1758 include_once DOL_DOCUMENT_ROOT.
'/supplier_proposal/class/supplier_proposal.class.php';
1760 } elseif ($modulepart ==
'order') {
1761 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
1762 $object_instance =
new Commande($this->db);
1763 } elseif ($modulepart ==
'order_supplier') {
1764 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
1766 } elseif ($modulepart ==
'contract') {
1767 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
1768 $object_instance =
new Contrat($this->db);
1769 } elseif ($modulepart ==
'product') {
1770 include_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
1771 $object_instance =
new Product($this->db);
1772 } elseif ($modulepart ==
'tax') {
1773 include_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
1775 } elseif ($modulepart ==
'tax-vat') {
1776 include_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
1777 $object_instance =
new Tva($this->db);
1778 } elseif ($modulepart ==
'salaries') {
1779 include_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
1780 $object_instance =
new Salary($this->db);
1781 } elseif ($modulepart ==
'project') {
1782 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
1783 $object_instance =
new Project($this->db);
1784 } elseif ($modulepart ==
'project_task') {
1785 include_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
1786 $object_instance =
new Task($this->db);
1787 } elseif ($modulepart ==
'fichinter') {
1788 include_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
1789 $object_instance =
new Fichinter($this->db);
1790 } elseif ($modulepart ==
'user') {
1791 include_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
1792 $object_instance =
new User($this->db);
1793 } elseif ($modulepart ==
'expensereport') {
1794 include_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
1796 } elseif ($modulepart ==
'holiday') {
1797 include_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
1798 $object_instance =
new Holiday($this->db);
1799 } elseif ($modulepart ==
'recruitment-recruitmentcandidature') {
1800 include_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
1802 } elseif ($modulepart ==
'banque') {
1803 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1804 $object_instance =
new Account($this->db);
1805 } elseif ($modulepart ==
'chequereceipt') {
1806 include_once DOL_DOCUMENT_ROOT.
'/compta/paiement/cheque/class/remisecheque.class.php';
1808 } elseif ($modulepart ==
'mrp-mo') {
1809 include_once DOL_DOCUMENT_ROOT.
'/mrp/class/mo.class.php';
1810 $object_instance =
new Mo($this->db);
1812 $parameters = array(
'modulepart' => $modulepart);
1813 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1814 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1815 if (array_key_exists(
'classpath', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classpath'])) {
1817 if (array_key_exists(
'classname', $hookmanager->resArray) && !empty($hookmanager->resArray[
'classname'])) {
1818 if (class_exists($hookmanager->resArray[
'classname'])) {
1819 $tmpclassname = $hookmanager->resArray[
'classname'];
1820 $object_instance =
new $tmpclassname($this->db);
1831 $relativepathfromroot = preg_replace(
'/'.preg_quote(DOL_DATA_ROOT.
'/',
'/').
'/',
'', $upload_dir);
1832 if ($relativepathfromroot) {
1836 if ($sortfield && $sortorder) {
1837 $filearray =
dol_sort_array($filearray, $sortfield, $sortorder, 1);
1843 foreach ($filearray as $key => $file) {
1844 if (!is_dir($file[
'name'])
1845 && $file[
'name'] !=
'.'
1846 && $file[
'name'] !=
'..'
1847 && $file[
'name'] !=
'CVS'
1848 && !preg_match(
'/\.meta$/i', $file[
'name'])) {
1850 $relativefile = preg_replace(
'/'.preg_quote($upload_dir.
'/',
'/').
'/',
'', $file[
'fullname']);
1858 if ($modulepart ==
'company' || $modulepart ==
'tax' || $modulepart ==
'tax-vat' || $modulepart ==
'salaries') {
1859 preg_match(
'/(\d+)\/[^\/]+$/', $relativefile, $reg);
1860 $id = (isset($reg[1]) ? $reg[1] :
'');
1861 } elseif ($modulepart ==
'invoice_supplier') {
1862 preg_match(
'/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
1863 $ref = (isset($reg[1]) ? $reg[1] :
'');
1864 if (is_numeric($ref)) {
1868 } elseif ($modulepart ==
'user') {
1870 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1871 $id = (isset($reg[1]) ? $reg[1] :
'');
1872 } elseif ($modulepart ==
'project_task') {
1874 $reg = explode(
"/", $relativefile);
1875 $ref = (isset($reg[1]) ? $reg[1] :
'');
1876 } elseif (in_array($modulepart, array(
1879 'supplier_proposal',
1888 'recruitment-recruitmentcandidature',
1893 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg);
1894 $ref = (isset($reg[1]) ? $reg[1] :
'');
1896 $parameters = array(
'modulepart' => $modulepart,
'fileinfo' => $file);
1897 $reshook = $hookmanager->executeHooks(
'addSectionECMAuto', $parameters);
1898 if ($reshook > 0 && is_array($hookmanager->resArray) && count($hookmanager->resArray) > 0) {
1899 if (array_key_exists(
'ref', $hookmanager->resArray) && !empty($hookmanager->resArray[
'ref'])) {
1900 $ref = $hookmanager->resArray[
'ref'];
1902 if (array_key_exists(
'id', $hookmanager->resArray) && !empty($hookmanager->resArray[
'id'])) {
1903 $id = $hookmanager->resArray[
'id'];
1909 if (!$id && !$ref) {
1914 if (!empty($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1920 if (is_object($object_instance)) {
1921 $object_instance->id = 0;
1922 $object_instance->ref =
'';
1924 $result = $object_instance->fetch($id);
1926 if (!($result = $object_instance->fetch(
'', $ref))) {
1932 $result = $object_instance->fetchOneLike($ref);
1939 $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref] = clone $object_instance;
1943 $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref] =
'notfound';
1944 unset($filearray[$key]);
1948 if ($found <= 0 || !is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1952 print
'<!-- Line list_of_autoecmfiles key='.$key.
' -->'.
"\n";
1953 print
'<tr class="oddeven">';
1955 if ($found > 0 && is_object($conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref])) {
1956 $tmpobject = $conf->cache[
'modulepartobject'][$modulepart.
'_'.$id.
'_'.$ref];
1958 print $tmpobject->getNomUrl(1,
'document');
1963 print $langs->trans(
"ObjectDeleted", ($id ? $id : $ref));
1981 print
'target="_blank" ';
1983 print
'href="'.DOL_URL_ROOT.
'/document.php?modulepart='.urlencode($modulepart);
1984 if ($forcedownload) {
1985 print
'&attachment=1';
1987 print
'&file='.urlencode($relativefile).
'">';
1994 print $this->
showPreview($file, $modulepart, $file[
'relativename']);
2001 print
'<td class="right nowraponall">';
2002 if ($sizetoshow == $sizetoshowbytes) {
2005 print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
2010 print
'<td class="center">'.dol_print_date($file[
'date'],
"dayhour").
'</td>';
2013 print
'<td class="right">';
2014 if (!empty($file[
'share'])) {
2016 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
2017 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
2023 if (!empty($file[
'share'])) {
2024 $paramlink .= ($paramlink ?
'&' :
'').
'hashp='.$file[
'share'];
2026 if ($forcedownload) {
2027 $paramlink .= ($paramlink ?
'&' :
'').
'attachment=1';
2030 $fulllink = $urlwithroot.
'/document.php'.($paramlink ?
'?'.$paramlink :
'');
2032 print
img_picto($langs->trans(
"FileSharedViaALink"),
'globe').
' ';
2033 print
'<input type="text" class="quatrevingtpercent width100 nopadding nopadding small" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).
'">';
2047 if (count($filearray) == 0) {
2048 print
'<tr class="oddeven"><td colspan="5">';
2049 if (empty($textifempty)) {
2050 print
'<span class="opacitymedium">'.$langs->trans(
"NoFileFound").
'</span>';
2052 print
'<span class="opacitymedium">'.$textifempty.
'</span>';
2059 if (!empty($addfilterfields)) {
2062 return count($filearray);
2076 public function listOfLinks(
$object, $permissiontodelete = 1, $action =
null, $selected =
null, $param =
'')
2078 global $user, $conf, $langs, $user;
2079 global $sortfield, $sortorder;
2081 $langs->load(
"link");
2083 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
2084 $link =
new Link($this->db);
2086 if ($sortfield ==
"name") {
2087 $sortfield =
"label";
2088 } elseif ($sortfield ==
"date") {
2089 $sortfield =
"datea";
2093 $res = $link->fetchAll($links,
$object->element,
$object->id, $sortfield, $sortorder);
2094 $param .= (isset(
$object->id) ?
'&id='.$object->id :
'');
2096 print
'<!-- listOfLinks -->'.
"\n";
2099 print
load_fiche_titre($langs->trans(
"LinkedFiles"),
'',
'link', 0,
'',
'table-list-of-links');
2101 print
'<form action="'.$_SERVER[
'PHP_SELF'].($param ?
'?'.$param :
'').
'" method="POST">';
2102 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2104 print
'<table class="liste noborder nobottom centpercent">';
2105 print
'<tr class="liste_titre">';
2107 $langs->trans(
"Links"),
2108 $_SERVER[
'PHP_SELF'],
2129 $langs->trans(
"Date"),
2130 $_SERVER[
'PHP_SELF'],
2141 $_SERVER[
'PHP_SELF'],
2152 $nboflinks = count($links);
2153 if ($nboflinks > 0) {
2154 include_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
2157 foreach ($links as $link) {
2158 print
'<tr class="oddeven">';
2160 if ($action ==
'update' && $selected === $link->id) {
2162 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
2163 print
'<input type="hidden" name="linkid" value="'.$link->id.
'">';
2164 print
'<input type="hidden" name="action" value="confirm_updateline">';
2165 print $langs->trans(
'Link').
': <input type="text" name="link" value="'.$link->url.
'">';
2168 print $langs->trans(
'Label').
': <input type="text" name="label" value="'.
dol_escape_htmltag($link->label).
'">';
2170 print
'<td class="center">'.dol_print_date(
dol_now(),
"dayhour",
"tzuser").
'</td>';
2171 print
'<td class="right"></td>';
2172 print
'<td class="right">';
2173 print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
2174 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
2179 print
'<a data-ajax="false" href="'.$link->url.
'" target="_blank" rel="noopener noreferrer">';
2183 print
'<td class="right"></td>';
2184 print
'<td class="center">'.dol_print_date($link->datea,
"dayhour",
"tzuser").
'</td>';
2185 print
'<td class="center"></td>';
2186 print
'<td class="right">';
2187 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=update&linkid='.$link->id.$param.
'&token='.
newToken().
'" class="editfilelink editfielda reposition" >'.
img_edit().
'</a>';
2188 if ($permissiontodelete) {
2189 print
' <a class="deletefilelink reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=deletelink&token='.
newToken().
'&linkid='.((int) $link->id).$param.
'">'.
img_delete().
'</a>';
2197 if ($nboflinks == 0) {
2198 print
'<tr class="oddeven"><td colspan="5">';
2199 print
'<span class="opacitymedium">'.$langs->trans(
"NoLinkFound").
'</span>';
2220 public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param =
'')
2222 global $langs, $conf;
2225 if ($conf->browser->layout !=
'phone' && !empty($conf->use_javascript_ajax)) {
2227 if (count($urladvancedpreview)) {
2228 $out .=
'<a class="pictopreview '.$urladvancedpreview[
'css'].
'" href="'.$urladvancedpreview[
'url'].
'"'.(empty($urladvancedpreview[
'mime']) ?
'' :
' mime="'.$urladvancedpreview[
'mime'].
'"').
' '.(empty($urladvancedpreview[
'target']) ?
'' :
' target="'.$urladvancedpreview[
'target'].
'"').
'>';
2230 if (empty($ruleforpicto)) {
2232 $out .=
'<span class="fa fa-search-plus pictofixedwidth" style="color: gray"></span>';
2234 $out .=
img_mime($relativepath, $langs->trans(
'Preview').
' '.$file[
'name'],
'pictofixedwidth');
2238 if ($ruleforpicto < 0) {
2239 $out .=
img_picto(
'',
'generic',
'',
false, 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 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.
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.
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.
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_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 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.