51if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
52 $res = @include str_replace(
"..",
"", $_SERVER[
"CONTEXT_DOCUMENT_ROOT"]).
"/main.inc.php";
55$tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME'];
56$tmp2 = realpath(__FILE__);
58$j = strlen($tmp2) - 1;
59while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
63if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
64 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
66if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
67 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
70if (!$res && file_exists(
"../main.inc.php")) {
71 $res = @include
"../main.inc.php";
73if (!$res && file_exists(
"../../main.inc.php")) {
74 $res = @include
"../../main.inc.php";
76if (!$res && file_exists(
"../../../main.inc.php")) {
77 $res = @include
"../../../main.inc.php";
80 die(
"Include of main fails");
90include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
91include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
92include_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
94include_once __DIR__.
'/class/myobject.class.php';
99$langs->loadLangs(array(
"mymodule@mymodule",
"other"));
102$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
103$massaction =
GETPOST(
'massaction',
'alpha');
105$confirm =
GETPOST(
'confirm',
'alpha');
106$cancel =
GETPOST(
'cancel',
'alpha');
107$toselect =
GETPOST(
'toselect',
'array:int');
109$backtopage =
GETPOST(
'backtopage',
'alpha');
110$optioncss =
GETPOST(
'optioncss',
'aZ');
112$groupby =
GETPOST(
'groupby',
'aZ09');
119$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
120$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
122if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
126$offset = $limit * $page;
127$pageprev = $page - 1;
128$pagenext = $page + 1;
133$diroutputmassaction =
$conf->mymodule->dir_output.
'/temp/massgeneration/'.$user->id;
134$hookmanager->initHooks(array($contextpage));
137$extrafields->fetch_name_optionals_label(
$object->table_element);
140$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
145 $sortfield =
"t.".key(
$object->fields);
152$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
154foreach (
$object->fields as $key => $val) {
155 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
156 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
158 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
165$fieldstosearchall = array();
181$arrayfields = array();
182foreach (
$object->fields as $key => $val) {
184 if (!empty($val[
'visible'])) {
185 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
186 $arrayfields[$tableprefix.
'.'.$key] = array(
187 'label' => $val[
'label'],
188 'checked' => (($visible < 0) ?
'0' :
'1'),
189 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
190 'position' => $val[
'position'],
191 'help' => isset($val[
'help']) ? $val[
'help'] :
''
197include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
199$parameters = array(
'arrayfields' => &$arrayfields);
200$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
208include DOL_DOCUMENT_ROOT.
'/core/tpl/arrayfield_object_position_fields.tpl.php';
215$enablepermissioncheck =
getDolGlobalInt(
'MYMODULE_ENABLE_PERMISSION_CHECK');
216if ($enablepermissioncheck) {
217 $permissiontoread = $user->hasRight(
'mymodule',
'myobject',
'read');
218 $permissiontoadd = $user->hasRight(
'mymodule',
'myobject',
'write');
219 $permissiontodelete = $user->hasRight(
'mymodule',
'myobject',
'delete');
221 $permissiontoread = 1;
222 $permissiontoadd = 1;
223 $permissiontodelete = 1;
227if ($user->socid > 0) {
237if (!$permissiontoread) {
246if (
GETPOST(
'cancel',
'alpha')) {
250if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
254$parameters = array(
'arrayfields' => &$arrayfields);
255$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
260if (empty($reshook)) {
262 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
265 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
266 foreach (
$object->fields as $key => $val) {
268 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
269 $search[$key.
'_dtstart'] =
'';
270 $search[$key.
'_dtend'] =
'';
275 $search_array_options = array();
277 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
278 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
283 $objectclass =
'MyObject';
284 $objectlabel =
'MyObject';
285 $uploaddir =
$conf->mymodule->dir_output;
288 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
304$title = $langs->trans(
"MyObjects");
314$sql .=
" ".$object->getFieldList(
't');
316if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
317 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
318 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
"");
322$parameters = array();
323$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
324$sql .= $hookmanager->resPrint;
325$sql = preg_replace(
'/,\s*$/',
'', $sql);
329$sql .=
" FROM ".$db->prefix().$object->table_element.
" as t";
331if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
332 $sql .=
" LEFT JOIN ".$db->prefix().$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
335$parameters = array();
336$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
337$sql .= $hookmanager->resPrint;
339if (!empty(
$object->ismultientitymanaged) && (
int)
$object->ismultientitymanaged == 1) {
340 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
341} elseif (preg_match(
'/^\w+@\w+$/', (
string)
$object->ismultientitymanaged)) {
342 $tmparray = explode(
'@', (
string)
$object->ismultientitymanaged);
343 $sql .=
" LEFT JOIN ".$object->db->prefix().$tmparray[1].
" as pt ON t.".
$db->sanitize($tmparray[0]).
" = pt.rowid";
344 $sql .=
" WHERE pt.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
346 $sql .=
" WHERE 1 = 1";
348foreach ($search as $key => $val) {
349 if (array_key_exists($key,
$object->fields)) {
350 if ($key ==
'status' && $search[$key] == -1) {
353 $field_spec =
$object->fields[$key];
355 $mode_search = ((
$object->isInt($field_spec) ||
$object->isFloat($field_spec)) ? 1 : 0);
356 if ((strpos($field_spec[
'type'],
'integer:') === 0) || (strpos($field_spec[
'type'],
'sellist:') === 0) || !empty($field_spec[
'arrayofkeyval'])) {
357 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($field_spec[
'arrayofkeyval']) || !array_key_exists(
'0', $field_spec[
'arrayofkeyval'])))) {
362 if ($field_spec[
'type'] ===
'boolean') {
364 if ($search[$key] ==
'-1') {
368 if (empty($field_spec[
'searchmulti'])) {
369 if (!is_array($search[$key]) && $search[$key] !=
'') {
370 $sql .=
natural_search(
"t.".
$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
373 if (is_array($search[$key]) && !empty($search[$key])) {
374 $sql .=
natural_search(
"t.".
$db->escape($key), implode(
',', $search[$key]), (($key ==
'status') ? 2 : $mode_search));
378 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
379 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
380 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
381 if (preg_match(
'/_dtstart$/', $key)) {
382 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".
$db->idate($search[$key]).
"'";
384 if (preg_match(
'/_dtend$/', $key)) {
385 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".
$db->idate($search[$key]).
"'";
392 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
415include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
417$parameters = array();
418$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
419$sql .= $hookmanager->resPrint;
456$nbtotalofrecords =
'';
459 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
460 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
462 $resql =
$db->query($sqlforcount);
464 $objforcount =
$db->fetch_object($resql);
465 $nbtotalofrecords = $objforcount->nbtotalofrecords;
470 if (($page * $limit) > (
int) $nbtotalofrecords) {
478$sql .=
$db->order($sortfield, $sortorder);
480 $sql .=
$db->plimit($limit + 1, $offset);
483$resql =
$db->query($sql);
489$num =
$db->num_rows($resql);
493if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
494 $obj =
$db->fetch_object($resql);
496 header(
"Location: ".
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?id='.((
int) $id));
504llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-mymodule page-list bodyforlist');
521$arrayofselected = is_array($toselect) ? $toselect : array();
525 $param .=
'&mode='.urlencode($mode);
528 $param .=
'&contextpage='.urlencode($contextpage);
530if ($limit > 0 && $limit !=
$conf->liste_limit) {
531 $param .=
'&limit='.((int) $limit);
533if ($optioncss !=
'') {
534 $param .=
'&optioncss='.urlencode($optioncss);
537 $param .=
'&groupby='.urlencode($groupby);
539foreach ($search as $key => $val) {
540 if (is_array($search[$key])) {
541 foreach ($search[$key] as $skey) {
543 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
546 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
547 $param .=
'&search_'.$key.
'month='.
GETPOSTINT(
'search_'.$key.
'month');
548 $param .=
'&search_'.$key.
'day='.
GETPOSTINT(
'search_'.$key.
'day');
549 $param .=
'&search_'.$key.
'year='.
GETPOSTINT(
'search_'.$key.
'year');
550 } elseif ($search[$key] !=
'') {
551 $param .=
'&search_'.$key.
'='.urlencode((
string) $search[$key]);
555include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
557$parameters = array(
'param' => &$param);
558$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
559$param .= $hookmanager->resPrint;
562$arrayofmassactions = array(
568if (!empty($permissiontodelete)) {
569 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
571if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
572 $arrayofmassactions = array();
574$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
576print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
577if ($optioncss !=
'') {
578 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
580print
'<input type="hidden" name="token" value="'.newToken().
'">';
581print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
582print
'<input type="hidden" name="action" value="list">';
583print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
584print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
585print
'<input type="hidden" name="page" value="'.$page.
'">';
586print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
587print
'<input type="hidden" name="page_y" value="">';
588print
'<input type="hidden" name="mode" value="'.$mode.
'">';
592$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
593$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
596$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode',
dol_buildpath(
'/mymodule/stats/myobject_index.php', 1).
'?mode=statistics&objecttype=myobject@mymodule'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
597$newcardbutton .= dolGetButtonTitleSeparator();
598$newcardbutton .= dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/mymodule/myobject_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
600print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
603$topicmail =
"SendMyObjectRef";
604$modelmail =
"myobject";
606$trackid =
'myobject'.$object->id;
607include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
612 foreach ($fieldstosearchall as $key => $val) {
613 $fieldstosearchall[$key] = $langs->trans($val);
614 $setupstring .= $key.
"=".$val.
";";
616 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
617 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
625$parameters = array();
626$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
627if (empty($reshook)) {
628 $moreforfilter .= $hookmanager->resPrint;
630 $moreforfilter = $hookmanager->resPrint;
633 'arrayfields' => &$arrayfields,
636if (!empty($moreforfilter)) {
637 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
638 print $moreforfilter;
642$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
643$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column, 1);
644$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
645$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
647print
'<div class="div-table-responsive">';
648print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
652print
'<tr class="liste_titre_filter">';
654if (
$conf->main_checkbox_left_column) {
655 print
'<td class="liste_titre center maxwidthsearch">';
656 $searchpicto = $form->showFilterButtons(
'left');
660foreach (
$object->fields as $key => $val) {
662 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
663 if ($key ==
'status') {
664 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
665 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
666 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
667 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
668 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
669 } 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'])) {
670 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
672 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
673 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
674 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
675 if (empty($val[
'searchmulti'])) {
676 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);
678 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
680 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
681 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
682 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
683 print
'<div class="nowrap">';
684 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
686 print
'<div class="nowrap">';
687 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
689 } elseif ($key ==
'lang') {
690 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
692 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
693 } elseif ($val[
'type'] ===
'boolean') {
694 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
696 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] :
'').
'">';
702include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
705$parameters = array(
'arrayfields' => $arrayfields);
706$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
707print $hookmanager->resPrint;
712if (!
$conf->main_checkbox_left_column) {
713 print
'<td class="liste_titre center maxwidthsearch">';
714 $searchpicto = $form->showFilterButtons();
725print
'<tr class="liste_titre">';
727if (
$conf->main_checkbox_left_column) {
728 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
731foreach (
$object->fields as $key => $val) {
732 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
733 if ($key ==
'status') {
734 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
735 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
736 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
737 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
738 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
739 } 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'])) {
740 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
742 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
743 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
744 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";
749include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
751$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
752$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
753print $hookmanager->resPrint;
759if (!
$conf->main_checkbox_left_column) {
760 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
766$needToFetchEachLine = 0;
767if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
768 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
769 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
770 $needToFetchEachLine++;
782$imaxinloop = ($limit ? min($num, $limit) : $num);
783while ($i < $imaxinloop) {
784 $obj =
$db->fetch_object($resql);
790 $object->setVarsFromFetchObj($obj);
806 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
808 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
809 print
'<div class="box-flex-container kanban">';
813 if ($massactionbutton || $massaction) {
815 if (in_array(
$object->id, $arrayofselected)) {
820 print
$object->getKanbanView(
'', array(
'selected' => $selected));
821 if ($i == ($imaxinloop - 1)) {
828 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
831 if (
$conf->main_checkbox_left_column) {
832 print
'<td class="nowrap center">';
833 if ($massactionbutton || $massaction) {
835 if (in_array(
$object->id, $arrayofselected)) {
838 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
846 foreach (
$object->fields as $key => $val) {
847 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
848 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
849 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
850 } elseif ($key ==
'status') {
851 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
854 if (in_array($val[
'type'], array(
'timestamp'))) {
855 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
856 } elseif ($key ==
'ref') {
857 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
860 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'])) {
861 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
865 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
866 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
867 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
868 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
871 if ($key ==
'status') {
872 print
$object->getLibStatut(5);
873 } elseif ($key ==
'rowid') {
874 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
876 if ($val[
'type'] ==
'html') {
877 print
'<div class="small lineheightsmall twolinesmax-normallineheight">';
879 print
$object->showOutputField($val, $key, (
string)
$object->$key,
'');
880 if ($val[
'type'] ==
'html') {
888 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
892 if (!isset($totalarray[
'val'])) {
895 if (!isset($totalarray[
'val'][
't.'.$key])) {
903 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
905 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
906 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
907 print $hookmanager->resPrint;
914 if (empty(
$conf->main_checkbox_left_column)) {
915 print
'<td class="nowrap center">';
916 if ($massactionbutton || $massaction) {
918 if (in_array(
$object->id, $arrayofselected)) {
921 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
936include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
941 foreach ($arrayfields as $key => $val) {
942 if (!empty($val[
'checked'])) {
946 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
952$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
953$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
954print $hookmanager->resPrint;
956print
'</table>'.
"\n";
961if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
962 $hidegeneratedfilelistifempty = 1;
963 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
964 $hidegeneratedfilelistifempty = 0;
967 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
971 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
972 $urlsource .= str_replace(
'&',
'&', $param);
974 $filedir = $diroutputmassaction;
975 $genallowed = $permissiontoread;
976 $delallowed = $permissiontoadd;
978 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_now($mode='gmt')
Return date for now.
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, $allowothertags=array())
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.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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.
getDolDefaultContextPage($s)
Return the default context page string.
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...
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.