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 ($search[$key] !=
'') {
347 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
350 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
351 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
352 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
353 if (preg_match(
'/_dtstart$/', $key)) {
354 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
356 if (preg_match(
'/_dtend$/', $key)) {
357 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
364 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
387include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
389$parameters = array();
390$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
391$sql .= $hookmanager->resPrint;
419$nbtotalofrecords =
'';
422 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
423 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
425 $resql = $db->query($sqlforcount);
427 $objforcount = $db->fetch_object($resql);
428 $nbtotalofrecords = $objforcount->nbtotalofrecords;
433 if (($page * $limit) > $nbtotalofrecords) {
441$sql .= $db->order($sortfield, $sortorder);
443 $sql .= $db->plimit($limit + 1, $offset);
446$resql = $db->query($sql);
452$num = $db->num_rows($resql);
456if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
457 $obj = $db->fetch_object($resql);
459 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
467llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
484$arrayofselected = is_array($toselect) ? $toselect : array();
488 $param .=
'&mode='.urlencode($mode);
490if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
491 $param .=
'&contextpage='.urlencode($contextpage);
493if ($limit > 0 && $limit !=
$conf->liste_limit) {
494 $param .=
'&limit='.((int) $limit);
496if ($optioncss !=
'') {
497 $param .=
'&optioncss='.urlencode($optioncss);
500 $param .=
'&groupby='.urlencode($groupby);
502foreach ($search as $key => $val) {
503 if (is_array($search[$key])) {
504 foreach ($search[$key] as $skey) {
506 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
509 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
510 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
511 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
512 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
513 } elseif ($search[$key] !=
'') {
514 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
518include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
520$parameters = array(
'param' => &$param);
521$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
522$param .= $hookmanager->resPrint;
525$arrayofmassactions = array(
531if (!empty($permissiontodelete)) {
532 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
534if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
535 $arrayofmassactions = array();
537$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
539print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
540if ($optioncss !=
'') {
541 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
543print
'<input type="hidden" name="token" value="'.newToken().
'">';
544print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
545print
'<input type="hidden" name="action" value="list">';
546print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
547print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
548print
'<input type="hidden" name="page" value="'.$page.
'">';
549print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
550print
'<input type="hidden" name="page_y" value="">';
551print
'<input type="hidden" name="mode" value="'.$mode.
'">';
555$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'));
556$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'));
558$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
560print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
563$topicmail =
"SendMyObjectRef";
564$modelmail =
"myobject";
566$trackid =
'xxxx'.$object->id;
567include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
572 foreach ($fieldstosearchall as $key => $val) {
573 $fieldstosearchall[$key] = $langs->trans($val);
574 $setupstring .= $key.
"=".$val.
";";
576 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
577 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
585$parameters = array();
586$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
587if (empty($reshook)) {
588 $moreforfilter .= $hookmanager->resPrint;
590 $moreforfilter = $hookmanager->resPrint;
593 'arrayfields' => &$arrayfields,
596if (!empty($moreforfilter)) {
597 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
598 print $moreforfilter;
602$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
603$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
604$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
605$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
607print
'<div class="div-table-responsive">';
608print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
612print
'<tr class="liste_titre_filter">';
614if (
$conf->main_checkbox_left_column) {
615 print
'<td class="liste_titre center maxwidthsearch">';
616 $searchpicto = $form->showFilterButtons(
'left');
620foreach (
$object->fields as $key => $val) {
622 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
623 if ($key ==
'status') {
624 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
625 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
626 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
627 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
628 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
629 } 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'])) {
630 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
632 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
633 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
634 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
635 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);
636 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
637 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
638 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
639 print
'<div class="nowrap">';
640 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
642 print
'<div class="nowrap">';
643 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
645 } elseif ($key ==
'lang') {
646 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
648 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
650 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] :
'').
'">';
656include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
659$parameters = array(
'arrayfields' => $arrayfields);
660$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
661print $hookmanager->resPrint;
666if (!
$conf->main_checkbox_left_column) {
667 print
'<td class="liste_titre center maxwidthsearch">';
668 $searchpicto = $form->showFilterButtons();
674$totalarray = array();
675$totalarray[
'nbfield'] = 0;
679print
'<tr class="liste_titre">';
681if (
$conf->main_checkbox_left_column) {
682 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
683 $totalarray[
'nbfield']++;
685foreach (
$object->fields as $key => $val) {
686 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
687 if ($key ==
'status') {
688 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
689 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
690 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
691 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
692 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
693 } 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'])) {
694 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
696 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
697 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
698 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";
699 $totalarray[
'nbfield']++;
703include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
705$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
706$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
707print $hookmanager->resPrint;
713if (!
$conf->main_checkbox_left_column) {
714 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
715 $totalarray[
'nbfield']++;
720$needToFetchEachLine = 0;
721if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
722 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
723 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
724 $needToFetchEachLine++;
733$savnbfield = $totalarray[
'nbfield'];
734$totalarray = array();
735$totalarray[
'nbfield'] = 0;
736$imaxinloop = ($limit ? min($num, $limit) : $num);
737while ($i < $imaxinloop) {
738 $obj = $db->fetch_object($resql);
744 $object->setVarsFromFetchObj($obj);
760 if ($mode ==
'kanban') {
762 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
763 print
'<div class="box-flex-container kanban">';
767 if ($massactionbutton || $massaction) {
769 if (in_array(
$object->id, $arrayofselected)) {
774 print
$object->getKanbanView(
'', array(
'selected' => $selected));
775 if ($i == ($imaxinloop - 1)) {
782 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
785 if (
$conf->main_checkbox_left_column) {
786 print
'<td class="nowrap center">';
787 if ($massactionbutton || $massaction) {
789 if (in_array(
$object->id, $arrayofselected)) {
792 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
796 $totalarray[
'nbfield']++;
800 foreach (
$object->fields as $key => $val) {
801 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
802 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
803 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
804 } elseif ($key ==
'status') {
805 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
808 if (in_array($val[
'type'], array(
'timestamp'))) {
809 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
810 } elseif ($key ==
'ref') {
811 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
814 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'])) {
815 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
819 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
820 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
821 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
822 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
825 if ($key ==
'status') {
826 print
$object->getLibStatut(5);
827 } elseif ($key ==
'rowid') {
834 $totalarray[
'nbfield']++;
836 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
838 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
840 if (!isset($totalarray[
'val'])) {
841 $totalarray[
'val'] = array();
843 if (!isset($totalarray[
'val'][
't.'.$key])) {
844 $totalarray[
'val'][
't.'.$key] = 0;
846 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
851 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
853 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
854 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
855 print $hookmanager->resPrint;
862 if (empty(
$conf->main_checkbox_left_column)) {
863 print
'<td class="nowrap center">';
864 if ($massactionbutton || $massaction) {
866 if (in_array(
$object->id, $arrayofselected)) {
869 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
873 $totalarray[
'nbfield']++;
884include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
889 foreach ($arrayfields as $key => $val) {
890 if (!empty($val[
'checked'])) {
894 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
900$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
901$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
902print $hookmanager->resPrint;
904print
'</table>'.
"\n";
909if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
910 $hidegeneratedfilelistifempty = 1;
911 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
912 $hidegeneratedfilelistifempty = 0;
915 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
919 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
920 $urlsource .= str_replace(
'&',
'&', $param);
922 $filedir = $diroutputmassaction;
923 $genallowed = $permissiontoread;
924 $delallowed = $permissiontoadd;
926 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.
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.