46function dolPrintLabel($s, $escapeonlyhtmltags = 0)
60function dolPrintText($s)
77function dolPrintHTML($s, $allowiframe = 0, $moreallowedtags = array())
86 $allowedtags =
'common';
87 if (!empty($moreallowedtags)) {
88 $allowedtags .=
','.implode(
',', $moreallowedtags);
90 return dol_escape_htmltag(
dol_htmlwithnojs(
dol_string_onlythesehtmltags($stringWithEntitesForSpecialChar, 1, 1, 1, $allowiframe, $allowedtags)), 1, 1, $allowedtags, 0, 1);
104function dolPrintHTMLForAttribute($s, $escapeonlyhtmltags = 0, $allowothertags = array())
106 $allowedtags = array(
'br',
'b',
'font',
'hr',
'span');
107 if (!empty($allowothertags) && is_array($allowothertags)) {
108 $allowedtags = array_merge($allowedtags, $allowothertags);
112 if ($escapeonlyhtmltags) {
113 return dol_escape_htmltag(
dol_string_onlythesehtmltags($s, 1, 0, 0, 0, $allowedtags), 1, -1,
'', 1, 1);
115 return dol_escape_htmltag(
dol_string_onlythesehtmltags(
dol_htmlentitiesbr($s), 1, 0, 0, 0, $allowedtags), 1, -1,
'', 0, 1);
128function dolPrintHTMLForAttributeUrl($s)
132 $escapeonlyhtmltags = 1;
133 return dol_escape_htmltag(
dol_string_onlythesehtmltags($s, 1, 1, 1, 0, array()), 0, 0,
'', $escapeonlyhtmltags, 1);
148function dolPrintHTMLForTextArea($s, $allowiframe = 0)
160function dolPrintPassword($s)
162 return htmlspecialchars($s, ENT_HTML5,
'UTF-8');
183function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapetags =
'', $escapeonlyhtmltags = 0, $cleanalsojavascript = 0)
185 if ($stringtoescape ===
null) {
189 if (preg_match(
'/^common([a-z,]*)/', $noescapetags, $reg)) {
190 $noescapetags =
'html,body,a,b,em,hr,i,u,ul,ol,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody,h1,h2,h3,h4,h5,h6,h7,h8,h9';
192 $noescapetags .=
',header,footer,nav,section,menu,menuitem';
193 if (!empty($reg[1])) {
194 $noescapetags .= $reg[1];
197 if ($cleanalsojavascript) {
202 if ($escapeonlyhtmltags) {
203 $tmp = htmlspecialchars_decode((
string) $stringtoescape, ENT_COMPAT);
210 $tmp = (string) $stringtoescape;
213 $tmp = str_ireplace(
'<',
'__DONOTDECODELT', $tmp);
214 $tmp = str_ireplace(
'>',
'__DONOTDECODEGT', $tmp);
215 $tmp = str_ireplace(
'&',
'__DONOTDECODEAMP', $tmp);
216 $tmp = str_ireplace(
'"',
'__DONOTDECODEQUOT', $tmp);
217 $tmp = str_ireplace(
'&apos',
'__DONOTDECODEAPOS', $tmp);
218 $tmp = str_ireplace(
''',
'__DONOTDECODE39', $tmp);
220 $tmp = html_entity_decode((
string) $tmp, ENT_COMPAT,
'UTF-8');
223 $tmp = str_ireplace(
'__DONOTDECODELT',
'<', $tmp);
224 $tmp = str_ireplace(
'__DONOTDECODEGT',
'>', $tmp);
225 $tmp = str_ireplace(
'__DONOTDECODEAMP',
'&', $tmp);
226 $tmp = str_ireplace(
'__DONOTDECODEQUOT',
'"', $tmp);
227 $tmp = str_ireplace(
'__DONOTDECODEAPOS',
'&apos', $tmp);
228 $tmp = str_ireplace(
'__DONOTDECODE39',
''', $tmp);
230 $tmp = str_ireplace(
''',
'__SIMPLEQUOTE__', $tmp);
233 $tmp = strtr($tmp, array(
"<b>" =>
'',
'</b>' =>
'',
'<strong>' =>
'',
'</strong>' =>
''));
236 $tmp = strtr($tmp, array(
"\r" =>
'\\r',
"\n" =>
'\\n'));
237 } elseif ($keepn == -1) {
238 $tmp = strtr($tmp, array(
"\r" =>
'',
"\n" =>
''));
241 if ($escapeonlyhtmltags) {
242 $tmp = htmlspecialchars($tmp, ENT_COMPAT,
'UTF-8');
246 $tmparrayoftags = array();
247 $tmparrayoftagsfound = array();
249 $tmparrayoftags = explode(
',', $noescapetags);
252 if (count($tmparrayoftags)) {
257 $tmp = str_ireplace(array(
'__DOUBLEQUOTE',
'__BEGINTAGTOREPLACE',
'__ENDTAGTOREPLACE',
'__BEGINENDTAGTOREPLACE'),
'', $tmp);
259 foreach ($tmparrayoftags as $tagtoreplace) {
262 if (stripos($tmp,
'<' . $tagtoreplace) ===
false && stripos($tmp,
'</' . $tagtoreplace) ===
false) {
265 $tmparrayoftagsfound[] = $tagtoreplace;
268 $tmp = preg_replace(
'/<' . preg_quote($tagtoreplace,
'/') .
'>/',
'__BEGINTAGTOREPLACE' . $tagtoreplace .
'__', $tmp);
269 $tmp = str_ireplace(
'</' . $tagtoreplace .
'>',
'__ENDTAGTOREPLACE' . $tagtoreplace .
'__', $tmp);
270 $tmp = preg_replace(
'/<' . preg_quote($tagtoreplace,
'/') .
' \/>/',
'__BEGINENDTAGTOREPLACE' . $tagtoreplace .
'__', $tmp);
276 $tmp = preg_replace_callback(
277 '/<'.preg_quote($tagtoreplace,
'/').
'(\s+)([^>]+)>/',
282 static function ($reg) use ($tagtoreplace) {
284 $tmpattributes = str_ireplace(array(
'[',
']'),
'_', $reg[2]);
285 $tmpattributes = str_ireplace(
'"',
'__DOUBLEQUOTE__', $tmpattributes);
286 $tmpattributes = preg_replace(
'/[^a-z0-9_%,\/\?\;\s=&\.\-@:\.#\+]/i',
'', $tmpattributes);
288 return '__BEGINTAGTOREPLACE'.$tagtoreplace.
'['.$tmpattributes.
']__';
294 $tmp = str_ireplace(
'&',
'__ANDNOSEMICOLON__', $tmp);
295 $tmp = str_ireplace(
'"',
'__DOUBLEQUOTENOSEMICOLON__', $tmp);
296 $tmp = str_ireplace(
'<',
'__LESSTHAN__', $tmp);
297 $tmp = str_ireplace(
'>',
'__GREATERTHAN__', $tmp);
301 $result = htmlentities($tmp, ENT_COMPAT,
'UTF-8');
305 if (count($tmparrayoftags)) {
307 foreach ($tmparrayoftagsfound as $tagtoreplace) {
308 $result = str_ireplace(
'__BEGINTAGTOREPLACE' . $tagtoreplace .
'__',
'<' . $tagtoreplace .
'>', $result);
309 $result = preg_replace(
'/__BEGINTAGTOREPLACE' . $tagtoreplace .
'\[([^\]]*)\]__/',
'<' . $tagtoreplace .
' \1>', $result);
310 $result = str_ireplace(
'__ENDTAGTOREPLACE' . $tagtoreplace .
'__',
'</' . $tagtoreplace .
'>', $result);
311 $result = str_ireplace(
'__BEGINENDTAGTOREPLACE' . $tagtoreplace .
'__',
'<' . $tagtoreplace .
' />', $result);
312 $result = preg_replace(
'/__BEGINENDTAGTOREPLACE' . $tagtoreplace .
'\[([^\]]*)\]__/',
'<' . $tagtoreplace .
' \1 />', $result);
315 $result = str_ireplace(
'__DOUBLEQUOTE__',
'"', $result);
317 $result = str_ireplace(
'__ANDNOSEMICOLON__',
'&', $result);
318 $result = str_ireplace(
'__DOUBLEQUOTENOSEMICOLON__',
'"', $result);
319 $result = str_ireplace(
'__LESSTHAN__',
'<', $result);
320 $result = str_ireplace(
'__GREATERTHAN__',
'>', $result);
323 $result = str_ireplace(
'__SIMPLEQUOTE__',
''', $result);
347 $form =
new Form($db);
349 $templatenameforexport = $website->name_template;
350 if (empty($templatenameforexport)) {
351 $templatenameforexport =
'website_' . $website->ref;
355 $out .=
'<input type="button" class="cursorpointer button bordertransp" id="open-dialog-' . $name .
'" value="' .
dol_escape_htmltag($buttonstring) .
'"/>';
358 $out .=
'<script nonce="' .
getNonce() .
'" type="text/javascript">';
359 $out .=
'jQuery(document).ready(function () {';
360 $out .=
' jQuery("#open-dialog-' . $name .
'").click(function () {';
361 $out .=
' var dialogHtml = \'';
363 $dialogcontent =
' <div id="custom-dialog-' . $name .
'">';
364 $dialogcontent .=
' <div style="margin-top: 20px;">';
365 $dialogcontent .=
' <label for="export-site-' . $name .
'"><strong>' . $langs->trans(
"ExportSiteLabel") .
'...</label><br>';
366 $dialogcontent .=
' <button class="button smallpaddingimp" id="export-site-' . $name .
'">' .
dol_escape_htmltag($langs->trans(
"DownloadZip")) .
'</button>';
367 $dialogcontent .=
' </div>';
368 $dialogcontent .=
' <br>';
369 $dialogcontent .=
' <div style="margin-top: 20px;">';
370 $dialogcontent .=
' <strong>' . $langs->trans(
"ExportSiteGitLabel") .
' ' . $form->textwithpicto(
'', $langs->trans(
"SourceFiles"), 1,
'help',
'', 0, 3,
'') .
'</strong><br>';
371 $dialogcontent .=
' <form action="' .
dol_escape_htmltag($overwriteGitUrl) .
'" method="POST">';
372 $dialogcontent .=
' <input type="hidden" name="action" value="overwritesite">';
373 $dialogcontent .=
' <input type="hidden" name="token" value="' .
newToken() .
'">';
374 $dialogcontent .=
' <input type="text" autofocus name="export_path" id="export-path-' . $name .
'" placeholder="' . $langs->trans(
'ExportPath') .
'" style="width:400px " value="' .
dol_escape_htmltag($templatenameforexport) .
'"/><br>';
375 $dialogcontent .=
' <button type="submit" class="button smallpaddingimp" id="overwrite-git-' . $name .
'">' .
dol_escape_htmltag($langs->trans(
"ExportIntoGIT")) .
'</button>';
376 $dialogcontent .=
' </form>';
377 $dialogcontent .=
' </div>';
378 $dialogcontent .=
' </div>';
385 // Add the content of the dialog to the body of the page
386 $out .= ' var $dialog = jQuery(
"#custom-dialog-' . $name . '");
';
387 $out .= ' if ($dialog.length > 0) {
390 jQuery(
"body").append(dialogHtml);
';
392 // Configuration of popup
393 $out .= ' jQuery(
"#custom-dialog-' . $name . '").dialog({
';
394 $out .= ' autoOpen:
false,
';
395 $out .= ' modal:
true,
';
396 $out .= ' height: 290,
';
397 $out .= ' width:
"40%",
';
401 // Simulate a click on the original "submit" input to export the site.
402 $out .= ' jQuery(
"#export-site-' . $name . '").click(
function () {
';
403 $out .= ' console.log(
"Click on exportsite.");
';
404 $out .= ' var target = jQuery(
"input[name=\'' . dol_escape_js($exportSiteName) . '\']");
';
405 $out .= ' console.log(
"element founded:", target.length > 0);
';
406 $out .= ' if (target.length > 0) { target.click(); }
';
407 $out .= ' jQuery(
"#custom-dialog-' . $name . '").dialog(
"close");
';
411 $out .= ' jQuery(
"#custom-dialog-' . $name . '").dialog(
"open");
';
412 $out .= ' return false;
';
437function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '
', $morecss = 'classlink
button bordertransp
', $jsonopen = '', $jsonclose = '', $accesskey = '')
441 if (strpos($url, '?
') > 0) {
442 $url .= '&dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup=
' . urlencode($name);
444 $url .= '?dol_hide_topmenu=1&dol_hide_leftmenu=1&dol_openinpopup=
' . urlencode($name);
447 if (preg_match('/^https/i
', $url)) {
450 $urltoopen = DOL_URL_ROOT . $url;
455 //print '<input
type=
"submit" class=
"button bordertransp"'.$disabled.' value=
"'.dol_escape_htmltag($langs->trans("MediaFiles
")).'" name=
"file_manager">
';
456 $out .= '<!-- a link
for button to open url into a dialog popup -->
';
457 $out .= '<a
' . ($accesskey ? ' accesskey=
"' . $accesskey . '"' : '') . ' class=
"cursorpointer reposition button_' . $name . ($morecss ? ' ' . $morecss : '') . '"' . $disabled . ' title=
"' . dol_escape_htmltag($label) . '"';
458 if (empty($conf->use_javascript_ajax)) {
459 $out .= ' href=
"' . $urltoopen . '" target=
"_blank"';
460 } elseif ($jsonopen) {
461 $out .= ' href=
"#" onclick=
"' . $jsonopen . '"';
465 $out .= '>
' . $buttonstring . '</a>
';
467 if (!empty($conf->use_javascript_ajax)) {
468 // Add code to open url using the popup.
469 $out .= '<!-- code to open popup and variables to retrieve returned variables -->
';
470 $out .= '<div
id=
"idfordialog' . $name . '" class=
"hidden">
' . (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER
') < 2 ? 'div
for dialog
' : '') . '</div>
';
472 $out .= '<!-- Add js code to open dialog popup on dialog -->
';
473 $out .= '<script nonce=
"' . getNonce() . '" type=
"text/javascript">
474 jQuery(document).ready(
function () {
475 jQuery(
".button_' . $name . '").click(
function () {
476 console.log(\
'Open popup with jQuery(...).dialog() on URL ' .
dol_escape_js($urltoopen) .
'\');
477 var $tmpdialog = $(\
'#idfordialog' . $name .
'\');
478 $tmpdialog.html(\
'<iframe class="iframedialog" id="iframedialog' . $name .
'" style="border: 0px;" src="' . $urltoopen .
'" width="100%" height="98%"></iframe>\');
482 height: (window.innerHeight - 150),
485 open:
function (event, ui) {
486 console.log(
"open popup name=' . $name . '");
488 close:
function (event, ui) {
489 console.log(
"Popup is closed, run jsonclose = ' . $jsonclose . '");
490 ' . (empty($jsonclose) || preg_match('/^TODO/
', $jsonclose) ? '' : $jsonclose . ';
') . '
494 $tmpdialog.dialog(\
'open\');
520function dol_fiche_head($links = array(), $active =
'0', $title =
'', $notab = 0, $picto =
'', $pictoisfullpath = 0, $morehtmlright =
'', $morecss =
'', $limittoshow = 0, $moretabssuffix =
'')
522 print
dol_get_fiche_head($links, $active, $title, $notab, $picto, $pictoisfullpath, $morehtmlright, $morecss, $limittoshow, $moretabssuffix);
542function dol_get_fiche_head($links = array(), $active =
'', $title =
'', $notab = 0, $picto =
'', $pictoisfullpath = 0, $morehtmlright =
'', $morecss =
'', $limittoshow = 0, $moretabssuffix =
'', $dragdropfile = 0, $morecssdiv =
'')
544 global
$conf, $langs, $hookmanager;
548 if (!empty(
$conf->dol_optimize_smallscreen)) {
552 $out =
"\n" .
'<!-- dol_fiche_head - dol_get_fiche_head -->';
554 if ((!empty($title) && $showtitle) || $morehtmlright || !empty($links)) {
555 $out .=
'<div class="tabs' . ($picto ?
'' :
' nopaddingleft') .
'" data-role="controlgroup" data-type="horizontal">' .
"\n";
559 if ($morehtmlright) {
560 $out .=
'<div class="inline-block floatright tabsElem">' . $morehtmlright .
'</div>';
567 if (is_array($links) && !empty($links)) {
568 $keys = array_keys($links);
570 $maxkey = max($keys);
575 if (empty($limittoshow)) {
578 if (!empty(
$conf->dol_optimize_smallscreen)) {
586 for ($i = 0; $i <= $maxkey; $i++) {
587 if ((is_numeric($active) && $i == $active) || (!empty($links[$i][2]) && !is_numeric($active) && $active == $links[$i][2])) {
589 if ($i >= $limittoshow) {
595 for ($i = 0; $i <= $maxkey; $i++) {
596 if ((is_numeric($active) && $i == $active) || (!empty($links[$i][2]) && !is_numeric($active) && $active == $links[$i][2])) {
602 if ($i < $limittoshow || $isactive) {
604 $out .=
'<div class="inline-block tabsElem' . ($isactive ?
' tabsElemActive' :
'') . ((!$isactive &&
getDolGlobalString(
'MAIN_HIDE_INACTIVETAB_ON_PRINT')) ?
' hideonprint' :
'') .
'"><!-- id tab = ' . (empty($links[$i][2]) ?
'' :
dol_escape_htmltag($links[$i][2])) .
' -->';
606 if (isset($links[$i][2]) && $links[$i][2] ==
'image') {
607 if (!empty($links[$i][0])) {
608 $out .=
'<a class="tabimage' . ($morecss ?
' ' . $morecss :
'') .
'" href="' . $links[$i][0] .
'">' . $links[$i][1] .
'</a>' .
"\n";
610 $out .=
'<span class="tabspan">' . $links[$i][1] .
'</span>' .
"\n";
612 } elseif (!empty($links[$i][1])) {
614 $out .=
'<div class="tab tab' . ($isactive ?
'active' :
'unactive') .
'" style="margin: 0 !important">';
616 if (!empty($links[$i][0])) {
617 $titletoshow = preg_replace(
'/<.*$/',
'', $links[$i][1]);
618 $out .=
'<a' . (!empty($links[$i][2]) ?
' id="' . $links[$i][2] .
'"' :
'') .
' class="tab inline-block valignmiddle' . ($morecss ?
' ' . $morecss :
'') . (!empty($links[$i][5]) ?
' ' . $links[$i][5] :
'') .
'" href="' . $links[$i][0] .
'" title="' .
dol_escape_htmltag($titletoshow) .
'">';
621 if ($displaytab == 0 && $picto) {
622 $out .= img_picto($title, $picto,
'', $pictoisfullpath, 0, 0,
'',
'imgTabTitle paddingright marginrightonlyshort');
625 $out .= $links[$i][1];
626 if (!empty($links[$i][0])) {
627 $out .=
'</a>' .
"\n";
629 $out .= empty($links[$i][4]) ?
'' : $links[$i][4];
638 $outmore .=
'<div class="popuptabset wordwrap">';
640 $outmore_content =
'';
642 if (isset($links[$i][2]) && $links[$i][2] ==
'image') {
643 if (!empty($links[$i][0])) {
644 $outmore_content .=
'<a class="tabimage' . ($morecss ?
' ' . $morecss :
'') .
'" href="' . $links[$i][0] .
'">' . $links[$i][1] .
'</a>' .
"\n";
646 $outmore_content .=
'<span class="tabspan">' . $links[$i][1] .
'</span>' .
"\n";
648 } elseif (!empty($links[$i][1])) {
649 $outmore_content .=
'<a' . (!empty($links[$i][2]) ?
' id="' . $links[$i][2] .
'"' :
'') .
' class="wordwrap inline-block' . ($morecss ?
' ' . $morecss :
'') .
'" href="' . $links[$i][0] .
'">';
650 $outmore_content .= preg_replace(
'/([a-z])\|([a-z])/i',
'\\1 | \\2', $links[$i][1]);
651 $outmore_content .=
'</a>' .
"\n";
653 if ($outmore_content !==
'') {
654 $outmore .=
'<div class="popuptab wordwrap" style="display:inherit;">' . $outmore_content .
'</div>';
660 $displaytab = $i + 1;
663 $outmore .=
'</div>';
667 $left = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'right' :
'left');
668 $right = ($langs->trans(
"DIRECTION") ==
'rtl' ?
'left' :
'right');
671 $tabsname = $moretabssuffix;
672 if (empty($tabsname)) {
673 $tabsname = str_replace(
"@",
"", $picto);
675 $out .=
'<div id="moretabs' . $tabsname .
'" class="inline-block tabsElem valignmiddle">';
677 $out .=
'<div class="tab valignmiddle"><a href="#" class="tab moretab inline-block tabunactive valignmiddle"><span class="fa fa-angle-down"></span> <span class="opacitymedium">+' . $nbintab .
'</span></a></div>';
679 $out .=
'<div id="moretabsList' . $tabsname .
'" style="width: ' . $widthofpopup .
'px; position: absolute; ' . $left .
': -999em; text-align: ' . $left .
'; margin:0px; padding:2px; z-index:10;">';
682 $out .=
'<div></div>';
685 $out .=
'<script nonce="' .
getNonce() .
'">';
686 $out .=
"$('#moretabs" . $tabsname .
"').mouseenter( function() {
687 var x = this.offsetLeft, y = this.offsetTop;
688 console.log('mouseenter " . $left .
" x='+x+' y='+y+' window.innerWidth='+window.innerWidth);
689 if ((window.innerWidth - x) < " . ($widthofpopup + 10) .
") {
690 $('#moretabsList" . $tabsname .
"').css('" . $right .
"','8px');
692 $('#moretabsList" . $tabsname .
"').css('" . $left .
"','auto');
695 $out .=
"$('#moretabs" . $tabsname .
"').mouseleave( function() { console.log('mouseleave " . $left .
"'); $('#moretabsList" . $tabsname .
"').css('" . $left .
"','-999em');});";
699 if ((!empty($title) && $showtitle) || $morehtmlright || !empty($links)) {
703 if (!$notab || $notab == -1 || $notab == -2 || $notab == -3 || $notab == -4) {
704 $out .=
"\n" .
'<div id="dragDropAreaTabBar" class="tabBar' . ($notab == -1 ?
'' : ($notab == -2 ?
' tabBarNoTop' : ((($notab == -3 || $notab == -4) ?
' noborderbottom' :
'') . ($notab == -4 ?
'' :
' tabBarWithBottom'))));
705 $out .= ($morecssdiv ?
' ' . $morecssdiv :
'');
708 if (!empty($dragdropfile)) {
709 include_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
712 $parameters = array(
'tabname' => $active,
'out' => $out);
713 $reshook = $hookmanager->executeHooks(
'printTabsHead', $parameters);
715 $out = $hookmanager->resPrint;
729function dol_fiche_end($notab = 0)
742 if (!$notab || $notab == -1) {
769function dol_banner_tab(
$object, $paramid, $morehtml =
'', $shownav = 1, $fieldid =
'rowid', $fieldref =
'ref', $morehtmlref =
'', $moreparam =
'', $nodbprefix = 0, $morehtmlleft =
'', $morehtmlstatus =
'', $onlybanner = 0, $morehtmlright =
'')
771 global
$conf, $form, $user, $langs, $hookmanager, $action;
775 $maxvisiblephotos = 1;
780 if (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
'barcode',
'lire_advance')) {
783 $modulepart =
'unknown';
785 if (in_array(
$object->element, [
'societe',
'contact',
'product',
'ticket',
'bom'])) {
786 $modulepart =
$object->element;
787 } elseif (
$object->element ==
'member') {
788 $modulepart =
'memberphoto';
789 } elseif (
$object->element ==
'user') {
790 $modulepart =
'userphoto';
793 if (class_exists(
"Imagick")) {
794 if (
$object->element ==
'expensereport' ||
$object->element ==
'propal' ||
$object->element ==
'commande' ||
$object->element ==
'facture' ||
$object->element ==
'supplier_proposal') {
795 $modulepart =
$object->element;
796 } elseif (
$object->element ==
'fichinter' ||
$object->element ==
'intervention') {
797 $modulepart =
'ficheinter';
798 } elseif (
$object->element ==
'contrat' ||
$object->element ==
'contract') {
799 $modulepart =
'contract';
800 } elseif (
$object->element ==
'order_supplier') {
801 $modulepart =
'supplier_order';
802 } elseif (
$object->element ==
'invoice_supplier') {
803 $modulepart =
'supplier_invoice';
807 if (
$object->element ==
'product') {
809 '@phan-var-force Product $object';
811 $cssclass =
'photowithmargin photoref';
812 $showimage =
$object->is_photo_available(
$conf->product->multidir_output[$entity]);
814 if (
$conf->browser->layout ==
'phone') {
815 $maxvisiblephotos = 1;
817 $useLinkPathPhoto =
getDolGlobalInt(
'PRODUCT_USE_LINK_PATH_FOR_PHOTO');
818 if ($showimage || $useLinkPathPhoto) {
819 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">' .
$object->show_photos(
'product',
$conf->product->multidir_output[$entity], 1, $maxvisiblephotos, 0, 0, 0, 0, $width, 0,
'') .
'</div>';
823 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
825 $nophoto =
'/public/theme/common/nophoto.png';
826 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart .
' ' . $cssclass .
'" title="' .
dol_escape_htmltag($langs->trans(
"UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv(
"Documents"))) .
'" alt="No photo" style="width: ' . $width .
'px" src="' . DOL_URL_ROOT . $nophoto .
'"></div>';
829 } elseif (
$object->element ==
'category') {
831 '@phan-var-force Categorie $object';
833 $cssclass =
'photowithmargin photoref';
834 $showimage =
$object->isAnyPhotoAvailable(
$conf->categorie->multidir_output[$entity]);
836 if (
$conf->browser->layout ==
'phone') {
837 $maxvisiblephotos = 1;
840 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">' .
$object->show_photos(
'category',
$conf->categorie->multidir_output[$entity],
'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0,
'') .
'</div>';
844 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
846 $nophoto =
'/public/theme/common/nophoto.png';
847 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart .
' ' . $cssclass .
'" title="' .
dol_escape_htmltag($langs->trans(
"UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv(
"Documents"))) .
'" alt="No photo" style="width: ' . $width .
'px" src="' . DOL_URL_ROOT . $nophoto .
'"></div>';
850 } elseif (
$object->element ==
'bom') {
852 '@phan-var-force Bom $object';
854 $cssclass =
'photowithmargin photoref';
855 $showimage =
$object->is_photo_available(
$conf->bom->multidir_output[$entity]);
857 if (
$conf->browser->layout ==
'phone') {
858 $maxvisiblephotos = 1;
861 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">' .
$object->show_photos(
'bom',
$conf->bom->multidir_output[$entity],
'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0,
'') .
'</div>';
865 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
867 $nophoto =
'/public/theme/common/nophoto.png';
868 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart .
' ' . $cssclass .
'" title="' .
dol_escape_htmltag($langs->trans(
"UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv(
"Documents"))) .
'" alt="No photo" style="width: ' . $width .
'px" src="' . DOL_URL_ROOT . $nophoto .
'"></div>';
871 } elseif (
$object->element ==
'ticket') {
873 $cssclass =
'photoref';
875 '@phan-var-force Ticket $object';
876 $showimage =
$object->is_photo_available(
$conf->ticket->multidir_output[$entity] .
'/' .
$object->ref);
878 if (
$conf->browser->layout ==
'phone') {
879 $maxvisiblephotos = 1;
883 $showphoto =
$object->show_photos(
'ticket',
$conf->ticket->multidir_output[$entity],
'small', $maxvisiblephotos, 0, 0, 0, $width, 0);
885 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">' . $showphoto .
'</div>';
893 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
895 $nophoto = img_picto(
'No photo',
'object_ticket');
896 $morehtmlleft .=
'<!-- No photo to show -->';
897 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
898 $morehtmlleft .= $nophoto;
899 $morehtmlleft .=
'</div></div>';
904 if ($modulepart !=
'unknown' || method_exists(
$object,
'getDataToShowPhoto')) {
907 if (in_array($modulepart, array(
'propal',
'commande',
'facture',
'ficheinter',
'contract',
'supplier_order',
'supplier_proposal',
'supplier_invoice',
'expensereport')) && class_exists(
"Imagick")) {
909 $dir_output = (empty(
$conf->$modulepart->multidir_output[$entity]) ?
$conf->$modulepart->dir_output :
$conf->$modulepart->multidir_output[$entity]) .
"/";
910 if (in_array($modulepart, array(
'invoice_supplier',
'supplier_invoice'))) {
912 $subdir .= ((!empty($subdir) && !preg_match(
'/\/$/', $subdir)) ?
'/' :
'') . $objectref;
916 if (empty($subdir)) {
917 $subdir =
'errorgettingsubdirofobject';
920 $filepath = $dir_output . $subdir .
"/";
922 $filepdf = $filepath . $objectref .
".pdf";
923 $relativepath = $subdir .
'/' . $objectref .
'.pdf';
926 $fileimage = $filepdf .
'_preview.png';
927 $relativepathimage = $relativepath .
'_preview.png';
929 $pdfexists = file_exists($filepdf);
934 if (!file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) {
936 include_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
945 if ($pdfexists && !$error) {
946 $heightforphotref = 80;
947 if (!empty(
$conf->dol_optimize_smallscreen)) {
948 $heightforphotref = 60;
951 if (file_exists($fileimage)) {
952 $phototoshow =
'<div class="photoref">';
953 $phototoshow .=
'<img height="' . $heightforphotref .
'" class="photo photowithborder" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=apercu' . $modulepart .
'&file=' . urlencode($relativepathimage) .
'">';
954 $phototoshow .=
'</div>';
957 } elseif (!$phototoshow) {
958 $phototoshow .= $form->showphoto($modulepart,
$object, 0, 0, 0,
'photowithmargin photoref',
'small', 1, 0);
962 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">';
963 $morehtmlleft .= $phototoshow;
964 $morehtmlleft .=
'</div>';
968 if (empty($phototoshow)) {
969 if (
$object->element ==
'action') {
971 $cssclass =
'photorefcenter';
972 $nophoto = img_picto(
'No photo',
'title_agenda');
975 $cssclass =
'photorefcenter';
981 if (strpos($picto,
'fontawesome_') !==
false) {
984 $nophoto = img_picto(
'No photo', $prefix . $picto);
986 $morehtmlleft .=
'<!-- No photo to show -->';
987 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
988 $morehtmlleft .= $nophoto;
989 $morehtmlleft .=
'</div></div>';
994 $morehtmlref .=
'<div style="clear: both;"></div>';
995 $morehtmlref .=
'<div class="smallimp refidno opacitymedium banner-object-technical-id">';
996 $morehtmlref .= $langs->trans(
"TechnicalID") .
': ' . ((int)
$object->id);
997 $morehtmlref .=
'</div>';
1003 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode(
$object, 100,
'photoref valignmiddle') .
'</div>';
1006 if (
$object->element ==
'societe') {
1008 if (!empty(
$conf->use_javascript_ajax) && $user->hasRight(
'societe',
'creer') &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
1011 $morehtmlstatus .=
$object->getLibStatut(6);
1013 } elseif (
$object->element ==
'product') {
1016 if (!empty(
$conf->use_javascript_ajax) && $user->hasRight(
'produit',
'creer') &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
1017 $morehtmlstatus .=
ajax_object_onoff(
$object,
'status',
'status',
'ProductStatusOnSell',
'ProductStatusNotOnSell');
1019 $morehtmlstatus .=
'<span class="statusrefsell">' .
$object->getLibStatut(6, 0) .
'</span>';
1021 $morehtmlstatus .=
' ';
1023 if (!empty(
$conf->use_javascript_ajax) && $user->hasRight(
'produit',
'creer') &&
getDolGlobalString(
'MAIN_DIRECT_STATUS_UPDATE')) {
1024 $morehtmlstatus .=
ajax_object_onoff(
$object,
'status_buy',
'status_buy',
'ProductStatusOnBuy',
'ProductStatusNotOnBuy');
1026 $morehtmlstatus .=
'<span class="statusrefbuy">' .
$object->getLibStatut(6, 1) .
'</span>';
1028 } elseif (in_array(
$object->element, array(
'salary'))) {
1030 '@phan-var-force Salary $object';
1032 if (empty($tmptxt) || $tmptxt ==
$object->getLibStatut(3)) {
1035 $morehtmlstatus .= $tmptxt;
1036 } elseif (in_array(
$object->element, array(
'facture',
'invoice',
'invoice_supplier'))) {
1038 '@phan-var-force Facture|FactureFournisseur|CommonInvoice $object';
1039 if (!isset(
$object->alreadypaid)) {
1045 $tmptxt =
$object->getLibStatut(6, (
float)
$object->alreadypaid);
1046 if (empty($tmptxt) || $tmptxt ==
$object->getLibStatut(3)) {
1047 $tmptxt =
$object->getLibStatut(5, (
float)
$object->alreadypaid);
1049 $morehtmlstatus .= $tmptxt;
1050 } elseif (in_array(
$object->element, array(
'chargesociales',
'loan',
'tva'))) {
1052 '@phan-var-force ChargeSociales|Loan|Tva $object';
1054 if (empty($tmptxt) || $tmptxt ==
$object->getLibStatut(3)) {
1057 $morehtmlstatus .= $tmptxt;
1058 } elseif (
$object->element ==
'contrat' ||
$object->element ==
'contract') {
1061 $morehtmlstatus .=
$object->getLibStatut(5);
1063 $morehtmlstatus .=
$object->getLibStatut(4);
1065 } elseif (
$object->element ==
'facturerec') {
1067 '@phan-var-force FactureRec $object';
1068 if (
$object->frequency == 0) {
1069 $morehtmlstatus .=
$object->getLibStatut(2);
1071 $morehtmlstatus .=
$object->getLibStatut(5);
1073 } elseif (
$object->element ==
'project_task') {
1075 $tmptxt =
$object->getLibStatut(4);
1076 $morehtmlstatus .= $tmptxt;
1077 } elseif (method_exists(
$object,
'getLibStatut')) {
1078 $tmptxt =
$object->getLibStatut(6);
1079 if (empty($tmptxt) || $tmptxt ==
$object->getLibStatut(3)) {
1080 $tmptxt =
$object->getLibStatut(5);
1082 $morehtmlstatus .= $tmptxt;
1086 if (
isModEnabled(
'accounting') && in_array(
$object->element, array(
'bank',
'paiementcharge',
'facture',
'invoice',
'invoice_supplier',
'expensereport',
'payment_various'))) {
1088 if (method_exists(
$object,
'getVentilExportCompta')) {
1089 $accounted =
$object->getVentilExportCompta(1);
1090 $langs->load(
"accountancy");
1091 $morehtmlstatus .=
'</div><div class="statusref statusrefbis"><span class="opacitymedium">' . ($accounted > 0 ?
'<a href="' . DOL_URL_ROOT .
'/accountancy/bookkeeping/list.php?search_mvt_num=' . ((int) $accounted) .
'">' . $langs->trans(
"Accounted") .
'</a>' : $langs->trans(
"NotYetAccounted")) .
'</span>';
1096 if (!empty(
$object->name_alias)) {
1098 '@phan-var-force Societe $object';
1099 $morehtmlref .=
'<div class="refidno opacitymedium banner-object-name-alias">' .
dol_escape_htmltag(
$object->name_alias) .
'</div>';
1103 if (in_array(
$object->element, array(
'product',
'bank_account',
'project_task'))) {
1106 $morehtmlref .=
'<div class="refidno banner-object-label">' .
$object->label .
'</div>';
1110 if (method_exists(
$object,
'getBannerAddress') && !in_array(
$object->element, array(
'product',
'bookmark',
'ecm_directories',
'ecm_files'))) {
1113 $morehtmlref .=
'<div class="refidno refaddress">';
1114 $morehtmlref .= $moreaddress;
1115 $morehtmlref .=
'</div>';
1119 $parameters = array(
'morehtmlref' => &$morehtmlref,
'moreparam' => &$moreparam,
'morehtmlleft' => &$morehtmlleft,
'morehtmlstatus' => &$morehtmlstatus,
'morehtmlright' => &$morehtmlright);
1120 $reshook = $hookmanager->executeHooks(
'formDolBanner', $parameters,
$object, $action);
1122 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
1123 } elseif (empty($reshook)) {
1124 $morehtmlref .= $hookmanager->resPrint;
1125 } elseif ($reshook > 0) {
1126 $morehtmlref = $hookmanager->resPrint;
1135 print
'<div class="' . ($onlybanner ?
'arearefnobottom ' :
'arearef ') .
'heightref valignmiddle centpercent object-banner-tab-container" data-module-part="'.dolPrintHTMLForAttribute($modulepart).
'">';
1136 print $form->showrefnav(
$object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
1138 print
'<div class="underrefbanner clearboth"></div>';
1154 if ($fieldrequired) {
1155 $ret .=
'<span class="fieldrequired">';
1157 $ret .=
'<label for="' . $fieldkey .
'">';
1158 $ret .= $langs->trans($langkey);
1160 if ($fieldrequired) {
1182function dolOutputDates($datep, $datef =
null, $fullday = 0, $addseconds = 0, $pictotoadd =
'', $tzoutput =
'tzuserrel', $reduceformat = 0)
1185 if (empty($datef)) {
1193 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
1195 $s .=
'<div class="center inline-block">';
1196 if ($tmpa[
'hours'] != $tmpb[
'hours'] || $tmpa[
'minutes'] != $tmpb[
'minutes']) {
1198 $s .=
dol_print_date($datep,
'day'.($reduceformat ?
'reduceformat' :
''), $tzoutput);
1200 if (empty($fullday)) {
1201 $s .=
'<br><span class="small opacitymedium">';
1202 $s .=
dol_print_date($datep,
'hour'.($addseconds ?
'sec' :
'').
'reduceformat', $tzoutput);
1203 $s .=
'-'.dol_print_date($datef,
'hour'.($addseconds ?
'sec' :
'').
'reduceformat', $tzoutput);
1208 $s .=
dol_print_date($datep,
'day'.($reduceformat ?
'reduceformat' :
''),
'tzuserrel');
1210 if (empty($fullday)) {
1211 $s .=
'<br><span class="small opacitymedium">';
1212 $s .=
dol_print_date($datep,
'hour'.($addseconds ?
'sec' :
'').
'reduceformat', $tzoutput);
1219 $s .=
'<div class="center inline-block dateborderright">';
1220 $s .=
dol_print_date($datep,
'day'.($reduceformat ?
'reduceformat' :
''), $tzoutput);
1221 if (empty($fullday)) {
1222 $s .=
'<br><span class="small opacitymedium">';
1223 $s .=
dol_print_date($datep,
'hour'.($addseconds ?
'sec' :
'').
'reduceformat', $tzoutput);
1227 $s .=
'<div class="center inline-block dateborderleft">';
1228 $s .=
dol_print_date($datef,
'day'.($reduceformat ?
'reduceformat' :
''),
'tzuserrel');
1230 if (empty($fullday)) {
1231 $s .=
'<br><span class="small opacitymedium">';
1232 $s .=
dol_print_date($datef,
'hour'.($addseconds ?
'sec' :
'').
'reduceformat', $tzoutput);
1252 $type2picto = array(
1253 'varchar' =>
'font',
1256 'int' =>
'sort-numeric-down',
1257 'double' =>
'sort-numeric-down',
1258 'price' =>
'currency',
1259 'pricecy' =>
'multicurrency',
1260 'password' =>
'key',
1261 'boolean' =>
'check-square',
1262 'date' =>
'calendar',
1263 'datetime' =>
'calendar',
1264 'duration' =>
'hourglass',
1270 'sellist' =>
'list',
1271 'stars' =>
'fontawesome_star_fas',
1272 'radio' =>
'check-circle',
1273 'checkbox' =>
'list',
1274 'chkbxlst' =>
'list',
1276 'icon' =>
"question",
1277 'point' =>
"country",
1278 'multipts' =>
'country',
1279 'linestrg' =>
"country",
1280 'polygon' =>
"country",
1281 'separate' =>
'minus'
1284 if (!empty($type2picto[$key])) {
1285 return img_picto(
'', $type2picto[$key],
'class="pictofixedwidth' . ($morecss ?
' ' . $morecss :
'') .
'"');
1288 return img_picto(
'',
'generic',
'class="pictofixedwidth' . ($morecss ?
' ' . $morecss :
'') .
'"');
1316function img_picto($titlealt, $picto, $moreatt =
'', $pictoisfullpath = 0, $srconly = 0, $notitle = 0, $alt =
'', $morecss =
'', $marginleftonlyshort = 2, $allowothertags = array())
1321 $url = DOL_URL_ROOT;
1322 $theme = isset(
$conf->theme) ?
$conf->theme :
null;
1323 $path =
'theme/' . $theme;
1324 if (empty($picto)) {
1329 $titlealt = str_replace(array(
'\n',
"\n"),
' - ', $titlealt);
1333 if ($pictoisfullpath) {
1335 if (!preg_match(
'/(\.png|\.gif|\.svg)$/i', $picto)) {
1338 $fullpathpicto = $picto;
1340 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
1341 $morecss .= ($morecss ?
' ' :
'') . $reg[1];
1342 $moreatt = str_replace(
'class="' . $reg[1] .
'"',
'', $moreatt);
1347 $pictowithouttext = preg_replace(
'/(\.png|\.gif|\.svg)$/',
'', $picto);
1348 $pictowithouttext = str_replace(
'object_',
'', $pictowithouttext);
1349 $pictowithouttext = str_replace(
'_nocolor',
'', $pictowithouttext);
1352 $pictoconvertkey = array(
1353 'facture' =>
'bill',
1354 'shipping' =>
'shipment',
1355 'fichinter' =>
'intervention',
1356 'agenda' =>
'calendar',
1357 'invoice_supplier' =>
'supplier_invoice',
1358 'order_supplier' =>
'supplier_order');
1359 if (in_array($pictowithouttext, array_keys($pictoconvertkey))) {
1360 $pictowithouttext = $pictoconvertkey[$pictowithouttext];
1363 if (strpos($pictowithouttext,
'fontawesome_') === 0 || strpos($pictowithouttext,
'fa-') === 0) {
1365 $pictowithouttext = str_replace(
'fontawesome_',
'', $pictowithouttext);
1366 $pictowithouttext = str_replace(
'fa-',
'', $pictowithouttext);
1369 if ($pictowithouttext ==
'file-o') {
1370 $pictowithouttext =
'file';
1373 $pictowithouttextarray = explode(
'_', $pictowithouttext);
1374 $marginleftonlyshort = 0;
1376 if (!empty($pictowithouttextarray[1])) {
1378 $fakey =
'fa-' . $pictowithouttextarray[0];
1379 $faprefix = empty($pictowithouttextarray[1]) ?
'fas' : $pictowithouttextarray[1];
1380 $facolor = empty($pictowithouttextarray[2]) ?
'' : $pictowithouttextarray[2];
1381 $fasize = empty($pictowithouttextarray[3]) ?
'' : $pictowithouttextarray[3];
1383 $fakey =
'fa-' . $pictowithouttext;
1393 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
1394 $morecss .= ($morecss ?
' ' :
'') . $reg[1];
1395 $moreatt = str_replace(
'class="' . $reg[1] .
'"',
'', $moreatt);
1397 if (preg_match(
'/style="([^"]+)"/', $moreatt, $reg)) {
1398 $morestyle = $reg[1];
1399 $moreatt = str_replace(
'style="' . $reg[1] .
'"',
'', $moreatt);
1401 $moreatt = trim($moreatt);
1403 $enabledisablehtml =
'<span class="' . $faprefix .
' ' . $fakey;
1404 $enabledisablehtml .= ($morecss ?
' ' . $morecss :
'') .
'" style="' . ($fasize ? (
'font-size: ' . $fasize .
';') :
'') . ($facolor ? (
' color: ' . $facolor .
';') :
'') . ($morestyle ?
' ' . $morestyle :
'') .
'"' . (($notitle || empty($titlealt)) ?
'' :
' title="' . dolPrintHTMLForAttribute($titlealt) .
'"') . ($moreatt ?
' ' . $moreatt :
'') .
'>';
1405 $enabledisablehtml .=
'</span>';
1407 return $enabledisablehtml;
1410 if (empty($srconly) && !preg_match(
'/[\.\/@]/', $picto)) {
1411 $fakey = $pictowithouttext;
1415 if (in_array($pictowithouttext, array(
'card',
'bell',
'clock',
'establishment',
'file',
'file-o',
'generic',
'minus-square',
'object_generic',
'pdf',
'plus-square',
'timespent',
'note',
'off',
'on',
'object_bookmark',
'bookmark',
'vcard'))) {
1418 if (in_array($pictowithouttext, array(
'black-tie',
'discord',
'facebook',
'flickr',
'github',
'google',
'google-plus-g',
'instagram',
'linkedin',
'meetup',
'microsoft',
'pinterest',
'skype',
'slack',
'twitter',
'reddit',
'snapchat',
'stripe',
'stripe-s',
'tumblr',
'viadeo',
'whatsapp',
'youtube'))) {
1424 if ($pictowithouttext ==
'off') {
1425 $fakey =
'fa-square';
1427 } elseif ($pictowithouttext ==
'on') {
1428 $fakey =
'fa-check-square';
1430 } elseif ($pictowithouttext ==
'listlight') {
1431 $fakey =
'fa-download';
1432 $marginleftonlyshort = 1;
1433 } elseif ($pictowithouttext ==
'printer') {
1434 $fakey =
'fa-print';
1436 } elseif ($pictowithouttext ==
'note') {
1437 $fakey =
'fa-sticky-note';
1438 $marginleftonlyshort = 1;
1439 } elseif (in_array($pictowithouttext, array(
'1uparrow',
'1downarrow',
'1leftarrow',
'1rightarrow',
'1uparrow_selected',
'1downarrow_selected',
'1leftarrow_selected',
'1rightarrow_selected'))) {
1440 $convertarray = array(
'1uparrow' =>
'caret-up',
'1downarrow' =>
'caret-down',
'1leftarrow' =>
'caret-left',
'1rightarrow' =>
'caret-right',
'1uparrow_selected' =>
'caret-up',
'1downarrow_selected' =>
'caret-down',
'1leftarrow_selected' =>
'caret-left',
'1rightarrow_selected' =>
'caret-right');
1441 $fakey =
'fa-' . $convertarray[$pictowithouttext];
1442 if (preg_match(
'/selected/', $pictowithouttext)) {
1445 $marginleftonlyshort = 1;
1446 } elseif (!empty($arrayconvpictotofa[$pictowithouttext])) {
1447 $fakey =
'fa-' . $arrayconvpictotofa[$pictowithouttext];
1449 $fakey =
'fa-' . $pictowithouttext;
1452 if (in_array($pictowithouttext, array(
'dollyrevert',
'member',
'members',
'contract',
'group',
'resource',
'shipment',
'reception'))) {
1453 $morecss .=
' em092';
1455 if (in_array($pictowithouttext, array(
'conferenceorbooth',
'eventorganization',
'holiday',
'info',
'info_black',
'project',
'workstation'))) {
1456 $morecss .=
' em088';
1458 if (in_array($pictowithouttext, array(
'asset',
'intervention',
'payment',
'loan',
'partnership',
'stock',
'technic'))) {
1459 $morecss .=
' em080';
1463 $arrayconvpictotomarginleftonly = array(
1493 '1uparrow_selected',
1494 '1downarrow_selected',
1495 '1leftarrow_selected',
1496 '1rightarrow_selected'
1498 if (!array_key_exists($pictowithouttext, $arrayconvpictotomarginleftonly)) {
1499 $marginleftonlyshort = 0;
1503 $arrayconvpictotomorcess = array(
1504 'action' =>
'infobox-action',
1505 'account' =>
'infobox-bank_account',
1506 'accounting_account' =>
'infobox-bank_account',
1507 'accountline' =>
'infobox-bank_account',
1508 'accountancy' =>
'infobox-bank_account',
1509 'admin' =>
'opacitymedium',
1510 'asset' =>
'infobox-bank_account',
1511 'bank_account' =>
'infobox-bank_account',
1512 'bill' =>
'infobox-commande',
1513 'billa' =>
'infobox-commande',
1514 'billr' =>
'infobox-commande',
1515 'billd' =>
'infobox-commande',
1516 'bookcal' =>
'infobox-portal',
1517 'margin' =>
'infobox-bank_account',
1518 'conferenceorbooth' =>
'infobox-project',
1519 'cash-register' =>
'infobox-portal',
1520 'contract' =>
'infobox-contrat',
1521 'check' =>
'font-status4',
1522 'conversation' =>
'infobox-contrat',
1523 'donation' =>
'infobox-commande',
1524 'dolly' =>
'infobox-commande',
1525 'dollyrevert' =>
'flip infobox-order_supplier',
1526 'ecm' =>
'infobox-action',
1527 'eventorganization' =>
'infobox-project',
1528 'hrm' =>
'infobox-adherent',
1529 'group' =>
'infobox-adherent',
1530 'intervention' =>
'infobox-contrat',
1531 'incoterm' =>
'infobox-supplier_proposal',
1532 'intracommreport' =>
'infobox-bank_account',
1533 'currency' =>
'infobox-bank_account',
1534 'multicurrency' =>
'infobox-bank_account',
1535 'members' =>
'infobox-adherent',
1536 'member' =>
'infobox-adherent',
1537 'money-bill-alt' =>
'infobox-bank_account',
1538 'order' =>
'infobox-commande',
1539 'user' =>
'infobox-adherent',
1540 'users' =>
'infobox-adherent',
1541 'error' =>
'pictoerror',
1542 'warning' =>
'pictowarning',
1543 'switch_on' =>
'font-status4',
1544 'switch_on_warning' =>
'font-status4 warning',
1545 'switch_on_red' =>
'font-status8',
1546 'switch_off_warning' =>
'font-status4 warning',
1547 'switch_off_red' =>
'font-status8',
1548 'holiday' =>
'infobox-holiday',
1549 'info' =>
'opacityhigh',
1550 'info_black' =>
'purple',
1551 'invoice' =>
'infobox-commande',
1552 'knowledgemanagement' =>
'infobox-contrat rotate90',
1553 'loan' =>
'infobox-commande',
1554 'payment' =>
'infobox-bank_account',
1555 'payment_vat' =>
'infobox-bank_account',
1556 'poll' =>
'infobox-portal',
1557 'pos' =>
'infobox-bank_account',
1558 'project' =>
'infobox-project',
1559 'projecttask' =>
'infobox-project',
1560 'propal' =>
'infobox-propal',
1561 'proposal' =>
'infobox-propal',
1562 'private' =>
'infobox-project',
1563 'reception' =>
'flip infobox-order_supplier',
1564 'recruitmentjobposition' =>
'infobox-adherent',
1565 'recruitmentcandidature' =>
'infobox-adherent',
1566 'resource' =>
'infobox-action',
1567 'salary' =>
'infobox-commande',
1568 'shapes' =>
'infobox-adherent',
1569 'shipment' =>
'infobox-commande',
1570 'store' =>
'infobox-portal',
1571 'stripe' =>
'infobox-bank_account',
1572 'supplier_invoice' =>
'infobox-order_supplier',
1573 'supplier_invoicea' =>
'infobox-order_supplier',
1574 'supplier_invoiced' =>
'infobox-order_supplier',
1575 'supplier_invoicer' =>
'infobox-order_supplier',
1576 'supplier' =>
'infobox-order_supplier',
1577 'supplier_order' =>
'infobox-order_supplier',
1578 'supplier_proposal' =>
'infobox-supplier_proposal',
1579 'ticket' =>
'infobox-contrat',
1580 'title_accountancy' =>
'infobox-bank_account',
1581 'title_hrm' =>
'infobox-holiday',
1582 'expensereport' =>
'infobox-expensereport',
1583 'trip' =>
'infobox-expensereport',
1584 'title_agenda' =>
'infobox-action',
1585 'vat' =>
'infobox-bank_account',
1586 'webportal' =>
'infobox-portal',
1587 'website' =>
'infobox-portal',
1589 'list-alt' =>
'imgforviewmode',
1590 'calendar' =>
'imgforviewmode',
1591 'calendarweek' =>
'imgforviewmode',
1592 'calendarmonth' =>
'imgforviewmode',
1593 'calendarday' =>
'imgforviewmode',
1594 'calendarperuser' =>
'imgforviewmode',
1595 'calendarpertype' =>
'imgforviewmode'
1597 if (!empty($arrayconvpictotomorcess[$pictowithouttext]) && strpos($picto,
'_nocolor') ===
false) {
1598 $morecss .= ($morecss ?
' ' :
'') . $arrayconvpictotomorcess[$pictowithouttext];
1602 $arrayconvpictotocolor = array(
1603 'address' =>
'#6c6aa8',
1604 'building' =>
'#6c6aa8',
1608 'companies' =>
'#6c6aa8',
1609 'company' =>
'#6c6aa8',
1610 'contact' =>
'#6c6aa8',
1612 'dynamicprice' =>
'#a69944',
1617 'listlight' =>
'#999',
1618 'language' =>
'#555',
1622 'map-marker-alt' =>
'#aaa',
1624 'product' =>
'#a69944',
1625 'service' =>
'#a69944',
1626 'inventory' =>
'#a69944',
1627 'stock' =>
'#a69944',
1628 'movement' =>
'#a69944',
1630 'world' =>
'#986c6a',
1631 'partnership' =>
'#6c6aa8',
1632 'playdisabled' =>
'#ccc',
1633 'printer' =>
'#444',
1634 'projectpub' =>
'#986c6a',
1638 'search-plus' =>
'#808080',
1639 'security' =>
'#999',
1641 'stop-circle' =>
'#888',
1643 'superadmin' =>
'#600',
1644 'switch_off' =>
'#999',
1645 'technic' =>
'#999',
1647 'timespent' =>
'#555',
1648 'uncheck' =>
'#800',
1649 'uparrow' =>
'#555',
1650 'user-cog' =>
'#999',
1651 'country' =>
'#aaa',
1652 'globe-americas' =>
'#aaa',
1656 'workstation' =>
'#a69944'
1658 if (isset($arrayconvpictotocolor[$pictowithouttext]) && strpos($picto,
'_nocolor') ===
false) {
1659 $facolor = $arrayconvpictotocolor[$pictowithouttext];
1666 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
1667 $morecss .= ($morecss ?
' ' :
'') . $reg[1];
1668 $moreatt = str_replace(
'class="' . $reg[1] .
'"',
'', $moreatt);
1670 if (preg_match(
'/style="([^"]+)"/', $moreatt, $reg)) {
1671 $morestyle = $reg[1];
1672 $moreatt = str_replace(
'style="' . $reg[1] .
'"',
'', $moreatt);
1674 $moreatt = trim($moreatt);
1676 $enabledisablehtml =
'<span class="' . $fa .
' ' . $fakey . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ?
' marginleftonlyshort' :
' marginleftonly') :
'');
1677 $enabledisablehtml .= ($morecss ?
' ' . $morecss :
'') .
'" style="' . ($fasize ? (
'font-size: ' . $fasize .
';') :
'') . ($facolor ? (
' color: ' . $facolor .
';') :
'') . ($morestyle ?
' ' . $morestyle :
'') .
'"' . (($notitle || empty($titlealt)) ?
'' :
' title="' . dolPrintHTMLForAttribute($titlealt) .
'"') . ($moreatt ?
' ' . $moreatt :
'') .
'>';
1678 $enabledisablehtml .=
'</span>';
1680 return $enabledisablehtml;
1687 } elseif (!empty(
$conf->modules_parts[
'theme']) && array_key_exists($theme,
$conf->modules_parts[
'theme'])) {
1688 $path = $theme .
'/theme/' . $theme;
1693 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $picto, $regs)) {
1699 if (!preg_match(
'/(\.png|\.gif|\.svg)$/i', $picto)) {
1704 foreach (
$conf->file->dol_document_root as $type => $dirroot) {
1705 if ($type ==
'main') {
1709 if (file_exists($dirroot .
'/' . $path .
'/img/' . $picto) && !empty(
$conf->file->dol_url_root)) {
1710 $url = DOL_URL_ROOT .
$conf->file->dol_url_root[$type];
1716 $fullpathpicto = $url .
'/' . $path .
'/img/' . $picto;
1720 return $fullpathpicto;
1724 return '<img src="' . $fullpathpicto .
'"' . ($notitle ?
'' :
' alt="' . dolPrintHTMLForAttribute($alt, 0, $allowothertags) .
'"') . (($notitle || empty($titlealt)) ?
'' :
' title="' . dolPrintHTMLForAttribute($titlealt, 0, $allowothertags) .
'"') . ($moreatt ?
' ' . $moreatt . ($morecss ?
' class="' . $morecss .
'"' :
'') :
' class="inline-block' . ($morecss ?
' ' . $morecss :
'') .
'"') .
'>';
1738 if (empty($mode) || $mode ==
'fa') {
1740 $arrayconvpictotofa = array(
1741 'account' =>
'university',
1742 'accounting_account' =>
'clipboard-list',
1743 'accountline' =>
'receipt',
1744 'accountancy' =>
'search-dollar',
1745 'action' =>
'calendar-alt',
1746 'add' =>
'plus-circle',
1747 'address' =>
'address-book',
1750 'asset' =>
'money-check-alt',
1751 'autofill' =>
'fill',
1752 'back' =>
'arrow-left',
1753 'bank_account' =>
'university',
1754 'bill' =>
'file-invoice-dollar',
1755 'billa' =>
'file-excel',
1756 'billr' =>
'file-invoice-dollar',
1757 'billd' =>
'file-medical',
1758 'blockedlog' =>
'file-archive',
1759 'bookcal' =>
'calendar-check',
1760 'supplier_invoice' =>
'file-invoice-dollar',
1761 'supplier_invoicea' =>
'file-excel',
1762 'supplier_invoicer' =>
'file-invoice-dollar',
1763 'supplier_invoiced' =>
'file-medical',
1765 'card' =>
'address-card',
1766 'chart' =>
'chart-line',
1767 'company' =>
'building',
1768 'contact' =>
'address-book',
1769 'contract' =>
'suitcase',
1770 'collab' =>
'people-arrows',
1771 'conversation' =>
'comments',
1772 'country' =>
'globe-americas',
1773 'cron' =>
'business-time',
1775 'chevron-double-left' =>
'angle-double-left',
1776 'chevron-double-right' =>
'angle-double-right',
1777 'chevron-double-down' =>
'angle-double-down',
1778 'chevron-double-top' =>
'angle-double-up',
1779 'donation' =>
'gift',
1780 'dynamicprice' =>
'hand-holding-usd',
1782 'companies' =>
'building',
1783 'products' =>
'cube',
1784 'commercial' =>
'suitcase',
1785 'invoicing' =>
'coins',
1786 'accounting' =>
'search-dollar',
1787 'category' =>
'tag',
1788 'dollyrevert' =>
'dolly',
1790 'generate' =>
'plus-square',
1791 'hrm' =>
'user-tie',
1792 'incoterm' =>
'truck-loading',
1793 'margin' =>
'calculator',
1794 'members' =>
'user-friends',
1795 'ticket' =>
'ticket-alt',
1796 'globe' =>
'external-link-alt',
1799 'establishment' =>
'building',
1800 'edit' =>
'pencil-alt',
1801 'entity' =>
'globe',
1802 'graph' =>
'chart-line',
1803 'grip_title' =>
'arrows-alt',
1804 'grip' =>
'arrows-alt',
1805 'help' =>
'question-circle',
1806 'generic' =>
'file',
1807 'holiday' =>
'umbrella-beach',
1808 'info' =>
'info-circle',
1809 'info_black' =>
'info-circle',
1810 'inventory' =>
'boxes',
1811 'intracommreport' =>
'globe-europe',
1812 'jobprofile' =>
'cogs',
1813 'knowledgemanagement' =>
'ticket-alt',
1814 'label' =>
'layer-group',
1815 'layout' =>
'columns',
1817 'loan' =>
'money-bill-alt',
1818 'member' =>
'user-alt',
1819 'meeting' =>
'chalkboard-teacher',
1821 'next' =>
'arrow-alt-circle-right',
1823 'expensereport' =>
'wallet',
1825 'movement' =>
'people-carry',
1826 'sign-out' =>
'sign-out-alt',
1827 'superadmin' =>
'star',
1828 'switch_off' =>
'toggle-off',
1829 'switch_off_grey' =>
'toggle-off',
1830 'switch_off_warning' =>
'toggle-off',
1831 'switch_off_red' =>
'toggle-off',
1832 'switch_on' =>
'toggle-on',
1833 'switch_on_grey' =>
'toggle-on',
1834 'switch_on_warning' =>
'toggle-on',
1835 'switch_on_red' =>
'toggle-on',
1837 'bookmark' =>
'star',
1838 'bank' =>
'university',
1839 'close_title' =>
'times',
1840 'delete' =>
'trash',
1841 'filter' =>
'filter',
1842 'list-alt' =>
'list-alt',
1843 'calendarlist' =>
'bars',
1844 'calendar' =>
'calendar-alt',
1845 'calendarmonth' =>
'calendar-alt',
1846 'calendarweek' =>
'calendar-week',
1847 'calendarday' =>
'calendar-day',
1848 'calendarperuser' =>
'table',
1849 'calendarpertype' =>
'table',
1850 'intervention' =>
'ambulance',
1851 'invoice' =>
'file-invoice-dollar',
1852 'order' =>
'file-invoice',
1853 'error' =>
'exclamation-triangle',
1854 'warning' =>
'exclamation-triangle',
1855 'other' =>
'square',
1856 'playdisabled' =>
'play',
1857 'pdf' =>
'file-pdf',
1858 'poll' =>
'check-double',
1859 'pos' =>
'cash-register',
1860 'preview' =>
'binoculars',
1861 'project' =>
'project-diagram',
1862 'projectpub' =>
'project-diagram',
1863 'projecttask' =>
'tasks',
1864 'propal' =>
'file-signature',
1865 'proposal' =>
'file-signature',
1866 'partnership' =>
'handshake',
1867 'payment' =>
'money-check-alt',
1868 'payment_vat' =>
'money-check-alt',
1869 'pictoconfirm' =>
'check-square',
1870 'phoning' =>
'phone',
1871 'phoning_mobile' =>
'mobile-alt',
1872 'phoning_fax' =>
'fax',
1873 'previous' =>
'arrow-alt-circle-left',
1874 'printer' =>
'print',
1875 'product' =>
'cube',
1876 'puce' =>
'angle-right',
1877 'recent' =>
'check-square',
1878 'reception' =>
'dolly',
1879 'recruitmentjobposition' =>
'id-card-alt',
1880 'recruitmentcandidature' =>
'id-badge',
1882 'supplier_order' =>
'dol-order_supplier',
1883 'supplier_proposal' =>
'file-signature',
1884 'refresh' =>
'redo',
1885 'region' =>
'map-marked',
1886 'replacement' =>
'exchange-alt',
1887 'resource' =>
'laptop-house',
1888 'recurring' =>
'history',
1889 'service' =>
'concierge-bell',
1890 'skill' =>
'shapes',
1891 'state' =>
'map-marked-alt',
1892 'security' =>
'key',
1893 'salary' =>
'wallet',
1894 'shipment' =>
'dolly',
1895 'stock' =>
'box-open',
1896 'stats' =>
'chart-bar',
1897 'split' =>
'code-branch',
1898 'status' =>
'stop-circle',
1899 'stripe' =>
'stripe-s',
1900 'supplier' =>
'building',
1901 'technic' =>
'cogs',
1903 'timespent' =>
'clock',
1904 'title_setup' =>
'tools',
1905 'title_accountancy' =>
'money-check-alt',
1906 'title_bank' =>
'university',
1907 'title_hrm' =>
'umbrella-beach',
1908 'title_agenda' =>
'calendar-alt',
1909 'uncheck' =>
'times',
1910 'uparrow' =>
'share',
1911 'url' =>
'external-link-alt',
1912 'vat' =>
'money-check-alt',
1913 'vcard' =>
'arrow-alt-circle-down',
1914 'jabber' =>
'comment',
1915 'website' =>
'globe-americas',
1916 'workstation' =>
'pallet',
1917 'webhook' =>
'bullseye',
1919 'private' =>
'user-lock',
1920 'conferenceorbooth' =>
'chalkboard-teacher',
1921 'eventorganization' =>
'project-diagram',
1922 'webportal' =>
'door-open'
1925 if (
$conf->currency ==
'EUR') {
1926 $arrayconvpictotofa[
'currency'] =
'euro-sign';
1927 $arrayconvpictotofa[
'multicurrency'] =
'dollar-sign';
1929 $arrayconvpictotofa[
'currency'] =
'dollar-sign';
1930 $arrayconvpictotofa[
'multicurrency'] =
'euro-sign';
1933 $arrayconvpictotofa = array();
1936 return $arrayconvpictotofa;
1955function img_object($titlealt, $picto, $moreatt =
'', $pictoisfullpath = 0, $srconly = 0, $notitle = 0, $allowothertags = array())
1957 return img_picto($titlealt, $picto, $moreatt, $pictoisfullpath, $srconly, $notitle,
'',
'', 2, $allowothertags);
1971function img_weather($titlealt, $picto, $moreatt =
'', $pictoisfullpath = 0, $morecss =
'')
1975 if (is_numeric($picto)) {
1978 return '<i class="fa fa-weather-level' . $picto .
'"></i>';
1979 } elseif (!preg_match(
'/(\.png|\.gif)$/i', $picto)) {
1983 $path = DOL_URL_ROOT .
'/theme/' .
$conf->theme .
'/img/weather/' . $picto;
1985 return img_picto($titlealt, $path, $moreatt, 1, 0, 0,
'', $morecss);
2003 if (!preg_match(
'/(\.png|\.gif)$/i', $picto)) {
2007 if ($pictoisfullpath) {
2010 $path = DOL_URL_ROOT .
'/theme/common/' . $picto;
2013 $themeimg =
'/theme/' .
$conf->theme .
'/img/' . $picto;
2015 if (file_exists(DOL_DOCUMENT_ROOT . $themeimg)) {
2016 $path = DOL_URL_ROOT . $themeimg;
2017 } elseif (!empty(
$conf->modules_parts[
'theme'])) {
2018 foreach (
$conf->modules_parts[
'theme'] as $reldir) {
2028 return img_picto($titlealt, $path, $moreatt, 1, 0, $notitle);
2044function img_action($titlealt, $numaction, $picto =
'', $moreatt =
'')
2048 if (empty($titlealt) || $titlealt ==
'default') {
2049 if ($numaction ==
'-1' || $numaction ==
'ST_NO') {
2051 $titlealt = $langs->transnoentitiesnoconv(
'ChangeDoNotContact');
2052 } elseif ($numaction ==
'0' || $numaction ==
'ST_NEVER') {
2054 $titlealt = $langs->transnoentitiesnoconv(
'ChangeNeverContacted');
2055 } elseif ($numaction ==
'1' || $numaction ==
'ST_TODO') {
2057 $titlealt = $langs->transnoentitiesnoconv(
'ChangeToContact');
2058 } elseif ($numaction ==
'2' || $numaction ==
'ST_PEND') {
2060 $titlealt = $langs->transnoentitiesnoconv(
'ChangeContactInProcess');
2061 } elseif ($numaction ==
'3' || $numaction ==
'ST_DONE') {
2063 $titlealt = $langs->transnoentitiesnoconv(
'ChangeContactDone');
2065 $titlealt = $langs->transnoentitiesnoconv(
'ChangeStatus ' . $numaction);
2069 if (!is_numeric($numaction)) {
2073 return img_picto($titlealt, (empty($picto) ?
'stcomm' . $numaction .
'.png' : $picto), $moreatt);
2084function img_edit_add($titlealt =
'default', $other =
'')
2088 if ($titlealt ==
'default') {
2089 $titlealt = $langs->trans(
'Add');
2092 return img_picto($titlealt,
'edit_add.png', $other);
2102function img_edit_remove($titlealt =
'default', $other =
'')
2106 if ($titlealt ==
'default') {
2107 $titlealt = $langs->trans(
'Remove');
2110 return img_picto($titlealt,
'edit_remove.png', $other);
2122function img_edit($titlealt =
'default', $float = 0, $other =
'')
2126 if ($titlealt ==
'default') {
2127 $titlealt = $langs->trans(
'Modify');
2130 return img_picto($titlealt,
'edit', ($float ?
'style="float: ' . ($langs->tab_translate[
"DIRECTION"] ==
'rtl' ?
'left' :
'right') .
'"' :
"") . ($other ?
' ' . $other :
''));
2142function img_view($titlealt =
'default', $float = 0, $other =
'class="valignmiddle"')
2146 if ($titlealt ==
'default') {
2147 $titlealt = $langs->trans(
'View');
2150 $moreatt = ($float ?
'style="float: right" ' :
'') . $other;
2152 return img_picto($titlealt,
'eye', $moreatt);
2164function img_delete($titlealt =
'default', $other =
'class="pictodelete"', $morecss =
'')
2168 if ($titlealt ==
'default') {
2169 $titlealt = $langs->trans(
'Delete');
2172 return img_picto($titlealt,
'delete', $other, 0, 0, 0,
'', $morecss);
2185 if ($titlealt ==
"default") {
2186 $titlealt = $langs->trans(
"Print");
2188 return img_picto($titlealt,
'printer', $other);
2198function img_split($titlealt =
'default', $other =
'class="pictosplit"')
2202 if ($titlealt ==
'default') {
2203 $titlealt = $langs->trans(
'Split');
2206 return img_picto($titlealt,
'split', $other);
2217function img_help($usehelpcursor = 1, $usealttitle = 1)
2222 if (is_string($usealttitle)) {
2225 $usealttitle = $langs->trans(
'Info');
2229 return img_picto($usealttitle,
'info',
'style="vertical-align: middle;' . ($usehelpcursor == 1 ?
' cursor: help' : ($usehelpcursor == 2 ?
' cursor: pointer' :
'')) .
'"');
2239function img_info($titlealt =
'default')
2243 if ($titlealt ==
'default') {
2244 $titlealt = $langs->trans(
'Informations');
2247 return img_picto($titlealt,
'info',
'style="vertical-align: middle;"');
2259function img_warning($titlealt =
'default', $moreatt =
'', $morecss =
'pictowarning')
2263 if ($titlealt ==
'default') {
2264 $titlealt = $langs->trans(
'Warning');
2268 return img_picto($titlealt,
'warning',
'class="' . $morecss .
'"' . ($moreatt ? ($moreatt ==
'1' ?
' style="float: right"' :
' ' . $moreatt) :
''));
2278function img_error($titlealt =
'default')
2282 if ($titlealt ==
'default') {
2283 $titlealt = $langs->trans(
'Error');
2286 return img_picto($titlealt,
'error');
2300 if ($titlealt ==
'default') {
2301 $titlealt = $langs->trans(
'Next');
2305 return '<span class="fa fa-chevron-right paddingright paddingleft" title="' .
dol_escape_htmltag($titlealt) .
'"></span>';
2319 if ($titlealt ==
'default') {
2320 $titlealt = $langs->trans(
'Previous');
2324 return '<span class="fa fa-chevron-left paddingright paddingleft" title="' .
dol_escape_htmltag($titlealt) .
'"></span>';
2335function img_down($titlealt =
'default', $selected = 0, $moreclass =
'')
2339 if ($titlealt ==
'default') {
2340 $titlealt = $langs->trans(
'Down');
2343 return img_picto($titlealt, ($selected ?
'1downarrow_selected' :
'1downarrow'),
'class="imgdown' . ($moreclass ?
" " . $moreclass :
"") .
'"');
2354function img_up($titlealt =
'default', $selected = 0, $moreclass =
'')
2358 if ($titlealt ==
'default') {
2359 $titlealt = $langs->trans(
'Up');
2362 return img_picto($titlealt, ($selected ?
'1uparrow_selected' :
'1uparrow'),
'class="imgup' . ($moreclass ?
" " . $moreclass :
"") .
'"');
2373function img_left($titlealt =
'default', $selected = 0, $moreatt =
'')
2377 if ($titlealt ==
'default') {
2378 $titlealt = $langs->trans(
'Left');
2381 return img_picto($titlealt, ($selected ?
'1leftarrow_selected' :
'1leftarrow'), $moreatt);
2392function img_right($titlealt =
'default', $selected = 0, $moreatt =
'')
2396 if ($titlealt ==
'default') {
2397 $titlealt = $langs->trans(
'Right');
2400 return img_picto($titlealt, ($selected ?
'1rightarrow_selected' :
'1rightarrow'), $moreatt);
2414 if ($titlealt ==
'default') {
2415 $titlealt = $langs->trans(
'Active');
2419 return img_picto($titlealt,
'tick');
2434 if (is_null($morecss)) {
2438 if ($brand ==
'visa' || $brand ==
'Visa') {
2440 } elseif ($brand ==
'mastercard' || $brand ==
'MasterCard') {
2441 $brand =
'cc-mastercard';
2442 } elseif ($brand ==
'amex' || $brand ==
'American Express') {
2444 } elseif ($brand ==
'discover' || $brand ==
'Discover') {
2445 $brand =
'cc-discover';
2446 } elseif ($brand ==
'jcb' || $brand ==
'JCB') {
2448 } elseif ($brand ==
'diners' || $brand ==
'Diners club') {
2449 $brand =
'cc-diners-club';
2450 } elseif (!in_array($brand, array(
'cc-visa',
'cc-mastercard',
'cc-amex',
'cc-discover',
'cc-jcb',
'cc-diners-club'))) {
2451 $brand =
'credit-card';
2454 return '<span class="fa fa-' . $brand .
' fa-fw' . ($morecss ?
' ' . $morecss :
'') .
'"></span>';
2467 require_once DOL_DOCUMENT_ROOT .
'/core/lib/files.lib.php';
2473 if (empty($titlealt)) {
2474 $titlealt =
'Mime type: ' . $mimetype;
2478 return '<i class="fa fa-' . $mimefa .
' ' . (preg_match(
'/pictofixedwidth/', $morecss) ?
'' :
'paddingright ') . ($morecss ?
' ' . $morecss :
'') .
'"' . ($titlealt ?
' title="' . dolPrintHTMLForAttribute($titlealt) .
'"' :
'') .
'></i>';
2493 if ($titlealt ==
'default') {
2494 $titlealt = $langs->trans(
'Search');
2497 $img = img_picto($titlealt,
'search', $other, 0, 1);
2499 $input =
'<input type="image" class="liste_titre" name="button_search" src="' . $img .
'" ';
2516 if ($titlealt ==
'default') {
2517 $titlealt = $langs->trans(
'Search');
2520 $img = img_picto($titlealt,
'searchclear.png', $other, 0, 1);
2522 $input =
'<input type="image" class="liste_titre" name="button_removefilter" src="' . $img .
'" ';
2542function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin =
'1', $morecss =
'hideonsmartphone', $textfordropdown =
'', $picto =
'', $textonpictotooltip =
'', $cssfordropdown =
'info_admin')
2544 global
$conf, $langs;
2546 if ($infoonimgalt) {
2547 $result = img_picto($text,
'info',
'class="' . ($morecss ?
' ' . $morecss :
'') .
'"');
2549 if (empty(
$conf->use_javascript_ajax)) {
2550 $textfordropdown =
'';
2553 $class = (empty($admin) ?
'undefined' : ((string) $admin ==
'1' ?
'info' : $admin));
2554 $fa =
'info-circle';
2555 if ($picto ==
'warning') {
2556 $fa =
'exclamation-triangle';
2558 $result = ($nodiv ?
'' :
'<div class="wordbreak ' . $class . ($cssfordropdown ?
' ' . $cssfordropdown :
'') . ($morecss ?
' ' . $morecss :
'') . ($textfordropdown ?
' hidden' :
'') .
'">');
2559 $result .= img_picto(((
string) $admin ? $langs->trans(
'InfoAdmin') : $langs->trans(
'Note')).($textonpictotooltip ?
' : '.$textonpictotooltip :
''), $fa);
2562 $result .= ($nodiv ?
'' :
'</div>');
2564 if ($textfordropdown) {
2565 $tmpresult =
'<span class="' . $class .
' '. $cssfordropdown.
'text opacitymedium cursorpointer">' . $langs->trans($textfordropdown) .
' ' . img_picto($langs->trans($textfordropdown),
'1downarrow') .
'</span>';
2566 $tmpresult .=
'<script nonce="' .
getNonce() .
'" type="text/javascript">
2567 jQuery(document).ready(function() {
2568 jQuery(".' . $cssfordropdown .
'text").click(function() {
2569 console.log("toggle text of .'.$cssfordropdown.
'");
2570 jQuery(".' . $cssfordropdown .
'").toggle().removeClass("hidden");
2575 $result = $tmpresult . $result;
2595function dol_print_error($db =
null, $error =
'', $errors =
null)
2597 global
$conf, $langs, $user, $argv;
2598 global $dolibarr_main_prod;
2605 require_once DOL_DOCUMENT_ROOT .
'/core/class/translate.class.php';
2607 $langs->load(
"main");
2611 $langs->loadLangs(array(
'main',
'errors'));
2613 if ($_SERVER[
'DOCUMENT_ROOT']) {
2614 $out .= $langs->trans(
"DolibarrHasDetectedError") .
".<br>\n";
2616 $out .=
"You use an experimental or develop level of features, so please do NOT report any bugs or vulnerability, except if problem is confirmed after moving option MAIN_FEATURES_LEVEL back to 0.<br>\n";
2618 $out .= $langs->trans(
"InformationToHelpDiagnose") .
":<br>\n";
2620 $out .=
"<b>" . $langs->trans(
"Date") .
":</b> " .
dol_print_date(
dol_now(),
'dayhourlog') .
"<br>\n";
2621 $out .=
"<b>" . $langs->trans(
"Dolibarr") .
":</b> " . DOL_VERSION .
" - https://www.dolibarr.org<br>\n";
2622 if (isset(
$conf->global->MAIN_FEATURES_LEVEL)) {
2623 $out .=
"<b>" . $langs->trans(
"LevelOfFeature") .
":</b> " .
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') .
"<br>\n";
2625 if ($user instanceof
User) {
2626 $out .=
"<b>" . $langs->trans(
"Login") .
":</b> " . $user->login .
"<br>\n";
2628 if (function_exists(
"phpversion")) {
2629 $out .=
"<b>" . $langs->trans(
"PHP") .
":</b> " . phpversion() .
"<br>\n";
2631 $out .=
"<b>" . $langs->trans(
"Server") .
":</b> " . (isset($_SERVER[
"SERVER_SOFTWARE"]) ?
dol_htmlentities($_SERVER[
"SERVER_SOFTWARE"], ENT_COMPAT) :
'') .
"<br>\n";
2632 if (function_exists(
"php_uname")) {
2633 $out .=
"<b>" . $langs->trans(
"OS") .
":</b> " . php_uname() .
"<br>\n";
2635 $out .=
"<b>" . $langs->trans(
"UserAgent") .
":</b> " . (isset($_SERVER[
"HTTP_USER_AGENT"]) ?
dol_htmlentities($_SERVER[
"HTTP_USER_AGENT"], ENT_COMPAT) :
'') .
"<br>\n";
2637 $out .=
"<b>" . $langs->trans(
"RequestedUrl") .
":</b> " . (isset($_SERVER[
"REQUEST_URI"]) ?
dol_htmlentities($_SERVER[
"REQUEST_URI"], ENT_COMPAT) :
'') .
"<br>\n";
2638 $out .=
"<b>" . $langs->trans(
"Referer") .
":</b> " . (isset($_SERVER[
"HTTP_REFERER"]) ?
dol_htmlentities($_SERVER[
"HTTP_REFERER"], ENT_COMPAT) :
'') .
"<br>\n";
2639 $out .=
"<b>" . $langs->trans(
"MenuManager") .
":</b> " . (isset(
$conf->standard_menu) ?
dol_htmlentities(
$conf->standard_menu, ENT_COMPAT) :
'') .
"<br>\n";
2641 $syslog .=
"url=" . (isset($_SERVER[
"REQUEST_URI"]) ?
dol_escape_htmltag($_SERVER[
"REQUEST_URI"]) :
'');
2642 $syslog .=
", query_string=" . (isset($_SERVER[
"QUERY_STRING"]) ?
dol_escape_htmltag($_SERVER[
"QUERY_STRING"]) :
'');
2644 $out .=
'> ' . $langs->transnoentities(
"ErrorInternalErrorDetected") .
":\n" . $argv[0] .
"\n";
2645 $syslog .=
"pid=" . dol_getmypid();
2648 if (!empty(
$conf->modules)) {
2649 $out .=
"<b>" . $langs->trans(
"Modules") .
":</b> " . implode(
', ',
$conf->modules) .
"<br>\n";
2652 if (is_object($db)) {
2653 if ($_SERVER[
'DOCUMENT_ROOT']) {
2654 $out .=
"<b>" . $langs->trans(
"DatabaseTypeManager") .
":</b> " . $db->type .
"<br>\n";
2655 $lastqueryerror = $db->lastqueryerror();
2657 $lastqueryerror =
"SQL error string is not a valid UTF8 string. We can't show it.";
2659 $out .=
"<b>" . $langs->trans(
"RequestLastAccessInError") .
":</b> " . ($lastqueryerror ?
dol_escape_htmltag($lastqueryerror) : $langs->trans(
"ErrorNoRequestInError")) .
"<br>\n";
2660 $out .=
"<b>" . $langs->trans(
"ReturnCodeLastAccessInError") .
":</b> " . ($db->lasterrno() ?
dol_escape_htmltag($db->lasterrno()) : $langs->trans(
"ErrorNoRequestInError")) .
"<br>\n";
2661 $out .=
"<b>" . $langs->trans(
"InformationLastAccessInError") .
":</b> " . ($db->lasterror() ?
dol_escape_htmltag($db->lasterror()) : $langs->trans(
"ErrorNoRequestInError")) .
"<br>\n";
2665 $out .=
'> ' . $langs->transnoentities(
"DatabaseTypeManager") .
":\n" . $db->type .
"\n";
2666 $out .=
'> ' . $langs->transnoentities(
"RequestLastAccessInError") .
":\n" . ($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities(
"ErrorNoRequestInError")) .
"\n";
2667 $out .=
'> ' . $langs->transnoentities(
"ReturnCodeLastAccessInError") .
":\n" . ($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities(
"ErrorNoRequestInError")) .
"\n";
2668 $out .=
'> ' . $langs->transnoentities(
"InformationLastAccessInError") .
":\n" . ($db->lasterror() ? $db->lasterror() : $langs->transnoentities(
"ErrorNoRequestInError")) .
"\n";
2670 $syslog .=
", sql=" . $db->lastquery();
2671 $syslog .=
", db_error=" . $db->lasterror();
2674 if ($error || $errors) {
2676 if (is_array($error) && is_array($errors)) {
2677 $errors = array_merge($error, $errors);
2678 } elseif (is_array($error)) {
2680 } elseif (is_array($errors) && !empty($error)) {
2681 $errors = array_merge(array($error), $errors);
2682 } elseif (!empty($error)) {
2683 $errors = array_merge(array($error), array($errors));
2686 $langs->load(
"errors");
2688 foreach ($errors as $msg) {
2692 if ($_SERVER[
'DOCUMENT_ROOT']) {
2693 $out .=
"<b>" . $langs->trans(
"Message") .
":</b> " .
dol_escape_htmltag($msg) .
"<br>\n";
2695 $out .=
'> ' . $langs->transnoentities(
"Message") .
":\n" . $msg .
"\n";
2697 $syslog .=
", msg=" . $msg;
2700 if (empty($dolibarr_main_prod) && $_SERVER[
'DOCUMENT_ROOT'] && function_exists(
'xdebug_print_function_stack') && function_exists(
'xdebug_call_file')) {
2701 xdebug_print_function_stack();
2702 $out .=
'<b>XDebug information:</b>' .
"<br>\n";
2703 $out .=
'File: ' . xdebug_call_file() .
"<br>\n";
2704 $out .=
'Line: ' . xdebug_call_line() .
"<br>\n";
2705 $out .=
'Function: ' . xdebug_call_function() .
"<br>\n";
2710 if (!headers_sent()) {
2711 if (function_exists(
'top_httphead')) {
2715 http_response_code(202);
2718 if (empty($dolibarr_main_prod)) {
2721 if (empty($langs->defaultlang)) {
2722 $langs->setDefaultLang();
2724 $langs->loadLangs(array(
"main",
"errors"));
2726 print
'This website or feature is currently temporarily not available or failed after a technical error.<br><br>This may be due to a maintenance operation. Current status of operation (' .
dol_print_date(
dol_now(),
'dayhourrfc') .
') are on next line...<br><br>' .
"\n";
2727 print $langs->trans(
"DolibarrHasDetectedError") .
'. ';
2728 print $langs->trans(
"YouCanSetOptionDolibarrMainProdToZero");
2729 if (!defined(
"MAIN_CORE_ERROR")) {
2730 define(
"MAIN_CORE_ERROR", 1);
2747function dol_print_error_email($prefixcode, $errormessage =
'', $errormessages = array(), $morecss =
'error', $email =
'')
2751 if (empty($email)) {
2755 $langs->load(
"errors");
2758 print
'<br><div class="center login_main_message"><div class="' . $morecss .
'">';
2759 print $langs->trans(
"ErrorContactEMail", $email, $prefixcode .
'-' .
dol_print_date($now,
'%Y%m%d%H%M%S'));
2760 if ($errormessage) {
2761 print
'<br><br>' . $errormessage;
2763 if (is_array($errormessages) && count($errormessages)) {
2764 foreach ($errormessages as $mesgtoshow) {
2765 print
'<br><br>' . $mesgtoshow;
2768 print
'</div></div>';
2787function print_liste_field_titre($name, $file =
"", $field =
"", $begin =
"", $param =
"", $moreattrib =
"", $sortfield =
"", $sortorder =
"", $prefix =
"", $tooltip =
"", $forcenowrapcolumntitle = 0)
2789 print
getTitleFieldOfList($name, 0, $file, $field, $begin, $param, $moreattrib, $sortfield, $sortorder, $prefix, 0, $tooltip, $forcenowrapcolumntitle);
2810function getTitleFieldOfList($name, $thead = 0, $file =
"", $field =
"", $begin =
"", $moreparam =
"", $moreattrib =
"", $sortfield =
"", $sortorder =
"", $prefix =
"", $disablesortlink = 0, $tooltip =
'', $forcenowrapcolumntitle = 0)
2812 global $langs, $form;
2815 if ($moreattrib ==
'class="right"') {
2816 $prefix .=
'right ';
2819 $tooltip = (string) $tooltip;
2821 $sortorder = strtoupper((
string) $sortorder);
2830 $tmpsortfield = explode(
',', (
string) $sortfield);
2831 $sortfield1 = trim($tmpsortfield[0]);
2832 $tmpfield = explode(
',', $field);
2833 $field1 = trim($tmpfield[0]);
2835 if (strpos((
string) $tooltip,
':') !==
false) {
2836 $tmptooltip = explode(
':', (
string) $tooltip);
2838 $tmptooltip = array($tooltip);
2841 $wrapcolumntitle = (empty($forcenowrapcolumntitle) || (!empty($tmptooltip[2]) && $tmptooltip[2] ==
'-1'));
2843 if (!
getDolGlobalString(
'MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && $wrapcolumntitle) {
2844 $prefix =
'wrapcolumntitle ' . $prefix;
2850 $liste_titre =
'liste_titre';
2851 if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace(
"/^[^\.]+\./",
"", $field1))) {
2852 $liste_titre =
'liste_titre_sel';
2855 $tagstart =
'<' . $tag .
' class="' . $prefix . $liste_titre .
'" ' . $moreattrib;
2857 $tagstart .= ($name && !
getDolGlobalString(
'MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE') && $wrapcolumntitle && !
dol_textishtml($name)) ?
' title="' . dolPrintHTMLForAttribute($langs->trans($name)) .
'"' :
'';
2860 if (empty($thead) && $field && empty($disablesortlink)) {
2861 $options = preg_replace(
'/sortfield=([a-zA-Z0-9,\s\.]+)/i',
'', (is_scalar($moreparam) ? $moreparam :
''));
2862 $options = preg_replace(
'/sortorder=([a-zA-Z0-9,\s\.]+)/i',
'', $options);
2863 $options = preg_replace(
'/&+/i',
'&', $options);
2864 if (!preg_match(
'/^&/', $options)) {
2865 $options =
'&' . $options;
2868 $sortordertouseinlink =
'';
2869 if ($field1 != $sortfield1) {
2870 if (preg_match(
'/^DESC/i', $sortorder)) {
2871 $sortordertouseinlink .= str_repeat(
'desc,', count(explode(
',', $field)));
2873 $sortordertouseinlink .= str_repeat(
'asc,', count(explode(
',', $field)));
2876 if (preg_match(
'/^ASC/i', $sortorder)) {
2877 $sortordertouseinlink .= str_repeat(
'desc,', count(explode(
',', $field)));
2879 $sortordertouseinlink .= str_repeat(
'asc,', count(explode(
',', $field)));
2882 $sortordertouseinlink = preg_replace(
'/,$/',
'', $sortordertouseinlink);
2883 $out .=
'<a class="reposition" href="' .
dolBuildUrl($file, [
'sortfield' => $field,
'sortorder' => $sortordertouseinlink,
'begin' => $begin]) . $options .
'"';
2887 if ($tooltip && $tmptooltip[0]) {
2889 $out .= $form->textwithpicto($langs->trans((
string) $name), $langs->trans((
string) $tmptooltip[0]), (empty($tmptooltip[2]) ?
'1' : $tmptooltip[2]),
'help', ((!empty($tmptooltip[2]) && $tmptooltip[2] ==
'-1') ?
'paddingrightonly' :
''), 0, 3, (empty($tmptooltip[1]) ?
'' :
'extra_' . str_replace(
'.',
'_', $field) .
'_' . $tmptooltip[1]));
2891 $out .= $langs->trans((
string) $name);
2894 if (empty($thead) && $field && empty($disablesortlink)) {
2898 if (empty($thead) && $field) {
2899 $options = preg_replace(
'/sortfield=([a-zA-Z0-9,\s\.]+)/i',
'', (is_scalar($moreparam) ? $moreparam :
''));
2900 $options = preg_replace(
'/sortorder=([a-zA-Z0-9,\s\.]+)/i',
'', $options);
2901 $options = preg_replace(
'/&+/i',
'&', $options);
2902 if (!preg_match(
'/^&/', $options)) {
2903 $options =
'&' . $options;
2906 if (!$sortorder || ($field1 != $sortfield1)) {
2909 if (preg_match(
'/^DESC/', $sortorder)) {
2910 $sortimg .=
'<span class="nowrap">' .
img_up(
"Z-A", 0,
'paddingright') .
'</span>';
2912 if (preg_match(
'/^ASC/', $sortorder)) {
2913 $sortimg .=
'<span class="nowrap">' .
img_down(
"A-Z", 0,
'paddingright') .
'</span>';
2918 $tagend =
'</' . $tag .
'>';
2920 $out = $tagstart . $sortimg . $out . $tagend;
2934function print_titre($title)
2936 dol_syslog(__FUNCTION__ .
" is deprecated", LOG_WARNING);
2938 print
'<div class="titre">' . $title .
'</div>';
2953function print_fiche_titre($title, $mesg =
'', $picto =
'generic', $pictoisfullpath = 0,
$id =
'')
2972function load_fiche_titre($title, $morehtmlright =
'', $picto =
'generic', $pictoisfullpath = 0,
$id =
'', $morecssontable =
'', $morehtmlcenter =
'', $morecssonpicto =
'widthpictotitle')
2976 if ($picto ==
'setup') {
2981 $return .=
'<table ' . (
$id ?
'id="' .
$id .
'" ' :
'') .
'class="centpercent notopnoleftnoright table-fiche-title' . ($morecssontable ?
' ' . $morecssontable :
'') .
'">';
2982 $return .=
'<tr class="toptitle">';
2984 $return .=
'<td class="nobordernopadding widthpictotitle valignmiddle col-picto">' . img_picto(
'', $picto,
'class="valignmiddle pictotitle'.($morecssonpicto ?
' '.$morecssonpicto :
'').
'"', $pictoisfullpath) .
'</td>';
2986 $return .=
'<td class="nobordernopadding valignmiddle col-title">';
2987 $return .=
'<div class="titre inline-block">';
2988 $return .=
'<span class="inline-block valignmiddle print-barre-liste">' . $title .
'</span>';
2989 $return .=
'</div>';
2992 $return .=
'<td class="nobordernopadding center valignmiddle col-center">' . $morehtmlcenter .
'</td>';
2995 $return .=
'<td class="nobordernopadding titre_right wordbreakimp right valignmiddle col-right">' . $morehtmlright .
'</td>';
2997 $return .=
'</tr></table>' .
"\n";
3026function print_barre_liste($title, $page, $file, $options =
'', $sortfield =
'', $sortorder =
'', $morehtmlcenter =
'', $num = -1, $totalnboflines =
'', $picto =
'generic', $pictoisfullpath = 0, $morehtmlright =
'', $morecss =
'', $limit = -1, $selectlimitsuffix = 0, $hidenavigation = 0, $pagenavastextinput = 0, $morehtmlrightbeforearrow =
'')
3028 global
$conf, $langs;
3031 $savtotalnboflines = $totalnboflines;
3032 if (is_numeric($totalnboflines)) {
3033 $totalnboflines = abs($totalnboflines);
3038 $tmparray = preg_split(
'/<br>/i', $title, 2);
3039 if (!empty($tmparray[1])) {
3040 $title = $tmparray[0];
3041 $subtitle = $tmparray[1];
3044 $page = (int) $page;
3046 if ($picto ==
'setup') {
3047 $picto =
'title_setup';
3049 if ((
$conf->browser->name ==
'ie') && $picto ==
'generic') {
3050 $picto =
'title.gif';
3053 $limit =
$conf->liste_limit;
3056 if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) {
3064 print
"<!-- Begin print_barre_liste -->\n";
3065 print
'<table class="centpercent notopnoleftnoright table-fiche-title' . ($morecss ?
' ' . $morecss :
'') .
'">';
3066 print
'<tr class="toptitle">';
3070 if ($picto && $title) {
3071 print
'<td class="nobordernopadding widthpictotitle valignmiddle col-picto">';
3072 print img_picto(
'', $picto,
'class="valignmiddle pictotitle widthpictotitle"', $pictoisfullpath);
3076 print
'<td class="nobordernopadding valignmiddle col-title">';
3077 print
'<div class="titre inline-block nowrap">';
3078 print
'<span class="inline-block valignmiddle print-barre-liste">' . $title .
'</span>';
3079 if (!empty($title) && $savtotalnboflines >= 0 && (
string) $savtotalnboflines !=
'') {
3080 if (is_numeric($totalnboflines) && (
int) $totalnboflines > 0) {
3081 print
'<span class="opacitymedium colorblack marginleftonly totalnboflines valignmiddle" title="' . $langs->trans(
"NbRecordQualified") .
'">(' . $totalnboflines .
')</span>';
3083 print
'<span class="opacitymedium colorblack marginleftonly totalnboflines valignmiddle">(' . $totalnboflines .
')</span>';
3087 if (!empty($subtitle)) {
3088 print
'<br><div class="subtitle inline-block hideonsmartphone">' . $subtitle .
'</div>';
3093 if ($morehtmlcenter && empty(
$conf->dol_optimize_smallscreen)) {
3094 print
'<td class="nobordernopadding center valignmiddle col-center">' . $morehtmlcenter .
'</td>';
3098 print
'<td class="nobordernopadding valignmiddle right col-right">';
3099 print
'<input type="hidden" name="pageplusoneold" value="' . ((int) $page + 1) .
'">';
3101 parse_str($options, $query);
3103 $query += [
'sortfield' => $sortfield];
3106 $query += [
'sortorder' => $sortorder];
3109 $options =
'&' . http_build_query($query);
3111 $query = array_merge($query, [
'page' => $page]);
3115 if ($savlimit != 0 && ($page > 0 || $num > $limit)) {
3116 if ($totalnboflines) {
3118 $maxnbofpage = (empty(
$conf->dol_optimize_smallscreen) ? 4 : 0);
3121 $nbpages = ceil($totalnboflines / $limit);
3125 $cpt = ($page - $maxnbofpage);
3131 if (empty($pagenavastextinput)) {
3133 $pagelist .=
'<li class="pagination"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">1</a></li>';
3135 $pagelist .=
'<li class="pagination"><span class="inactive">...</span></li>';
3136 } elseif ($cpt == 2) {
3138 $pagelist .=
'<li class="pagination"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">2</a></li>';
3144 if ($pagenavastextinput) {
3145 if ($cpt == $page) {
3146 $pagelist .=
'<li class="pagination pageplusone valignmiddle"><input type="text" class="' . ($totalnboflines > 100 ?
'width40' :
'width25') .
' center pageplusone heightofcombo" name="pageplusone" value="' . ($page + 1) .
'"></li>';
3150 if ($cpt == $page) {
3151 $pagelist .=
'<li class="pagination"><span class="active">' . ($page + 1) .
'</span></li>';
3153 $query[
'page'] = $cpt;
3154 $pagelist .=
'<li class="pagination"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">' . ($cpt + 1) .
'</a></li>';
3158 }
while ($cpt < $nbpages && $cpt <= ($page + $maxnbofpage));
3160 if (empty($pagenavastextinput)) {
3161 if ($cpt < $nbpages) {
3162 if ($cpt < $nbpages - 2) {
3163 $pagelist .=
'<li class="pagination"><span class="inactive">...</span></li>';
3164 } elseif ($cpt == $nbpages - 2) {
3165 $query[
'page'] = ($nbpages - 2);
3166 $pagelist .=
'<li class="pagination"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">' . ($nbpages - 1) .
'</a></li>';
3168 $query[
'page'] = ($nbpages - 1);
3169 $pagelist .=
'<li class="pagination"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">' . $nbpages .
'</a></li>';
3172 $query[
'page'] = ($nbpages - 1);
3173 $pagelist .=
'<li class="pagination paginationlastpage"><a class="reposition" href="' .
dolBuildUrl($file, $query) .
'">' . $nbpages .
'</a></li>';
3176 $pagelist .=
'<li class="pagination"><span class="active">' . ($page + 1) .
"</li>";
3180 if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) {
3182 print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $selectlimitsuffix, $morehtmlrightbeforearrow, $hidenavigation);
3186 if ($pagenavastextinput) {
3196 if ($morehtmlcenter && !empty(
$conf->dol_optimize_smallscreen)) {
3197 print
'<div class="nobordernopadding marginbottomonly center valignmiddle col-center centpercent">' . $morehtmlcenter .
'</div>';
3200 print
"<!-- End title -->\n\n";
3219function print_fleche_navigation($page, $file, $options =
'', $nextpage = 0, $betweenarrows =
'', $afterarrows =
'', $limit = -1, $totalnboflines = 0, $selectlimitsuffix =
'', $beforearrows =
'', $hidenavigation = 0)
3221 global
$conf, $langs;
3223 print
'<div class="pagination"><ul>';
3224 if ($beforearrows) {
3225 print
'<li class="paginationbeforearrows">';
3226 print $beforearrows;
3230 if (empty($hidenavigation)) {
3231 if ((
int) $limit > 0 && (empty($selectlimitsuffix) || !is_numeric($selectlimitsuffix))) {
3232 $pagesizechoices =
'10:10,15:15,20:20,25:25,50:50,100:100,250:250,500:500,1000:1000';
3233 $pagesizechoices .=
',5000:5000';
3243 print
'<li class="pagination">';
3244 print
'<input onfocus="this.value=null;" onchange="this.blur();" class="flat selectlimit nopadding maxwidth75 right pageplusone" id="limit" name="limit" list="limitlist" title="' .
dol_escape_htmltag($langs->trans(
"MaxNbOfRecordPerPage")) .
'" value="' . $limit .
'">';
3245 print
'<datalist id="limitlist">';
3247 print
'<li class="paginationcombolimit valignmiddle">';
3248 print
'<select id="limit' . (is_numeric($selectlimitsuffix) ?
'' : $selectlimitsuffix) .
'" name="'.(is_numeric($selectlimitsuffix) ?
'limit' : $selectlimitsuffix).
'" class="flat selectlimit nopadding maxwidth75 center' . (is_numeric($selectlimitsuffix) ?
'' :
' ' . $selectlimitsuffix) .
'" title="' .
dol_escape_htmltag($langs->trans(
"MaxNbOfRecordPerPage")) .
'">';
3250 $tmpchoice = explode(
',', $pagesizechoices);
3251 $tmpkey = $limit .
':' . $limit;
3252 if (!in_array($tmpkey, $tmpchoice)) {
3253 $tmpchoice[$tmpkey] = $tmpkey;
3255 $tmpkey =
$conf->liste_limit .
':' .
$conf->liste_limit;
3256 if (!in_array($tmpkey, $tmpchoice)) {
3257 $tmpchoice[$tmpkey] = $tmpkey;
3259 asort($tmpchoice, SORT_NUMERIC);
3260 foreach ($tmpchoice as $val) {
3262 $tmp = explode(
':', $val);
3265 if ($key !=
'' && $val !=
'') {
3266 if ((
int) $key == (
int) $limit) {
3267 $selected =
' selected="selected"';
3269 print
'<option name="' . $key .
'"' . $selected .
'>' .
dol_escape_htmltag($val) .
'</option>' .
"\n";
3273 print
'</datalist>';
3276 print
ajax_combobox(
"limit" . (is_numeric($selectlimitsuffix) ?
'' : $selectlimitsuffix), array(), 0, 0,
'resolve',
'-1',
'limit');
3280 if (
$conf->use_javascript_ajax) {
3281 print
'<!-- JS CODE TO ENABLE select limit to launch submit of page -->
3283 jQuery(document).ready(function () {
3284 jQuery(".selectlimit").change(function() {
3285 console.log("We change limit so we submit the form");
3286 $(this).parents(\'form:first\').submit();
3295 print
'<li class="pagination paginationpage paginationpageleft"><a class="paginationprevious reposition" href="' . $file .
'?page=' . ($page - 1) . $options .
'"><i class="fa fa-chevron-left" title="' .
dol_escape_htmltag($langs->trans(
"Previous")) .
'"></i></a></li>';
3297 if ($betweenarrows) {
3298 print
'<!--<div class="betweenarrows nowraponall inline-block">-->';
3299 print $betweenarrows;
3300 print
'<!--</div>-->';
3302 if ($nextpage > 0) {
3303 print
'<li class="pagination paginationpage paginationpageright"><a class="paginationnext reposition" href="' . $file .
'?page=' . ($page + 1) . $options .
'"><i class="fa fa-chevron-right" title="' .
dol_escape_htmltag($langs->trans(
"Next")) .
'"></i></a></li>';
3306 print
'<li class="paginationafterarrows">';
3311 print
'</ul></div>' .
"\n";
3323 return '<span class="amount">'.$amount.
'</span>';
3338function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput =
'no', $use_short_label = 0)
3340 require_once DOL_DOCUMENT_ROOT .
'/core/lib/product.lib.php';
3342 if (($forceunitoutput ==
'no' && $dimension < 1 / 10000 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) {
3343 $dimension *= 1000000;
3345 } elseif (($forceunitoutput ==
'no' && $dimension < 1 / 10 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == -3)) {
3348 } elseif (($forceunitoutput ==
'no' && $dimension > 100000000 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == 6)) {
3349 $dimension /= 1000000;
3351 } elseif (($forceunitoutput ==
'no' && $dimension > 100000 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == 3)) {
3368 $ret =
price($dimension, 0, $outputlangs, 0, 0, $round);
3386function yn($yesno, $format = 1, $color = 0)
3390 $result =
'unknown';
3392 if ($yesno ===
true || (
int) $yesno == 1 || (isset($yesno) && (strtolower($yesno) ==
'yes' || strtolower($yesno) ==
'true'))) {
3393 $result = $langs->trans(
'yes');
3394 if ($format == 1 || $format == 3) {
3395 $result = $langs->trans(
"Yes");
3398 $result =
'<input type="checkbox" value="1" checked disabled>';
3401 $result =
'<input type="checkbox" value="1" checked disabled> ' . $result;
3403 if ($format == 4 || !is_numeric($format)) {
3404 $result = img_picto(is_numeric($format) ?
'' : $format,
'check');
3409 $result = $langs->trans(
"no");
3410 if ($format == 1 || $format == 3) {
3411 $result = $langs->trans(
"No");
3414 $result =
'<input type="checkbox" value="0" disabled>';
3417 $result =
'<input type="checkbox" value="0" disabled> ' . $result;
3419 if ($format == 4 || !is_numeric($format)) {
3420 $result = img_picto(is_numeric($format) ?
'' : $format,
'uncheck');
3426 $classname =
'error';
3430 return '<span class="' . $classname .
'">' . $result .
'</span>';
3449function setEventMessage($mesgs, $style =
'mesgs', $noduplicate = 0, $attop = 0)
3452 if (!is_array($mesgs)) {
3453 $mesgs = trim((
string) $mesgs);
3456 if (!empty($noduplicate) && isset($_SESSION[
'dol_events'][$style]) && in_array($mesgs, $_SESSION[
'dol_events'][$style])) {
3460 array_unshift($_SESSION[
'dol_events'][$style], $mesgs);
3462 $_SESSION[
'dol_events'][$style][] = $mesgs;
3467 foreach ($mesgs as $mesg) {
3468 $mesg = trim((
string) $mesg);
3470 if (!empty($noduplicate) && isset($_SESSION[
'dol_events'][$style]) && in_array($mesg, $_SESSION[
'dol_events'][$style])) {
3474 array_unshift($_SESSION[
'dol_events'][$style], $mesgs);
3476 $_SESSION[
'dol_events'][$style][] = $mesg;
3497function setEventMessages($mesg, $mesgs, $style =
'mesgs', $messagekey =
'', $noduplicate = 0, $attop = 0)
3499 if (empty($mesg) && empty($mesgs)) {
3507 if (empty($messagekey) || empty($_COOKIE[
"DOLUSER_HIDEMESSAGE" . $messagekey])) {
3508 if (!in_array((
string) $style, array(
'mesgs',
'warnings',
'errors'))) {
3509 dol_print_error(
null,
'Bad parameter style=' . $style .
' for setEventMessages');
3511 if (empty($mesgs)) {
3512 setEventMessage((
string) $mesg, $style, $noduplicate, $attop);
3514 if (!empty($mesg) && !in_array($mesg, $mesgs)) {
3515 setEventMessage($mesg, $style, $noduplicate, $attop);
3517 setEventMessage($mesgs, $style, $noduplicate, $attop);
3535 if (isset($_SESSION[
'dol_events'][
'mesgs'])) {
3536 if (empty($disabledoutputofmessages)) {
3539 unset($_SESSION[
'dol_events'][
'mesgs']);
3542 if (isset($_SESSION[
'dol_events'][
'errors'])) {
3543 if (empty($disabledoutputofmessages)) {
3546 unset($_SESSION[
'dol_events'][
'errors']);
3550 if (isset($_SESSION[
'dol_events'][
'warnings'])) {
3551 if (empty($disabledoutputofmessages)) {
3554 unset($_SESSION[
'dol_events'][
'warnings']);
3574 global
$conf, $langs;
3579 $divstart = $divend =
'';
3582 if ((empty(
$conf->use_javascript_ajax) ||
getDolGlobalString(
'MAIN_DISABLE_JQUERY_JNOTIFY') || defined(
'DISABLE_JQUERY_JNOTIFY') || $keepembedded) && !preg_match(
'/<div class=".*">/i', $out)) {
3583 $divstart =
'<div class="' . $style .
' clearboth">';
3587 if ((is_array($mesgarray) && count($mesgarray)) || $mesgstring) {
3588 $langs->load(
"errors");
3590 if (is_array($mesgarray) && count($mesgarray)) {
3591 foreach ($mesgarray as $message) {
3593 $out .= $langs->trans($message);
3594 if ($ret < count($mesgarray)) {
3601 $out .= $langs->trans($mesgstring);
3607 if (!empty(
$conf->use_javascript_ajax) && !
getDolGlobalString(
'MAIN_DISABLE_JQUERY_JNOTIFY') && !defined(
'DISABLE_JQUERY_JNOTIFY') && empty($keepembedded)) {
3608 if ($style ==
"ok") {
3610 $return =
'<script nonce="' .
getNonce() .
'">
3611 /* jnotify(message, params) */
3612 $(document).ready(function() {
3617 create:
function($note) {
3618 $note.css(
"cursor",
"pointer").click(
function(e) {
3619 e.stopPropagation();
3627 // For error and warning messages, close immediately on click without fade
3628 $return = '<script nonce=
"' . getNonce() . '">
3629 $(document).ready(
function() {
3634 create:
function($note) {
3635 $note.find(
"a.jnotify-close").click(
function(e) {
3636 e.stopPropagation();
3663function get_htmloutput_errors($mesgstring = '
', $mesgarray = array(), $keepembedded = 0)
3665 return get_htmloutput_mesg($mesgstring, $mesgarray, 'error
', $keepembedded);
3681function dol_htmloutput_mesg($mesgstring = '
', $mesgarray = array(), $style = 'ok
', $keepembedded = 0)
3683 if (empty($mesgstring) && (!is_array($mesgarray) || count($mesgarray) == 0)) {
3689 if (is_array($mesgarray)) {
3690 foreach ($mesgarray as $val) {
3691 if ($val && preg_match('/
class=
"error"/i
', $val)) {
3695 if ($val && preg_match('/
class=
"warning"/i
', $val)) {
3700 } elseif ($mesgstring && preg_match('/
class=
"error"/i
', $mesgstring)) {
3702 } elseif ($mesgstring && preg_match('/
class=
"warning"/i
', $mesgstring)) {
3705 if ($style == 'error
' || $style == 'errors
') {
3708 if ($style == 'warning
' || $style == 'warnings
') {
3712 if ($iserror || $iswarning) {
3713 // Remove div from texts
3714 $mesgstring = preg_replace('/<\/div><div
class=
"(error|warning)">/
', '<br>
', $mesgstring);
3715 $mesgstring = preg_replace('/<div
class=
"(error|warning)">/
', '', $mesgstring);
3716 $mesgstring = preg_replace('/<\/div>/
', '', $mesgstring);
3717 // Remove div from texts array
3718 if (is_array($mesgarray)) {
3719 $newmesgarray = array();
3720 foreach ($mesgarray as $val) {
3721 if (is_string($val)) {
3722 $tmpmesgstring = preg_replace('/<\/div><div
class=
"(error|warning)">/
', '<br>
', $val);
3723 $tmpmesgstring = preg_replace('/<div
class=
"(error|warning)">/
', '', $tmpmesgstring);
3724 $tmpmesgstring = preg_replace('/<\/div>/
', '', $tmpmesgstring);
3725 $newmesgarray[] = $tmpmesgstring;
3727 dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING);
3730 $mesgarray = $newmesgarray;
3732 print get_htmloutput_mesg($mesgstring, $mesgarray, ($iserror ? 'error
' : 'warning
'), $keepembedded);
3734 print get_htmloutput_mesg($mesgstring, $mesgarray, 'ok
', $keepembedded);
3749function dol_htmloutput_errors($mesgstring = '
', $mesgarray = array(), $keepembedded = 0)
3751 dol_htmloutput_mesg($mesgstring, $mesgarray, 'error
', $keepembedded);
3764function picto_from_langcode($codelang, $moreatt = '
', $notitlealt = 0)
3766 if (empty($codelang)) {
3770 if ($codelang == 'auto') {
3771 return '<span
class=
"fa fa-language"></span>
';
3774 $langtocountryflag = array(
3776 'ca_ES
' => 'catalonia
',
3780 'sw_SW
' => 'unknown
',
3790 if (isset($langtocountryflag[$codelang])) {
3791 $flagImage = $langtocountryflag[$codelang];
3793 $tmparray = explode('_
', $codelang);
3794 $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
3799 if (preg_match('/
class=
"([^"]+)
"/', $moreatt, $reg)) {
3804 // return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt);
3805 return '<span class="flag-sprite
' . strtolower($flagImage) . ($morecss ? ' ' . $morecss : '') . '"' . ($moreatt ? ' ' . $moreatt : '') . (!$notitlealt ? ' title="' . $codelang . '"' : '') . '></span>';
3820function printCommonFooter($zone = 'private')
3822 global $conf, $hookmanager, $user, $langs;
3824 global $micro_start_time;
3826 if ($zone == 'private') {
3827 print "\n
" . '<!-- Common footer for private page -->' . "\n
";
3829 print "\n
" . '<!-- Common footer for public page -->' . "\n
";
3832 // A div to store page_y POST parameter so we can read it using javascript
3833 print "\n<!-- A div to store page_y POST parameter -->\n
";
3834 print '<div id="page_y
" style="display: none;
">' . (GETPOST('page_y') ? GETPOST('page_y') : '') . '</div>' . "\n
";
3836 $parameters = array('zone' => $zone);
3838 // @phan-suppress-next-line PhanPluginConstantVariableNull
3839 $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by some hooks
3840 if (empty($reshook)) {
3841 if (getDolGlobalString('MAIN_HTML_FOOTER')) {
3842 print getDolGlobalString('MAIN_HTML_FOOTER') . "\n
";
3846 if (!empty($conf->use_javascript_ajax)) {
3847 print "\n<!-- A script section to add menuhider handler on backoffice, manage focus and mandatory fields, tuning info, ... -->\n
";
3848 print '<script>' . "\n
";
3849 print 'jQuery(document).ready(function() {' . "\n
";
3851 if ($zone == 'private' && empty($conf->dol_use_jmobile)) {
3853 print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */' . "\n
";
3854 print 'jQuery("li.menuhider
").click(function(event) {';
3855 print ' if (!$( "body
" ).hasClass( "sidebar-collapse
" )){ event.preventDefault(); }' . "\n
";
3856 print ' console.log("We click on .menuhider
");' . "\n
";
3857 print ' $("body
").toggleClass("sidebar-collapse
")' . "\n
";
3861 // Management of focus and mandatory for fields
3862 if ($action == 'create' || $action == 'add' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF
"]))) || ((empty($action) || $action == 'addline') && (preg_match('/card\.php/', $_SERVER["PHP_SELF
"])))) {
3863 print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n
";
3864 $relativepathstring = $_SERVER["PHP_SELF
"];
3865 // Clean $relativepathstring
3866 if (constant('DOL_URL_ROOT')) {
3867 $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring);
3869 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
3870 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
3871 //$tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
3873 if (!empty($user->default_values[$relativepathstring]['focus'])) {
3874 foreach ($user->default_values[$relativepathstring]['focus'] as $defkey => $defval) {
3876 if ($defkey != '_noquery_') {
3877 $tmpqueryarraytohave = explode('&', $defkey);
3879 foreach ($tmpqueryarraytohave as $tmpquerytohave) {
3880 $tmpquerytohaveparam = explode('=', $tmpquerytohave);
3881 //print "console.log(
'".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');
";
3882 if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) {
3889 //var_dump($defkey.'-'.$qualified);
3895 print 'console.log("set the focus by executing jQuery(...).focus();
")' . "\n
";
3896 foreach ($defval as $paramkey => $paramval) {
3897 // Set focus on field
3898 print 'jQuery("input[
name=\
'' . $paramkey .
'\']
").focus();' . "\n
";
3899 print 'jQuery("textarea[
name=\
'' . $paramkey .
'\']
").focus();' . "\n
"; // TODO KO with ckeditor
3900 print 'jQuery("select[
name=\
'' . $paramkey .
'\']
").focus();' . "\n
"; // Not really useful, but we keep it in case of.
3905 if (!empty($user->default_values[$relativepathstring]['mandatory'])) {
3906 foreach ($user->default_values[$relativepathstring]['mandatory'] as $defkey => $defval) {
3908 if ($defkey != '_noquery_') {
3909 $tmpqueryarraytohave = explode('&', $defkey);
3911 foreach ($tmpqueryarraytohave as $tmpquerytohave) {
3912 $tmpquerytohaveparam = explode('=', $tmpquerytohave);
3913 //print "console.log(
'".$tmpquerytohaveparam[0]." ".$tmpquerytohaveparam[1]." ".GETPOST($tmpquerytohaveparam[0])."');
";
3914 if (!GETPOSTISSET($tmpquerytohaveparam[0]) || ($tmpquerytohaveparam[1] != GETPOST($tmpquerytohaveparam[0]))) {
3921 //var_dump($defkey.'-'.$qualified);
3927 print 'console.log("set the js code to manage fields that are
set as mandatory
");' . "\n
";
3929 foreach ($defval as $paramkey => $paramval) {
3930 // Solution 1: Add handler on submit to check if mandatory fields are empty
3931 print 'var form = $(\'[name="'.dol_escape_js($paramkey).'"]\').closest("form
");'."\n
";
3932 print "form.on(
'submit',
function(event) {
3933 var submitter = \$(
this).find(
':submit:focus').get(0);
3934 var buttonName = submitter ? \$(submitter).attr(
'name') :
'save';
3936 if (buttonName ==
'cancel') {
3937 console.log(
'We click on cancel button so we accept submit with no need to check mandatory fields');
3941 console.log(
'We did not click on cancel button but on something else, we check that field [name=".dol_escape_js($paramkey)."] is not empty');
3943 var tmpvalue = jQuery(
'[name=\"".dol_escape_js($paramkey)."\"]').val();
3944 let tmptypefield = jQuery(
'[name=\"".dol_escape_js($paramkey)."\"]').prop(
'nodeName').toLowerCase();
3946 if (tmptypefield ==
'textarea') {
3948 var tmpeditor = (typeof CKEDITOR !==
'undefined') ? CKEDITOR.instances[
'".dol_escape_js($paramkey)."'] :
null;
3950 tmpvalue = tmpeditor.getData();
3951 console.log(
'For textarea tmpvalue is '+tmpvalue);
3955 let tmpvalueisempty =
false;
3956 if (tmpvalue ===
null || tmpvalue === undefined || tmpvalue ===
'' || tmpvalue === -1 || tmpvalue ===
'-1') {
3957 tmpvalueisempty =
true;
3959 if (tmpvalue ===
'0' && (tmptypefield ==
'select' || tmptypefield ==
'input')) {
3960 tmpvalueisempty =
true;
3962 if (tmpvalueisempty && buttonName !==
'cancel') {
3963 console.log(
'field has type '+tmptypefield+
' and is empty, we cancel the submit');
3964 event.preventDefault();
3965 event.stopPropagation();
3967 alert(
'".dol_escape_js($langs->transnoentitiesnoconv("ErrorFieldRequired", $paramkey).' (
'.$langs->transnoentitiesnoconv("CustomMandatoryFieldRule").')
')."');
3971 console.log(
'field has type '+tmptypefield+
' and is defined to '+tmpvalue);
3976 // Solution 2: Add property 'required' on input
3977 // so browser will check value and try to focus on it when submitting the form.
3978 //print 'setTimeout(function() {'; // If we want to wait that ckeditor beuatifier has finished its job.
3979 //print 'jQuery("input[
name=\
''.$paramkey.
'\']
").prop(\'required\',true);'."\n
";
3980 //print 'jQuery("textarea[
id=\
''.$paramkey.
'\']
").prop(\'required\',true);'."\n
";
3981 //print 'jQuery("select[
name=\
''.$paramkey.
'\']
").prop(\'required\',true);'."\n
";*/
3982 //print '// required on a select works only if key is "", so we add the required attributes but also we reset the key -1 or 0 to an empty string'."\n
";
3983 //print 'jQuery("select[
name=\
''.$paramkey.
'\'] option[value=\
'-1\']").prop(\'value\', \'\');'.
"\n";
3989 print
'jQuery(\':input[name="' .
dol_escape_js($paramkey) .
'"]\').closest("tr").find("td:first").addClass("fieldrequired");' .
"\n";
3993 print
'jQuery("input[name=\'cancel\']").click(function() {
3994 console.log("We click on cancel button so removed all required attribute");
3995 jQuery("input, textarea, select").each(function(){this.removeAttribute(\'required\');});
4005 if (!empty($_SERVER[
'MAIN_SHOW_TUNING_INFO']) ||
getDolGlobalString(
'MAIN_SHOW_TUNING_INFO')) {
4007 print
"/* JS CODE TO ENABLE to add memory info */\n";
4008 print
'window.console && console.log("';
4013 if (!empty($micro_start_time)) {
4014 $micro_end_time = microtime(
true);
4015 print
' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) .
' ms';
4018 if (function_exists(
"memory_get_usage")) {
4019 print
' - Mem: ' . memory_get_usage();
4021 if (function_exists(
"memory_get_peak_usage")) {
4022 print
' - Real mem peak: ' . memory_get_peak_usage(
true);
4024 if (function_exists(
"zend_loader_file_encoded")) {
4025 print
' - Zend encoded file: ' . (zend_loader_file_encoded() ?
'yes' :
'no');
4030 print
"\n" .
'</script>' .
"\n";
4036 foreach ($tmptagarray as $tmptag) {
4038 print
"<!-- JS CODE TO ENABLE for google analtics tag -->\n";
4040 <!-- Global site tag (gtag.js) - Google Analytics -->
4041 <script nonce="' .
getNonce() .
'" async src="https://www.googletagmanager.com/gtag/js?id=' . trim($tmptag) .
'"></script>
4043 window.dataLayer = window.dataLayer || [];
4044 function gtag(){dataLayer.push(arguments);}
4045 gtag(\'js\', new Date());
4047 gtag(\'config\', \'' . trim($tmptag) .
'\');
4054 // Add Xdebug coverage of code
4055 if (defined('XDEBUGCOVERAGE
')) {
4056 print_r(xdebug_get_code_coverage());
4059 // Output string from hooks
4060 if (!empty($hookmanager->resPrint)) {
4061 print $hookmanager->resPrint;
4064 // Add DebugBar data
4065 if ($user->hasRight('debugbar
', 'read
')) {
4067 if ($debugbar instanceof DebugBar\DebugBar) {
4068 if (isset($debugbar['time
'])) {
4069 // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
4070 $debugbar['time
']->stopMeasure('pageaftermaster
');
4072 print '<!-- Output debugbar data -->
' . "\n";
4073 $renderer = $debugbar->getJavascriptRenderer();
4074 print $renderer->render();
4076 } elseif (count($conf->logbuffer)) { // If there is some logs in buffer to show
4078 print "<!-- Start of log output\n";
4079 //print '<div
class=
"hidden">
'."\n";
4080 foreach ($conf->logbuffer as $logline) {
4081 print $logline . "<br>\n";
4083 //print '</div>
'."\n";
4084 print "End of log output -->\n";
4097function dol_set_focus($selector, $nooutput = 0)
4099 $out = "\n" . '<!-- Set focus onto a specific field -->
' . "\n";
4100 $out .= '<script nonce=
"' . getNonce() . '">jQuery(document).ready(
function() { console.log(
"Force focus by dol_set_focus"); jQuery(\
'' .
dol_escape_js($selector) .
'\').focus(); });</script>
' . "\n";
4120function showSimpleHTMLTable($outputlangs, $object)
4124 $outputlangs->loadLangs(array("products"));
4126 $discountIsAvailable = false;
4127 $orderPositionHasNoPrice = false;
4129 if (!property_exists($object->lines[0], "remise_percent") ||
4130 !property_exists($object->lines[0], "fk_unit") ||
4131 !property_exists($object->lines[0], "multicurrency_total_ttc") ||
4132 !property_exists($object->lines[0], "description") ||
4133 !property_exists($object->lines[0], "qty")) {
4137 foreach ($object->lines as $order_position) {
4138 if (!property_exists($order_position, "price")) {
4139 $orderPositionHasNoPrice = true;
4143 if (!empty($order_position->remise_percent)) {
4144 $discountIsAvailable = true;
4149 if ($orderPositionHasNoPrice) {
4153 $discountHeader = $discountIsAvailable ? '<th style=
"width:120px">
'.$outputlangs->trans("Discount").'</th>
' : '';
4155 $table = '<
table border=
"0" cellpadding=
"1" cellspacing=
"1">
';
4159 <th style=
"width:50px; text-align:left">#</th>
4160 <th style=
"text-align:left">
'.$outputlangs->trans("Description").'</th>
4161 <th style=
"width:120px; text-align:right;">
'.$outputlangs->trans("Price").'</th>
4162 <th style=
"width:100px; text-align:right;">
'.$outputlangs->trans("Quantity").'</th>
4163 <th style=
"width:120px; text-align:right;">
'.$outputlangs->trans("Unit").'</th>
'.
4165 <th style=
"width:120px; text-align:right;">
'.$outputlangs->trans("Sum").'</th>
4170 foreach ($object->lines as $index => $order_position) {
4171 $position = $index + 1;
4172 $price = price($order_position->price, 0, $outputlangs, 0, -1, -1, $conf->currency);
4173 $unit = measuringUnitString($order_position->fk_unit, '', null, 1);
4174 $total = price($order_position->multicurrency_total_ttc, 0, $outputlangs, 0, -1, -1, $conf->currency);
4175 $discount = $discountIsAvailable ? '<td style=
"text-align:center">
'.$order_position->remise_percent.'%</td>
' : "";
4179 <td>
'.$position.'</td>
4180 <td>
'.$order_position->description.'</td>
4181 <td style=
"text-align:right">
'.$price.'</td>
4182 <td style=
"text-align:right">
'.$order_position->qty.'</td>
4183 <td style=
"text-align:right">
'.$unit.'</td>
'.
4185 <td style=
"text-align:right">
'.$total.'</td>
4188 $table .= '</tbody></
table>
';
4199function showDirectDownloadLink($object)
4204 $url = $object->getLastMainDocLink($object->element);
4206 $out .= img_picto($langs->trans("PublicDownloadLinkDesc"), 'globe
') . ' <span
class=
"opacitymedium">
' . $langs->trans("DirectDownloadLink") . '</span><br>
';
4208 $out .= '<div
class=
"urllink"><input
type=
"text" id=
"directdownloadlink" class=
"quatrevingtpercent" value=
"' . $url . '"></div>
';
4209 $out .= ajax_autoselect("directdownloadlink", '');
4211 $out .= '<div
class=
"urllink">
' . $langs->trans("FileNotShared") . '</div>
';
4228function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param = '
')
4230 global $conf, $langs;
4232 if (empty($conf->use_javascript_ajax)) {
4236 $isAllowedForPreview = dolIsAllowedForPreview($relativepath);
4238 if ($alldata == 1) {
4239 if ($isAllowedForPreview) {
4240 return array('target
' => '_blank
', 'css
' => 'documentpreview
', 'url
' => DOL_URL_ROOT . '/document.php?modulepart=
' . urlencode($modulepart) . '&attachment=0&file=
' . urlencode($relativepath) . ($param ? '&
' . $param : ''), 'mime
' => dol_mimetype($relativepath));
4246 // old behavior, return a string
4247 if ($isAllowedForPreview) {
4248 $tmpurl = DOL_URL_ROOT . '/document.php?modulepart=
' . urlencode($modulepart) . '&attachment=0&file=
' . urlencode($relativepath) . ($param ? '&
' . $param : '');
4249 $title = $langs->transnoentities("Preview");
4250 //$title = '%27-alert(document.domain)-%27
'; // An example of js injection into a corrupted title string, that should be blocked by the dol_escape_uri().
4251 //$tmpurl = 'file=
'.urlencode("'-alert(document.domain)-
'_small.jpg"); // An example of tmpurl that should be blocked by the dol_escape_uri()
4253 // We need to do a dol_escape_uri() on the full string after the javascript: because such parts are the URI and when we click on such links, a RFC3986 decode is done,
4254 // by the browser, converting the %27 (like when having param file=abc%27def), or when having a corrupted title), into a ', BEFORE interpreting the content that can be a js code.
4272function ajax_autoselect($htmlname, $addlink = '
', $textonlink = 'Link')
4275 $out = '<script nonce=
"' . getNonce() . '">
4276 jQuery(document).ready(
function () {
4277 jQuery(
"' . ((strpos($htmlname, '.') === 0 ? '' : '#') . $htmlname) . '").click(
function() { jQuery(
this).select(); } );
4281 if ($textonlink === 'image
') {
4282 $out .= ' <a href=
"' . $addlink . '" target=
"_blank" rel=
"noopener noreferrer">
' . img_picto('', 'globe
') . '</a>
';
4284 $out .= ' <a href=
"' . $addlink . '" target=
"_blank" rel=
"noopener noreferrer">
' . $langs->trans("Link") . '</a>
';
4304function dolGetBadge($label, $html = '
', $type = 'primary
', $mode = '', $url = '', $params = array())
4306 $csstouse = 'badge
';
4307 $csstouse .= (!empty($mode) ? ' badge-
' . $mode : '');
4308 $csstouse .= (!empty($type) ? ' badge-
' . $type : '');
4309 $csstouse .= (empty($params['css
']) ? '' : ' ' . $params['css
']);
4312 'class' => $csstouse
4320 $attr['href
'] = $url;
4323 if ($mode === 'dot
') {
4324 $attr['class'] .= ' classfortooltip
';
4325 $attr['title
'] = $html;
4326 $attr['aria-label
'] = $label;
4331 if (!empty($params['attr
']) && is_array($params['attr
'])) {
4332 foreach ($params['attr
'] as $key => $value) {
4333 if ($key == 'class') {
4334 $attr['class'] .= ' ' . $value;
4335 } elseif ($key == 'classOverride
') {
4336 $attr['class'] = $value;
4338 $attr[$key] = $value;
4345 // escape all attribute
4346 $attr = array_map('dolPrintHTMLForAttribute
', $attr);
4348 $TCompiledAttr = array();
4349 foreach ($attr as $key => $value) {
4350 $TCompiledAttr[] = $key . '=
"' . $value . '"';
4353 $compiledAttributes = !empty($TCompiledAttr) ? implode(' ', $TCompiledAttr) : '';
4355 $tag = !empty($url) ? 'a
' : 'span
';
4357 return '<
' . $tag . ' ' . $compiledAttributes . '>
' . $html . '</
' . $tag . '>
';
4374function dolGetStatus($statusLabel = '
', $statusLabelShort = '', $html = '', $statusType = 'status0
', $displayMode = 0, $url = '', $params = array())
4379 $dolGetBadgeParams = array();
4381 if (!empty($params['badgeParams
'])) {
4382 $dolGetBadgeParams = $params['badgeParams
'];
4385 // TODO : add a hook
4386 if ($displayMode == 0) {
4387 $return = !empty($html) ? $html : (empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort));
4388 } elseif ($displayMode == 1) {
4389 $return = !empty($html) ? $html : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort);
4390 } elseif (getDolGlobalString('MAIN_STATUS_USES_IMAGES
')) {
4391 // Use status with images (for backward compatibility)
4393 $htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '<span
class=
"hideonsmartphone">
' : '') . (!empty($html) ? $html : $statusLabel) . (in_array($displayMode, array(1, 2, 5)) ? '</span>
' : '');
4394 $htmlLabelShort = (in_array($displayMode, array(1, 2, 5)) ? '<span
class=
"hideonsmartphone">
' : '') . (!empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel)) . (in_array($displayMode, array(1, 2, 5)) ? '</span>
' : '');
4396 // For small screen, we always use the short label instead of long label.
4397 if (!empty($conf->dol_optimize_smallscreen)) {
4398 if ($displayMode == 0) {
4400 } elseif ($displayMode == 4) {
4402 } elseif ($displayMode == 6) {
4407 // For backward compatibility. Image's filename are still in French, so we use
this array to convert
4409 'status0' =>
'statut0',
4410 'status1' =>
'statut1',
4411 'status2' =>
'statut2',
4412 'status3' =>
'statut3',
4413 'status4' =>
'statut4',
4414 'status5' =>
'statut5',
4415 'status6' =>
'statut6',
4416 'status7' =>
'statut7',
4417 'status8' =>
'statut8',
4418 'status9' =>
'statut9'
4421 if (!empty($statusImg[$statusType])) {
4422 $htmlImg = img_picto($statusLabel, $statusImg[$statusType]);
4424 $htmlImg = img_picto($statusLabel, $statusType);
4427 if ($displayMode === 2) {
4428 $return = $htmlImg .
' ' . $htmlLabelShort;
4429 } elseif ($displayMode === 3) {
4431 } elseif ($displayMode === 4) {
4432 $return = $htmlImg .
' ' . $htmlLabel;
4433 } elseif ($displayMode === 5) {
4434 $return = $htmlLabelShort .
' ' . $htmlImg;
4436 $return = $htmlLabel .
' ' . $htmlImg;
4438 } elseif (!empty($displayMode)) {
4440 $statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort);
4442 $dolGetBadgeParams[
'attr'][
'class'] =
'badge-status';
4443 if (empty($dolGetBadgeParams[
'attr'][
'title'])) {
4444 $dolGetBadgeParams[
'attr'][
'title'] = empty($params[
'tooltip']) ? $statusLabel : ($params[
'tooltip'] !=
'no' ? $params[
'tooltip'] :
'');
4446 $dolGetBadgeParams[
'attr'][
'class'] .=
' classfortooltip';
4448 $dolGetBadgeParams[
'attr'][
'title'] =
dol_htmlentitiesbr((
string) $dolGetBadgeParams[
'attr'][
'title'], 1);
4451 if ($displayMode == 3) {
4452 $return = dolGetBadge((empty(
$conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)),
'', $statusType,
'dot', $url, $dolGetBadgeParams);
4453 } elseif ($displayMode === 5) {
4454 $return = dolGetBadge($statusLabelShort, $html, $statusType,
'', $url, $dolGetBadgeParams);
4456 $return = dolGetBadge(((empty(
$conf->dol_optimize_smallscreen) && $displayMode != 2) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)), $html, $statusType,
'', $url, $dolGetBadgeParams);
4502function dolGetButtonAction($label, $text =
'', $actionType =
'default', $url =
'',
$id =
'', $userRight = 1, $params = array())
4504 global $hookmanager, $action,
$object, $langs;
4507 if (is_array($url)) {
4509 foreach ($url as $key => $subbutton) {
4510 if (isset($subbutton[
'enabled']) && empty($subbutton[
'enabled'])) {
4517 if (array_key_exists(
'areDropdownButtons', $params) && $params[
"areDropdownButtons"] ===
false) {
4518 foreach ($url as $button) {
4519 if (!empty($button[
'lang'])) {
4520 $langs->load($button[
'lang']);
4522 $label = $langs->trans($button[
'label']);
4523 $text = $button[
'text'] ??
'';
4524 $actionType = $button[
'actionType'] ??
'';
4526 if (isset($button[
'urlraw']) && !empty($button[
'urlraw'])) {
4527 $tmpUrl = $button[
'urlraw'];
4528 } elseif (!empty($button[
'urlroot'])) {
4529 $tmpUrl = $button[
'urlroot'] . (empty($params[
'backtopage']) ?
'' :
'&backtopage=' . urlencode($params[
'backtopage']));
4530 } elseif (!empty($button[
'url'])) {
4531 $tmpUrl = DOL_URL_ROOT . $button[
'url'] . (empty($params[
'backtopage']) ?
'' :
'&backtopage=' . urlencode($params[
'backtopage']));
4534 $id = $button[
'id'] ??
'';
4535 $userRight = $button[
'perm'] ?? 1;
4536 $button[
'params'] = $button[
'params'] ?? [];
4538 $out .= dolGetButtonAction($label, $text, $actionType, $tmpUrl,
$id, $userRight, $button[
'params']);
4543 if (count($url) > 1 || !empty($params[
"forceDropdownButtons"])) {
4544 $out .=
'<div class="dropdown inline-block dropdown-holder">';
4545 $out .=
'<a style="margin-right: auto;" class="dropdown-toggle classfortooltip butAction' . ($userRight ?
'' :
'Refused') .
'" title="' .
dol_escape_htmltag($label) .
'" data-toggle="dropdown">' . ($text ? $text : $label) .
'</a>';
4546 $out .=
'<div class="dropdown-content">';
4547 foreach ($url as $subbutton) {
4548 if (!empty($subbutton[
'lang'])) {
4549 $langs->load($subbutton[
'lang']);
4552 if (!empty($subbutton[
'urlraw'])) {
4553 $tmpurl = $subbutton[
'urlraw'];
4555 $tmpurl = !empty($subbutton[
'urlroot']) ? $subbutton[
'urlroot'] : $subbutton[
'url'];
4559 $subbuttonparam = array();
4560 if (!empty($subbutton[
'attr'])) {
4561 $subbuttonparam[
'attr'] = $subbutton[
'attr'];
4563 $subbuttonparam[
'isDropDown'] = (empty($params[
'isDropDown']) ? ($subbutton[
'isDropDown'] ??
false) : $params[
'isDropDown']);
4565 $out .= dolGetButtonAction($subbutton[
'text'] ??
'', $langs->trans($subbutton[
'label']),
'default', $tmpurl, $subbutton[
'id'] ??
'', $subbutton[
'perm'], $subbuttonparam);
4570 foreach ($url as $subbutton) {
4571 if (!empty($subbutton[
'lang'])) {
4572 $langs->load($subbutton[
'lang']);
4575 if (!empty($subbutton[
'urlraw'])) {
4576 $tmpurl = $subbutton[
'urlraw'];
4578 $tmpurl = !empty($subbutton[
'urlroot']) ? $subbutton[
'urlroot'] : $subbutton[
'url'];
4582 $label = $langs->trans($subbutton[
'label']);
4583 $text = $subbutton[
'text'] ??
'';
4589 $out .= dolGetButtonAction($label, $text,
'default', $tmpurl,
'', $subbutton[
'perm'], $params);
4597 if (!empty($params[
'isDropdown']) || !empty($params[
'isDropDown'])) {
4598 $class =
"dropdown-item";
4600 $class =
'butAction';
4601 if ($actionType ==
'edit') {
4602 $class =
'butAction butActionEdit';
4603 } elseif ($actionType ==
'email') {
4604 $class =
'butAction butActionEmail';
4605 } elseif ($actionType ==
'clone') {
4606 $class =
'butAction butActionClone';
4607 } elseif ($actionType ==
'cancel') {
4608 $class =
'butAction butActionDelete';
4609 } elseif ($actionType ==
'danger' || $actionType ==
'delete') {
4610 $class =
'butAction butActionDelete';
4611 if (!empty($url) && strpos($url,
'token=') ===
false) {
4616 if (empty($label) && !empty($userRight) && $userRight > 0 && in_array($actionType, array(
'email',
'clone',
'delete',
'danger',
'cancel'))) {
4621 'href' => empty($url) ?
'' : $url,
4627 $attr[
'title'] =
'';
4629 $attr[
'title'] = $label;
4630 $attr[
'aria-label'] = $label;
4633 if (empty($userRight) || $userRight < 0) {
4634 $attr[
'class'] =
'butActionRefused';
4636 $attr[
'title'] = (($label && $text && $label != $text) ? $label :
'');
4637 $attr[
'title'] = ($attr[
'title'] ? $attr[
'title'] . (empty($userRight) ?
'<br>' :
'') :
'');
4638 $attr[
'title'] .= ((empty($userRight) && empty($label)) ? $langs->trans(
'NotEnoughPermissions') :
'');
4646 if (!empty($params[
'attr']) && is_array($params[
'attr'])) {
4647 foreach ($params[
'attr'] as $key => $value) {
4648 if ($key ==
'class') {
4649 $attr[
'class'] .=
' ' . $value;
4650 } elseif ($key ==
'classOverride') {
4651 $attr[
'class'] = $value;
4653 $attr[$key] = $value;
4659 if (!empty($attr[
'title']) && !empty($attr[
'class']) && strpos($attr[
'class'],
'classfortooltip') ===
false) {
4660 $attr[
'class'] .=
' classfortooltip';
4664 if ($userRight && !empty($params[
'confirm'])) {
4665 if (!is_array($params[
'confirm'])) {
4666 $params[
'confirm'] = array();
4669 if (empty($params[
'confirm'][
'url'])) {
4670 $params[
'confirm'][
'url'] = $url . (strpos($url,
'?') > 0 ?
'&' :
'?') .
'confirm=yes';
4674 $attr[
'data-confirm-url'] = $params[
'confirm'][
'url'];
4675 $attr[
'data-confirm-title'] = !empty($params[
'confirm'][
'title']) ? $params[
'confirm'][
'title'] : $langs->trans(
'ConfirmBtnCommonTitle', $label);
4676 $attr[
'data-confirm-content'] = !empty($params[
'confirm'][
'content']) ? $params[
'confirm'][
'content'] : $langs->trans(
'ConfirmBtnCommonContent', $label);
4677 $attr[
'data-confirm-content'] = preg_replace(
"/\r|\n/",
"", $attr[
'data-confirm-content']);
4678 $attr[
'data-confirm-action-btn-label'] = !empty($params[
'confirm'][
'action-btn-label']) ? $params[
'confirm'][
'action-btn-label'] : $langs->trans(
'Confirm');
4679 $attr[
'data-confirm-cancel-btn-label'] = !empty($params[
'confirm'][
'cancel-btn-label']) ? $params[
'confirm'][
'cancel-btn-label'] : $langs->trans(
'CloseDialog');
4680 $attr[
'data-confirm-modal'] = !empty($params[
'confirm'][
'modal']) ? $params[
'confirm'][
'modal'] :
true;
4682 $attr[
'class'] .=
' butActionConfirm';
4685 if (isset($attr[
'href']) && empty($attr[
'href'])) {
4686 unset($attr[
'href']);
4691 $TCompiledAttr = array();
4692 foreach ($attr as $key => $value) {
4693 if (!empty($params[
'use_unsecured_unescapedattr']) && is_array($params[
'use_unsecured_unescapedattr']) && in_array($key, $params[
'use_unsecured_unescapedattr'])) {
4696 } elseif (in_array($key, [
'href',
'data-confirm-url'])) {
4697 $value = dolPrintHTMLForAttributeUrl($value);
4699 $value = dolPrintHTMLForAttribute($value);
4702 $TCompiledAttr[] = $key .
'="' . $value .
'"';
4704 $compiledAttributes = empty($TCompiledAttr) ?
'' : implode(
' ', $TCompiledAttr);
4706 $tag = !empty($attr[
'href']) ?
'a' :
'span';
4708 $parameters = array(
4709 'TCompiledAttr' => $TCompiledAttr,
4710 'compiledAttributes' => $compiledAttributes,
4715 'actionType' => $actionType,
4718 'userRight' => $userRight,
4722 $reshook = $hookmanager->executeHooks(
'dolGetButtonAction', $parameters,
$object, $action);
4724 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
4727 if (empty($reshook)) {
4729 return '<' . $tag .
' ' . $compiledAttributes .
'><span class="textbutton">' . $text .
'</span></' . $tag .
'>';
4731 return '<' . $tag .
' ' . $compiledAttributes .
'><span class="textbutton">' .
dol_escape_htmltag($text) .
'</span></' . $tag .
'>';
4734 return $hookmanager->resPrint;
4770 $TCompiledAttr = array();
4775 foreach ($attr as $key => $value) {
4779 $TCompiledAttr[$key] = $key;
4784 if (!empty($unescapedAttr) && in_array($key, $unescapedAttr)) {
4787 } elseif (in_array($key, [
'href',
'data-confirm-url'])) {
4788 $value = dolPrintHTMLForAttributeUrl((
string) $value);
4790 $value = dolPrintHTMLForAttribute((
string) $value);
4793 $TCompiledAttr[$key] = $key .
'="' . $value .
'"';
4796 return $TCompiledAttr;
4868 $parsedUrl = parse_url($url);
4869 if ((isset($parsedUrl[
'scheme']) && in_array($parsedUrl[
'scheme'], [
'javascript',
'mailto',
'tel'])) || strpos($url,
'#') === 0) {
4873 if (!empty($parsedUrl[
'query'])) {
4876 parse_str($parsedUrl[
'query'], $urlQuery);
4877 if (!isset($urlQuery[
'backtopage']) && isset($params[
'backtopage'])) {
4878 $url .=
'&backtopage=' . urlencode($params[
'backtopage']);
4882 if (!isset($parsedUrl[
'scheme']) && $addDolUrlRoot) {
4883 $url = DOL_URL_ROOT . $url;
4898 return '<span class="button-title-separator ' . $moreClass .
'" ></span>';
4910 if (!empty($fieldValidationErrorMsg)) {
4911 $out .=
'<span class="field-error-icon classfortooltip" title="' .
dol_escape_htmltag($fieldValidationErrorMsg, 1) .
'" role="alert" >';
4912 $out .=
'<span class="fa fa-exclamation-circle" aria-hidden="true" ></span>';
4931function dolGetButtonTitle($label, $helpText =
'', $iconClass =
'fa fa-file', $url =
'',
$id =
'', $status = 1, $params = array())
4933 global $langs, $user;
4936 if (
getDolGlobalString(
'MAIN_BUTTON_HIDE_UNAUTHORIZED') && (!$user->admin) && $status <= 0) {
4940 if ($iconClass ==
'fa fa-th-list imgforviewmode') {
4941 $iconClass =
' fa fa-grip-horizontal imgforviewmode';
4944 $class =
'btnTitle';
4945 if (in_array($iconClass, array(
'fa fa-plus-circle',
'fa fa-plus-circle size15x',
'fa fa-comment-dots',
'fa fa-paper-plane'))) {
4946 $class .=
' btnTitlePlus';
4948 $useclassfortooltip = 1;
4950 if (!empty($params[
'morecss'])) {
4951 $class .=
' ' . $params[
'morecss'];
4956 'href' => empty($url) ?
'' : $url
4959 if (!empty($helpText)) {
4960 $attr[
'title'] = $helpText;
4962 $attr[
'title'] = $label;
4963 $useclassfortooltip = 0;
4967 $attr[
'class'] .=
' btnTitleSelected';
4968 } elseif ($status <= 0) {
4969 $attr[
'class'] .=
' refused';
4973 if ($status == -1) {
4974 $attr[
'title'] = $langs->transnoentitiesnoconv(
"FeatureDisabled");
4975 } elseif ($status == 0) {
4976 $attr[
'title'] = $langs->transnoentitiesnoconv(
"NotEnoughPermissions");
4980 if (!empty($attr[
'title']) && $useclassfortooltip) {
4981 $attr[
'class'] .=
' classfortooltip';
4989 if (!empty($params[
'attr']) && is_array($params[
'attr'])) {
4990 foreach ($params[
'attr'] as $key => $value) {
4991 if ($key ==
'class') {
4992 $attr[
'class'] .=
' ' . $value;
4993 } elseif ($key ==
'classOverride') {
4994 $attr[
'class'] = $value;
4996 $attr[$key] = $value;
5001 if (isset($attr[
'href']) && empty($attr[
'href'])) {
5002 unset($attr[
'href']);
5008 $TCompiledAttr = array();
5009 foreach ($attr as $key => $value) {
5013 $compiledAttributes = (empty($TCompiledAttr) ?
'' : implode(
' ', $TCompiledAttr));
5015 $tag = (empty($attr[
'href']) ?
'span' :
'a');
5017 $button =
'<' . $tag .
' ' . $compiledAttributes .
'>';
5018 $button .=
'<span class="' . $iconClass .
' valignmiddle btnTitle-icon"></span>';
5019 if (!empty($params[
'forcenohideoftext'])) {
5020 $button .=
'<span class="valignmiddle text-plus-circle btnTitle-label' . (empty($params[
'forcenohideoftext']) ?
' hideonsmartphone' :
'') .
'">' . $label .
'</span>';
5022 $button .=
'</' . $tag .
'>';
5042function startSimpleTable($header, $link =
"", $arguments =
"", $emptyColumns = 0, $number = -1, $pictofulllist =
'')
5046 print
'<div class="div-table-responsive-no-min">';
5047 print
'<table class="noborder centpercent">';
5048 print
'<tr class="liste_titre">';
5050 print ($emptyColumns < 1) ?
'<th>' :
'<th colspan="' . ($emptyColumns + 1) .
'">';
5052 print
'<span class="valignmiddle">' . $langs->trans($header) .
'</span>';
5054 if (!empty($link)) {
5055 if (!empty($arguments)) {
5056 print
'<a href="' . DOL_URL_ROOT .
'/' . $link .
'?' . $arguments .
'">';
5058 print
'<a href="' . DOL_URL_ROOT .
'/' . $link .
'">';
5063 print
'<span class="badge marginleftonlyshort">' . $number .
'</span>';
5064 } elseif (!empty($link)) {
5065 print
'<span class="badge marginleftonlyshort">...</span>';
5068 if (!empty($link)) {
5074 if ($number < 0 && !empty($link)) {
5075 print
'<th class="right">';
5095 if ($addLineBreak) {
5111function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0, $noneWord =
"None", $extraRightColumn =
false)
5116 print
'<tr class="oddeven">';
5117 print
'<td colspan="' . $tableColumnCount .
'"><span class="opacitymedium">' . $langs->trans($noneWord) .
'</span></td>';
5122 if ($nbofloop === 0) {
5132 if ($num > $nbofloop) {
5133 $colspan = $tableColumnCount;
5135 $colspan = $tableColumnCount - 1;
5138 if ($extraRightColumn) {
5142 print
'<tr class="liste_total">';
5144 if ($nbofloop > 0 && $num > $nbofloop) {
5145 print
'<td colspan="' . $colspan .
'" class="right">' . $langs->trans(
"XMoreLines", ($num - $nbofloop)) .
'</td>';
5147 print
'<td colspan="' . $colspan .
'" class="right"> ' . $langs->trans(
"Total") .
'</td>';
5148 print
'<td class="right centpercent">' .
price($total) .
'</td>';
5151 if ($extraRightColumn) {
5175 $result =
'<span class="clipboardCP' . ($showonlyonhover ?
' clipboardCPShowOnHover valignmiddle' :
'') .
'">';
5176 if ($texttoshow ===
'none') {
5177 $result .=
'<' . $tag .
' class="clipboardCPValue hidewithsize">' .
dol_escape_htmltag($valuetocopy, 1, 1) .
'</' . $tag .
'>';
5178 $result .=
'<span class="clipboardCPValueToPrint"></span>';
5179 } elseif ($texttoshow) {
5180 $result .=
'<' . $tag .
' class="clipboardCPValue hidewithsize">' .
dol_escape_htmltag($valuetocopy, 1, 1) .
'</' . $tag .
'>';
5181 $result .=
'<span class="clipboardCPValueToPrint">' .
dol_escape_htmltag($texttoshow, 1, 1) .
'</span>';
5183 $result .=
'<' . $tag .
' class="clipboardCPValue">' .
dol_escape_htmltag($valuetocopy, 1, 1) .
'</' . $tag .
'>';
5185 $result .=
'<span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft pictomodule" title="' . dolPrintHTML($langs->trans(
"ClickToCopyToClipboard")) .
'"></span>';
5186 $result .= img_picto(
'',
'tick',
'class="clipboardCPTick hidden paddingleft pictomodule"');
5187 $result .=
'<span class="clipboardCPText"></span>';
5188 $result .=
'</span>';
5212function show_actions_messaging(
$conf, $langs, $db, $filterobj, $objcon =
null, $noprint = 0, $actioncode =
'', $donetodo =
'done', $filters = array(), $sortfield =
'a.datep,a.id', $sortorder =
'DESC')
5214 dol_syslog(
'show_actions_messaging::begin', LOG_DEBUG);
5215 global $user,
$conf;
5218 global $param, $massactionbutton;
5220 require_once DOL_DOCUMENT_ROOT .
'/comm/action/class/actioncomm.class.php';
5223 if (!is_object($filterobj) && !is_object($objcon)) {
5224 dol_print_error(
null,
'BadParameter');
5228 '@phan-var-force array<int,array{type:string,tododone:string,id:string,datestart:int|string,dateend:int|string,fulldayevent:int,note:string,message:string,percent:string,userid:string,login:string,userfirstname:string,userlastname:string,userphoto:string,msg_from?:string,contact_id?:string,socpeopleassigned?:int[],lastname?:string,firstname?:string,fk_element?:int,elementtype?:string,acode:string,alabel?:string,libelle?:string,apicto?:string}> $histo';
5233 $sortfield_list = explode(
',', $sortfield);
5234 $sortfield_label_list = array(
'a.id' =>
'id',
'a.datep' =>
'dp',
'a.percent' =>
'percent');
5235 $sanitized_sortfield_new_list = array();
5236 foreach ($sortfield_list as $sortfield_value) {
5237 $sanitized_sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)];
5239 $sanitized_sortfield_new = implode(
',', $sanitized_sortfield_new_list);
5246 if (is_object($objcon) && $objcon->id > 0) {
5247 $sql =
"SELECT DISTINCT a.id, a.label as label,";
5249 $sql =
"SELECT a.id, a.label as label,";
5251 $sql .=
" a.datep as dp,";
5252 $sql .=
" a.note as message,";
5253 $sql .=
" a.datep2 as dp2,";
5254 $sql .=
" a.percent as percent, 'action' as type,";
5255 $sql .=
" a.fk_element, a.elementtype,";
5256 $sql .=
" a.fk_contact, a.fulldayevent,";
5257 $sql .=
" a.email_from as msg_from,";
5258 $sql .=
" c.code as acode, c.libelle as alabel, c.picto as apicto,";
5259 $sql .=
" u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
5260 if (is_object($filterobj) && get_class($filterobj) ==
'Societe') {
5261 $sql .=
", sp.lastname, sp.firstname";
5262 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
5263 $sql .=
", m.lastname, m.firstname";
5264 } elseif (is_object($filterobj) && in_array(get_class($filterobj), array(
'Commande',
'CommandeFournisseur',
'Product',
'Ticket',
'BOM',
'Contrat',
'Facture',
'FactureFournisseur',
'Propal',
'Expedition'))) {
5267 if (is_object($filterobj) && !empty($filterobj->table_element) && !empty($filterobj->element) && !empty($filterobj->id) && array_key_exists(
'ref', $filterobj->fields)) {
5271 $sql .=
" FROM " . MAIN_DB_PREFIX .
"actioncomm as a";
5272 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"user as u on u.rowid = a.fk_user_action";
5273 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"c_actioncomm as c ON a.fk_action = c.id";
5275 $force_filter_contact = $filterobj instanceof
User;
5277 if (is_object($objcon) && $objcon->id > 0) {
5278 $force_filter_contact =
true;
5279 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"actioncomm_resources as r ON a.id = r.fk_actioncomm";
5280 $sql .=
" AND r.element_type = '" . $db->escape($objcon->table_element) .
"' AND r.fk_element = " . ((int) $objcon->id);
5283 if ((is_object($filterobj) && get_class($filterobj) ==
'Societe') || (is_object($filterobj) && get_class($filterobj) ==
'Contact')) {
5284 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"socpeople as sp ON a.fk_contact = sp.rowid";
5285 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Dolresource') {
5286 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"element_resources as er";
5287 $sql .=
" ON er.resource_type = 'dolresource'";
5288 $sql .=
" AND er.element_id = a.id";
5289 $sql .=
" AND er.resource_id = " . ((int) $filterobj->id);
5290 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
5291 $sql .=
", " . MAIN_DB_PREFIX .
"adherent as m";
5292 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
5293 $sql .=
", " . MAIN_DB_PREFIX .
"commande_fournisseur as o";
5294 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
5295 $sql .=
", " . MAIN_DB_PREFIX .
"product as o";
5296 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
5297 $sql .=
", " . MAIN_DB_PREFIX .
"ticket as o";
5298 } elseif (is_object($filterobj) && get_class($filterobj) ==
'BOM') {
5299 $sql .=
", " . MAIN_DB_PREFIX .
"bom_bom as o";
5300 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contrat') {
5301 $sql .=
", " . MAIN_DB_PREFIX .
"contrat as o";
5302 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Facture') {
5303 $sql .=
", " . MAIN_DB_PREFIX .
"facture as o";
5304 } elseif (is_object($filterobj) && get_class($filterobj) ==
'FactureFournisseur') {
5305 $sql .=
", " . MAIN_DB_PREFIX .
"facture_fourn as o";
5306 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Commande') {
5307 $sql .=
", " . MAIN_DB_PREFIX .
"commande as o";
5308 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Expedition') {
5309 $sql .=
", " . MAIN_DB_PREFIX .
"expedition as o";
5310 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Propal') {
5311 $sql .=
", " . MAIN_DB_PREFIX .
"propal as o";
5313 if (is_object($filterobj) && !empty($filterobj->table_element) && !empty($filterobj->element) && !empty($filterobj->id) && array_key_exists(
'ref', $filterobj->fields)) {
5314 $sql .=
", " . MAIN_DB_PREFIX . $filterobj->table_element .
" as o";
5317 $sql .=
" WHERE a.entity IN (" .
getEntity(
'agenda') .
")";
5318 if (!$force_filter_contact) {
5319 if (is_object($filterobj) && in_array(get_class($filterobj), array(
'Societe',
'Client',
'Fournisseur')) && $filterobj->id) {
5320 $sql .=
" AND a.fk_soc = " . ((int) $filterobj->id);
5321 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Project' && $filterobj->id) {
5322 $sql .=
" AND a.fk_project = o.rowid AND a.fk_project = " . ((int) $filterobj->id);
5323 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
5324 $sql .=
" AND a.fk_element = m.rowid AND a.elementtype = 'member'";
5325 if ($filterobj->id) {
5326 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5328 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Commande') {
5329 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'order'";
5330 if ($filterobj->id) {
5331 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5333 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Expedition') {
5334 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'shipping'";
5335 if ($filterobj->id) {
5336 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5338 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Propal') {
5339 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'propal'";
5340 if ($filterobj->id) {
5341 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5343 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
5344 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
5345 if ($filterobj->id) {
5346 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5348 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
5349 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'product'";
5350 if ($filterobj->id) {
5351 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5353 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
5354 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
5355 if ($filterobj->id) {
5356 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5358 } elseif (is_object($filterobj) && get_class($filterobj) ==
'BOM') {
5359 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
5360 if ($filterobj->id) {
5361 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5363 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contrat') {
5364 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
5365 if ($filterobj->id) {
5366 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5368 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contact' && $filterobj->id) {
5369 $sql .=
" AND a.fk_contact = sp.rowid";
5370 $sql .=
" AND a.fk_contact = " . ((int) $filterobj->id);
5371 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Facture') {
5372 $sql .=
" AND a.fk_element = o.rowid";
5373 if ($filterobj->id) {
5374 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id) .
" AND a.elementtype = 'invoice'";
5376 } elseif (is_object($filterobj) && get_class($filterobj) ==
'FactureFournisseur') {
5377 $sql .=
" AND a.fk_element = o.rowid";
5378 if ($filterobj->id) {
5379 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id) .
" AND a.elementtype = 'invoice_supplier'";
5382 if (is_object($filterobj) && !empty($filterobj->element) && !empty($filterobj->id) && array_key_exists(
'ref', $filterobj->fields)) {
5383 $sql .=
" AND a.fk_element = o.rowid";
5384 $sql .=
" AND a.elementtype = '" . $db->escape($filterobj->element) .
"'";
5385 $sql .=
" AND a.fk_element = " . ((int) $filterobj->id);
5389 $sql .=
" AND u.rowid = " . ((int) $filterobj->id);
5393 if (!empty($actioncode) && $actioncode !=
'-1') {
5395 if ($actioncode ==
'AC_NON_AUTO') {
5396 $sql .=
" AND c.type != 'systemauto'";
5397 } elseif ($actioncode ==
'AC_ALL_AUTO') {
5398 $sql .=
" AND c.type = 'systemauto'";
5400 if ($actioncode ==
'AC_OTH') {
5401 $sql .=
" AND c.type != 'systemauto'";
5402 } elseif ($actioncode ==
'AC_OTH_AUTO') {
5403 $sql .=
" AND c.type = 'systemauto'";
5407 if ($actioncode ==
'AC_NON_AUTO') {
5408 $sql .=
" AND c.type != 'systemauto'";
5409 } elseif ($actioncode ==
'AC_ALL_AUTO') {
5410 $sql .=
" AND c.type = 'systemauto'";
5412 $sql .=
" AND c.code = '" . $db->escape($actioncode) .
"'";
5416 if ($donetodo ==
'todo') {
5417 $sql .=
" AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '" . $db->idate($now) .
"'))";
5418 } elseif ($donetodo ==
'done') {
5419 $sql .=
" AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '" . $db->idate($now) .
"'))";
5421 if (is_array($filters) && $filters[
'search_agenda_label']) {
5422 $sql .=
natural_search(
'a.label', $filters[
'search_agenda_label']);
5429 && (empty($actioncode) || $actioncode ==
'AC_OTH_AUTO' || $actioncode ==
'AC_EMAILING')
5431 $langs->load(
"mails");
5433 $sql2 =
"SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
5434 $sql2 .=
", null as fk_element, '' as elementtype, null as contact_id";
5435 $sql2 .=
", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
5436 $sql2 .=
", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
5437 if (is_object($filterobj) && get_class($filterobj) ==
'Societe') {
5438 $sql2 .=
", '' as lastname, '' as firstname";
5439 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
5440 $sql2 .=
", '' as lastname, '' as firstname";
5441 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
5442 $sql2 .=
", '' as ref";
5443 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
5444 $sql2 .=
", '' as ref";
5445 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
5446 $sql2 .=
", '' as ref";
5448 $sql2 .=
" FROM " . MAIN_DB_PREFIX .
"mailing as m, " . MAIN_DB_PREFIX .
"mailing_cibles as mc, " . MAIN_DB_PREFIX .
"user as u";
5449 $sql2 .=
" WHERE mc.email = '" . $db->escape((
string) $objcon->email) .
"'";
5450 $sql2 .=
" AND mc.statut = 1";
5451 $sql2 .=
" AND u.rowid = m.fk_user_valid";
5452 $sql2 .=
" AND mc.fk_mailing=m.rowid";
5456 $MAXWITHOUTPAGINATION =
getDolGlobalInt(
'AGENDA_MAX_EVENTS_ON_PAGE_WITHOUT_PAGINATION', 100);
5458 if ($sql || $sql2) {
5459 if (!empty($sql) && !empty($sql2)) {
5460 $sql = $sql .
" UNION " . $sql2;
5461 } elseif (empty($sql) && !empty($sql2)) {
5467 $limit = $MAXWITHOUTPAGINATION;
5470 $sql .= $db->order($sanitized_sortfield_new, $sortorder);
5472 $sql .= $db->plimit($limit + 1, $offset);
5475 dol_syslog(
"function.lib::show_actions_messaging", LOG_DEBUG);
5477 $resql = $db->query($sql);
5480 $num = $db->num_rows($resql);
5482 $imaxinloop = ($limit ? min($num, $limit) : $num);
5483 while ($i < $imaxinloop) {
5484 $obj = $db->fetch_object($resql);
5486 if ($obj->type ==
'action') {
5488 $contactaction->id = $obj->id;
5489 $result = $contactaction->fetchResources();
5491 dol_print_error($db);
5492 setEventMessage(
"actions.lib::show_actions_messaging Error fetch resource",
'errors');
5498 if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->dp > $now)) {
5502 $histo[$numaction] = array(
5503 'type' => $obj->type,
5504 'tododone' => $tododone,
5506 'datestart' => $db->jdate($obj->dp),
5507 'dateend' => $db->jdate($obj->dp2),
5508 'fulldayevent' => (
int) $obj->fulldayevent,
5509 'note' => $obj->label,
5510 'message' => $obj->message,
5511 'percent' => $obj->percent,
5513 'userid' => $obj->user_id,
5514 'login' => $obj->user_login,
5515 'userfirstname' => $obj->user_firstname,
5516 'userlastname' => $obj->user_lastname,
5517 'userphoto' => $obj->user_photo,
5518 'msg_from' => $obj->msg_from,
5520 'contact_id' => $obj->fk_contact,
5521 'socpeopleassigned' => $contactaction->socpeopleassigned,
5522 'lastname' => (empty($obj->lastname) ?
'' : $obj->lastname),
5523 'firstname' => (empty($obj->firstname) ?
'' : $obj->firstname),
5524 'fk_element' => $obj->fk_element,
5525 'elementtype' => $obj->elementtype,
5527 'acode' => $obj->acode,
5528 'alabel' => $obj->alabel,
5529 'libelle' => $obj->alabel,
5530 'apicto' => $obj->apicto
5533 $histo[$numaction] = array(
5534 'type' => $obj->type,
5535 'tododone' =>
'done',
5537 'datestart' => $db->jdate($obj->dp),
5538 'dateend' => $db->jdate($obj->dp2),
5539 'fulldayevent' => (
int) $obj->fulldayevent,
5540 'note' => $obj->label,
5541 'message' => $obj->message,
5542 'percent' => $obj->percent,
5543 'acode' => $obj->acode,
5545 'userid' => $obj->user_id,
5546 'login' => $obj->user_login,
5547 'userfirstname' => $obj->user_firstname,
5548 'userlastname' => $obj->user_lastname,
5549 'userphoto' => $obj->user_photo
5557 dol_print_error($db);
5565 $langs->loadLangs(array(
"admin",
"errors"));
5566 $out =
info_admin($langs->trans(
"WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv(
"Module2400Name")), 0, 0,
'warning');
5570 $delay_warning =
getDolGlobalInt(
'MAIN_DELAY_ACTIONS_TODO') * 24 * 60 * 60;
5572 require_once DOL_DOCUMENT_ROOT .
'/comm/action/class/actioncomm.class.php';
5573 include_once DOL_DOCUMENT_ROOT .
'/core/lib/functions2.lib.php';
5574 require_once DOL_DOCUMENT_ROOT .
'/core/class/html.formactions.class.php';
5575 require_once DOL_DOCUMENT_ROOT .
'/contact/class/contact.class.php';
5580 $userstatic =
new User($db);
5581 $contactstatic =
new Contact($db);
5582 $userGetNomUrlCache = array();
5583 $contactGetNomUrlCache = array();
5585 $out .=
'<div class="filters-container" >';
5586 $out .=
'<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER[
"PHP_SELF"] .
'" method="POST" spellcheck="false">';
5587 $out .=
'<input type="hidden" name="token" value="' .
newToken() .
'">';
5590 $objcon && get_class($objcon) ==
'Contact' &&
5591 (is_null($filterobj) || get_class($filterobj) ==
'Societe')
5593 $out .=
'<input type="hidden" name="id" value="' . $objcon->id .
'" />';
5595 $out .=
'<input type="hidden" name="id" value="' . $filterobj->id .
'" />';
5597 if (($filterobj && get_class($filterobj) ==
'Societe')) {
5598 $out .=
'<input type="hidden" name="socid" value="' . $filterobj->id .
'" />';
5600 $out .=
'<input type="hidden" name="userid" value="' . $filterobj->id .
'" />';
5605 $out .=
'<div class="div-table-responsive-no-min">';
5606 $out .=
'<table class="noborder borderbottom centpercent">';
5608 $out .=
'<tr class="liste_titre">';
5611 if (
$conf->main_checkbox_left_column) {
5612 $out .=
'<th class="liste_titre width50 middle">';
5613 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
5614 $out .= $searchpicto;
5619 $out .=
getTitleFieldOfList(
'Date', 0, $_SERVER[
"PHP_SELF"],
'a.datep',
'', $param,
'', $sortfield, $sortorder,
'nowraponall nopaddingleftimp ') .
"\n";
5621 $out .=
'<th class="liste_titre hideonsmartphone"><strong class="hideonsmartphone">' . $langs->trans(
"Search") .
' : </strong></th>';
5623 $out .=
'<th class="liste_titre"></th>';
5626 $out .=
'<th class="liste_titre">';
5627 $out .=
'<span class="fas fa-square inline-block fawidth30 hideonsmartphone" style="color: #ddd;" title="' . $langs->trans(
"ActionType") .
'"></span>';
5628 $out .= $formactions->select_type_actions($actioncode,
"actioncode",
'',
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? -1 : 1, 0, 0, 1,
'selecttype minwidth100', $langs->trans(
"Type"));
5631 $out .=
'<th class="liste_titre maxwidth100onsmartphone">';
5632 $out .=
'<input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="' . $filters[
'search_agenda_label'] .
'" placeholder="' . $langs->trans(
"Label") .
'">';
5636 if (!
$conf->main_checkbox_left_column) {
5637 $out .=
'<th class="liste_titre width50 middle">';
5638 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
5639 $out .= $searchpicto;
5652 $out .=
'<ul class="timeline">';
5656 if ($filterobj instanceof
Societe) {
5657 $tmp .=
'<a href="' . DOL_URL_ROOT .
'/comm/action/list.php?mode=show_list&socid=' . $filterobj->id .
'&status=done">';
5659 if ($filterobj instanceof
User) {
5660 $tmp .=
'<a href="' . DOL_URL_ROOT .
'/comm/action/list.php?mode=show_list&socid=' . $filterobj->id .
'&status=done">';
5662 $tmp .= ($donetodo !=
'done' ? $langs->trans(
"ActionsToDoShort") :
'');
5663 $tmp .= ($donetodo !=
'done' && $donetodo !=
'todo' ?
' / ' :
'');
5664 $tmp .= ($donetodo !=
'todo' ? $langs->trans(
"ActionsDoneShort") :
'');
5666 if ($filterobj instanceof
Societe) {
5669 if ($filterobj instanceof
User) {
5675 require_once DOL_DOCUMENT_ROOT .
'/comm/action/class/cactioncomm.class.php';
5677 $arraylist = $caction->liste_array(1,
'code',
'', (!
getDolGlobalString(
'AGENDA_USE_EVENT_TYPE') ? 1 : 0),
'', 1);
5679 $actualCycleDate =
false;
5682 foreach ($histo as $key => $value) {
5683 $actionstatic->fetch($histo[$key][
'id']);
5685 $actionstatic->type_picto = $histo[$key][
'apicto'];
5686 $actionstatic->type_code = $histo[$key][
'acode'];
5688 $labeltype = $actionstatic->type_code;
5690 $labeltype =
'AC_OTH';
5692 if (!empty($actionstatic->code) && preg_match(
'/^TICKET_MSG/', $actionstatic->code)) {
5693 $labeltype = $langs->trans(
"Message");
5695 if (!empty($arraylist[$labeltype])) {
5696 $labeltype = $arraylist[$labeltype];
5698 if ($actionstatic->type_code ==
'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labeltype && !empty($arraylist[$actionstatic->code])) {
5699 $labeltype .=
' - ' . $arraylist[$actionstatic->code];
5703 $url = DOL_URL_ROOT .
'/comm/action/card.php?id=' . $histo[$key][
'id'];
5705 $tmpa =
dol_getdate($histo[$key][
'datestart'],
false);
5707 if (isset($tmpa[
'year']) && isset($tmpa[
'yday']) && $actualCycleDate !== $tmpa[
'year'] .
'-' . $tmpa[
'yday']) {
5708 $actualCycleDate = $tmpa[
'year'] .
'-' . $tmpa[
'yday'];
5709 $out .=
'<!-- timeline time label -->';
5710 $out .=
'<li class="time-label">';
5711 $out .=
'<span class="timeline-badge-date">';
5712 $out .=
dol_print_date($histo[$key][
'datestart'],
'daytext',
'tzuserrel', $langs);
5715 $out .=
'<!-- /.timeline-label -->';
5719 $out .=
'<!-- timeline item -->' .
"\n";
5720 $out .=
'<li class="timeline-code-' . (!empty($actionstatic->code) ? strtolower($actionstatic->code) :
"none") .
'">';
5723 $typeicon = $actionstatic->getTypePicto(
'pictofixedwidth timeline-icon-not-applicble', $labeltype);
5728 $out .=
'<div class="timeline-item">' .
"\n";
5730 $out .=
'<span class="time timeline-header-action2">';
5732 if (isset($histo[$key][
'type']) && $histo[$key][
'type'] ==
'mailing') {
5733 $out .=
'<a class="paddingleft paddingright timeline-btn2 editfielda" href="' . DOL_URL_ROOT .
'/comm/mailing/card.php?id=' . $histo[$key][
'id'] .
'">' . img_object($langs->trans(
"ShowEMailing"),
"email") .
' ';
5734 $out .= $histo[$key][
'id'];
5737 $out .= $actionstatic->getNomUrl(1, -1,
'valignmiddle') .
' ';
5741 $user->hasRight(
'agenda',
'allactions',
'create') ||
5742 (($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->hasRight(
'agenda',
'myactions',
'create'))
5744 $out .=
'<a class="paddingleft paddingright timeline-btn2 editfielda" href="' . DOL_MAIN_URL_ROOT .
'/comm/action/card.php?action=edit&token=' .
newToken() .
'&id=' . $actionstatic->id .
'&backtopage=' . urlencode($_SERVER[
"PHP_SELF"] .
'?' . $param) .
'">';
5746 $out .= img_picto($langs->trans(
"Modify"),
'edit',
'class="edita"');
5753 $out .=
'<span class="time"><i class="fa fa-clock valignmiddle"></i> ';
5754 $out .=
'<span class="valignmiddle marginrightonly">';
5755 $out .=
dol_print_date($histo[$key][
'datestart'],
'day',
'tzuserrel');
5758 $out .=
' '.dol_print_date($histo[$key][
'datestart'],
'hour',
'tzuserrel',
null,
false,
'opacitymedium');
5760 if ($histo[$key][
'dateend'] && $histo[$key][
'dateend'] != $histo[$key][
'datestart']) {
5761 $tmpa =
dol_getdate($histo[$key][
'datestart'],
true);
5762 $tmpb =
dol_getdate($histo[$key][
'dateend'],
true);
5763 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
5764 $out .=
' - ' .
dol_print_date($histo[$key][
'dateend'],
'hour',
'tzuserrel',
null,
false, 1);
5766 $out .=
' - ' .
dol_print_date($histo[$key][
'dateend'],
'day',
'tzuserrel');
5768 $out .=
' '.dol_print_date($histo[$key][
'dateend'],
'hour',
'tzuserrel',
null,
false,
'opacitymedium');
5773 if ($histo[$key][
'percent'] == 0 && $histo[$key][
'datestart'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) {
5776 if ($histo[$key][
'percent'] == 0 && !$histo[$key][
'datestart'] && $histo[$key][
'dateend'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) {
5779 if ($histo[$key][
'percent'] > 0 && $histo[$key][
'percent'] < 100 && $histo[$key][
'dateend'] && $histo[$key][
'dateend'] < ($now - $delay_warning)) {
5782 if ($histo[$key][
'percent'] > 0 && $histo[$key][
'percent'] < 100 && !$histo[$key][
'dateend'] && $histo[$key][
'datestart'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) {
5786 $out .= img_warning($langs->trans(
"Late")) .
' ';
5788 $out .=
"</span></span>\n";
5790 $out .=
'<span class="time">';
5791 $out .= $actionstatic->getLibStatut(2);
5795 $out .=
'<h3 class="timeline-header">';
5798 $out .=
'<div class="messaging-author inline-block tdoverflowmax150 valignmiddle marginrightonly">';
5799 if ($histo[$key][
'userid'] > 0) {
5800 if (!isset($userGetNomUrlCache[$histo[$key][
'userid']])) {
5801 $userstatic->fetch($histo[$key][
'userid']);
5802 $userGetNomUrlCache[$histo[$key][
'userid']] = $userstatic->getNomUrl(-1,
'', 0, 0, 16, 0,
'firstelselast',
'');
5804 $out .= $userGetNomUrlCache[$histo[$key][
'userid']];
5805 } elseif (!empty($histo[$key][
'msg_from']) && $actionstatic->code ==
'TICKET_MSG') {
5806 if (!isset($contactGetNomUrlCache[$histo[$key][
'msg_from']])) {
5807 if ($contactstatic->fetch(0,
null,
'', $histo[$key][
'msg_from']) > 0) {
5808 $contactGetNomUrlCache[$histo[$key][
'msg_from']] = $contactstatic->getNomUrl(-1,
'', 16);
5810 $contactGetNomUrlCache[$histo[$key][
'msg_from']] = $histo[$key][
'msg_from'];
5813 $out .= $contactGetNomUrlCache[$histo[$key][
'msg_from']];
5815 $out .=
'<img class="photomemberphoto userphoto" alt="" src="/public/theme/common/user_anonymous.png">'.$langs->trans(
"Anonymous");
5820 $out .=
' <div class="messaging-title inline-block">';
5822 if (empty(
$conf->dol_optimize_smallscreen) && $actionstatic->type_code !=
'AC_OTH_AUTO') {
5823 $out .= $labeltype .
' - ';
5828 if (!empty($actionstatic->code) && preg_match(
'/^TICKET_MSG_PRIVATE/', $actionstatic->code)) {
5829 $out .= $langs->trans(
'TicketNewMessage').
' - <em>'.img_picto($langs->trans(
'Private'),
'lock',
'class="valignmiddle"').
' '.$langs->trans(
'Private').
'</em>';
5830 $summary = preg_replace(
'/\[[^\]]*\]\s*/',
'', $actionstatic->label);
5832 $out .=
' - '.dolPrintHTML($summary);
5834 } elseif (!empty($actionstatic->code) && preg_match(
'/^TICKET_MSG/', $actionstatic->code)) {
5835 $out .= $langs->trans(
'TicketNewMessage');
5836 } elseif (isset($histo[$key][
'type'])) {
5837 if ($histo[$key][
'type'] ==
'action') {
5838 $transcode = $langs->transnoentitiesnoconv(
"Action" . $histo[$key][
'acode']);
5840 $tmplabel = $histo[$key][
'note'];
5841 $actionstatic->id = $histo[$key][
'id'];
5842 if ($tmplabel != $labeltype) {
5845 } elseif ($histo[$key][
'type'] ==
'mailing') {
5846 $out .=
'<a href="' . DOL_URL_ROOT .
'/comm/mailing/card.php?id=' . $histo[$key][
'id'] .
'">' . img_object($langs->trans(
"ShowEMailing"),
"email") .
' ';
5847 $transcode = $langs->transnoentitiesnoconv(
"Action" . $histo[$key][
'acode']);
5848 $tmplabel = ($transcode !=
"Action" . $histo[$key][
'acode'] ? $transcode :
'Send mass mailing');
5851 $tmplabel .= $histo[$key][
'note'];
5855 $out = preg_replace(
'/ - $/',
'', $out);
5857 if (isset($histo[$key][
'elementtype']) && !empty($histo[$key][
'fk_element'])) {
5858 if (isset(
$conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']]) && isset(
$conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']][$histo[$key][
'fk_element']])) {
5859 $link =
$conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']][$histo[$key][
'fk_element']];
5861 if (!isset(
$conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']])) {
5862 $conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']] = array();
5864 $link =
dolGetElementUrl($histo[$key][
'fk_element'], $histo[$key][
'elementtype'], 1);
5865 $conf->cache[
'elementlinkcache'][$histo[$key][
'elementtype']][$histo[$key][
'fk_element']] = $link;
5870 if (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
5871 if ($histo[$key][
'elementtype'] ==
'ticket') {
5876 if ($link && $showlink) {
5877 $out .=
' - ' . $link;
5886 if ($actionstatic->code ==
'AC_TICKET_CREATE') {
5887 $newmess = $filterobj->message;
5889 $newmess = $histo[$key][
'message'];
5892 !empty($newmess && $newmess != $tmplabel)
5893 && $actionstatic->code !=
'AC_TICKET_MODIFY'
5895 $out .=
'<div class="timeline-body wordbreak small">';
5896 $truncateLines =
getDolGlobalInt(
'MAIN_TRUNCATE_TIMELINE_MESSAGE', 3);
5902 if ($truncateLines > 0 && strlen($newmess) > strlen($truncatedText)) {
5903 $out .=
'<div class="readmore-block --closed" >';
5904 $out .=
' <div class="readmore-block__excerpt">';
5905 $out .= dolPrintHTML($truncatedText, 0, array(
'pre',
'code'));
5906 $out .=
' <br><a class="read-more-link" data-read-more-action="open" href="' . DOL_MAIN_URL_ROOT .
'/comm/action/card.php?id=' . $actionstatic->id .
'&backtopage=' . urlencode($_SERVER[
"PHP_SELF"] .
'?' . $param) .
'" >' . $langs->trans(
"ReadMore") .
' <span class="fa fa-chevron-right" aria-hidden="true"></span></a>';
5908 $out .=
' <div class="readmore-block__full-text" >';
5910 $out .= dolPrintHTML($newmess, 0, array(
'pre',
'code'));
5912 $out .=
' <a class="read-less-link" data-read-more-action="close" href="#" ><span class="fa fa-chevron-up" aria-hidden="true"></span> ' . $langs->trans(
"ReadLess") .
'</a>';
5916 $out .= dolPrintHTML($newmess, 0, array(
'pre',
'code'));
5925 if (isset($histo[$key][
'socpeopleassigned']) && is_array($histo[$key][
'socpeopleassigned']) && count($histo[$key][
'socpeopleassigned']) > 0) {
5927 foreach ($histo[$key][
'socpeopleassigned'] as $cid => $Tab) {
5928 if (empty(
$conf->cache[
'contact'][$cid])) {
5930 $result = $contact->fetch($cid);
5931 $conf->cache[
'contact'][$cid] = $contact;
5933 $contact =
$conf->cache[
'contact'][$cid];
5934 $result = ($contact instanceof
Contact) ? $contact->id : 0;
5938 $contactList .= !empty($contactList) ?
', ' :
'';
5939 $contactList .= $contact->getNomUrl(1);
5940 if (isset($histo[$key][
'acode']) && $histo[$key][
'acode'] ==
'AC_TEL') {
5941 if (!empty($contact->phone_pro)) {
5948 $footer .= $langs->trans(
'ActionOnContact') .
' : ' . $contactList;
5949 } elseif (empty($objcon->id) && isset($histo[$key][
'contact_id']) && $histo[$key][
'contact_id'] > 0) {
5950 if (empty(
$conf->cache[
'contact'][$histo[$key][
'contact_id']])) {
5952 $result = $contact->fetch($histo[$key][
'contact_id']);
5953 $conf->cache[
'contact'][$histo[$key][
'contact_id']] = $contact;
5955 $contact =
$conf->cache[
'contact'][$histo[$key][
'contact_id']];
5956 $result = ($contact instanceof
Contact) ? $contact->id : 0;
5960 $footer .= $contact->getNomUrl(1);
5961 if (isset($histo[$key][
'acode']) && $histo[$key][
'acode'] ==
'AC_TEL') {
5962 if (!empty($contact->phone_pro)) {
5970 if (!empty($documents)) {
5971 $footer .=
'<div class="timeline-documents-container">';
5972 foreach ($documents as $doc) {
5973 $footer .=
'<span id="document_' . $doc->id .
'" class="timeline-documents" ';
5974 $footer .=
' data-id="' . $doc->id .
'" ';
5975 $footer .=
' data-path="' . $doc->filepath .
'"';
5979 $filePath = DOL_DATA_ROOT .
'/' . $doc->filepath .
'/' . $doc->filename;
5981 if (empty($doc->agenda_id)) {
5982 $dir_ref = $actionstatic->id;
5983 $modulepart =
'actions';
5985 $split_dir = explode(
'/', $doc->filepath);
5986 $modulepart = array_shift($split_dir);
5987 $dir_ref = implode(
'/', $split_dir);
5990 $file = $dir_ref .
'/' . $doc->filename;
5991 $thumb = $dir_ref .
'/thumbs/' . substr($doc->filename, 0, strrpos($doc->filename,
'.')) .
'_mini' . substr($doc->filename, strrpos($doc->filename,
'.'));
5992 $doclink =
dol_buildpath(
'document.php', 1) .
'?modulepart=' . $modulepart .
'&attachment=0&file=' . urlencode($file) .
'&entity=' .
$conf->entity;
5993 $viewlink =
dol_buildpath(
'viewimage.php', 1) .
'?modulepart=' . $modulepart .
'&file=' . urlencode($thumb) .
'&entity=' .
$conf->entity;
5997 $mimeAttr =
' mime="' . $mime .
'" ';
5999 if (in_array($mime, array(
'image/png',
'image/jpeg',
'application/pdf'))) {
6000 $class .=
' documentpreview';
6003 $footer .=
'<a href="' . $doclink .
'" class="btn-link ' . $class .
'" target="_blank" rel="noopener noreferrer" ' . $mimeAttr .
' >';
6004 $footer .=
img_mime($filePath) .
' ' . $doc->filename;
6007 $footer .=
'</span>';
6009 $footer .=
'</div>';
6012 if (!empty($footer)) {
6013 $out .=
'<div class="timeline-footer">' . $footer .
'</div>';
6016 $out .=
'</div>' .
"\n";
6019 $out .=
'<!-- END timeline item -->';
6026 jQuery(document).ready(function () {
6027 $(document).on("click", "[data-read-more-action]", function(e){
6028 console.log("We click on data-read-more-action");
6029 let readMoreBloc = $(this).closest(".readmore-block");
6030 if(readMoreBloc.length > 0){
6032 if($(this).attr("data-read-more-action") == "close"){
6033 readMoreBloc.addClass("--closed").removeClass("--open");
6034 $("html, body").animate({
6035 scrollTop: readMoreBloc.offset().top - 200
6038 readMoreBloc.addClass("--open").removeClass("--closed");
6046 if (empty($histo)) {
6047 $out .=
'<span class="opacitymedium">' . $langs->trans(
"NoRecordFound") .
'</span>';
6050 if ($num > $MAXWITHOUTPAGINATION) {
6051 $langs->load(
"errors");
6052 $out .=
'<center><span class="opacitymedium">...' . $langs->trans(
"WarningTooManyDataPleaseUseMoreFilters", $MAXWITHOUTPAGINATION) .
'...</span></center>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
Convert a html select field into an ajax combobox.
ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array(), $morecss='', $htmlname='', $forcenojs=0, $moreparam='', $readonly=0)
On/off button to change a property status of an object This uses the ajax service objectonoff....
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage agenda events (actions)
Class to manage different types of events.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
dol_convert_file($fileinput, $ext='png', $fileoutput='', $page='')
Convert a PDF file into another image format.
dragAndDropFileUpload($htmlname)
Function to manage the drag and drop of a file.
dolGetElementUrl($objectid, $objecttype, $withpicto=0, $option='')
Return link url to an object.
dol_now($mode='gmt')
Return date for now.
dol_print_phone($phone, $countrycode='', $contactid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
getCallerInfoString()
Get caller info as a string that can be appended to a log message.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
dol_escape_uri($stringtoescape)
Returns text escaped by RFC 3986 for inclusion into a clickable link.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dolCloseUnclosedHtmlTags($text)
Close the HTML tags left open in a truncated HTML string.
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.
getNonce()
Return a random string to be used as a nonce value for js.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox=0, $check='restricthtml')
Sanitize a HTML to remove js, dangerous content and external links.
getActionCommEcmList($object)
getActionCommEcmList
dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles=1, $removeclassattribute=1, $cleanalsojavascript=0, $allowiframe=0, $allowed_tags=array(), $allowlink=0, $allowscript=0, $allowstyle=0, $allowphp=0)
Clean a string to keep only desirable HTML tags.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
utf8_check($str)
Check if a string is in UTF8.
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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_weather($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $morecss='')
Show weather picto.
finishSimpleTable($addLineBreak=false)
Add the correct HTML close tags for "startSimpleTable(...)" (use after the last table line)
show_actions_messaging($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions in messaging format.
img_credit_card($brand, $morecss='fa-2x inline-block valignmiddle')
Return image of a credit card according to its brand name.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_right($titlealt='default', $selected=0, $moreatt='')
Show right arrow logo.
commonHtmlAttributeBuilder($attr, array $unescapedAttr=[])
Builds an array of safe and properly escaped HTML attributes from a key-value pair list.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_left($titlealt='default', $selected=0, $moreatt='')
Show left arrow logo.
getListOfHtmlBooleanAttributes()
Returns a list of HTML boolean attributes.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolOutputDates($datep, $datef=null, $fullday=0, $addseconds=0, $pictotoadd='', $tzoutput='tzuserrel', $reduceformat=0)
Print decorated date-hour.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_action($titlealt, $numaction, $picto='', $moreatt='')
Show logo action.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
getPictoForType($key, $morecss='')
Return the picto for a data type.
img_allow($allow, $titlealt='default')
Show tick logo if allowed.
dolButtonToOpenExportDialog($name, $label, $buttonstring, $exportSiteName, $overwriteGitUrl, $website)
Create a dialog with two buttons for export and overwrite of a website.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
dolCompletUrlForDropdownButton(string $url, array $params, bool $addDolUrlRoot=true)
An function to complete dropdown url in dolGetButtonAction.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
img_picto_common($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $notitle=0)
Show picto (generic function)
img_search($titlealt='default', $other='')
Show search logo.
showTotalAmount($amount)
Style total amount of an object.
img_previous($titlealt='default', $moreatt='')
Show previous logo.
fieldLabel($langkey, $fieldkey, $fieldrequired=0)
Show a string with the label tag dedicated to the HTML edit field.
img_printer($titlealt="default", $other='')
Show printer logo.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
getImgPictoConv($mode='fa')
Get array to convert the Dolibarr picto keys into Font awesome keys.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
img_split($titlealt='default', $other='class="pictosplit"')
Show split logo.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
img_next($titlealt='default', $moreatt='')
Show next logo.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
get_htmloutput_mesg($mesgstring='', $mesgarray=[], $style='ok', $keepembedded=0)
Get formatted messages to output (Used to show messages on html output).
print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $selectlimitsuffix='', $beforearrows='', $hidenavigation=0)
Function to show navigation arrows into lists.
addSummaryTableLine($tableColumnCount, $num, $nbofloop=0, $total=0, $noneWord="None", $extraRightColumn=false)
Add a summary line to the current open table ("None", "XMoreLines" or "Total xxx")
img_searchclear($titlealt='default', $other='')
Show search logo.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
startSimpleTable($header, $link="", $arguments="", $emptyColumns=0, $number=-1, $pictofulllist='')
Start a table with headers and a optional clickable number (don't forget to use "finishSimpleTable()"...
getFieldErrorIcon($fieldValidationErrorMsg)
get field error icon
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.
$conf db name
Only used if Module[ID]Name translation string is not found.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
treeview li table
No Email.