27 require
'../../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/product/stock/stocktransfer/class/stocktransfer.class.php';
35 $langs->loadLangs(array(
"stocks",
"other"));
38 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
39 $massaction =
GETPOST(
'massaction',
'alpha');
41 $confirm =
GETPOST(
'confirm',
'alpha');
42 $cancel =
GETPOST(
'cancel',
'alpha');
43 $toselect =
GETPOST(
'toselect',
'array');
44 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'stocktransferlist';
45 $backtopage =
GETPOST(
'backtopage',
'alpha');
46 $optioncss =
GETPOST(
'optioncss',
'aZ');
52 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59 $offset = $limit * $page;
60 $pageprev = $page - 1;
61 $pagenext = $page + 1;
67 $hookmanager->initHooks(array(
'stocktransferlist'));
70 $extrafields->fetch_name_optionals_label(
$object->table_element);
73 $search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
78 $sortfield =
"t.".key(
$object->fields);
85 $search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
87 foreach (
$object->fields as $key => $val) {
88 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
89 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
91 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
98 $fieldstosearchall = array();
99 foreach (
$object->fields as $key => $val) {
100 if (!empty($val[
'searchall'])) {
101 $fieldstosearchall[
't.'.$key] = $val[
'label'];
106 $arrayfields = array();
107 foreach (
$object->fields as $key => $val) {
109 if (!empty($val[
'visible'])) {
110 $visible = (int)
dol_eval($val[
'visible'], 1);
111 $arrayfields[
't.'.$key] = array(
112 'label'=>$val[
'label'],
113 'checked'=>(($visible < 0) ? 0 : 1),
114 'enabled'=>(abs($visible) != 3 && (
int)
dol_eval($val[
'enabled'], 1)),
115 'position'=>$val[
'position'],
116 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
121 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
126 $permissiontoread = $user->hasRight(
'stocktransfer',
'stocktransfer',
'read');
127 $permissiontoadd = $user->hasRight(
'stocktransfer',
'stocktransfer',
'write');
128 $permissiontodelete = $user->hasRight(
'stocktransfer',
'stocktransfer',
'delete');
131 if (empty($conf->stocktransfer->enabled)) {
136 if ($user->socid > 0) {
140 if (!$permissiontoread) {
150 if (
GETPOST(
'cancel',
'alpha')) {
154 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
158 $parameters = array();
159 $reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
164 if (empty($reshook)) {
166 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
169 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
170 foreach (
$object->fields as $key => $val) {
172 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
173 $search[$key.
'_dtstart'] =
'';
174 $search[$key.
'_dtend'] =
'';
178 $search_array_options = array();
180 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
181 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
186 $objectclass =
'StockTransfer';
187 $objectlabel =
'StockTransfer';
188 $uploaddir = $conf->stocktransfer->dir_output;
189 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
198 $form =
new Form($db);
202 $title = $langs->trans(
'StockTransferList');
214 if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
215 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
216 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
220 $parameters = array();
221 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters,
$object, $action);
222 $sql .= $hookmanager->resPrint;
223 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
227 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
228 if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
229 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
232 $parameters = array();
233 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters,
$object, $action);
234 $sql .= $hookmanager->resPrint;
235 if (
$object->ismultientitymanaged == 1) {
236 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
238 $sql .=
" WHERE 1 = 1";
240 foreach ($search as $key => $val) {
241 if (array_key_exists($key,
$object->fields)) {
242 if ($key ==
'status' && $search[$key] == -1) {
246 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
247 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
252 if ($search[$key] !=
'') {
253 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
256 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
257 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
258 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
259 if (preg_match(
'/_dtstart$/', $key)) {
260 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
262 if (preg_match(
'/_dtend$/', $key)) {
263 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
274 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
276 $parameters = array();
277 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters,
$object, $action);
278 $sql .= $hookmanager->resPrint;
299 $nbtotalofrecords =
'';
302 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
303 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
304 $resql = $db->query($sqlforcount);
306 $objforcount = $db->fetch_object($resql);
307 $nbtotalofrecords = $objforcount->nbtotalofrecords;
312 if (($page * $limit) > $nbtotalofrecords) {
320 $sql .= $db->order($sortfield, $sortorder);
322 $sql .= $db->plimit($limit + 1, $offset);
325 $resql = $db->query(
$sql);
331 $num = $db->num_rows($resql);
334 if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
335 $obj = $db->fetch_object($resql);
337 header(
"Location: ".
dol_buildpath(
'/product/stock/stocktransfer/stocktransfer_card.php', 1).
'?id='.$id);
345 llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
362 $arrayofselected = is_array($toselect) ? $toselect : array();
366 $param .=
'&mode='.urlencode($mode);
368 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
369 $param .=
'&contextpage='.urlencode($contextpage);
371 if ($limit > 0 && $limit != $conf->liste_limit) {
372 $param .=
'&limit='.((int) $limit);
374 if ($optioncss !=
'') {
375 $param .=
'&optioncss='.urlencode($optioncss);
377 foreach ($search as $key => $val) {
378 if (is_array($search[$key])) {
379 foreach ($search[$key] as $skey) {
381 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
384 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
385 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
386 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
387 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
388 } elseif ($search[$key] !=
'') {
389 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
393 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
395 $parameters = array(
'param' => &$param);
396 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters,
$object, $action);
397 $param .= $hookmanager->resPrint;
400 $arrayofmassactions = array(
406 if (!empty($permissiontodelete)) {
407 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
409 if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
410 $arrayofmassactions = array();
412 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
414 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
415 if ($optioncss !=
'') {
416 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
418 print
'<input type="hidden" name="token" value="'.newToken().
'">';
419 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
420 print
'<input type="hidden" name="action" value="list">';
421 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
422 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
423 print
'<input type="hidden" name="page" value="'.$page.
'">';
424 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
425 print
'<input type="hidden" name="page_y" value="">';
426 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
429 $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);
431 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
434 $topicmail =
"SendStockTransferRef";
435 $modelmail =
"stocktransfer";
437 $trackid =
'xxxx'.$object->id;
438 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
442 foreach ($fieldstosearchall as $key => $val) {
443 $fieldstosearchall[$key] = $langs->trans($val);
444 $setupstring .= $key.
"=".$val.
";";
446 print
'<!-- Search done like if STOCKTRANSFER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
447 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
455 $parameters = array();
456 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
457 if (empty($reshook)) {
458 $moreforfilter .= $hookmanager->resPrint;
460 $moreforfilter = $hookmanager->resPrint;
463 if (!empty($moreforfilter)) {
464 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
465 print $moreforfilter;
466 $parameters = array();
467 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
468 print $hookmanager->resPrint;
472 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
473 $htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
474 $selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
475 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
477 print
'<div class="div-table-responsive">';
478 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
483 print
'<tr class="liste_titre_filter">';
486 print
'<td class="liste_titre center maxwidthsearch">';
487 $searchpicto = $form->showFilterButtons(
'left');
491 foreach (
$object->fields as $key => $val) {
492 $searchkey = empty($search[$key]) ?
'' : $search[$key];
493 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
494 if ($key ==
'status') {
495 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
496 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
497 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
498 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
499 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
500 } 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'])) {
501 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
503 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
504 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
505 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
506 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);
507 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
508 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
509 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
510 print
'<div class="nowrap">';
511 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
513 print
'<div class="nowrap">';
514 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
516 } elseif ($key ==
'lang') {
517 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
519 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
521 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
527 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
530 $parameters = array(
'arrayfields'=>$arrayfields);
531 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters,
$object, $action);
532 print $hookmanager->resPrint;
535 print
'<td class="liste_titre center maxwidthsearch">';
536 $searchpicto = $form->showFilterButtons();
542 $totalarray = array();
543 $totalarray[
'nbfield'] = 0;
547 print
'<tr class="liste_titre">';
550 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
551 $totalarray[
'nbfield']++;
553 foreach (
$object->fields as $key => $val) {
554 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
555 if ($key ==
'status') {
556 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
557 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
558 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
559 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
560 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
561 } 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'])) {
562 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
564 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
565 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
566 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";
567 $totalarray[
'nbfield']++;
571 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
573 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
574 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters,
$object, $action);
575 print $hookmanager->resPrint;
578 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
579 $totalarray[
'nbfield']++;
585 $needToFetchEachLine = 0;
586 if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
587 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
588 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
589 $needToFetchEachLine++;
598 $savnbfield = $totalarray[
'nbfield'];
599 $totalarray = array();
600 $totalarray[
'nbfield'] = 0;
601 $imaxinloop = ($limit ? min($num, $limit) : $num);
602 while ($i < $imaxinloop) {
603 $obj = $db->fetch_object($resql);
609 $object->setVarsFromFetchObj($obj);
611 if ($mode ==
'kanban') {
613 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
614 print
'<div class="box-flex-container kanban">';
618 if ($massactionbutton || $massaction) {
620 if (in_array(
$object->id, $arrayofselected)) {
625 print
$object->getKanbanView(
'', array(
'selected' => $selected));
626 if ($i == ($imaxinloop - 1)) {
633 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
637 print
'<td class="nowrap center">';
638 if ($massactionbutton || $massaction) {
640 if (in_array(
$object->id, $arrayofselected)) {
643 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
647 $totalarray[
'nbfield']++;
650 foreach (
$object->fields as $key => $val) {
651 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
652 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
653 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
654 } elseif ($key ==
'status') {
655 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
658 if (in_array($val[
'type'], array(
'timestamp'))) {
659 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
660 } elseif ($key ==
'ref') {
661 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
664 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'])) {
665 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
669 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
670 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
671 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
672 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
675 if ($key ==
'status') {
676 print
$object->getLibStatut(5);
677 } elseif ($key ==
'rowid') {
684 $totalarray[
'nbfield']++;
686 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
688 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
690 if (!isset($totalarray[
'val'])) {
691 $totalarray[
'val'] = array();
693 if (!isset($totalarray[
'val'][
't.'.$key])) {
694 $totalarray[
'val'][
't.'.$key] = 0;
696 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
701 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
703 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>
$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
704 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters,
$object, $action);
705 print $hookmanager->resPrint;
708 print
'<td class="nowrap center">';
709 if ($massactionbutton || $massaction) {
711 if (in_array(
$object->id, $arrayofselected)) {
714 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
718 $totalarray[
'nbfield']++;
729 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
734 foreach ($arrayfields as $key => $val) {
735 if (!empty($val[
'checked'])) {
739 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
745 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
746 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters,
$object, $action);
747 print $hookmanager->resPrint;
749 print
'</table>'.
"\n";
752 print
'</form>'.
"\n";
754 if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
755 $hidegeneratedfilelistifempty = 1;
756 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
757 $hidegeneratedfilelistifempty = 0;
760 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
764 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
765 $urlsource .= str_replace(
'&',
'&', $param);
767 $filedir = $diroutputmassaction;
768 $genallowed = $permissiontoread;
769 $delallowed = $permissiontoadd;
771 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()
Empty header.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
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_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.
print_barre_liste($title, $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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.