50require
'../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/intracommreport/class/intracommreport.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
56$langs->loadLangs(array(
'intracommreport'));
59$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
60$massaction =
GETPOST(
'massaction',
'alpha');
61$show_files =
GETPOST(
'show_files',
'int');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$optioncss =
GETPOST(
'optioncss',
'alpha');
68$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
69$search_ref =
GETPOST(
"search_ref",
'alpha');
70$search_type =
GETPOST(
"search_type",
'int');
73$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'intracommreportlist';
74if ((
string) $type ==
'1') {
75 $contextpage =
'DESlist';
76 if ($search_type ==
'') {
80if ((
string) $type ==
'0') {
81 $contextpage =
'DEBlist';
82 if ($search_type ==
'') {
87$diroutputmassaction = $conf->product->dir_output.
'/temp/massgeneration/'.$user->id;
91$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
92$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
94if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
98$offset = $limit * $page;
100$pagenext = $page + 1;
106$diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
107$hookmanager->initHooks(array($contextpage));
110$extrafields->fetch_name_optionals_label(
$object->table_element);
113$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
118 $sortfield =
"t.".key(
$object->fields);
125$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
127foreach (
$object->fields as $key => $val) {
128 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
129 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
131 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
137$fieldstosearchall = array(
143$hookmanager->initHooks(array(
'intracommreportlist'));
145$form =
new Form($db);
160$arrayfields = array();
161foreach (
$object->fields as $key => $val) {
163 if (!empty($val[
'visible'])) {
164 $visible = (int)
dol_eval($val[
'visible'], 1);
165 $arrayfields[
't.'.$key] = array(
166 'label' => $val[
'label'],
167 'checked' => (($visible < 0) ? 0 : 1),
168 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
169 'position' => $val[
'position'],
170 'help' => isset($val[
'help']) ? $val[
'help'] :
''
175include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
185$permissiontoread = $user->hasRight(
'intracommreport',
'read');
186$permissiontoadd = $user->hasRight(
'intracommreport',
'write');
187$permissiontodelete = $user->hasRight(
'intracommreport',
'delete');
190if ($search_type ==
'0') {
191 $result =
restrictedArea($user,
'produit',
'',
'',
'',
'',
'', 0);
192} elseif ($search_type ==
'1') {
193 $result =
restrictedArea($user,
'service',
'',
'',
'',
'',
'', 0);
195 $result =
restrictedArea($user,
'produit|service',
'',
'',
'',
'',
'', 0);
198if (!isModEnabled(
"intracommreport")) {
208if (
GETPOST(
'cancel',
'alpha')) {
212if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
216$parameters = array();
217$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
222if (empty($reshook)) {
224 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
227 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
234 $search_array_options = array();
238 $objectclass =
'Product';
239 if ((
string) $search_type ==
'1') {
240 $objectlabel =
'Services';
242 if ((
string) $search_type ==
'0') {
243 $objectlabel =
'Products';
246 $uploaddir = $conf->product->dir_output;
247 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
255$form =
new Form($db);
259$title = $langs->trans(
"IntraCommReports");
269$sql .=
$object->getFieldList(
't');
271if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
272 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
273 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
277$parameters = array();
278$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
279$sql .= $hookmanager->resPrint;
280$sql = preg_replace(
'/,\s*$/',
'', $sql);
284$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
286if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
287 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
290$parameters = array();
291$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
292$sql .= $hookmanager->resPrint;
293if (
$object->ismultientitymanaged == 1) {
294 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
296 $sql .=
" WHERE 1 = 1";
298foreach ($search as $key => $val) {
299 if (array_key_exists($key,
$object->fields)) {
300 if ($key ==
'status' && $search[$key] == -1) {
304 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
305 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
310 if ($search[$key] !=
'') {
311 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
314 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
315 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
316 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
317 if (preg_match(
'/_dtstart$/', $key)) {
318 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
320 if (preg_match(
'/_dtend$/', $key)) {
321 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
328 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
351include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
353$parameters = array();
354$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
355$sql .= $hookmanager->resPrint;
383$nbtotalofrecords =
'';
386 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
387 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
389 $resql = $db->query($sqlforcount);
391 $objforcount = $db->fetch_object($resql);
392 $nbtotalofrecords = $objforcount->nbtotalofrecords;
397 if (($page * $limit) > $nbtotalofrecords) {
405$sql .= $db->order($sortfield, $sortorder);
407 $sql .= $db->plimit($limit + 1, $offset);
410$resql = $db->query($sql);
416$num = $db->num_rows($resql);
420if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
421 $obj = $db->fetch_object($resql);
423 header(
"Location: ".
dol_buildpath(
'/intracommreport/card.php', 1).
'?id='.((
int)
$id));
431llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
448$arrayofselected = is_array($toselect) ? $toselect : array();
452 $param .=
'&mode='.urlencode($mode);
454if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
455 $param .=
'&contextpage='.urlencode($contextpage);
457if ($limit > 0 && $limit != $conf->liste_limit) {
458 $param .=
'&limit='.((int) $limit);
460if ($optioncss !=
'') {
461 $param .=
'&optioncss='.urlencode($optioncss);
464 $param .=
'&groupby='.urlencode($groupby);
466foreach ($search as $key => $val) {
467 if (is_array($search[$key])) {
468 foreach ($search[$key] as $skey) {
470 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
473 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
474 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
475 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
476 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
477 } elseif ($search[$key] !=
'') {
478 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
482include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
484$parameters = array(
'param' => &$param);
485$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
486$param .= $hookmanager->resPrint;
489$arrayofmassactions = array(
495if (!empty($permissiontodelete)) {
496 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
498if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
499 $arrayofmassactions = array();
501$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
503print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
504if ($optioncss !=
'') {
505 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
507print
'<input type="hidden" name="token" value="'.newToken().
'">';
508print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
509print
'<input type="hidden" name="action" value="list">';
510print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
511print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
512print
'<input type="hidden" name="page" value="'.$page.
'">';
513print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
514print
'<input type="hidden" name="page_y" value="">';
515print
'<input type="hidden" name="mode" value="'.$mode.
'">';
519$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
520$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
522$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/intracommreport/card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
524print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
527$topicmail =
"SendIntraCommReportRef";
528$modelmail =
"intracommreport";
530$trackid =
'xxxx'.$object->id;
531include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
535 foreach ($fieldstosearchall as $key => $val) {
536 $fieldstosearchall[$key] = $langs->trans($val);
537 $setupstring .= $key.
"=".$val.
";";
539 print
'<!-- Search done like if INTRACOMMREPORT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
540 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
548$parameters = array();
549$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
550if (empty($reshook)) {
551 $moreforfilter .= $hookmanager->resPrint;
553 $moreforfilter = $hookmanager->resPrint;
556if (!empty($moreforfilter)) {
557 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
558 print $moreforfilter;
559 $parameters = array();
560 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
561 print $hookmanager->resPrint;
565$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
566$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
567$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
568$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
570print
'<div class="div-table-responsive">';
571print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
575print
'<tr class="liste_titre_filter">';
577if ($conf->main_checkbox_left_column) {
578 print
'<td class="liste_titre center maxwidthsearch">';
579 $searchpicto = $form->showFilterButtons(
'left');
583foreach (
$object->fields as $key => $val) {
585 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
586 if ($key ==
'status') {
587 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
588 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
589 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
590 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
591 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
592 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
593 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
595 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
596 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
597 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
598 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
599 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
600 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
601 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
602 print
'<div class="nowrap">';
603 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
605 print
'<div class="nowrap">';
606 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
608 } elseif ($key ==
'lang') {
609 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
611 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
613 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
619include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
622$parameters = array(
'arrayfields' => $arrayfields);
623$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
624print $hookmanager->resPrint;
629if (!$conf->main_checkbox_left_column) {
630 print
'<td class="liste_titre center maxwidthsearch">';
631 $searchpicto = $form->showFilterButtons();
637$totalarray = array();
638$totalarray[
'nbfield'] = 0;
642print
'<tr class="liste_titre">';
644if ($conf->main_checkbox_left_column) {
645 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
646 $totalarray[
'nbfield']++;
648foreach (
$object->fields as $key => $val) {
649 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
650 if ($key ==
'status') {
651 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
652 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
653 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
654 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
655 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
656 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
657 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
659 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
660 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
661 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
''), 0, (empty($val[
'helplist']) ?
'' : $val[
'helplist'])).
"\n";
662 $totalarray[
'nbfield']++;
666include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
668$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
669$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
670print $hookmanager->resPrint;
676if (!$conf->main_checkbox_left_column) {
677 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
678 $totalarray[
'nbfield']++;
683$needToFetchEachLine = 0;
684if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
685 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
686 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
687 $needToFetchEachLine++;
696$savnbfield = $totalarray[
'nbfield'];
697$totalarray = array();
698$totalarray[
'nbfield'] = 0;
699$imaxinloop = ($limit ? min($num, $limit) : $num);
700while ($i < $imaxinloop) {
701 $obj = $db->fetch_object($resql);
707 $object->setVarsFromFetchObj($obj);
723 if ($mode ==
'kanban') {
725 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
726 print
'<div class="box-flex-container kanban">';
730 if ($massactionbutton || $massaction) {
732 if (in_array(
$object->id, $arrayofselected)) {
737 print
$object->getKanbanView(
'', array(
'selected' => $selected));
738 if ($i == ($imaxinloop - 1)) {
745 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
748 if ($conf->main_checkbox_left_column) {
749 print
'<td class="nowrap center">';
750 if ($massactionbutton || $massaction) {
752 if (in_array(
$object->id, $arrayofselected)) {
755 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
759 $totalarray[
'nbfield']++;
763 foreach (
$object->fields as $key => $val) {
764 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
765 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
766 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
767 } elseif ($key ==
'status') {
768 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
771 if (in_array($val[
'type'], array(
'timestamp'))) {
772 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
773 } elseif ($key ==
'ref') {
774 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
777 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
778 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
782 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
783 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
784 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
785 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
788 if ($key ==
'status') {
789 print
$object->getLibStatut(5);
790 } elseif ($key ==
'rowid') {
797 $totalarray[
'nbfield']++;
799 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
801 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
803 if (!isset($totalarray[
'val'])) {
804 $totalarray[
'val'] = array();
806 if (!isset($totalarray[
'val'][
't.'.$key])) {
807 $totalarray[
'val'][
't.'.$key] = 0;
809 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
814 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
816 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
817 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
818 print $hookmanager->resPrint;
825 if (empty($conf->main_checkbox_left_column)) {
826 print
'<td class="nowrap center">';
827 if ($massactionbutton || $massaction) {
829 if (in_array(
$object->id, $arrayofselected)) {
832 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
836 $totalarray[
'nbfield']++;
847include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
852 foreach ($arrayfields as $key => $val) {
853 if (!empty($val[
'checked'])) {
857 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
863$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
864$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
865print $hookmanager->resPrint;
867print
'</table>'.
"\n";
872if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
873 $hidegeneratedfilelistifempty = 1;
874 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
875 $hidegeneratedfilelistifempty = 0;
878 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
882 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
883 $urlsource .= str_replace(
'&',
'&', $param);
885 $filedir = $diroutputmassaction;
886 $genallowed = $permissiontoread;
887 $delallowed = $permissiontoadd;
889 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage intracomm report.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.