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';
93$langs->loadLangs(array(
"mymodule@mymodule",
"other"));
96$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
97$massaction =
GETPOST(
'massaction',
'alpha');
99$confirm =
GETPOST(
'confirm',
'alpha');
100$cancel =
GETPOST(
'cancel',
'alpha');
101$toselect =
GETPOST(
'toselect',
'array:int');
102$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
103$backtopage =
GETPOST(
'backtopage',
'alpha');
104$optioncss =
GETPOST(
'optioncss',
'aZ');
106$groupby =
GETPOST(
'groupby',
'aZ09');
113$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
114$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
116if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
120$offset = $limit * $page;
121$pageprev = $page - 1;
122$pagenext = $page + 1;
127$diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
128$hookmanager->initHooks(array($contextpage));
131$extrafields->fetch_name_optionals_label(
$object->table_element);
134$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
139 $sortfield =
"t.".key(
$object->fields);
146$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
148foreach (
$object->fields as $key => $val) {
149 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
150 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
152 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
158$fieldstosearchall = array();
175$arrayfields = array();
176foreach (
$object->fields as $key => $val) {
178 if (!empty($val[
'visible'])) {
179 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
180 $arrayfields[$tableprefix.
'.'.$key] = array(
181 'label' => $val[
'label'],
182 'checked' => (($visible < 0) ? 0 : 1),
183 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
184 'position' => $val[
'position'],
185 'help' => isset($val[
'help']) ? $val[
'help'] :
''
190include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
198$enablepermissioncheck = 0;
199if ($enablepermissioncheck) {
200 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
201 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
202 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
204 $permissiontoread = 1;
205 $permissiontoadd = 1;
206 $permissiontodelete = 1;
210if ($user->socid > 0) {
217if (!isModEnabled(
"mymodule")) {
220if (!$permissiontoread) {
229if (
GETPOST(
'cancel',
'alpha')) {
233if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
237$parameters = array(
'arrayfields' => &$arrayfields);
238$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
243if (empty($reshook)) {
245 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
248 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
249 foreach (
$object->fields as $key => $val) {
251 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
252 $search[$key.
'_dtstart'] =
'';
253 $search[$key.
'_dtend'] =
'';
258 $search_array_options = array();
260 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
261 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
266 $objectclass =
'MyObject';
267 $objectlabel =
'MyObject';
268 $uploaddir = $conf->mymodule->dir_output;
269 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
281$form =
new Form($db);
285$title = $langs->trans(
"MyObjects");
295$sql .=
" ".$object->getFieldList(
't');
297if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
298 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
299 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
303$parameters = array();
304$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
305$sql .= $hookmanager->resPrint;
306$sql = preg_replace(
'/,\s*$/',
'', $sql);
310$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
312if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
313 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
316$parameters = array();
317$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
318$sql .= $hookmanager->resPrint;
319if (
$object->ismultientitymanaged == 1) {
320 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
322 $sql .=
" WHERE 1 = 1";
324foreach ($search as $key => $val) {
325 if (array_key_exists($key,
$object->fields)) {
326 if ($key ==
'status' && $search[$key] == -1) {
330 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
331 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
336 if ($search[$key] !=
'') {
337 $sql .=
natural_search(
"t.".$db->sanitize($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
340 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
341 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
342 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
343 if (preg_match(
'/_dtstart$/', $key)) {
344 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
346 if (preg_match(
'/_dtend$/', $key)) {
347 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
354 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
377include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
379$parameters = array();
380$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
381$sql .= $hookmanager->resPrint;
409$nbtotalofrecords =
'';
412 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
413 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
415 $resql = $db->query($sqlforcount);
417 $objforcount = $db->fetch_object($resql);
418 $nbtotalofrecords = $objforcount->nbtotalofrecords;
423 if (($page * $limit) > $nbtotalofrecords) {
431$sql .= $db->order($sortfield, $sortorder);
433 $sql .= $db->plimit($limit + 1, $offset);
436$resql = $db->query($sql);
442$num = $db->num_rows($resql);
446if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
447 $obj = $db->fetch_object($resql);
449 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
457llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
474$arrayofselected = is_array($toselect) ? $toselect : array();
478 $param .=
'&mode='.urlencode($mode);
480if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
481 $param .=
'&contextpage='.urlencode($contextpage);
483if ($limit > 0 && $limit != $conf->liste_limit) {
484 $param .=
'&limit='.((int) $limit);
486if ($optioncss !=
'') {
487 $param .=
'&optioncss='.urlencode($optioncss);
490 $param .=
'&groupby='.urlencode($groupby);
492foreach ($search as $key => $val) {
493 if (is_array($search[$key])) {
494 foreach ($search[$key] as $skey) {
496 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
499 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
500 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
501 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
502 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
503 } elseif ($search[$key] !=
'') {
504 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
508include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
510$parameters = array(
'param' => &$param);
511$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
512$param .= $hookmanager->resPrint;
515$arrayofmassactions = array(
521if (!empty($permissiontodelete)) {
522 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
524if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
525 $arrayofmassactions = array();
527$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
529print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
530if ($optioncss !=
'') {
531 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
533print
'<input type="hidden" name="token" value="'.newToken().
'">';
534print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
535print
'<input type="hidden" name="action" value="list">';
536print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
537print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
538print
'<input type="hidden" name="page" value="'.$page.
'">';
539print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
540print
'<input type="hidden" name="page_y" value="">';
541print
'<input type="hidden" name="mode" value="'.$mode.
'">';
545$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'));
546$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'));
548$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
550print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
553$topicmail =
"SendMyObjectRef";
554$modelmail =
"myobject";
556$trackid =
'xxxx'.$object->id;
557include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
562 foreach ($fieldstosearchall as $key => $val) {
563 $fieldstosearchall[$key] = $langs->trans($val);
564 $setupstring .= $key.
"=".$val.
";";
566 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
567 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
575$parameters = array();
576$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
577if (empty($reshook)) {
578 $moreforfilter .= $hookmanager->resPrint;
580 $moreforfilter = $hookmanager->resPrint;
583 'arrayfields' => &$arrayfields,
586if (!empty($moreforfilter)) {
587 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
588 print $moreforfilter;
592$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
593$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column);
594$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
595$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
597print
'<div class="div-table-responsive">';
598print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
602print
'<tr class="liste_titre_filter">';
604if ($conf->main_checkbox_left_column) {
605 print
'<td class="liste_titre center maxwidthsearch">';
606 $searchpicto = $form->showFilterButtons(
'left');
610foreach (
$object->fields as $key => $val) {
612 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
613 if ($key ==
'status') {
614 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
615 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
616 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
617 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
618 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
619 } 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'])) {
620 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
622 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
623 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
624 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
625 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);
626 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
627 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
628 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
629 print
'<div class="nowrap">';
630 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
632 print
'<div class="nowrap">';
633 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
635 } elseif ($key ==
'lang') {
636 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
638 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
640 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
646include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
649$parameters = array(
'arrayfields' => $arrayfields);
650$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
651print $hookmanager->resPrint;
656if (!$conf->main_checkbox_left_column) {
657 print
'<td class="liste_titre center maxwidthsearch">';
658 $searchpicto = $form->showFilterButtons();
664$totalarray = array();
665$totalarray[
'nbfield'] = 0;
669print
'<tr class="liste_titre">';
671if ($conf->main_checkbox_left_column) {
672 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
673 $totalarray[
'nbfield']++;
675foreach (
$object->fields as $key => $val) {
676 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
677 if ($key ==
'status') {
678 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
679 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
680 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
681 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
682 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
683 } 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'])) {
684 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
686 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
687 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
688 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";
689 $totalarray[
'nbfield']++;
693include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
695$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
696$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
697print $hookmanager->resPrint;
703if (!$conf->main_checkbox_left_column) {
704 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
705 $totalarray[
'nbfield']++;
710$needToFetchEachLine = 0;
711if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
712 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
713 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
714 $needToFetchEachLine++;
723$savnbfield = $totalarray[
'nbfield'];
724$totalarray = array();
725$totalarray[
'nbfield'] = 0;
726$imaxinloop = ($limit ? min($num, $limit) : $num);
727while ($i < $imaxinloop) {
728 $obj = $db->fetch_object($resql);
734 $object->setVarsFromFetchObj($obj);
750 if ($mode ==
'kanban') {
752 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
753 print
'<div class="box-flex-container kanban">';
757 if ($massactionbutton || $massaction) {
759 if (in_array(
$object->id, $arrayofselected)) {
764 print
$object->getKanbanView(
'', array(
'selected' => $selected));
765 if ($i == ($imaxinloop - 1)) {
772 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
775 if ($conf->main_checkbox_left_column) {
776 print
'<td class="nowrap center">';
777 if ($massactionbutton || $massaction) {
779 if (in_array(
$object->id, $arrayofselected)) {
782 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
786 $totalarray[
'nbfield']++;
790 foreach (
$object->fields as $key => $val) {
791 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
792 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
793 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
794 } elseif ($key ==
'status') {
795 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
798 if (in_array($val[
'type'], array(
'timestamp'))) {
799 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
800 } elseif ($key ==
'ref') {
801 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
804 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'])) {
805 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
809 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
810 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
811 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
812 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
815 if ($key ==
'status') {
816 print
$object->getLibStatut(5);
817 } elseif ($key ==
'rowid') {
824 $totalarray[
'nbfield']++;
826 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
828 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
830 if (!isset($totalarray[
'val'])) {
831 $totalarray[
'val'] = array();
833 if (!isset($totalarray[
'val'][
't.'.$key])) {
834 $totalarray[
'val'][
't.'.$key] = 0;
836 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
841 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
843 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
844 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
845 print $hookmanager->resPrint;
852 if (empty($conf->main_checkbox_left_column)) {
853 print
'<td class="nowrap center">';
854 if ($massactionbutton || $massaction) {
856 if (in_array(
$object->id, $arrayofselected)) {
859 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
863 $totalarray[
'nbfield']++;
874include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
879 foreach ($arrayfields as $key => $val) {
880 if (!empty($val[
'checked'])) {
884 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
890$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
891$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
892print $hookmanager->resPrint;
894print
'</table>'.
"\n";
899if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
900 $hidegeneratedfilelistifempty = 1;
901 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
902 $hidegeneratedfilelistifempty = 0;
905 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
909 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
910 $urlsource .= str_replace(
'&',
'&', $param);
912 $filedir = $diroutputmassaction;
913 $genallowed = $permissiontoread;
914 $delallowed = $permissiontoadd;
916 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.
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.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.