51 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
52 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
55 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
56 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
60 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
61 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
63 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
64 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
67 if (!$res && file_exists(
"../main.inc.php")) {
68 $res = @include
"../main.inc.php";
70 if (!$res && file_exists(
"../../main.inc.php")) {
71 $res = @include
"../../main.inc.php";
73 if (!$res && file_exists(
"../../../main.inc.php")) {
74 $res = @include
"../../../main.inc.php";
77 die(
"Include of main fails");
80 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
81 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
82 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
84 require_once __DIR__.
'/class/myobject.class.php';
89 $langs->loadLangs(array(
"mymodule@mymodule",
"other"));
92 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
93 $massaction =
GETPOST(
'massaction',
'alpha');
94 $show_files =
GETPOST(
'show_files',
'int');
95 $confirm =
GETPOST(
'confirm',
'alpha');
96 $cancel =
GETPOST(
'cancel',
'alpha');
97 $toselect =
GETPOST(
'toselect',
'array');
98 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
99 $backtopage =
GETPOST(
'backtopage',
'alpha');
100 $optioncss =
GETPOST(
'optioncss',
'aZ');
104 $ref =
GETPOST(
'ref',
'alpha');
108 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
109 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
111 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
115 $offset = $limit * $page;
116 $pageprev = $page - 1;
117 $pagenext = $page + 1;
122 $diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
123 $hookmanager->initHooks(array($contextpage));
126 $extrafields->fetch_name_optionals_label(
$object->table_element);
129 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
134 $sortfield =
"t.".key(
$object->fields);
141 $search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
143 foreach (
$object->fields as $key => $val) {
144 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
145 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
147 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
153 $fieldstosearchall = array();
169 $arrayfields = array();
170 foreach (
$object->fields as $key => $val) {
172 if (!empty($val[
'visible'])) {
173 $visible = (int)
dol_eval($val[
'visible'], 1);
174 $arrayfields[
't.'.$key] = array(
175 'label'=>$val[
'label'],
176 'checked'=>(($visible < 0) ? 0 : 1),
177 'enabled'=>(abs($visible) != 3 && (
int)
dol_eval($val[
'enabled'], 1)),
178 'position'=>$val[
'position'],
179 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
184 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
192 $enablepermissioncheck = 0;
193 if ($enablepermissioncheck) {
194 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
195 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
196 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
198 $permissiontoread = 1;
199 $permissiontoadd = 1;
200 $permissiontodelete = 1;
204 if ($user->socid > 0) {
214 if (!$permissiontoread) {
223 if (
GETPOST(
'cancel',
'alpha')) {
227 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
231 $parameters = array();
232 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
237 if (empty($reshook)) {
239 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
242 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
243 foreach (
$object->fields as $key => $val) {
245 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
246 $search[$key.
'_dtstart'] =
'';
247 $search[$key.
'_dtend'] =
'';
252 $search_array_options = array();
254 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
255 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
260 $objectclass =
'MyObject';
261 $objectlabel =
'MyObject';
262 $uploaddir = $conf->mymodule->dir_output;
263 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
279 $title = $langs->trans(
"MyObjects");
291 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
292 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
293 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
297 $parameters = array();
298 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
299 $sql .= $hookmanager->resPrint;
300 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
304 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
306 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
307 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
310 $parameters = array();
311 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object, $action);
312 $sql .= $hookmanager->resPrint;
313 if (
$object->ismultientitymanaged == 1) {
314 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOST(
'search_current_entity',
'int') ? 0 : 1)).
")";
316 $sql .=
" WHERE 1 = 1";
318 foreach ($search as $key => $val) {
319 if (array_key_exists($key,
$object->fields)) {
320 if ($key ==
'status' && $search[$key] == -1) {
324 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
325 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
330 if ($search[$key] !=
'') {
331 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
334 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
335 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
336 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
337 if (preg_match(
'/_dtstart$/', $key)) {
338 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
340 if (preg_match(
'/_dtend$/', $key)) {
341 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
371 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
373 $parameters = array();
374 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
375 $sql .= $hookmanager->resPrint;
403 $nbtotalofrecords =
'';
406 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
407 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
409 $resql = $db->query($sqlforcount);
411 $objforcount = $db->fetch_object($resql);
412 $nbtotalofrecords = $objforcount->nbtotalofrecords;
417 if (($page * $limit) > $nbtotalofrecords) {
425 $sql .= $db->order($sortfield, $sortorder);
427 $sql .= $db->plimit($limit + 1, $offset);
430 $resql = $db->query(
$sql);
436 $num = $db->num_rows($resql);
440 if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
441 $obj = $db->fetch_object($resql);
443 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
451 llxHeader(
'', $title,
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
468 $arrayofselected = is_array($toselect) ? $toselect : array();
472 $param .=
'&mode='.urlencode($mode);
474 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
475 $param .=
'&contextpage='.urlencode($contextpage);
477 if ($limit > 0 && $limit != $conf->liste_limit) {
478 $param .=
'&limit='.((int) $limit);
480 if ($optioncss !=
'') {
481 $param .=
'&optioncss='.urlencode($optioncss);
483 foreach ($search as $key => $val) {
484 if (is_array($search[$key])) {
485 foreach ($search[$key] as $skey) {
487 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
490 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
491 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
492 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
493 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
494 } elseif ($search[$key] !=
'') {
495 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
499 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
501 $parameters = array();
502 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
503 $param .= $hookmanager->resPrint;
506 $arrayofmassactions = array(
512 if (!empty($permissiontodelete)) {
513 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
515 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
516 $arrayofmassactions = array();
518 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
520 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
521 if ($optioncss !=
'') {
522 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
524 print
'<input type="hidden" name="token" value="'.newToken().
'">';
525 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
526 print
'<input type="hidden" name="action" value="list">';
527 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
528 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
529 print
'<input type="hidden" name="page" value="'.$page.
'">';
530 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
531 print
'<input type="hidden" name="page_y" value="">';
532 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
536 $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'));
537 $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'));
539 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
541 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
544 $topicmail =
"SendMyObjectRef";
545 $modelmail =
"myobject";
547 $trackid =
'xxxx'.$object->id;
548 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
552 foreach ($fieldstosearchall as $key => $val) {
553 $fieldstosearchall[$key] = $langs->trans($val);
554 $setupstring .= $key.
"=".$val.
";";
556 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
557 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
565 $parameters = array();
566 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
567 if (empty($reshook)) {
568 $moreforfilter .= $hookmanager->resPrint;
570 $moreforfilter = $hookmanager->resPrint;
573 if (!empty($moreforfilter)) {
574 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
575 print $moreforfilter;
576 $parameters = array();
577 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
578 print $hookmanager->resPrint;
582 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
583 $htmlofselectarray =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
584 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
585 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
587 print
'<div class="div-table-responsive">';
588 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
592 print
'<tr class="liste_titre_filter">';
595 print
'<td class="liste_titre center maxwidthsearch">';
596 $searchpicto =
$form->showFilterButtons(
'left');
600 foreach (
$object->fields as $key => $val) {
602 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
603 if ($key ==
'status') {
604 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
605 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
606 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
607 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
608 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
609 } 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'])) {
610 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
612 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
613 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
614 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
615 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);
616 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
617 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
618 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
619 print
'<div class="nowrap">';
620 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
622 print
'<div class="nowrap">';
623 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
625 } elseif ($key ==
'lang') {
626 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
628 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
630 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
636 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
639 $parameters = array(
'arrayfields'=>$arrayfields);
640 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
641 print $hookmanager->resPrint;
647 print
'<td class="liste_titre center maxwidthsearch">';
648 $searchpicto =
$form->showFilterButtons();
654 $totalarray = array();
655 $totalarray[
'nbfield'] = 0;
659 print
'<tr class="liste_titre">';
662 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
663 $totalarray[
'nbfield']++;
665 foreach (
$object->fields as $key => $val) {
666 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
667 if ($key ==
'status') {
668 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
669 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
670 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
671 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
672 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
673 } 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'])) {
674 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
676 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
677 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
678 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";
679 $totalarray[
'nbfield']++;
683 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
685 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
686 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
687 print $hookmanager->resPrint;
694 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
695 $totalarray[
'nbfield']++;
700 $needToFetchEachLine = 0;
701 if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
702 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
703 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
704 $needToFetchEachLine++;
713 $savnbfield = $totalarray[
'nbfield'];
714 $totalarray = array();
715 $totalarray[
'nbfield'] = 0;
716 $imaxinloop = ($limit ? min($num, $limit) : $num);
717 while ($i < $imaxinloop) {
718 $obj = $db->fetch_object($resql);
724 $object->setVarsFromFetchObj($obj);
740 if ($mode ==
'kanban') {
742 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
743 print
'<div class="box-flex-container kanban">';
747 if ($massactionbutton || $massaction) {
749 if (in_array(
$object->id, $arrayofselected)) {
754 print
$object->getKanbanView(
'', array(
'selected' => $selected));
755 if ($i == ($imaxinloop - 1)) {
762 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
766 print
'<td class="nowrap center">';
767 if ($massactionbutton || $massaction) {
769 if (in_array(
$object->id, $arrayofselected)) {
772 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
776 $totalarray[
'nbfield']++;
779 foreach (
$object->fields as $key => $val) {
780 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
781 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
782 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
783 } elseif ($key ==
'status') {
784 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
787 if (in_array($val[
'type'], array(
'timestamp'))) {
788 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
789 } elseif ($key ==
'ref') {
790 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
793 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'])) {
794 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
798 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
799 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
800 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
801 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
804 if ($key ==
'status') {
805 print
$object->getLibStatut(5);
806 } elseif ($key ==
'rowid') {
813 $totalarray[
'nbfield']++;
815 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
817 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
819 if (!isset($totalarray[
'val'])) {
820 $totalarray[
'val'] = array();
822 if (!isset($totalarray[
'val'][
't.'.$key])) {
823 $totalarray[
'val'][
't.'.$key] = 0;
825 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
830 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
832 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>
$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
833 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
834 print $hookmanager->resPrint;
842 print
'<td class="nowrap center">';
843 if ($massactionbutton || $massaction) {
845 if (in_array(
$object->id, $arrayofselected)) {
848 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
852 $totalarray[
'nbfield']++;
863 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
868 foreach ($arrayfields as $key => $val) {
869 if (!empty($val[
'checked'])) {
873 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
879 $parameters = array(
'arrayfields' => $arrayfields,
'sql' =>
$sql);
880 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
881 print $hookmanager->resPrint;
883 print
'</table>'.
"\n";
886 print
'</form>'.
"\n";
888 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
889 $hidegeneratedfilelistifempty = 1;
890 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
891 $hidegeneratedfilelistifempty = 0;
894 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
898 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
899 $urlsource .= str_replace(
'&',
'&', $param);
901 $filedir = $diroutputmassaction;
902 $genallowed = $permissiontoread;
903 $delallowed = $permissiontoadd;
905 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(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
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...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.