48 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
49 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
52 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
53 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
57 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
58 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
60 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
61 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
64 if (!$res && file_exists(
"../main.inc.php")) {
65 $res = @include
"../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";
74 die(
"Include of main fails");
77 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
78 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
79 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
82 require_once __DIR__.
'/class/myobject.class.php';
88 $langs->loadLangs(array(
"mymodule@mymodule",
"other"));
90 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
91 $massaction =
GETPOST(
'massaction',
'alpha');
92 $show_files =
GETPOST(
'show_files',
'int');
93 $confirm =
GETPOST(
'confirm',
'alpha');
94 $cancel =
GETPOST(
'cancel',
'alpha');
95 $toselect =
GETPOST(
'toselect',
'array');
96 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
97 $backtopage =
GETPOST(
'backtopage',
'alpha');
98 $optioncss =
GETPOST(
'optioncss',
'aZ');
102 $ref =
GETPOST(
'ref',
'alpha');
105 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
106 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
107 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
109 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113 $offset = $limit * $page;
114 $pageprev = $page - 1;
115 $pagenext = $page + 1;
120 $diroutputmassaction = $conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
121 $hookmanager->initHooks(array(
'myobjectlist'));
124 $extrafields->fetch_name_optionals_label($object->table_element);
127 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
131 reset($object->fields);
132 $sortfield =
"t.".key($object->fields);
139 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
141 foreach ($object->fields as $key => $val) {
142 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
143 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
145 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
146 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
147 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
152 $fieldstosearchall = array();
153 foreach ($object->fields as $key => $val) {
154 if (!empty($val[
'searchall'])) {
155 $fieldstosearchall[
't.'.$key] = $val[
'label'];
160 $arrayfields = array();
161 foreach ($object->fields as $key => $val) {
163 if (!empty($val[
'visible'])) {
164 $visible = (int)
dol_eval($val[
'visible'], 1);
165 $arrayfields[
't.'.$key] = array(
166 'label'=>$val[
'label'],
167 'checked'=>(($visible < 0) ? 0 : 1),
168 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
169 'position'=>$val[
'position'],
170 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
175 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
183 $enablepermissioncheck = 0;
184 if ($enablepermissioncheck) {
185 $permissiontoread = $user->rights->mymodule->myobject->read;
186 $permissiontoadd = $user->rights->mymodule->myobject->write;
187 $permissiontodelete = $user->rights->mymodule->myobject->delete;
189 $permissiontoread = 1;
190 $permissiontoadd = 1;
191 $permissiontodelete = 1;
210 if (
GETPOST(
'cancel',
'alpha')) {
214 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
218 $parameters = array();
219 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
224 if (empty($reshook)) {
226 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
229 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
230 foreach ($object->fields as $key => $val) {
232 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
233 $search[$key.
'_dtstart'] =
'';
234 $search[$key.
'_dtend'] =
'';
238 $search_array_options = array();
240 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
241 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
246 $objectclass =
'MyObject';
247 $objectlabel =
'MyObject';
248 $uploaddir = $conf->mymodule->dir_output;
249 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
264 $title = $langs->trans(
"MyObjects");
272 $sql .= $object->getFieldList(
't');
274 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
275 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
276 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
280 $parameters = array();
281 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
282 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
283 $sql = preg_replace(
'/,\s*$/',
'', $sql);
288 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
290 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
291 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
294 $parameters = array();
295 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
296 $sql .= $hookmanager->resPrint;
297 if ($object->ismultientitymanaged == 1) {
298 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
300 $sql .=
" WHERE 1 = 1";
302 foreach ($search as $key => $val) {
303 if (array_key_exists($key, $object->fields)) {
304 if ($key ==
'status' && $search[$key] == -1) {
307 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
308 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
309 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
314 if ($search[$key] !=
'') {
315 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
318 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
319 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
320 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
321 if (preg_match(
'/_dtstart$/', $key)) {
322 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
324 if (preg_match(
'/_dtend$/', $key)) {
325 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
332 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
336 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
338 $parameters = array();
339 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
340 $sql .= $hookmanager->resPrint;
369 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
371 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
372 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
373 $resql = $db->query($sqlforcount);
375 $objforcount = $db->fetch_object(
$resql);
389 $sql .= $db->order($sortfield, $sortorder);
391 $sql .= $db->plimit($limit + 1, $offset);
394 $resql = $db->query($sql);
400 $num = $db->num_rows(
$resql);
404 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
405 $obj = $db->fetch_object(
$resql);
407 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.$id);
432 $arrayofselected = is_array($toselect) ? $toselect : array();
436 $param .=
'&mode='.urlencode($mode);
438 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
439 $param .=
'&contextpage='.urlencode($contextpage);
441 if ($limit > 0 && $limit != $conf->liste_limit) {
442 $param .=
'&limit='.urlencode($limit);
444 foreach ($search as $key => $val) {
445 if (is_array($search[$key])) {
446 foreach ($search[$key] as $skey) {
448 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
451 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
452 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
453 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
454 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
455 } elseif ($search[$key] !=
'') {
456 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
459 if ($optioncss !=
'') {
460 $param .=
'&optioncss='.urlencode($optioncss);
463 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
465 $parameters = array();
466 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
467 $param .= $hookmanager->resPrint;
470 $arrayofmassactions = array(
476 if (!empty($permissiontodelete)) {
477 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
479 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
480 $arrayofmassactions = array();
482 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
484 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
485 if ($optioncss !=
'') {
486 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
488 print
'<input type="hidden" name="token" value="'.newToken().
'">';
489 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
490 print
'<input type="hidden" name="action" value="list">';
491 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
492 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
493 print
'<input type="hidden" name="page" value="'.$page.
'">';
494 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
495 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
499 $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'));
500 $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'));
502 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
504 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
507 $topicmail =
"SendMyObjectRef";
508 $modelmail =
"myobject";
510 $trackid =
'xxxx'.$object->id;
511 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
515 foreach ($fieldstosearchall as $key => $val) {
516 $fieldstosearchall[$key] = $langs->trans($val);
517 $setupstring .= $key.
"=".$val.
";";
519 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
520 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
528 $parameters = array();
529 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
530 if (empty($reshook)) {
531 $moreforfilter .= $hookmanager->resPrint;
533 $moreforfilter = $hookmanager->resPrint;
536 if (!empty($moreforfilter)) {
537 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
538 print $moreforfilter;
542 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
543 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
544 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
546 print
'<div class="div-table-responsive">';
547 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
552 print
'<tr class="liste_titre">';
554 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
555 print
'<td class="liste_titre maxwidthsearch">';
556 $searchpicto =
$form->showFilterButtons(
'left');
560 foreach ($object->fields as $key => $val) {
561 $searchkey = empty($search[$key]) ?
'' : $search[$key];
562 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
563 if ($key ==
'status') {
564 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
565 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
566 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
567 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
568 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
569 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
570 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
572 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
573 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
574 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
575 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status onrightofpage' :
''), 1);
576 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
577 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
578 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
579 print
'<div class="nowrap">';
580 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
582 print
'<div class="nowrap">';
583 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
585 } elseif ($key ==
'lang') {
586 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
588 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
590 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
596 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
599 $parameters = array(
'arrayfields'=>$arrayfields);
600 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
601 print $hookmanager->resPrint;
606 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
607 print
'<td class="liste_titre maxwidthsearch">';
608 $searchpicto =
$form->showFilterButtons();
614 $totalarray = array();
615 $totalarray[
'nbfield'] = 0;
619 print
'<tr class="liste_titre">';
620 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
621 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
623 foreach ($object->fields as $key => $val) {
624 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
625 if ($key ==
'status') {
626 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
627 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
628 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
629 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
630 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
631 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
632 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
634 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
635 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
636 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
637 $totalarray[
'nbfield']++;
641 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
643 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
644 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
645 print $hookmanager->resPrint;
651 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
652 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
654 $totalarray[
'nbfield']++;
659 $needToFetchEachLine = 0;
660 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
661 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
662 if (preg_match(
'/\$object/', $val)) {
663 $needToFetchEachLine++;
672 $savnbfield = $totalarray[
'nbfield'];
673 $totalarray = array();
674 $totalarray[
'nbfield'] = 0;
675 $imaxinloop = ($limit ? min($num, $limit) : $num);
676 while ($i < $imaxinloop) {
677 $obj = $db->fetch_object(
$resql);
683 $object->setVarsFromFetchObj($obj);
685 if ($mode ==
'kanban') {
687 print
'<tr><td colspan="'.$savnbfield.
'">';
688 print
'<div class="box-flex-container">';
691 print $object->getKanbanView(
'');
692 if ($i == ($imaxinloop - 1)) {
699 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
701 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
702 print
'<td class="nowrap center">';
703 if ($massactionbutton || $massaction) {
705 if (in_array($object->id, $arrayofselected)) {
708 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
712 foreach ($object->fields as $key => $val) {
713 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
714 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
715 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
716 } elseif ($key ==
'status') {
717 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
720 if (in_array($val[
'type'], array(
'timestamp'))) {
721 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
722 } elseif ($key ==
'ref') {
723 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
726 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
727 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
731 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
732 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
733 if (preg_match(
'/tdoverflow/', $cssforfield)) {
734 print
' title="'.dol_escape_htmltag($object->$key).
'"';
737 if ($key ==
'status') {
738 print $object->getLibStatut(5);
739 } elseif ($key ==
'rowid') {
740 print $object->showOutputField($val, $key, $object->id,
'');
742 print $object->showOutputField($val, $key, $object->$key,
'');
746 $totalarray[
'nbfield']++;
748 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
750 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
752 if (!isset($totalarray[
'val'])) {
753 $totalarray[
'val'] = array();
755 if (!isset($totalarray[
'val'][
't.'.$key])) {
756 $totalarray[
'val'][
't.'.$key] = 0;
758 $totalarray[
'val'][
't.'.$key] += $object->$key;
763 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
765 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
766 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
767 print $hookmanager->resPrint;
772 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
773 print
'<td class="nowrap center">';
774 if ($massactionbutton || $massaction) {
776 if (in_array($object->id, $arrayofselected)) {
779 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
784 $totalarray[
'nbfield']++;
794 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
799 foreach ($arrayfields as $key => $val) {
800 if (!empty($val[
'checked'])) {
804 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
810 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
811 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
812 print $hookmanager->resPrint;
814 print
'</table>'.
"\n";
817 print
'</form>'.
"\n";
820 $hidegeneratedfilelistifempty = 1;
821 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
822 $hidegeneratedfilelistifempty = 0;
825 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
829 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
830 $urlsource .= str_replace(
'&',
'&', $param);
832 $filedir = $diroutputmassaction;
833 $genallowed = $permissiontoread;
834 $delallowed = $permissiontoadd;
836 print $formfile->showdocuments(
'massfilesarea_mymodule',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
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 informations (by default a local PHP server timestamp) Re...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.