28require
'../../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
36$langs->loadLangs(array(
"stocks",
"other"));
39$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
40$massaction =
GETPOST(
'massaction',
'alpha');
42$confirm =
GETPOST(
'confirm',
'alpha');
43$cancel =
GETPOST(
'cancel',
'alpha');
44$toselect =
GETPOST(
'toselect',
'array');
45$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'stocktransferlist';
46$backtopage =
GETPOST(
'backtopage',
'alpha');
47$optioncss =
GETPOST(
'optioncss',
'aZ');
54$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
55$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
57if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
61$offset = $limit * $page;
68$diroutputmassaction =
getMultidirOutput($object).
'/temp/massgeneration/'.$user->id;
69$hookmanager->initHooks(array(
'stocktransferlist'));
72$extrafields->fetch_name_optionals_label(
$object->table_element);
75$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
80 $sortfield =
"t.".key(
$object->fields);
87$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
89foreach (
$object->fields as $key => $val) {
90 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
91 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
93 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
100$fieldstosearchall = array();
101foreach (
$object->fields as $key => $val) {
102 if (!empty($val[
'searchall'])) {
103 $fieldstosearchall[
't.'.$key] = $val[
'label'];
108$arrayfields = array();
109foreach (
$object->fields as $key => $val) {
111 if (!empty($val[
'visible'])) {
112 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
113 $arrayfields[
't.'.$key] = array(
114 'label' => $val[
'label'],
115 'checked' => (($visible < 0) ? 0 : 1),
116 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
117 'position' => $val[
'position'],
118 'help' => isset($val[
'help']) ? $val[
'help'] :
''
123include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
128$permissiontoread = $user->hasRight(
'stocktransfer',
'stocktransfer',
'read');
129$permissiontoadd = $user->hasRight(
'stocktransfer',
'stocktransfer',
'write');
130$permissiontodelete = $user->hasRight(
'stocktransfer',
'stocktransfer',
'delete');
133if (empty($conf->stocktransfer->enabled)) {
138if ($user->socid > 0) {
142if (!$permissiontoread) {
152if (
GETPOST(
'cancel',
'alpha')) {
156if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
160$parameters = array();
161$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
166if (empty($reshook)) {
168 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
171 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
172 foreach (
$object->fields as $key => $val) {
174 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
175 $search[$key.
'_dtstart'] =
'';
176 $search[$key.
'_dtend'] =
'';
180 $search_array_options = array();
182 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
183 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
188 $objectclass =
'StockTransfer';
189 $objectlabel =
'StockTransfer';
190 $uploaddir = $conf->stocktransfer->dir_output;
191 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
200$form =
new Form($db);
204$title = $langs->trans(
'StockTransferList');
214$sql .=
$object->getFieldList(
't');
216if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
217 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
218 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
222$parameters = array();
223$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
224$sql .= $hookmanager->resPrint;
225$sql = preg_replace(
'/,\s*$/',
'', $sql);
229$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
230if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
231 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
234$parameters = array();
235$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
236$sql .= $hookmanager->resPrint;
237if (
$object->ismultientitymanaged == 1) {
238 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
240 $sql .=
" WHERE 1 = 1";
242foreach ($search as $key => $val) {
243 if (array_key_exists($key,
$object->fields)) {
244 if ($key ==
'status' && $search[$key] == -1) {
248 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
249 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
254 if ($search[$key] !=
'') {
255 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
258 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
259 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
260 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
261 if (preg_match(
'/_dtstart$/', $key)) {
262 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
264 if (preg_match(
'/_dtend$/', $key)) {
265 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
272 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
276include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
278$parameters = array();
279$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
280$sql .= $hookmanager->resPrint;
301$nbtotalofrecords =
'';
304 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
305 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
306 $resql = $db->query($sqlforcount);
308 $objforcount = $db->fetch_object($resql);
309 $nbtotalofrecords = $objforcount->nbtotalofrecords;
314 if (($page * $limit) > $nbtotalofrecords) {
322$sql .= $db->order($sortfield, $sortorder);
324 $sql .= $db->plimit($limit + 1, $offset);
327$resql = $db->query($sql);
333$num = $db->num_rows($resql);
336if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
337 $obj = $db->fetch_object($resql);
339 header(
"Location: ".
dol_buildpath(
'/product/stock/stocktransfer/stocktransfer_card.php', 1).
'?id='.$id);
347llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-product page-stock-stocktransfer_stocktransfer_list');
364$arrayofselected = is_array($toselect) ? $toselect : array();
368 $param .=
'&mode='.urlencode($mode);
370if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
371 $param .=
'&contextpage='.urlencode($contextpage);
373if ($limit > 0 && $limit != $conf->liste_limit) {
374 $param .=
'&limit='.((int) $limit);
376if ($optioncss !=
'') {
377 $param .=
'&optioncss='.urlencode($optioncss);
379foreach ($search as $key => $val) {
380 if (is_array($search[$key])) {
381 foreach ($search[$key] as $skey) {
383 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
386 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
387 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
388 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
389 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
390 } elseif ($search[$key] !=
'') {
391 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
395include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
397$parameters = array(
'param' => &$param);
398$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
399$param .= $hookmanager->resPrint;
402$arrayofmassactions = array(
408if (!empty($permissiontodelete)) {
409 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
411if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
412 $arrayofmassactions = array();
414$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
416print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
417if ($optioncss !=
'') {
418 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
420print
'<input type="hidden" name="token" value="'.newToken().
'">';
421print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
422print
'<input type="hidden" name="action" value="list">';
423print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
424print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
425print
'<input type="hidden" name="page" value="'.$page.
'">';
426print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
427print
'<input type="hidden" name="page_y" value="">';
428print
'<input type="hidden" name="mode" value="'.$mode.
'">';
431$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);
433print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
436$topicmail =
"SendStockTransferRef";
437$modelmail =
"stocktransfer";
439$trackid =
'xxxx'.$object->id;
440include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
444 foreach ($fieldstosearchall as $key => $val) {
445 $fieldstosearchall[$key] = $langs->trans($val);
446 $setupstring .= $key.
"=".$val.
";";
448 print
'<!-- Search done like if STOCKTRANSFER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
449 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
457$parameters = array();
458$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
459if (empty($reshook)) {
460 $moreforfilter .= $hookmanager->resPrint;
462 $moreforfilter = $hookmanager->resPrint;
465if (!empty($moreforfilter)) {
466 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
467 print $moreforfilter;
471$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
472$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
473$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
474$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
476print
'<div class="div-table-responsive">';
477print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
482print
'<tr class="liste_titre_filter">';
485 print
'<td class="liste_titre center maxwidthsearch">';
486 $searchpicto = $form->showFilterButtons(
'left');
490foreach (
$object->fields as $key => $val) {
491 $searchkey = empty($search[$key]) ?
'' : $search[$key];
492 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
493 if ($key ==
'status') {
494 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
495 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
496 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
497 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
498 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
499 } 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'])) {
500 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
502 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
503 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
504 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
505 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);
506 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
507 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
508 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
509 print
'<div class="nowrap">';
510 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
512 print
'<div class="nowrap">';
513 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
515 } elseif ($key ==
'lang') {
516 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
518 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
520 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
526include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
529$parameters = array(
'arrayfields'=>$arrayfields);
530$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
531print $hookmanager->resPrint;
534 print
'<td class="liste_titre center maxwidthsearch">';
535 $searchpicto = $form->showFilterButtons();
541$totalarray = array();
542$totalarray[
'nbfield'] = 0;
546print
'<tr class="liste_titre">';
549 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
550 $totalarray[
'nbfield']++;
552foreach (
$object->fields as $key => $val) {
553 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
554 if ($key ==
'status') {
555 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
556 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
557 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
558 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
559 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
560 } 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'])) {
561 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
563 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
564 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
565 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";
566 $totalarray[
'nbfield']++;
570include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
572$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
573$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
574print $hookmanager->resPrint;
577 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
578 $totalarray[
'nbfield']++;
584$needToFetchEachLine = 0;
585if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
586 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
587 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
588 $needToFetchEachLine++;
597$savnbfield = $totalarray[
'nbfield'];
598$totalarray = array();
599$totalarray[
'nbfield'] = 0;
600$imaxinloop = ($limit ? min($num, $limit) : $num);
601while ($i < $imaxinloop) {
602 $obj = $db->fetch_object($resql);
608 $object->setVarsFromFetchObj($obj);
610 if ($mode ==
'kanban') {
612 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
613 print
'<div class="box-flex-container kanban">';
617 if ($massactionbutton || $massaction) {
619 if (in_array(
$object->id, $arrayofselected)) {
624 print
$object->getKanbanView(
'', array(
'selected' => $selected));
625 if ($i == ($imaxinloop - 1)) {
632 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
636 print
'<td class="nowrap center">';
637 if ($massactionbutton || $massaction) {
639 if (in_array(
$object->id, $arrayofselected)) {
642 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
646 $totalarray[
'nbfield']++;
649 foreach (
$object->fields as $key => $val) {
650 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
651 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
652 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
653 } elseif ($key ==
'status') {
654 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
657 if (in_array($val[
'type'], array(
'timestamp'))) {
658 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
659 } elseif ($key ==
'ref') {
660 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
663 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'])) {
664 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
668 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
669 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
670 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
671 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
674 if ($key ==
'status') {
675 print
$object->getLibStatut(5);
676 } elseif ($key ==
'rowid') {
683 $totalarray[
'nbfield']++;
685 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
687 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
689 if (!isset($totalarray[
'val'])) {
690 $totalarray[
'val'] = array();
692 if (!isset($totalarray[
'val'][
't.'.$key])) {
693 $totalarray[
'val'][
't.'.$key] = 0;
695 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
700 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
702 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
703 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
704 print $hookmanager->resPrint;
707 print
'<td class="nowrap center">';
708 if ($massactionbutton || $massaction) {
710 if (in_array(
$object->id, $arrayofselected)) {
713 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
717 $totalarray[
'nbfield']++;
728include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
733 foreach ($arrayfields as $key => $val) {
734 if (!empty($val[
'checked'])) {
738 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
744$parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
745$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
746print $hookmanager->resPrint;
748print
'</table>'.
"\n";
753if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
754 $hidegeneratedfilelistifempty = 1;
755 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
756 $hidegeneratedfilelistifempty = 0;
759 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
763 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
764 $urlsource .= str_replace(
'&',
'&', $param);
766 $filedir = $diroutputmassaction;
767 $genallowed = $permissiontoread;
768 $delallowed = $permissiontoadd;
770 print $formfile->showdocuments(
'massfilesarea_'.
$object->module,
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!function_exists( 'utf8_encode')) if(!function_exists('utf8_decode')) if(!function_exists( 'str_starts_with')) if(!function_exists('str_ends_with')) if(!function_exists( 'str_contains')) 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,...
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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.