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;
562$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
563$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
564$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
565$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
567print
'<div class="div-table-responsive">';
568print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
572print
'<tr class="liste_titre_filter">';
574if ($conf->main_checkbox_left_column) {
575 print
'<td class="liste_titre center maxwidthsearch">';
576 $searchpicto = $form->showFilterButtons(
'left');
580foreach (
$object->fields as $key => $val) {
582 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
583 if ($key ==
'status') {
584 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
585 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
586 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
587 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
588 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
589 } 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'])) {
590 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
592 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
593 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
594 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
595 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);
596 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
597 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
598 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
599 print
'<div class="nowrap">';
600 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
602 print
'<div class="nowrap">';
603 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
605 } elseif ($key ==
'lang') {
606 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
608 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
610 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
616include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
619$parameters = array(
'arrayfields' => $arrayfields);
620$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
621print $hookmanager->resPrint;
626if (!$conf->main_checkbox_left_column) {
627 print
'<td class="liste_titre center maxwidthsearch">';
628 $searchpicto = $form->showFilterButtons();
634$totalarray = array();
635$totalarray[
'nbfield'] = 0;
639print
'<tr class="liste_titre">';
641if ($conf->main_checkbox_left_column) {
642 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
643 $totalarray[
'nbfield']++;
645foreach (
$object->fields as $key => $val) {
646 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
647 if ($key ==
'status') {
648 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
649 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
650 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
651 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
652 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
653 } 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'])) {
654 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
656 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
657 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
658 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";
659 $totalarray[
'nbfield']++;
663include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
665$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
666$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
667print $hookmanager->resPrint;
673if (!$conf->main_checkbox_left_column) {
674 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
675 $totalarray[
'nbfield']++;
680$needToFetchEachLine = 0;
681if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
682 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
683 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
684 $needToFetchEachLine++;
693$savnbfield = $totalarray[
'nbfield'];
694$totalarray = array();
695$totalarray[
'nbfield'] = 0;
696$imaxinloop = ($limit ? min($num, $limit) : $num);
697while ($i < $imaxinloop) {
698 $obj = $db->fetch_object($resql);
704 $object->setVarsFromFetchObj($obj);
720 if ($mode ==
'kanban') {
722 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
723 print
'<div class="box-flex-container kanban">';
727 if ($massactionbutton || $massaction) {
729 if (in_array(
$object->id, $arrayofselected)) {
734 print
$object->getKanbanView(
'', array(
'selected' => $selected));
735 if ($i == ($imaxinloop - 1)) {
742 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
745 if ($conf->main_checkbox_left_column) {
746 print
'<td class="nowrap center">';
747 if ($massactionbutton || $massaction) {
749 if (in_array(
$object->id, $arrayofselected)) {
752 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
756 $totalarray[
'nbfield']++;
760 foreach (
$object->fields as $key => $val) {
761 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
762 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
763 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
764 } elseif ($key ==
'status') {
765 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
768 if (in_array($val[
'type'], array(
'timestamp'))) {
769 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
770 } elseif ($key ==
'ref') {
771 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
774 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'])) {
775 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
779 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
780 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
781 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
782 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
785 if ($key ==
'status') {
786 print
$object->getLibStatut(5);
787 } elseif ($key ==
'rowid') {
794 $totalarray[
'nbfield']++;
796 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
798 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
800 if (!isset($totalarray[
'val'])) {
801 $totalarray[
'val'] = array();
803 if (!isset($totalarray[
'val'][
't.'.$key])) {
804 $totalarray[
'val'][
't.'.$key] = 0;
806 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
811 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
813 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
814 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
815 print $hookmanager->resPrint;
822 if (empty($conf->main_checkbox_left_column)) {
823 print
'<td class="nowrap center">';
824 if ($massactionbutton || $massaction) {
826 if (in_array(
$object->id, $arrayofselected)) {
829 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
833 $totalarray[
'nbfield']++;
844include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
849 foreach ($arrayfields as $key => $val) {
850 if (!empty($val[
'checked'])) {
854 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
860$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
861$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
862print $hookmanager->resPrint;
864print
'</table>'.
"\n";
869if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
870 $hidegeneratedfilelistifempty = 1;
871 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
872 $hidegeneratedfilelistifempty = 0;
875 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
879 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
880 $urlsource .= str_replace(
'&',
'&', $param);
882 $filedir = $diroutputmassaction;
883 $genallowed = $permissiontoread;
884 $delallowed = $permissiontoadd;
886 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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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='')
Print a title with navigation controls for pagination.
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.