614function GETPOST($paramname, $check =
'alphanohtml', $method = 0, $filter =
null, $options =
null, $noreplace = 0)
616 global $mysoc, $user, $conf;
618 if (empty($paramname)) {
619 return 'BadFirstParameterForGETPOST';
622 dol_syslog(
"Deprecated use of GETPOST, called with 1st param = ".$paramname.
" and 2nd param is '', when calling page ".$_SERVER[
"PHP_SELF"], LOG_WARNING);
627 if (empty($method)) {
628 $out = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] :
'');
629 } elseif ($method == 1) {
630 $out = isset($_GET[$paramname]) ? $_GET[$paramname] :
'';
631 } elseif ($method == 2) {
632 $out = isset($_POST[$paramname]) ? $_POST[$paramname] :
'';
633 } elseif ($method == 3) {
634 $out = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] :
'');
636 return 'BadThirdParameterForGETPOST';
639 if (empty($method) || $method == 3 || $method == 4) {
640 $relativepathstring = $_SERVER[
"PHP_SELF"];
642 if (constant(
'DOL_URL_ROOT')) {
643 $relativepathstring = preg_replace(
'/^'.preg_quote(constant(
'DOL_URL_ROOT'),
'/').
'/',
'', $relativepathstring);
645 $relativepathstring = preg_replace(
'/^\//',
'', $relativepathstring);
646 $relativepathstring = preg_replace(
'/^custom\//',
'', $relativepathstring);
652 if (!empty($_GET[
'restore_lastsearch_values'])) {
653 if (!empty($_SESSION[
'lastsearch_values_'.$relativepathstring])) {
654 $tmp = json_decode($_SESSION[
'lastsearch_values_'.$relativepathstring],
true);
655 if (is_array($tmp)) {
656 foreach ($tmp as $key => $val) {
657 if ($key == $paramname) {
665 if ($paramname ==
'contextpage' && !empty($_SESSION[
'lastsearch_contextpage_'.$relativepathstring])) {
666 $out = $_SESSION[
'lastsearch_contextpage_'.$relativepathstring];
667 } elseif ($paramname ==
'limit' && !empty($_SESSION[
'lastsearch_limit_'.$relativepathstring])) {
668 $out = $_SESSION[
'lastsearch_limit_'.$relativepathstring];
669 } elseif ($paramname ==
'page' && !empty($_SESSION[
'lastsearch_page_'.$relativepathstring])) {
670 $out = $_SESSION[
'lastsearch_page_'.$relativepathstring];
671 } elseif ($paramname ==
'mode' && !empty($_SESSION[
'lastsearch_mode_'.$relativepathstring])) {
672 $out = $_SESSION[
'lastsearch_mode_'.$relativepathstring];
674 } elseif (!isset($_GET[
'sortfield'])) {
677 if (!empty($_GET[
'action']) && $_GET[
'action'] ==
'create' && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) {
680 if (is_object($object) && isset($object->fields[$paramname][
'default'])) {
681 $out = $object->fields[$paramname][
'default'];
684 if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
685 if (!empty($_GET[
'action']) && (preg_match(
'/^create/', $_GET[
'action']) || preg_match(
'/^presend/', $_GET[
'action'])) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) {
687 if (!empty($user->default_values)) {
688 if (isset($user->default_values[$relativepathstring][
'createform'])) {
689 foreach ($user->default_values[$relativepathstring][
'createform'] as $defkey => $defval) {
691 if ($defkey !=
'_noquery_') {
692 $tmpqueryarraytohave = explode(
'&', $defkey);
695 foreach ($tmpqueryarraytohave as $tmpquerytohave) {
696 if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) {
709 if (isset($user->default_values[$relativepathstring][
'createform'][$defkey][$paramname])) {
710 $out = $user->default_values[$relativepathstring][
'createform'][$defkey][$paramname];
717 } elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) {
719 if (!empty($user->default_values)) {
722 if ($paramname ==
'sortfield' || $paramname ==
'sortorder') {
724 if (isset($user->default_values[$relativepathstring][
'sortorder'])) {
726 foreach ($user->default_values[$relativepathstring][
'sortorder'] as $defkey => $defval) {
728 if ($defkey !=
'_noquery_') {
729 $tmpqueryarraytohave = explode(
'&', $defkey);
732 foreach ($tmpqueryarraytohave as $tmpquerytohave) {
733 if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) {
746 $forbidden_chars_to_replace = array(
" ",
"'",
"/",
"\\",
":",
"*",
"?",
"\"",
"<",
">",
"|",
"[",
"]",
";",
"=");
747 foreach ($user->default_values[$relativepathstring][
'sortorder'][$defkey] as $key => $val) {
751 if ($paramname ==
'sortfield') {
754 if ($paramname ==
'sortorder') {
762 } elseif (isset($user->default_values[$relativepathstring][
'filters'])) {
763 foreach ($user->default_values[$relativepathstring][
'filters'] as $defkey => $defval) {
764 if (!empty($_GET[
'disabledefaultvalues'])) {
768 if ($defkey !=
'_noquery_') {
769 $tmpqueryarraytohave = explode(
'&', $defkey);
772 foreach ($tmpqueryarraytohave as $tmpquerytohave) {
773 if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) {
785 if ($qualified && isset($user->default_values[$relativepathstring][
'filters'][$defkey][$paramname])) {
787 if (isset($_POST[
'sall']) || isset($_POST[
'search_all']) || isset($_GET[
'sall']) || isset($_GET[
'search_all'])) {
789 if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) {
790 $forbidden_chars_to_replace = array(
" ",
"'",
"/",
"\\",
":",
"*",
"?",
"\"",
"<",
">",
"|",
"[",
"]",
";",
"=");
791 $out =
dol_string_nospecial($user->default_values[$relativepathstring][
'filters'][$defkey][$paramname],
'', $forbidden_chars_to_replace);
794 $forbidden_chars_to_replace = array(
" ",
"'",
"/",
"\\",
":",
"*",
"?",
"\"",
"<",
">",
"|",
"[",
"]",
";",
"=");
795 $out =
dol_string_nospecial($user->default_values[$relativepathstring][
'filters'][$defkey][$paramname],
'', $forbidden_chars_to_replace);
810 if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
814 while (preg_match(
'/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) {
818 if ($reg[1] ==
'DAY') {
820 $newout = $tmp[
'mday'];
821 } elseif ($reg[1] ==
'MONTH') {
823 $newout = $tmp[
'mon'];
824 } elseif ($reg[1] ==
'YEAR') {
826 $newout = $tmp[
'year'];
827 } elseif ($reg[1] ==
'PREVIOUS_DAY') {
830 $newout = $tmp2[
'day'];
831 } elseif ($reg[1] ==
'PREVIOUS_MONTH') {
834 $newout = $tmp2[
'month'];
835 } elseif ($reg[1] ==
'PREVIOUS_YEAR') {
837 $newout = ($tmp[
'year'] - 1);
838 } elseif ($reg[1] ==
'NEXT_DAY') {
841 $newout = $tmp2[
'day'];
842 } elseif ($reg[1] ==
'NEXT_MONTH') {
845 $newout = $tmp2[
'month'];
846 } elseif ($reg[1] ==
'NEXT_YEAR') {
848 $newout = ($tmp[
'year'] + 1);
849 } elseif ($reg[1] ==
'MYCOMPANY_COUNTRY_ID' || $reg[1] ==
'MYCOUNTRY_ID' || $reg[1] ==
'MYCOUNTRYID') {
850 $newout = $mysoc->country_id;
851 } elseif ($reg[1] ==
'USER_ID' || $reg[1] ==
'USERID') {
853 } elseif ($reg[1] ==
'USER_SUPERVISOR_ID' || $reg[1] ==
'SUPERVISOR_ID' || $reg[1] ==
'SUPERVISORID') {
854 $newout = $user->fk_user;
855 } elseif ($reg[1] ==
'ENTITY_ID' || $reg[1] ==
'ENTITYID') {
856 $newout = $conf->entity;
861 $out = preg_replace(
'/__'.preg_quote($reg[1],
'/').
'__/', $newout, $out);
866 if (preg_match(
'/^array/', $check)) {
867 if (!is_array($out) || empty($out)) {
870 $tmparray = explode(
':', $check);
871 if (!empty($tmparray[1])) {
872 $tmpcheck = $tmparray[1];
874 $tmpcheck =
'alphanohtml';
876 foreach ($out as $outkey => $outval) {
877 $out[$outkey] =
sanitizeVal($outval, $tmpcheck, $filter, $options);
883 if (strpos($paramname,
'search_') === 0) {
884 $out = preg_replace(
'/([<>])([-+]?\d)/',
'\1 \2', $out);
887 $out =
sanitizeVal($out, $check, $filter, $options);
892 if ($paramname ==
'backtopage' || $paramname ==
'backtolist' || $paramname ==
'backtourl') {
893 $out = str_replace(
'\\',
'/', $out);
894 $out = str_replace(array(
':',
';',
'@',
"\t",
' '),
'', $out);
896 $oldstringtoclean = $out;
897 $out = str_ireplace(array(
'javascript',
'vbscript',
'&colon',
'&#'),
'', $out);
898 $out = preg_replace(array(
'/^[^\?]*%/'),
'', $out);
899 $out = preg_replace(array(
'/^[a-z]*\/\s*\/+/i'),
'', $out);
900 }
while ($oldstringtoclean != $out);
905 if (empty($method) || $method == 3 || $method == 4) {
906 if (preg_match(
'/^search_/', $paramname) || in_array($paramname, array(
'sortorder',
'sortfield'))) {
913 if ($out !=
'' && isset($user)) {
914 $user->lastsearch_values_tmp[$relativepathstring][$paramname] = $out;
2252function dol_banner_tab($object, $paramid, $morehtml =
'', $shownav = 1, $fieldid =
'rowid', $fieldref =
'ref', $morehtmlref =
'', $moreparam =
'', $nodbprefix = 0, $morehtmlleft =
'', $morehtmlstatus =
'', $onlybanner = 0, $morehtmlright =
'')
2254 global $conf, $form, $user, $langs, $hookmanager, $action;
2258 $maxvisiblephotos = 1;
2260 $entity = (empty($object->entity) ? $conf->entity : $object->entity);
2261 $showbarcode = empty($conf->barcode->enabled) ? 0 : (empty($object->barcode) ? 0 : 1);
2262 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
2265 $modulepart =
'unknown';
2267 if ($object->element ==
'societe' || $object->element ==
'contact' || $object->element ==
'product' || $object->element ==
'ticket') {
2268 $modulepart = $object->element;
2269 } elseif ($object->element ==
'member') {
2270 $modulepart =
'memberphoto';
2271 } elseif ($object->element ==
'user') {
2272 $modulepart =
'userphoto';
2275 if (class_exists(
"Imagick")) {
2276 if ($object->element ==
'expensereport' || $object->element ==
'propal' || $object->element ==
'commande' || $object->element ==
'facture' || $object->element ==
'supplier_proposal') {
2277 $modulepart = $object->element;
2278 } elseif ($object->element ==
'fichinter') {
2279 $modulepart =
'ficheinter';
2280 } elseif ($object->element ==
'contrat') {
2281 $modulepart =
'contract';
2282 } elseif ($object->element ==
'order_supplier') {
2283 $modulepart =
'supplier_order';
2284 } elseif ($object->element ==
'invoice_supplier') {
2285 $modulepart =
'supplier_invoice';
2289 if ($object->element ==
'product') {
2291 $cssclass =
'photowithmargin photoref';
2292 $showimage = $object->is_photo_available($conf->product->multidir_output[$entity]);
2293 $maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : 5);
2294 if ($conf->browser->layout ==
'phone') {
2295 $maxvisiblephotos = 1;
2298 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos(
'product', $conf->product->multidir_output[$entity],
'small', $maxvisiblephotos, 0, 0, 0, 0, $width, 0,
'').
'</div>';
2300 if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
2302 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
2304 $nophoto =
'/public/theme/common/nophoto.png';
2305 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ?
' '.$cssclass :
'').
'" title="'.
dol_escape_htmltag($langs->trans(
"UploadAnImageToSeeAPhotoHere", $langs->transnoentitiesnoconv(
"Documents"))).
'" alt="No photo"'.($width ?
' style="width: '.$width.
'px"' :
'').
' src="'.DOL_URL_ROOT.$nophoto.
'"></div>';
2308 } elseif ($object->element ==
'ticket') {
2310 $cssclass =
'photoref';
2311 $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].
'/'.$object->ref);
2312 $maxvisiblephotos = (isset($conf->global->TICKET_MAX_VISIBLE_PHOTO) ? $conf->global->TICKET_MAX_VISIBLE_PHOTO : 2);
2313 if ($conf->browser->layout ==
'phone') {
2314 $maxvisiblephotos = 1;
2318 $showphoto = $object->show_photos(
'ticket', $conf->ticket->multidir_output[$entity],
'small', $maxvisiblephotos, 0, 0, 0, $width, 0);
2319 if ($object->nbphoto > 0) {
2320 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">'.$showphoto.
'</div>';
2326 if (!empty($conf->global->TICKET_NODISPLAYIFNOPHOTO)) {
2328 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"></div>';
2330 $nophoto =
img_picto(
'No photo',
'object_ticket');
2331 $morehtmlleft .=
'<!-- No photo to show -->';
2332 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
2333 $morehtmlleft .= $nophoto;
2334 $morehtmlleft .=
'</div></div>';
2339 if ($modulepart !=
'unknown') {
2342 if (in_array($modulepart, array(
'propal',
'commande',
'facture',
'ficheinter',
'contract',
'supplier_order',
'supplier_proposal',
'supplier_invoice',
'expensereport')) && class_exists(
"Imagick")) {
2344 $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]).
"/";
2345 if (in_array($modulepart, array(
'invoice_supplier',
'supplier_invoice'))) {
2346 $subdir =
get_exdir($object->id, 2, 0, 1, $object, $modulepart);
2347 $subdir .= ((!empty($subdir) && !preg_match(
'/\/$/', $subdir)) ?
'/' :
'').$objectref;
2349 $subdir =
get_exdir($object->id, 0, 0, 1, $object, $modulepart);
2351 if (empty($subdir)) {
2352 $subdir =
'errorgettingsubdirofobject';
2355 $filepath = $dir_output.$subdir.
"/";
2357 $filepdf = $filepath.$objectref.
".pdf";
2358 $relativepath = $subdir.
'/'.$objectref.
'.pdf';
2361 $fileimage = $filepdf.
'_preview.png';
2362 $relativepathimage = $relativepath.
'_preview.png';
2364 $pdfexists = file_exists($filepdf);
2369 if (!file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) {
2370 if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) {
2371 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
2380 if ($pdfexists && !$error) {
2381 $heightforphotref = 80;
2382 if (!empty($conf->dol_optimize_smallscreen)) {
2383 $heightforphotref = 60;
2386 if (file_exists($fileimage)) {
2387 $phototoshow =
'<div class="photoref">';
2388 $phototoshow .=
'<img height="'.$heightforphotref.
'" class="photo photowithborder" src="'.DOL_URL_ROOT.
'/viewimage.php?modulepart=apercu'.$modulepart.
'&file='.urlencode($relativepathimage).
'">';
2389 $phototoshow .=
'</div>';
2392 } elseif (!$phototoshow) {
2393 $phototoshow .= $form->showphoto($modulepart, $object, 0, 0, 0,
'photowithmargin photoref',
'small', 1, 0, $maxvisiblephotos);
2397 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">';
2398 $morehtmlleft .= $phototoshow;
2399 $morehtmlleft .=
'</div>';
2403 if (empty($phototoshow)) {
2404 if ($object->element ==
'action') {
2406 $cssclass =
'photorefcenter';
2407 $nophoto =
img_picto(
'No photo',
'title_agenda');
2410 $cssclass =
'photorefcenter';
2411 $picto = $object->picto;
2412 $prefix =
'object_';
2413 if ($object->element ==
'project' && !$object->public) {
2416 if (strpos($picto,
'fontawesome_') !==
false) {
2419 $nophoto =
img_picto(
'No photo', $prefix.$picto);
2421 $morehtmlleft .=
'<!-- No photo to show -->';
2422 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
2423 $morehtmlleft .= $nophoto;
2424 $morehtmlleft .=
'</div></div>';
2431 $morehtmlleft .=
'<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object, 100,
'photoref valignmiddle').
'</div>';
2434 if ($object->element ==
'societe') {
2435 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
'societe',
'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
2436 $morehtmlstatus .=
ajax_object_onoff($object,
'status',
'status',
'InActivity',
'ActivityCeased');
2438 $morehtmlstatus .= $object->getLibStatut(6);
2440 } elseif ($object->element ==
'product') {
2442 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
'produit',
'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
2443 $morehtmlstatus .=
ajax_object_onoff($object,
'status',
'tosell',
'ProductStatusOnSell',
'ProductStatusNotOnSell');
2445 $morehtmlstatus .=
'<span class="statusrefsell">'.$object->getLibStatut(6, 0).
'</span>';
2447 $morehtmlstatus .=
' ';
2449 if (!empty($conf->use_javascript_ajax) && $user->hasRight(
'produit',
'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
2450 $morehtmlstatus .=
ajax_object_onoff($object,
'status_buy',
'tobuy',
'ProductStatusOnBuy',
'ProductStatusNotOnBuy');
2452 $morehtmlstatus .=
'<span class="statusrefbuy">'.$object->getLibStatut(6, 1).
'</span>';
2454 } elseif (in_array($object->element, array(
'facture',
'invoice',
'invoice_supplier',
'chargesociales',
'loan',
'tva',
'salary'))) {
2455 $tmptxt = $object->getLibStatut(6, $object->totalpaid);
2456 if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
2457 $tmptxt = $object->getLibStatut(5, $object->totalpaid);
2459 $morehtmlstatus .= $tmptxt;
2460 } elseif ($object->element ==
'contrat' || $object->element ==
'contract') {
2461 if ($object->statut == 0) {
2462 $morehtmlstatus .= $object->getLibStatut(5);
2464 $morehtmlstatus .= $object->getLibStatut(4);
2466 } elseif ($object->element ==
'facturerec') {
2467 if ($object->frequency == 0) {
2468 $morehtmlstatus .= $object->getLibStatut(2);
2470 $morehtmlstatus .= $object->getLibStatut(5);
2472 } elseif ($object->element ==
'project_task') {
2473 $object->fk_statut = 1;
2474 if ($object->progress > 0) {
2475 $object->fk_statut = 2;
2477 if ($object->progress >= 100) {
2478 $object->fk_statut = 3;
2480 $tmptxt = $object->getLibStatut(5);
2481 $morehtmlstatus .= $tmptxt;
2482 } elseif (method_exists($object,
'getLibStatut')) {
2483 $tmptxt = $object->getLibStatut(6);
2484 if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
2485 $tmptxt = $object->getLibStatut(5);
2487 $morehtmlstatus .= $tmptxt;
2491 if (isModEnabled(
'accounting') && in_array($object->element, array(
'bank',
'paiementcharge',
'facture',
'invoice',
'invoice_supplier',
'expensereport',
'payment_various'))) {
2493 if (method_exists($object,
'getVentilExportCompta')) {
2494 $accounted = $object->getVentilExportCompta();
2495 $langs->load(
"accountancy");
2496 $morehtmlstatus .=
'</div><div class="statusref statusrefbis"><span class="opacitymedium">'.($accounted > 0 ? $langs->trans(
"Accounted") : $langs->trans(
"NotYetAccounted")).
'</span>';
2501 if (!empty($object->name_alias)) {
2502 $morehtmlref .=
'<div class="refidno opacitymedium">'.dol_escape_htmltag($object->name_alias).
'</div>';
2506 if (in_array($object->element, array(
'product',
'bank_account',
'project_task'))) {
2507 if (!empty($object->label)) {
2508 $morehtmlref .=
'<div class="refidno opacitymedium">'.$object->label.
'</div>';
2513 if (method_exists($object,
'getBannerAddress') && !in_array($object->element, array(
'product',
'bookmark',
'ecm_directories',
'ecm_files'))) {
2514 $moreaddress = $object->getBannerAddress(
'refaddress', $object);
2516 $morehtmlref .=
'<div class="refidno refaddress">';
2517 $morehtmlref .= $moreaddress;
2518 $morehtmlref .=
'</div>';
2521 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && ($conf->global->MAIN_SHOW_TECHNICAL_ID ==
'1' || preg_match(
'/'.preg_quote($object->element,
'/').
'/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
2522 $morehtmlref .=
'<div style="clear: both;"></div>';
2523 $morehtmlref .=
'<div class="refidno opacitymedium">';
2524 $morehtmlref .= $langs->trans(
"TechnicalID").
': '.((int) $object->id);
2525 $morehtmlref .=
'</div>';
2528 $parameters=array(
'morehtmlref'=>$morehtmlref);
2529 $reshook = $hookmanager->executeHooks(
'formDolBanner', $parameters, $object, $action);
2532 } elseif (empty($reshook)) {
2533 $morehtmlref .= $hookmanager->resPrint;
2534 } elseif ($reshook > 0) {
2535 $morehtmlref = $hookmanager->resPrint;
2539 print
'<div class="'.($onlybanner ?
'arearefnobottom ' :
'arearef ').
'heightref valignmiddle centpercent">';
2540 print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
2542 print
'<div class="underrefbanner clearboth"></div>';
2722function dol_print_date($time, $format =
'', $tzoutput =
'auto', $outputlangs =
'', $encodetooutput =
false)
2724 global $conf, $langs;
2731 if ($tzoutput ===
'auto') {
2732 $tzoutput = (empty($conf) ?
'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey :
'tzserver'));
2737 $offsettz = $offsetdst = 0;
2740 if (is_string($tzoutput)) {
2741 if ($tzoutput ==
'tzserver') {
2743 $offsettzstring = @date_default_timezone_get();
2746 } elseif ($tzoutput ==
'tzuser' || $tzoutput ==
'tzuserrel') {
2748 $offsettzstring = (empty($_SESSION[
'dol_tz_string']) ?
'UTC' : $_SESSION[
'dol_tz_string']);
2750 if (class_exists(
'DateTimeZone')) {
2751 $user_date_tz =
new DateTimeZone($offsettzstring);
2752 $user_dt =
new DateTime();
2753 $user_dt->setTimezone($user_date_tz);
2754 $user_dt->setTimestamp($tzoutput ==
'tzuser' ?
dol_now() : (int) $time);
2755 $offsettz = $user_dt->getOffset();
2757 $offsettz = (empty($_SESSION[
'dol_tz']) ? 0 : $_SESSION[
'dol_tz']) * 60 * 60;
2758 $offsetdst = (empty($_SESSION[
'dol_dst']) ? 0 : $_SESSION[
'dol_dst']) * 60 * 60;
2763 if (!is_object($outputlangs)) {
2764 $outputlangs = $langs;
2767 $format =
'daytextshort';
2772 $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array(
'day',
'dayhour'))) ? 1 : 0;
2773 $format = preg_replace(
'/inputnoreduce/',
'', $format);
2774 $formatwithoutreduce = preg_replace(
'/reduceformat/',
'', $format);
2775 if ($formatwithoutreduce != $format) {
2776 $format = $formatwithoutreduce;
2782 if ($format ==
'day') {
2783 $format = ($outputlangs->trans(
"FormatDateShort") !=
"FormatDateShort" ? $outputlangs->trans(
"FormatDateShort") : $conf->format_date_short);
2784 } elseif ($format ==
'hour') {
2785 $format = ($outputlangs->trans(
"FormatHourShort") !=
"FormatHourShort" ? $outputlangs->trans(
"FormatHourShort") : $conf->format_hour_short);
2786 } elseif ($format ==
'hourduration') {
2787 $format = ($outputlangs->trans(
"FormatHourShortDuration") !=
"FormatHourShortDuration" ? $outputlangs->trans(
"FormatHourShortDuration") : $conf->format_hour_short_duration);
2788 } elseif ($format ==
'daytext') {
2789 $format = ($outputlangs->trans(
"FormatDateText") !=
"FormatDateText" ? $outputlangs->trans(
"FormatDateText") : $conf->format_date_text);
2790 } elseif ($format ==
'daytextshort') {
2791 $format = ($outputlangs->trans(
"FormatDateTextShort") !=
"FormatDateTextShort" ? $outputlangs->trans(
"FormatDateTextShort") : $conf->format_date_text_short);
2792 } elseif ($format ==
'dayhour') {
2793 $format = ($outputlangs->trans(
"FormatDateHourShort") !=
"FormatDateHourShort" ? $outputlangs->trans(
"FormatDateHourShort") : $conf->format_date_hour_short);
2794 } elseif ($format ==
'dayhoursec') {
2795 $format = ($outputlangs->trans(
"FormatDateHourSecShort") !=
"FormatDateHourSecShort" ? $outputlangs->trans(
"FormatDateHourSecShort") : $conf->format_date_hour_sec_short);
2796 } elseif ($format ==
'dayhourtext') {
2797 $format = ($outputlangs->trans(
"FormatDateHourText") !=
"FormatDateHourText" ? $outputlangs->trans(
"FormatDateHourText") : $conf->format_date_hour_text);
2798 } elseif ($format ==
'dayhourtextshort') {
2799 $format = ($outputlangs->trans(
"FormatDateHourTextShort") !=
"FormatDateHourTextShort" ? $outputlangs->trans(
"FormatDateHourTextShort") : $conf->format_date_hour_text_short);
2800 } elseif ($format ==
'dayhourlog') {
2802 $format =
'%Y%m%d%H%M%S';
2803 } elseif ($format ==
'dayhourlogsmall') {
2805 $format =
'%y%m%d%H%M';
2806 } elseif ($format ==
'dayhourldap') {
2807 $format =
'%Y%m%d%H%M%SZ';
2808 } elseif ($format ==
'dayhourxcard') {
2809 $format =
'%Y%m%dT%H%M%SZ';
2810 } elseif ($format ==
'dayxcard') {
2812 } elseif ($format ==
'dayrfc') {
2813 $format =
'%Y-%m-%d';
2814 } elseif ($format ==
'dayhourrfc') {
2815 $format =
'%Y-%m-%dT%H:%M:%SZ';
2816 } elseif ($format ==
'standard') {
2817 $format =
'%Y-%m-%d %H:%M:%S';
2820 if ($reduceformat) {
2821 $format = str_replace(
'%Y',
'%y', $format);
2822 $format = str_replace(
'yyyy',
'yy', $format);
2826 if (preg_match(
'/%b/i', $format)) {
2828 $format = str_replace(
'%b',
'__b__', $format);
2829 $format = str_replace(
'%B',
'__B__', $format);
2831 if (preg_match(
'/%a/i', $format)) {
2833 $format = str_replace(
'%a',
'__a__', $format);
2834 $format = str_replace(
'%A',
'__A__', $format);
2839 if (preg_match(
'/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) {
2840 dol_print_error(
'',
"Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER[
"PHP_SELF"]);
2842 } elseif (preg_match(
'/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) {
2844 dol_syslog(
"Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER[
"PHP_SELF"], LOG_WARNING);
2847 $syear = (!empty($reg[1]) ? $reg[1] :
'');
2848 $smonth = (!empty($reg[2]) ? $reg[2] :
'');
2849 $sday = (!empty($reg[3]) ? $reg[3] :
'');
2850 $shour = (!empty($reg[4]) ? $reg[4] :
'');
2851 $smin = (!empty($reg[5]) ? $reg[5] :
'');
2852 $ssec = (!empty($reg[6]) ? $reg[6] :
'');
2854 $time =
dol_mktime($shour, $smin, $ssec, $smonth, $sday, $syear,
true);
2857 $tzo =
new DateTimeZone(
'UTC');
2859 $tzo =
new DateTimeZone(date_default_timezone_get());
2861 $dtts =
new DateTime();
2862 $dtts->setTimestamp($time);
2863 $dtts->setTimezone($tzo);
2864 $newformat = str_replace(
2865 array(
'%Y',
'%y',
'%m',
'%d',
'%H',
'%I',
'%M',
'%S',
'%p',
'T',
'Z',
'__a__',
'__A__',
'__b__',
'__B__'),
2866 array(
'Y',
'y',
'm',
'd',
'H',
'h',
'i',
's',
'A',
'__£__',
'__$__',
'__{__',
'__}__',
'__[__',
'__]__'),
2868 $ret = $dtts->format($newformat);
2870 array(
'__£__',
'__$__',
'__{__',
'__}__',
'__[__',
'__]__'),
2871 array(
'T',
'Z',
'__a__',
'__A__',
'__b__',
'__B__'),
2876 if ($time < 100000000000) {
2877 $timetouse = $time + $offsettz + $offsetdst;
2880 $tzo =
new DateTimeZone(
'UTC');
2882 $tzo =
new DateTimeZone(date_default_timezone_get());
2884 $dtts =
new DateTime();
2885 $dtts->setTimestamp($timetouse);
2886 $dtts->setTimezone($tzo);
2887 $newformat = str_replace(
2888 array(
'%Y',
'%y',
'%m',
'%d',
'%H',
'%I',
'%M',
'%S',
'%p',
'%w',
'T',
'Z',
'__a__',
'__A__',
'__b__',
'__B__'),
2889 array(
'Y',
'y',
'm',
'd',
'H',
'h',
'i',
's',
'A',
'w',
'__£__',
'__$__',
'__{__',
'__}__',
'__[__',
'__]__'),
2891 $ret = $dtts->format($newformat);
2893 array(
'__£__',
'__$__',
'__{__',
'__}__',
'__[__',
'__]__'),
2894 array(
'T',
'Z',
'__a__',
'__A__',
'__b__',
'__B__'),
2899 $ret =
'Bad value '.$time.
' for date';
2903 if (preg_match(
'/__b__/i', $format)) {
2904 $timetouse = $time + $offsettz + $offsetdst;
2907 $tzo =
new DateTimeZone(
'UTC');
2909 $tzo =
new DateTimeZone(date_default_timezone_get());
2911 $dtts =
new DateTime();
2912 $dtts->setTimestamp($timetouse);
2913 $dtts->setTimezone($tzo);
2914 $month = $dtts->format(
"m");
2915 $month = sprintf(
"%02d", $month);
2916 if ($encodetooutput) {
2917 $monthtext = $outputlangs->transnoentities(
'Month'.$month);
2918 $monthtextshort = $outputlangs->transnoentities(
'MonthShort'.$month);
2920 $monthtext = $outputlangs->transnoentitiesnoconv(
'Month'.$month);
2921 $monthtextshort = $outputlangs->transnoentitiesnoconv(
'MonthShort'.$month);
2924 $ret = str_replace(
'__b__', $monthtextshort, $ret);
2925 $ret = str_replace(
'__B__', $monthtext, $ret);
2929 if (preg_match(
'/__a__/i', $format)) {
2931 $timetouse = $time + $offsettz + $offsetdst;
2934 $tzo =
new DateTimeZone(
'UTC');
2936 $tzo =
new DateTimeZone(date_default_timezone_get());
2938 $dtts =
new DateTime();
2939 $dtts->setTimestamp($timetouse);
2940 $dtts->setTimezone($tzo);
2941 $w = $dtts->format(
"w");
2942 $dayweek = $outputlangs->transnoentitiesnoconv(
'Day'.$w);
2944 $ret = str_replace(
'__A__', $dayweek, $ret);
2945 $ret = str_replace(
'__a__',
dol_substr($dayweek, 0, 3), $ret);
3448function dol_print_phone($phone, $countrycode =
'', $cid = 0, $socid = 0, $addlink =
'', $separ =
" ", $withpicto =
'', $titlealt =
'', $adddivfloat = 0)
3450 global $conf, $user, $langs, $mysoc, $hookmanager;
3453 $phone = is_null($phone) ?
'' : preg_replace(
"/[\s.-]/",
"", trim($phone));
3454 if (empty($phone)) {
3457 if (!empty($conf->global->MAIN_PHONE_SEPAR)) {
3458 $separ = $conf->global->MAIN_PHONE_SEPAR;
3460 if (empty($countrycode) && is_object($mysoc)) {
3461 $countrycode = $mysoc->country_code;
3465 if ($conf->dol_optimize_smallscreen) {
3470 if (strtoupper($countrycode) ==
"FR") {
3473 $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 2).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2);
3475 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2);
3477 $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2);
3479 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
3481 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3483 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 2);
3485 } elseif (strtoupper($countrycode) ==
"CA") {
3487 $newphone = ($separ !=
'' ?
'(' :
'').substr($newphone, 0, 3).($separ !=
'' ?
')' :
'').$separ.substr($newphone, 3, 3).($separ !=
'' ?
'-' :
'').substr($newphone, 6, 4);
3489 } elseif (strtoupper($countrycode) ==
"PT") {
3491 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
3493 } elseif (strtoupper($countrycode) ==
"SR") {
3495 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3);
3497 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 4);
3499 } elseif (strtoupper($countrycode) ==
"DE") {
3501 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 4).$separ.substr($newphone, 11, 3);
3503 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 4).$separ.substr($newphone, 10, 3);
3505 } elseif (strtoupper($countrycode) ==
"ES") {
3507 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
3509 } elseif (strtoupper($countrycode) ==
"BF") {
3511 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3513 } elseif (strtoupper($countrycode) ==
"RO") {
3515 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3517 } elseif (strtoupper($countrycode) ==
"TR") {
3519 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4);
3521 } elseif (strtoupper($countrycode) ==
"US") {
3523 $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
3525 } elseif (strtoupper($countrycode) ==
"MX") {
3527 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2);
3529 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
3531 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4);
3533 } elseif (strtoupper($countrycode) ==
"ML") {
3535 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3537 } elseif (strtoupper($countrycode) ==
"TH") {
3539 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3);
3541 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3);
3543 } elseif (strtoupper($countrycode) ==
"MU") {
3546 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
3548 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3550 } elseif (strtoupper($countrycode) ==
"ZA") {
3552 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3554 } elseif (strtoupper($countrycode) ==
"SY") {
3556 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3558 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3);
3560 } elseif (strtoupper($countrycode) ==
"AE") {
3562 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2);
3564 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
3566 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 4);
3568 } elseif (strtoupper($countrycode) ==
"DZ") {
3570 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
3572 } elseif (strtoupper($countrycode) ==
"BE") {
3574 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3);
3576 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
3578 } elseif (strtoupper($countrycode) ==
"PF") {
3580 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3582 } elseif (strtoupper($countrycode) ==
"CO") {
3584 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3586 } elseif (strtoupper($countrycode) ==
"JO") {
3588 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
3590 } elseif (strtoupper($countrycode) ==
"JM") {
3592 $newphone = substr($newphone, 0, 5).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
3594 } elseif (strtoupper($countrycode) ==
"MG") {
3596 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 2);
3598 } elseif (strtoupper($countrycode) ==
"GB") {
3600 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
3602 } elseif (strtoupper($countrycode) ==
"CH") {
3604 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3606 $newphone = $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 4);
3608 } elseif (strtoupper($countrycode) ==
"TN") {
3610 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
3612 } elseif (strtoupper($countrycode) ==
"GF") {
3614 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3616 } elseif (strtoupper($countrycode) ==
"GP") {
3618 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3620 } elseif (strtoupper($countrycode) ==
"MQ") {
3622 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3624 } elseif (strtoupper($countrycode) ==
"IT") {
3626 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
3628 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3630 } elseif (strtoupper($countrycode) ==
"AU") {
3634 $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4);
3636 } elseif (strtoupper($countrycode) ==
"LU") {
3639 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2);
3641 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 1);
3643 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
3645 $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2);
3648 if (!empty($addlink)) {
3649 if ($addlink ==
'tel' || $conf->browser->layout ==
'phone' || (isModEnabled(
'clicktodial') && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) {
3650 $newphoneform = $newphone;
3651 $newphone =
'<a href="tel:'.$phone.
'"';
3652 $newphone .=
'>'.$newphoneform.
'</a>';
3653 } elseif (isModEnabled(
'clicktodial') && $addlink ==
'AC_TEL') {
3654 if (empty($user->clicktodial_loaded)) {
3655 $user->fetch_clicktodial();
3659 $urlmask =
'ErrorClickToDialModuleNotConfigured';
3660 if (!empty($conf->global->CLICKTODIAL_URL)) {
3661 $urlmask = $conf->global->CLICKTODIAL_URL;
3663 if (!empty($user->clicktodial_url)) {
3664 $urlmask = $user->clicktodial_url;
3667 $clicktodial_poste = (!empty($user->clicktodial_poste) ?urlencode($user->clicktodial_poste) :
'');
3668 $clicktodial_login = (!empty($user->clicktodial_login) ?urlencode($user->clicktodial_login) :
'');
3669 $clicktodial_password = (!empty($user->clicktodial_password) ?urlencode($user->clicktodial_password) :
'');
3671 $url = sprintf($urlmask, urlencode($phone), $clicktodial_poste, $clicktodial_login, $clicktodial_password);
3673 $substitarray = array(
'__PHONEFROM__'=>$clicktodial_poste,
3674 '__PHONETO__'=>urlencode($phone),
3675 '__LOGIN__'=>$clicktodial_login,
3676 '__PASS__'=>$clicktodial_password);
3678 $newphonesav = $newphone;
3679 if (empty($conf->global->CLICKTODIAL_DO_NOT_USE_AJAX_CALL)) {
3681 $newphone =
'<a href="'.$url.
'" class="cssforclicktodial"';
3682 $newphone .=
'>'.$newphonesav.
'</a>';
3685 $newphone =
'<a href="'.$url.
'"';
3686 if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) {
3687 $newphone .=
' target="_blank" rel="noopener noreferrer"';
3689 $newphone .=
'>'.$newphonesav.
'</a>';
3694 if (isModEnabled(
'agenda') && $user->hasRight(
"agenda",
"myactions",
"create")) {
3697 if ($addlink ==
'AC_FAX') {
3700 if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE)) {
3701 $link =
'<a href="'.DOL_URL_ROOT.
'/comm/action/card.php?action=create&backtopage='. urlencode($_SERVER[
'REQUEST_URI']) .
'&actioncode='.$type.($cid ?
'&contactid='.$cid :
'').($socid ?
'&socid='.$socid :
'').
'">'.
img_object($langs->trans(
"AddAction"),
"calendar").
'</a>';
3704 $newphone =
'<div>'.$newphone.
' '.$link.
'</div>';
3709 if (empty($titlealt)) {
3710 $titlealt = ($withpicto ==
'fax' ? $langs->trans(
"Fax") : $langs->trans(
"Phone"));
3715 $parameters = array(
'countrycode' => $countrycode,
'cid' => $cid,
'socid' => $socid,
'titlealt' => $titlealt,
'picto' => $withpicto);
3716 $reshook = $hookmanager->executeHooks(
'printPhone', $parameters, $phone);
3717 $rep .= $hookmanager->resPrint;
3719 if (empty($reshook)) {
3722 if ($withpicto ==
'fax') {
3723 $picto =
'phoning_fax';
3724 } elseif ($withpicto ==
'phone') {
3726 } elseif ($withpicto ==
'mobile') {
3727 $picto =
'phoning_mobile';
3732 if ($adddivfloat == 1) {
3733 $rep .=
'<div class="nospan float" style="margin-right: 10px">';
3734 } elseif (empty($adddivfloat)) {
3735 $rep .=
'<span style="margin-right: 10px;">';
3737 $rep .= ($withpicto ?
img_picto($titlealt,
'object_'.$picto.
'.png').
' ' :
'').$newphone;
3738 if ($adddivfloat == 1) {
3740 } elseif (empty($adddivfloat)) {
4182function img_picto($titlealt, $picto, $moreatt =
'', $pictoisfullpath =
false, $srconly = 0, $notitle = 0, $alt =
'', $morecss =
'', $marginleftonlyshort = 2)
4184 global $conf, $langs;
4187 $url = DOL_URL_ROOT;
4188 $theme = isset($conf->theme) ? $conf->theme :
null;
4189 $path =
'theme/'.$theme;
4191 if ($pictoisfullpath) {
4193 if (!preg_match(
'/(\.png|\.gif|\.svg)$/i', $picto)) {
4196 $fullpathpicto = $picto;
4198 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
4199 $morecss .= ($morecss ?
' ' :
'').$reg[1];
4200 $moreatt = str_replace(
'class="'.$reg[1].
'"',
'', $moreatt);
4203 $pictowithouttext = preg_replace(
'/(\.png|\.gif|\.svg)$/',
'', $picto);
4204 $pictowithouttext = str_replace(
'object_',
'', $pictowithouttext);
4205 $pictowithouttext = str_replace(
'_nocolor',
'', $pictowithouttext);
4207 if (strpos($pictowithouttext,
'fontawesome_') !==
false || preg_match(
'/^fa-/', $pictowithouttext)) {
4209 $pictowithouttext = str_replace(
'fontawesome_',
'', $pictowithouttext);
4210 $pictowithouttext = str_replace(
'fa-',
'', $pictowithouttext);
4212 $pictowithouttextarray = explode(
'_', $pictowithouttext);
4213 $marginleftonlyshort = 0;
4215 if (!empty($pictowithouttextarray[1])) {
4217 $fakey =
'fa-'.$pictowithouttextarray[0];
4218 $fa = empty($pictowithouttextarray[1]) ?
'fa' : $pictowithouttextarray[1];
4219 $facolor = empty($pictowithouttextarray[2]) ?
'' : $pictowithouttextarray[2];
4220 $fasize = empty($pictowithouttextarray[3]) ?
'' : $pictowithouttextarray[3];
4222 $fakey =
'fa-'.$pictowithouttext;
4232 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
4233 $morecss .= ($morecss ?
' ' :
'').$reg[1];
4234 $moreatt = str_replace(
'class="'.$reg[1].
'"',
'', $moreatt);
4236 if (preg_match(
'/style="([^"]+)"/', $moreatt, $reg)) {
4237 $morestyle = $reg[1];
4238 $moreatt = str_replace(
'style="'.$reg[1].
'"',
'', $moreatt);
4240 $moreatt = trim($moreatt);
4242 $enabledisablehtml =
'<span class="'.$fa.
' '.$fakey.($marginleftonlyshort ? ($marginleftonlyshort == 1 ?
' marginleftonlyshort' :
' marginleftonly') :
'');
4243 $enabledisablehtml .= ($morecss ?
' '.$morecss :
'').
'" style="'.($fasize ? (
'font-size: '.$fasize.
';') :
'').($facolor ? (
' color: '.$facolor.
';') :
'').($morestyle ?
' '.$morestyle :
'').
'"'.(($notitle || empty($titlealt)) ?
'' :
' title="'.dol_escape_htmltag($titlealt).
'"').($moreatt ?
' '.$moreatt :
'').
'>';
4247 $enabledisablehtml .=
'</span>';
4249 return $enabledisablehtml;
4252 if (empty($srconly) && in_array($pictowithouttext, array(
4253 '1downarrow',
'1uparrow',
'1leftarrow',
'1rightarrow',
'1uparrow_selected',
'1downarrow_selected',
'1leftarrow_selected',
'1rightarrow_selected',
4254 'accountancy',
'accounting_account',
'account',
'accountline',
'action',
'add',
'address',
'angle-double-down',
'angle-double-up',
'asset',
4255 'bank_account',
'barcode',
'bank',
'bell',
'bill',
'billa',
'billr',
'billd',
'birthday-cake',
'bookmark',
'bom',
'briefcase-medical',
'bug',
'building',
4256 'card',
'calendarlist',
'calendar',
'calendarmonth',
'calendarweek',
'calendarday',
'calendarperuser',
'calendarpertype',
4257 'cash-register',
'category',
'chart',
'check',
'clock',
'clone',
'close_title',
'cog',
'collab',
'company',
'contact',
'country',
'contract',
'conversation',
'cron',
'cross',
'cubes',
4258 'currency',
'multicurrency',
4259 'delete',
'dolly',
'dollyrevert',
'donation',
'download',
'dynamicprice',
4260 'edit',
'ellipsis-h',
'email',
'entity',
'envelope',
'eraser',
'establishment',
'expensereport',
'external-link-alt',
'external-link-square-alt',
'eye',
4261 'filter',
'file-code',
'file-export',
'file-import',
'file-upload',
'autofill',
'folder',
'folder-open',
'folder-plus',
4262 'gears',
'generate',
'generic',
'globe',
'globe-americas',
'graph',
'grip',
'grip_title',
'group',
4263 'hands-helping',
'help',
'holiday',
4264 'id-card',
'images',
'incoterm',
'info',
'intervention',
'inventory',
'intracommreport',
'jobprofile',
4265 'knowledgemanagement',
4266 'label',
'language',
'line',
'link',
'list',
'list-alt',
'listlight',
'loan',
'lock',
'lot',
'long-arrow-alt-right',
4267 'margin',
'map-marker-alt',
'member',
'meeting',
'money-bill-alt',
'movement',
'mrp',
'note',
'next',
4268 'off',
'on',
'order',
4269 'paiment',
'paragraph',
'play',
'pdf',
'phone',
'phoning',
'phoning_mobile',
'phoning_fax',
'playdisabled',
'previous',
'poll',
'pos',
'printer',
'product',
'propal',
'proposal',
'puce',
4270 'stock',
'resize',
'service',
'stats',
'trip',
4271 'security',
'setup',
'share-alt',
'sign-out',
'split',
'stripe',
'stripe-s',
'switch_off',
'switch_on',
'switch_on_warning',
'switch_on_red',
'tools',
'unlink',
'uparrow',
'user',
'user-tie',
'vcard',
'wrench',
4272 'github',
'google',
'jabber',
'microsoft',
'skype',
'twitter',
'facebook',
'linkedin',
'instagram',
'snapchat',
'youtube',
'google-plus-g',
'whatsapp',
4273 'chevron-left',
'chevron-right',
'chevron-down',
'chevron-top',
'commercial',
'companies',
4274 'generic',
'home',
'hrm',
'members',
'products',
'invoicing',
4275 'partnership',
'payment',
'payment_vat',
'pencil-ruler',
'pictoconfirm',
'preview',
'project',
'projectpub',
'projecttask',
'question',
'refresh',
'region',
4276 'salary',
'shipment',
'state',
'supplier_invoice',
'supplier_invoicea',
'supplier_invoicer',
'supplier_invoiced',
4277 'technic',
'ticket',
4279 'recent',
'reception',
'recruitmentcandidature',
'recruitmentjobposition',
'replacement',
'resource',
'recurring',
'rss',
4280 'shapes',
'skill',
'square',
'stop-circle',
'supplier',
'supplier_proposal',
'supplier_order',
'supplier_invoice',
4281 'timespent',
'title_setup',
'title_accountancy',
'title_bank',
'title_hrm',
'title_agenda',
4282 'uncheck',
'url',
'user-cog',
'user-injured',
'user-md',
'vat',
'website',
'workstation',
'webhook',
'world',
'private',
4283 'conferenceorbooth',
'eventorganization',
4284 'stamp',
'signature'
4286 $fakey = $pictowithouttext;
4290 if (in_array($pictowithouttext, array(
'card',
'bell',
'clock',
'establishment',
'generic',
'minus-square',
'object_generic',
'pdf',
'plus-square',
'timespent',
'note',
'off',
'on',
'object_bookmark',
'bookmark',
'vcard'))) {
4293 if (in_array($pictowithouttext, array(
'black-tie',
'github',
'google',
'microsoft',
'skype',
'twitter',
'facebook',
'linkedin',
'instagram',
'snapchat',
'stripe',
'stripe-s',
'youtube',
'google-plus-g',
'whatsapp'))) {
4297 $arrayconvpictotofa = array(
4298 'account'=>
'university',
'accounting_account'=>
'clipboard-list',
'accountline'=>
'receipt',
'accountancy'=>
'search-dollar',
'action'=>
'calendar-alt',
'add'=>
'plus-circle',
'address'=>
'address-book',
'asset'=>
'money-check-alt',
'autofill'=>
'fill',
4299 'bank_account'=>
'university',
4300 'bill'=>
'file-invoice-dollar',
'billa'=>
'file-excel',
'billr'=>
'file-invoice-dollar',
'billd'=>
'file-medical',
4301 'supplier_invoice'=>
'file-invoice-dollar',
'supplier_invoicea'=>
'file-excel',
'supplier_invoicer'=>
'file-invoice-dollar',
'supplier_invoiced'=>
'file-medical',
4303 'card'=>
'address-card',
'chart'=>
'chart-line',
'company'=>
'building',
'contact'=>
'address-book',
'contract'=>
'suitcase',
'collab'=>
'people-arrows',
'conversation'=>
'comments',
'country'=>
'globe-americas',
'cron'=>
'business-time',
'cross'=>
'times',
4304 'donation'=>
'file-alt',
'dynamicprice'=>
'hand-holding-usd',
4305 'setup'=>
'cog',
'companies'=>
'building',
'products'=>
'cube',
'commercial'=>
'suitcase',
'invoicing'=>
'coins',
4306 'accounting'=>
'search-dollar',
'category'=>
'tag',
'dollyrevert'=>
'dolly',
4307 'generate'=>
'plus-square',
'hrm'=>
'user-tie',
'incoterm'=>
'truck-loading',
4308 'margin'=>
'calculator',
'members'=>
'user-friends',
'ticket'=>
'ticket-alt',
'globe'=>
'external-link-alt',
'lot'=>
'barcode',
4309 'email'=>
'at',
'establishment'=>
'building',
'edit'=>
'pencil-alt',
'entity'=>
'globe',
4310 'graph'=>
'chart-line',
'grip_title'=>
'arrows-alt',
'grip'=>
'arrows-alt',
'help'=>
'question-circle',
4311 'generic'=>
'file',
'holiday'=>
'umbrella-beach',
4312 'info'=>
'info-circle',
'inventory'=>
'boxes',
'intracommreport'=>
'globe-europe',
'jobprofile'=>
'cogs',
4313 'knowledgemanagement'=>
'ticket-alt',
'label'=>
'layer-group',
'line'=>
'bars',
'loan'=>
'money-bill-alt',
4314 'member'=>
'user-alt',
'meeting'=>
'chalkboard-teacher',
'mrp'=>
'cubes',
'next'=>
'arrow-alt-circle-right',
4315 'trip'=>
'wallet',
'expensereport'=>
'wallet',
'group'=>
'users',
'movement'=>
'people-carry',
4316 'sign-out'=>
'sign-out-alt',
4317 'switch_off'=>
'toggle-off',
'switch_on'=>
'toggle-on',
'switch_on_warning'=>
'toggle-on',
'switch_on_red'=>
'toggle-on',
'check'=>
'check',
'bookmark'=>
'star',
4318 'bank'=>
'university',
'close_title'=>
'times',
'delete'=>
'trash',
'filter'=>
'filter',
4319 'list-alt'=>
'list-alt',
'calendarlist'=>
'bars',
'calendar'=>
'calendar-alt',
'calendarmonth'=>
'calendar-alt',
'calendarweek'=>
'calendar-week',
'calendarday'=>
'calendar-day',
'calendarperuser'=>
'table',
4320 'intervention'=>
'ambulance',
'invoice'=>
'file-invoice-dollar',
'currency'=>
'dollar-sign',
'multicurrency'=>
'dollar-sign',
'order'=>
'file-invoice',
4321 'error'=>
'exclamation-triangle',
'warning'=>
'exclamation-triangle',
4323 'playdisabled'=>
'play',
'pdf'=>
'file-pdf',
'poll'=>
'check-double',
'pos'=>
'cash-register',
'preview'=>
'binoculars',
'project'=>
'project-diagram',
'projectpub'=>
'project-diagram',
'projecttask'=>
'tasks',
'propal'=>
'file-signature',
'proposal'=>
'file-signature',
4324 'partnership'=>
'handshake',
'payment'=>
'money-check-alt',
'payment_vat'=>
'money-check-alt',
'pictoconfirm'=>
'check-square',
'phoning'=>
'phone',
'phoning_mobile'=>
'mobile-alt',
'phoning_fax'=>
'fax',
'previous'=>
'arrow-alt-circle-left',
'printer'=>
'print',
'product'=>
'cube',
'puce'=>
'angle-right',
4325 'recent' =>
'check-square',
'reception'=>
'dolly',
'recruitmentjobposition'=>
'id-card-alt',
'recruitmentcandidature'=>
'id-badge',
4326 'resize'=>
'crop',
'supplier_order'=>
'dol-order_supplier',
'supplier_proposal'=>
'file-signature',
4327 'refresh'=>
'redo',
'region'=>
'map-marked',
'replacement'=>
'exchange-alt',
'resource'=>
'laptop-house',
'recurring'=>
'history',
4328 'service'=>
'concierge-bell',
4329 'skill'=>
'shapes',
'state'=>
'map-marked-alt',
'security'=>
'key',
'salary'=>
'wallet',
'shipment'=>
'dolly',
'stock'=>
'box-open',
'stats' =>
'chart-bar',
'split'=>
'code-branch',
'stripe'=>
'stripe-s',
4330 'supplier'=>
'building',
'technic'=>
'cogs',
4331 'timespent'=>
'clock',
'title_setup'=>
'tools',
'title_accountancy'=>
'money-check-alt',
'title_bank'=>
'university',
'title_hrm'=>
'umbrella-beach',
4332 'title_agenda'=>
'calendar-alt',
4333 'uncheck'=>
'times',
'uparrow'=>
'share',
'url'=>
'external-link-alt',
'vat'=>
'money-check-alt',
'vcard'=>
'arrow-alt-circle-down',
4334 'jabber'=>
'comment-o',
4335 'website'=>
'globe-americas',
'workstation'=>
'pallet',
'webhook'=>
'bullseye',
'world'=>
'globe',
'private'=>
'user-lock',
4336 'conferenceorbooth'=>
'chalkboard-teacher',
'eventorganization'=>
'project-diagram'
4338 if ($pictowithouttext ==
'off') {
4339 $fakey =
'fa-square';
4341 } elseif ($pictowithouttext ==
'on') {
4342 $fakey =
'fa-check-square';
4344 } elseif ($pictowithouttext ==
'listlight') {
4345 $fakey =
'fa-download';
4346 $marginleftonlyshort = 1;
4347 } elseif ($pictowithouttext ==
'printer') {
4348 $fakey =
'fa-print';
4350 } elseif ($pictowithouttext ==
'note') {
4351 $fakey =
'fa-sticky-note';
4352 $marginleftonlyshort = 1;
4353 } elseif (in_array($pictowithouttext, array(
'1uparrow',
'1downarrow',
'1leftarrow',
'1rightarrow',
'1uparrow_selected',
'1downarrow_selected',
'1leftarrow_selected',
'1rightarrow_selected'))) {
4354 $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');
4355 $fakey =
'fa-'.$convertarray[$pictowithouttext];
4356 if (preg_match(
'/selected/', $pictowithouttext)) {
4359 $marginleftonlyshort = 1;
4360 } elseif (!empty($arrayconvpictotofa[$pictowithouttext])) {
4361 $fakey =
'fa-'.$arrayconvpictotofa[$pictowithouttext];
4363 $fakey =
'fa-'.$pictowithouttext;
4366 if (in_array($pictowithouttext, array(
'dollyrevert',
'member',
'members',
'contract',
'group',
'resource',
'shipment'))) {
4367 $morecss .=
' em092';
4369 if (in_array($pictowithouttext, array(
'conferenceorbooth',
'collab',
'eventorganization',
'holiday',
'info',
'project',
'workstation'))) {
4370 $morecss .=
' em088';
4372 if (in_array($pictowithouttext, array(
'asset',
'intervention',
'payment',
'loan',
'partnership',
'stock',
'technic'))) {
4373 $morecss .=
' em080';
4377 $arrayconvpictotomarginleftonly = array(
4378 'bank',
'check',
'delete',
'generic',
'grip',
'grip_title',
'jabber',
4379 'grip_title',
'grip',
'listlight',
'note',
'on',
'off',
'playdisabled',
'printer',
'resize',
'sign-out',
'stats',
'switch_on',
'switch_on_red',
'switch_off',
4380 'uparrow',
'1uparrow',
'1downarrow',
'1leftarrow',
'1rightarrow',
'1uparrow_selected',
'1downarrow_selected',
'1leftarrow_selected',
'1rightarrow_selected'
4382 if (!isset($arrayconvpictotomarginleftonly[$pictowithouttext])) {
4383 $marginleftonlyshort = 0;
4387 $arrayconvpictotomorcess = array(
4388 'action'=>
'infobox-action',
'account'=>
'infobox-bank_account',
'accounting_account'=>
'infobox-bank_account',
'accountline'=>
'infobox-bank_account',
'accountancy'=>
'infobox-bank_account',
'asset'=>
'infobox-bank_account',
4389 'bank_account'=>
'infobox-bank_account',
4390 'bill'=>
'infobox-commande',
'billa'=>
'infobox-commande',
'billr'=>
'infobox-commande',
'billd'=>
'infobox-commande',
4391 'margin'=>
'infobox-bank_account',
'conferenceorbooth'=>
'infobox-project',
4392 'cash-register'=>
'infobox-bank_account',
'contract'=>
'infobox-contrat',
'check'=>
'font-status4',
'collab'=>
'infobox-action',
'conversation'=>
'infobox-contrat',
4393 'donation'=>
'infobox-commande',
'dolly'=>
'infobox-commande',
'dollyrevert'=>
'flip infobox-order_supplier',
4394 'ecm'=>
'infobox-action',
'eventorganization'=>
'infobox-project',
4395 'hrm'=>
'infobox-adherent',
'group'=>
'infobox-adherent',
'intervention'=>
'infobox-contrat',
4396 'incoterm'=>
'infobox-supplier_proposal',
4397 'currency'=>
'infobox-bank_account',
'multicurrency'=>
'infobox-bank_account',
4398 'members'=>
'infobox-adherent',
'member'=>
'infobox-adherent',
'money-bill-alt'=>
'infobox-bank_account',
4399 'order'=>
'infobox-commande',
4400 'user'=>
'infobox-adherent',
'users'=>
'infobox-adherent',
4401 'error'=>
'pictoerror',
'warning'=>
'pictowarning',
'switch_on'=>
'font-status4',
'switch_on_warning'=>
'font-status4 warning',
'switch_on_red'=>
'font-status8',
4402 'holiday'=>
'infobox-holiday',
'info'=>
'opacityhigh',
'invoice'=>
'infobox-commande',
4403 'knowledgemanagement'=>
'infobox-contrat rotate90',
'loan'=>
'infobox-bank_account',
4404 'payment'=>
'infobox-bank_account',
'payment_vat'=>
'infobox-bank_account',
'poll'=>
'infobox-adherent',
'pos'=>
'infobox-bank_account',
'project'=>
'infobox-project',
'projecttask'=>
'infobox-project',
4405 'propal'=>
'infobox-propal',
'proposal'=>
'infobox-propal',
'private'=>
'infobox-project',
4406 'reception'=>
'flip',
'recruitmentjobposition'=>
'infobox-adherent',
'recruitmentcandidature'=>
'infobox-adherent',
4407 'resource'=>
'infobox-action',
4408 'salary'=>
'infobox-bank_account',
'shipment'=>
'infobox-commande',
'supplier_invoice'=>
'infobox-order_supplier',
'supplier_invoicea'=>
'infobox-order_supplier',
'supplier_invoiced'=>
'infobox-order_supplier',
4409 'supplier'=>
'infobox-order_supplier',
'supplier_order'=>
'infobox-order_supplier',
'supplier_proposal'=>
'infobox-supplier_proposal',
4410 'ticket'=>
'infobox-contrat',
'title_accountancy'=>
'infobox-bank_account',
'title_hrm'=>
'infobox-holiday',
'expensereport'=>
'infobox-expensereport',
'trip'=>
'infobox-expensereport',
'title_agenda'=>
'infobox-action',
4411 'vat'=>
'infobox-bank_account',
4413 'list-alt'=>
'imgforviewmode',
'calendar'=>
'imgforviewmode',
'calendarweek'=>
'imgforviewmode',
'calendarmonth'=>
'imgforviewmode',
'calendarday'=>
'imgforviewmode',
'calendarperuser'=>
'imgforviewmode'
4415 if (!empty($arrayconvpictotomorcess[$pictowithouttext]) && strpos($picto,
'_nocolor') ===
false) {
4416 $morecss .= ($morecss ?
' ' :
'').$arrayconvpictotomorcess[$pictowithouttext];
4420 $arrayconvpictotocolor = array(
4421 'address'=>
'#6c6aa8',
'building'=>
'#6c6aa8',
'bom'=>
'#a69944',
4422 'clone'=>
'#999',
'cog'=>
'#999',
'companies'=>
'#6c6aa8',
'company'=>
'#6c6aa8',
'contact'=>
'#6c6aa8',
'cron'=>
'#555',
4423 'dynamicprice'=>
'#a69944',
4424 'edit'=>
'#444',
'note'=>
'#999',
'error'=>
'',
'help'=>
'#bbb',
'listlight'=>
'#999',
'language'=>
'#555',
4426 'lock'=>
'#ddd',
'lot'=>
'#a69944',
4427 'map-marker-alt'=>
'#aaa',
'mrp'=>
'#a69944',
'product'=>
'#a69944',
'service'=>
'#a69944',
'inventory'=>
'#a69944',
'stock'=>
'#a69944',
'movement'=>
'#a69944',
4428 'other'=>
'#ddd',
'world'=>
'#986c6a',
4429 'partnership'=>
'#6c6aa8',
'playdisabled'=>
'#ccc',
'printer'=>
'#444',
'projectpub'=>
'#986c6a',
'reception'=>
'#a69944',
'resize'=>
'#444',
'rss'=>
'#cba',
4431 'security'=>
'#999',
'square'=>
'#888',
'stop-circle'=>
'#888',
'stats'=>
'#444',
'switch_off'=>
'#999',
'technic'=>
'#999',
'timespent'=>
'#555',
4432 'uncheck'=>
'#800',
'uparrow'=>
'#555',
'user-cog'=>
'#999',
'country'=>
'#aaa',
'globe-americas'=>
'#aaa',
'region'=>
'#aaa',
'state'=>
'#aaa',
4433 'website'=>
'#304',
'workstation'=>
'#a69944'
4435 if (isset($arrayconvpictotocolor[$pictowithouttext]) && strpos($picto,
'_nocolor') ===
false) {
4436 $facolor = $arrayconvpictotocolor[$pictowithouttext];
4443 if (preg_match(
'/class="([^"]+)"/', $moreatt, $reg)) {
4444 $morecss .= ($morecss ?
' ' :
'').$reg[1];
4445 $moreatt = str_replace(
'class="'.$reg[1].
'"',
'', $moreatt);
4447 if (preg_match(
'/style="([^"]+)"/', $moreatt, $reg)) {
4448 $morestyle = $reg[1];
4449 $moreatt = str_replace(
'style="'.$reg[1].
'"',
'', $moreatt);
4451 $moreatt = trim($moreatt);
4453 $enabledisablehtml =
'<span class="'.$fa.
' '.$fakey.($marginleftonlyshort ? ($marginleftonlyshort == 1 ?
' marginleftonlyshort' :
' marginleftonly') :
'');
4454 $enabledisablehtml .= ($morecss ?
' '.$morecss :
'').
'" style="'.($fasize ? (
'font-size: '.$fasize.
';') :
'').($facolor ? (
' color: '.$facolor.
';') :
'').($morestyle ?
' '.$morestyle :
'').
'"'.(($notitle || empty($titlealt)) ?
'' :
' title="'.dol_escape_htmltag($titlealt).
'"').($moreatt ?
' '.$moreatt :
'').
'>';
4458 $enabledisablehtml .=
'</span>';
4460 return $enabledisablehtml;
4463 if (!empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
4464 $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.
'/theme/'.$theme;
4465 } elseif (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
4466 $path = $conf->global->MAIN_OVERWRITE_THEME_RES.
'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES;
4467 } elseif (!empty($conf->modules_parts[
'theme']) && array_key_exists($theme, $conf->modules_parts[
'theme'])) {
4468 $path = $theme.
'/theme/'.$theme;
4473 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $picto, $regs)) {
4479 if (!preg_match(
'/(\.png|\.gif|\.svg)$/i', $picto)) {
4484 foreach ($conf->file->dol_document_root as $type => $dirroot) {
4485 if ($type ==
'main') {
4489 if (file_exists($dirroot.
'/'.$path.
'/img/'.$picto)) {
4490 $url = DOL_URL_ROOT.$conf->file->dol_url_root[$type];
4496 $fullpathpicto = $url.
'/'.$path.
'/img/'.$picto;
4500 return $fullpathpicto;
4504 return '<img src="'.$fullpathpicto.
'"'.($notitle ?
'' :
' alt="'.dol_escape_htmltag($alt).
'"').(($notitle || empty($titlealt)) ?
'' :
' title="'.dol_escape_htmltag($titlealt).
'"').($moreatt ?
' '.$moreatt.($morecss ?
' class="'.$morecss.
'"' :
'') :
' class="inline-block'.($morecss ?
' '.$morecss :
'').
'"').
'>';