28require
'../../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
42$langs->loadLangs(array(
"stocks",
"other"));
45$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
46$massaction =
GETPOST(
'massaction',
'alpha');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$cancel =
GETPOST(
'cancel',
'alpha');
50$toselect =
GETPOST(
'toselect',
'array:int');
51$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'stocktransferlist';
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$optioncss =
GETPOST(
'optioncss',
'aZ');
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
67$offset = $limit * $page;
74$diroutputmassaction =
getMultidirOutput($object,
'', 0,
'temp') .
'massgeneration/'.$user->id;
75$hookmanager->initHooks(array(
'stocktransferlist'));
78$extrafields->fetch_name_optionals_label(
$object->table_element);
81$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
86 $sortfield =
"t.".key(
$object->fields);
93$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
95foreach (
$object->fields as $key => $val) {
96 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
97 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
99 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
106$fieldstosearchall = array();
107foreach (
$object->fields as $key => $val) {
108 if (!empty($val[
'searchall'])) {
109 $fieldstosearchall[
't.'.$key] = $val[
'label'];
114$arrayfields = array();
115foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'visible'])) {
118 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
119 $arrayfields[
't.'.$key] = array(
120 'label' => $val[
'label'],
121 'checked' => (($visible < 0) ? 0 : 1),
122 'enabled' => (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
123 'position' => $val[
'position'],
124 'help' => isset($val[
'help']) ? $val[
'help'] :
''
129include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
131$parameters = array(
'arrayfields' => &$arrayfields);
132$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
137$permissiontoread = $user->hasRight(
'stocktransfer',
'stocktransfer',
'read');
138$permissiontoadd = $user->hasRight(
'stocktransfer',
'stocktransfer',
'write');
139$permissiontodelete = $user->hasRight(
'stocktransfer',
'stocktransfer',
'delete');
142if (empty(
$conf->stocktransfer->enabled)) {
147if ($user->socid > 0) {
151if (!$permissiontoread) {
161if (
GETPOST(
'cancel',
'alpha')) {
165if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
169$parameters = array();
170$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
172 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
175if (empty($reshook)) {
177 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
180 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
181 foreach (
$object->fields as $key => $val) {
183 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
184 $search[$key.
'_dtstart'] =
'';
185 $search[$key.
'_dtend'] =
'';
189 $search_array_options = array();
191 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
192 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
197 $objectclass =
'StockTransfer';
198 $objectlabel =
'StockTransfer';
199 $uploaddir =
$conf->stocktransfer->dir_output;
200 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
209$form =
new Form($db);
213$title = $langs->trans(
'StockTransferList');
219$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
220$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
226$sql .=
$object->getFieldList(
't');
228if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
229 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
230 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
234$parameters = array();
235$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
236$sql .= $hookmanager->resPrint;
237$sql = preg_replace(
'/,\s*$/',
'', $sql);
241$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
242if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
243 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
246$parameters = array();
247$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
248$sql .= $hookmanager->resPrint;
249if (
$object->ismultientitymanaged == 1) {
250 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
252 $sql .=
" WHERE 1 = 1";
254foreach ($search as $key => $val) {
255 if (array_key_exists($key,
$object->fields)) {
256 if ($key ==
'status' && $search[$key] == -1) {
260 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
261 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
266 if ($search[$key] !=
'') {
267 if ($key ==
'ref' && empty($arrayfields[
't.label'][
'checked'])) {
271 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
275 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
276 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
277 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
278 if (preg_match(
'/_dtstart$/', $key)) {
279 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".$db->idate($search[$key]).
"'";
281 if (preg_match(
'/_dtend$/', $key)) {
282 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".$db->idate($search[$key]).
"'";
289 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
293include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
295$parameters = array();
296$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
297$sql .= $hookmanager->resPrint;
318$nbtotalofrecords =
'';
321 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
322 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
323 $resql = $db->query($sqlforcount);
325 $objforcount = $db->fetch_object($resql);
326 $nbtotalofrecords = $objforcount->nbtotalofrecords;
328 dol_print_error($db);
331 if (($page * $limit) > (
int) $nbtotalofrecords) {
339$sql .= $db->order($sortfield, $sortorder);
341 $sql .= $db->plimit($limit + 1, $offset);
344$resql = $db->query($sql);
346 dol_print_error($db);
350$num = $db->num_rows($resql);
353if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
354 $obj = $db->fetch_object($resql);
356 header(
"Location: ".
dol_buildpath(
'/product/stock/stocktransfer/stocktransfer_card.php', 1).
'?id='.$id);
364llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-product page-stock-stocktransfer_stocktransfer_list');
381$arrayofselected = is_array($toselect) ? $toselect : array();
385 $param .=
'&mode='.urlencode($mode);
387if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
388 $param .=
'&contextpage='.urlencode($contextpage);
390if ($limit > 0 && $limit !=
$conf->liste_limit) {
391 $param .=
'&limit='.((int) $limit);
393if ($optioncss !=
'') {
394 $param .=
'&optioncss='.urlencode($optioncss);
396foreach ($search as $key => $val) {
397 if (is_array($search[$key])) {
398 foreach ($search[$key] as $skey) {
400 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
403 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
404 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
405 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
406 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
407 } elseif ($search[$key] !=
'') {
408 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
412include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
414$parameters = array(
'param' => &$param);
415$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
416$param .= $hookmanager->resPrint;
419$arrayofmassactions = array(
425if (!empty($permissiontodelete)) {
426 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
428if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
429 $arrayofmassactions = array();
431$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
433print
'<form method="POST" id="searchFormList" spellcheck="false" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
434if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437print
'<input type="hidden" name="token" value="'.newToken().
'">';
438print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439print
'<input type="hidden" name="action" value="list">';
440print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
441print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
442print
'<input type="hidden" name="page" value="'.$page.
'">';
443print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
444print
'<input type="hidden" name="page_y" value="">';
445print
'<input type="hidden" name="mode" value="'.$mode.
'">';
448$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/product/stock/stocktransfer/stocktransfer_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
450print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
453$topicmail =
"SendStockTransferRef";
454$modelmail =
"stocktransfer";
456$trackid =
'xxxx'.$object->id;
457include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
461 foreach ($fieldstosearchall as $key => $val) {
462 $fieldstosearchall[$key] = $langs->trans($val);
463 $setupstring .= $key.
"=".$val.
";";
465 print
'<!-- Search done like if STOCKTRANSFER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
466 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
474$parameters = array();
475$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
476if (empty($reshook)) {
477 $moreforfilter .= $hookmanager->resPrint;
479 $moreforfilter = $hookmanager->resPrint;
482if (!empty($moreforfilter)) {
483 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
484 print $moreforfilter;
488$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
489$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
491print
'<div class="div-table-responsive">';
492print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
497print
'<tr class="liste_titre_filter">';
499if (
$conf->main_checkbox_left_column) {
500 print
'<td class="liste_titre center maxwidthsearch">';
501 $searchpicto = $form->showFilterButtons(
'left');
505foreach (
$object->fields as $key => $val) {
506 $searchkey = empty($search[$key]) ?
'' : $search[$key];
507 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
508 if ($key ==
'status') {
509 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
510 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
511 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
512 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
513 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
514 } 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'])) {
515 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
517 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
518 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
519 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
520 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);
521 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
522 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
523 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
524 print
'<div class="nowrap">';
525 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
527 print
'<div class="nowrap">';
528 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
530 } elseif ($key ==
'lang') {
531 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
533 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
535 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
541include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
544$parameters = array(
'arrayfields' => $arrayfields);
545$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
546print $hookmanager->resPrint;
548if (!
$conf->main_checkbox_left_column) {
549 print
'<td class="liste_titre center maxwidthsearch">';
550 $searchpicto = $form->showFilterButtons();
556$totalarray = array();
557$totalarray[
'nbfield'] = 0;
561print
'<tr class="liste_titre">';
563if (
$conf->main_checkbox_left_column) {
564 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
565 $totalarray[
'nbfield']++;
567foreach (
$object->fields as $key => $val) {
568 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
569 if ($key ==
'status') {
570 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
571 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
572 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
573 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
574 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
575 } 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'])) {
576 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
578 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
579 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
580 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";
581 $totalarray[
'nbfield']++;
585include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
587$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
588$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
589print $hookmanager->resPrint;
591if (!
$conf->main_checkbox_left_column) {
592 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
593 $totalarray[
'nbfield']++;
599$needToFetchEachLine = 0;
600if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
601 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
602 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
603 $needToFetchEachLine++;
612$savnbfield = $totalarray[
'nbfield'];
613$totalarray = array();
614$totalarray[
'nbfield'] = 0;
615$imaxinloop = ($limit ? min($num, $limit) : $num);
616while ($i < $imaxinloop) {
617 $obj = $db->fetch_object($resql);
623 $object->setVarsFromFetchObj($obj);
625 if ($mode ==
'kanban') {
627 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
628 print
'<div class="box-flex-container kanban">';
632 if ($massactionbutton || $massaction) {
634 if (in_array(
$object->id, $arrayofselected)) {
639 print
$object->getKanbanView(
'', array(
'selected' => $selected));
640 if ($i == ($imaxinloop - 1)) {
647 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
650 if (
$conf->main_checkbox_left_column) {
651 print
'<td class="nowrap center">';
652 if ($massactionbutton || $massaction) {
654 if (in_array(
$object->id, $arrayofselected)) {
657 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
661 $totalarray[
'nbfield']++;
664 foreach (
$object->fields as $key => $val) {
665 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
666 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
667 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
668 } elseif ($key ==
'status') {
669 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
672 if (in_array($val[
'type'], array(
'timestamp'))) {
673 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
674 } elseif ($key ==
'ref') {
675 $cssforfield .= ($cssforfield ?
' ' :
'').(empty($arrayfields[
't.label'][
'checked']) ?
'tdlineheightsmall' :
'nowraponall');
678 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'])) {
679 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
682 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
683 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
684 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
685 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
688 if ($key ==
'status') {
689 print
$object->getLibStatut(5);
690 } elseif ($key ==
'rowid') {
691 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
692 } elseif ($key ==
'ref' && empty($arrayfields[
't.label'][
'checked'])) {
694 print
'<div class="tdoverflowmax150 inline-block lineheightsmall">';
697 print
'<br><span class="spantitle">'.dolPrintHTML(
$object->label).
'</span>';
700 } elseif ($key ==
'label') {
701 print
'<span class="spantitle">'.$object->showOutputField($val, $key,
$object->$key,
'').
'</span>';
707 $totalarray[
'nbfield']++;
709 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
711 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
713 if (!isset($totalarray[
'val'])) {
714 $totalarray[
'val'] = array();
716 if (!isset($totalarray[
'val'][
't.'.$key])) {
717 $totalarray[
'val'][
't.'.$key] = 0;
719 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
724 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
726 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
727 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
728 print $hookmanager->resPrint;
730 if (!
$conf->main_checkbox_left_column) {
731 print
'<td class="nowrap center">';
732 if ($massactionbutton || $massaction) {
734 if (in_array(
$object->id, $arrayofselected)) {
737 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
741 $totalarray[
'nbfield']++;
752include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
757 foreach ($arrayfields as $key => $val) {
758 if (!empty($val[
'checked'])) {
762 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
768$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
769$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
770print $hookmanager->resPrint;
772print
'</table>'.
"\n";
777if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
778 $hidegeneratedfilelistifempty = 1;
779 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
780 $hidegeneratedfilelistifempty = 0;
783 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
787 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
788 $urlsource .= str_replace(
'&',
'&', $param);
790 $filedir = $diroutputmassaction;
791 $genallowed = $permissiontoread;
792 $delallowed = $permissiontoadd;
794 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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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...
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...
getMultidirOutput($object, $module='', $forobject=0, $mode='output')
Return the full path of the directory where a module (or an object of a module) stores its files.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.