52if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
53 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
56$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
57$tmp2 = realpath(__FILE__);
59$j = strlen($tmp2) - 1;
60while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
64if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
65 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
67if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
68 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
71if (!$res && file_exists(
"../main.inc.php")) {
72 $res = @include
"../main.inc.php";
74if (!$res && file_exists(
"../../main.inc.php")) {
75 $res = @include
"../../main.inc.php";
77if (!$res && file_exists(
"../../../main.inc.php")) {
78 $res = @include
"../../../main.inc.php";
81 die(
"Include of main fails");
84require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
85require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
86require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
88require_once __DIR__.
'/class/myobject.class.php';
101$langs->loadLangs(array(
"mymodule@mymodule",
"other"));
104$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
105$massaction =
GETPOST(
'massaction',
'alpha');
107$confirm =
GETPOST(
'confirm',
'alpha');
108$cancel =
GETPOST(
'cancel',
'alpha');
109$toselect =
GETPOST(
'toselect',
'array:int');
110$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
111$backtopage =
GETPOST(
'backtopage',
'alpha');
112$optioncss =
GETPOST(
'optioncss',
'aZ');
114$groupby =
GETPOST(
'groupby',
'aZ09');
121$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
122$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
124if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
128$offset = $limit * $page;
129$pageprev = $page - 1;
130$pagenext = $page + 1;
135$diroutputmassaction =
$conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
136$hookmanager->initHooks(array($contextpage));
139$extrafields->fetch_name_optionals_label(
$object->table_element);
142$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
147 $sortfield =
"t.".key(
$object->fields);
154$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
156foreach (
$object->fields as $key => $val) {
157 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
158 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
160 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
166$fieldstosearchall = array();
183$arrayfields = array();
184foreach (
$object->fields as $key => $val) {
186 if (!empty($val[
'visible'])) {
187 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
188 $arrayfields[$tableprefix.
'.'.$key] = array(
189 'label' => $val[
'label'],
190 'checked' => (($visible < 0) ? 0 : 1),
191 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
192 'position' => $val[
'position'],
193 'help' => isset($val[
'help']) ? $val[
'help'] :
''
198include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
206$enablepermissioncheck =
getDolGlobalInt(
'MYMODULE_ENABLE_PERMISSION_CHECK');
207if ($enablepermissioncheck) {
208 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
209 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
210 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
212 $permissiontoread = 1;
213 $permissiontoadd = 1;
214 $permissiontodelete = 1;
218if ($user->socid > 0) {
225if (!isModEnabled(
"mymodule")) {
228if (!$permissiontoread) {
237if (
GETPOST(
'cancel',
'alpha')) {
241if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
245$parameters = array(
'arrayfields' => &$arrayfields);
246$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
251if (empty($reshook)) {
253 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
256 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
257 foreach (
$object->fields as $key => $val) {
259 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
260 $search[$key.
'_dtstart'] =
'';
261 $search[$key.
'_dtend'] =
'';
266 $search_array_options = array();
268 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
269 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
274 $objectclass =
'MyObject';
275 $objectlabel =
'MyObject';
276 $uploaddir =
$conf->mymodule->dir_output;
279 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
291$form =
new Form($db);
295$title = $langs->trans(
"MyObjects");
305$sql .=
" ".$object->getFieldList(
't');
307if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
308 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
309 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
313$parameters = array();
314$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
315$sql .= $hookmanager->resPrint;
316$sql = preg_replace(
'/,\s*$/',
'', $sql);
320$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
322if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
323 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
326$parameters = array();
327$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
328$sql .= $hookmanager->resPrint;
329if (
$object->ismultientitymanaged == 1) {
330 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
332 $sql .=
" WHERE 1 = 1";
334foreach ($search as $key => $val) {
335 if (array_key_exists($key,
$object->fields)) {
336 if ($key ==
'status' && $search[$key] == -1) {
340 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
341 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
346 if (empty(
$object->fields[$key][
'searchmulti'])) {
347 if (!is_array($search[$key]) && $search[$key] !=
'') {
348 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
351 if (is_array($search[$key]) && !empty($search[$key])) {
352 $sql .=
natural_search(
"t.".$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
356 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
357 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
358 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
359 if (preg_match(
'/_dtstart$/', $key)) {
360 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
362 if (preg_match(
'/_dtend$/', $key)) {
363 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
370 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
393include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
395$parameters = array();
396$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
397$sql .= $hookmanager->resPrint;
425$nbtotalofrecords =
'';
428 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
429 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
431 $resql = $db->query($sqlforcount);
433 $objforcount = $db->fetch_object($resql);
434 $nbtotalofrecords = $objforcount->nbtotalofrecords;
439 if (($page * $limit) > $nbtotalofrecords) {
447$sql .= $db->order($sortfield, $sortorder);
449 $sql .= $db->plimit($limit + 1, $offset);
452$resql = $db->query($sql);
458$num = $db->num_rows($resql);
462if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
463 $obj = $db->fetch_object($resql);
465 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
473llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
490$arrayofselected = is_array($toselect) ? $toselect : array();
494 $param .=
'&mode='.urlencode($mode);
496if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
497 $param .=
'&contextpage='.urlencode($contextpage);
499if ($limit > 0 && $limit !=
$conf->liste_limit) {
500 $param .=
'&limit='.((int) $limit);
502if ($optioncss !=
'') {
503 $param .=
'&optioncss='.urlencode($optioncss);
506 $param .=
'&groupby='.urlencode($groupby);
508foreach ($search as $key => $val) {
509 if (is_array($search[$key])) {
510 foreach ($search[$key] as $skey) {
512 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
515 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
516 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
517 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
518 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
519 } elseif ($search[$key] !=
'') {
520 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
524include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
526$parameters = array(
'param' => &$param);
527$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
528$param .= $hookmanager->resPrint;
531$arrayofmassactions = array(
537if (!empty($permissiontodelete)) {
538 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
540if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
541 $arrayofmassactions = array();
543$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
545print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
546if ($optioncss !=
'') {
547 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
549print
'<input type="hidden" name="token" value="'.newToken().
'">';
550print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
551print
'<input type="hidden" name="action" value="list">';
552print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
553print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
554print
'<input type="hidden" name="page" value="'.$page.
'">';
555print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
556print
'<input type="hidden" name="page_y" value="">';
557print
'<input type="hidden" name="mode" value="'.$mode.
'">';
561$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'));
562$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'));
564$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
566print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
569$topicmail =
"SendMyObjectRef";
570$modelmail =
"myobject";
572$trackid =
'xxxx'.$object->id;
573include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
578 foreach ($fieldstosearchall as $key => $val) {
579 $fieldstosearchall[$key] = $langs->trans($val);
580 $setupstring .= $key.
"=".$val.
";";
582 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
583 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
591$parameters = array();
592$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
593if (empty($reshook)) {
594 $moreforfilter .= $hookmanager->resPrint;
596 $moreforfilter = $hookmanager->resPrint;
599 'arrayfields' => &$arrayfields,
602if (!empty($moreforfilter)) {
603 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
604 print $moreforfilter;
608$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
609$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
610$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
611$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
613print
'<div class="div-table-responsive">';
614print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
618print
'<tr class="liste_titre_filter">';
620if (
$conf->main_checkbox_left_column) {
621 print
'<td class="liste_titre center maxwidthsearch">';
622 $searchpicto = $form->showFilterButtons(
'left');
626foreach (
$object->fields as $key => $val) {
628 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
629 if ($key ==
'status') {
630 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
631 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
632 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
633 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
634 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
635 } 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'])) {
636 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
638 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
639 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
640 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
641 if (empty($val[
'searchmulti'])) {
642 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);
644 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
646 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
647 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
648 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
649 print
'<div class="nowrap">';
650 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
652 print
'<div class="nowrap">';
653 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
655 } elseif ($key ==
'lang') {
656 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
658 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
660 print
'<input type="text" class="flat maxwidth'.(in_array($val[
'type'], array(
'integer',
'price')) ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
666include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
669$parameters = array(
'arrayfields' => $arrayfields);
670$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
671print $hookmanager->resPrint;
676if (!
$conf->main_checkbox_left_column) {
677 print
'<td class="liste_titre center maxwidthsearch">';
678 $searchpicto = $form->showFilterButtons();
684$totalarray = array();
685$totalarray[
'nbfield'] = 0;
689print
'<tr class="liste_titre">';
691if (
$conf->main_checkbox_left_column) {
692 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
693 $totalarray[
'nbfield']++;
695foreach (
$object->fields as $key => $val) {
696 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
697 if ($key ==
'status') {
698 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
699 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
700 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
701 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
702 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
703 } 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'])) {
704 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
706 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
707 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
708 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";
709 $totalarray[
'nbfield']++;
713include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
715$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
716$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
717print $hookmanager->resPrint;
723if (!
$conf->main_checkbox_left_column) {
724 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
725 $totalarray[
'nbfield']++;
730$needToFetchEachLine = 0;
731if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
732 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
733 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
734 $needToFetchEachLine++;
743$savnbfield = $totalarray[
'nbfield'];
744$totalarray = array();
745$totalarray[
'nbfield'] = 0;
746$imaxinloop = ($limit ? min($num, $limit) : $num);
747while ($i < $imaxinloop) {
748 $obj = $db->fetch_object($resql);
754 $object->setVarsFromFetchObj($obj);
770 if ($mode ==
'kanban') {
772 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
773 print
'<div class="box-flex-container kanban">';
777 if ($massactionbutton || $massaction) {
779 if (in_array(
$object->id, $arrayofselected)) {
784 print
$object->getKanbanView(
'', array(
'selected' => $selected));
785 if ($i == ($imaxinloop - 1)) {
792 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
795 if (
$conf->main_checkbox_left_column) {
796 print
'<td class="nowrap center">';
797 if ($massactionbutton || $massaction) {
799 if (in_array(
$object->id, $arrayofselected)) {
802 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
806 $totalarray[
'nbfield']++;
810 foreach (
$object->fields as $key => $val) {
811 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
812 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
813 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
814 } elseif ($key ==
'status') {
815 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
818 if (in_array($val[
'type'], array(
'timestamp'))) {
819 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
820 } elseif ($key ==
'ref') {
821 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
824 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'])) {
825 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
829 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
830 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
831 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
832 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
835 if ($key ==
'status') {
836 print
$object->getLibStatut(5);
837 } elseif ($key ==
'rowid') {
844 $totalarray[
'nbfield']++;
846 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
848 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
850 if (!isset($totalarray[
'val'])) {
851 $totalarray[
'val'] = array();
853 if (!isset($totalarray[
'val'][
't.'.$key])) {
854 $totalarray[
'val'][
't.'.$key] = 0;
856 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
861 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
863 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
864 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
865 print $hookmanager->resPrint;
872 if (empty(
$conf->main_checkbox_left_column)) {
873 print
'<td class="nowrap center">';
874 if ($massactionbutton || $massaction) {
876 if (in_array(
$object->id, $arrayofselected)) {
879 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
883 $totalarray[
'nbfield']++;
894include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
899 foreach ($arrayfields as $key => $val) {
900 if (!empty($val[
'checked'])) {
904 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
910$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
911$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
912print $hookmanager->resPrint;
914print
'</table>'.
"\n";
919if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
920 $hidegeneratedfilelistifempty = 1;
921 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
922 $hidegeneratedfilelistifempty = 0;
925 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
929 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
930 $urlsource .= str_replace(
'&',
'&', $param);
932 $filedir = $diroutputmassaction;
933 $genallowed = $permissiontoread;
934 $delallowed = $permissiontoadd;
936 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
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.