50 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
51 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
54 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
55 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
58 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
59 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
61 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
62 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
65 if (!$res && file_exists(
"../main.inc.php")) {
66 $res = @include
"../main.inc.php";
68 if (!$res && file_exists(
"../../main.inc.php")) {
69 $res = @include
"../../main.inc.php";
71 if (!$res && file_exists(
"../../../main.inc.php")) {
72 $res = @include
"../../../main.inc.php";
75 die(
"Include of main fails");
78 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
79 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
80 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
83 require_once __DIR__.
'/class/target.class.php';
89 $langs->loadLangs(array(
"webhook@webhook",
"other"));
91 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
92 $massaction =
GETPOST(
'massaction',
'alpha');
93 $show_files =
GETPOST(
'show_files',
'int');
94 $confirm =
GETPOST(
'confirm',
'alpha');
95 $cancel =
GETPOST(
'cancel',
'alpha');
96 $toselect =
GETPOST(
'toselect',
'array');
97 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'targetlist';
98 $backtopage =
GETPOST(
'backtopage',
'alpha');
99 $optioncss =
GETPOST(
'optioncss',
'aZ');
105 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
106 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
107 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
109 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113 $offset = $limit * $page;
114 $pageprev = $page - 1;
115 $pagenext = $page + 1;
118 $object =
new Target($db);
120 $diroutputmassaction = $conf->webhook->dir_output.
'/temp/massgeneration/'.$user->id;
121 $hookmanager->initHooks(array(
'targetlist'));
124 $extrafields->fetch_name_optionals_label($object->table_element);
127 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
131 reset($object->fields);
132 $sortfield =
"t.".key($object->fields);
139 $search_all =
GETPOST(
'search_all',
'alphanohtml');
141 foreach ($object->fields as $key => $val) {
142 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
143 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
145 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
146 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
147 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
152 $fieldstosearchall = array();
153 foreach ($object->fields as $key => $val) {
154 if (!empty($val[
'searchall'])) {
155 $fieldstosearchall[
't.'.$key] = $val[
'label'];
160 $arrayfields = array();
161 foreach ($object->fields as $key => $val) {
163 if (!empty($val[
'visible'])) {
164 $visible = (int)
dol_eval($val[
'visible'], 1);
165 $arrayfields[
't.'.$key] = array(
166 'label'=>$val[
'label'],
167 'checked'=>(($visible < 0) ? 0 : 1),
168 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
169 'position'=>$val[
'position'],
170 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
175 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
183 $enablepermissioncheck = 0;
184 if ($enablepermissioncheck) {
185 $permissiontoread = $user->rights->webhook->target->read;
186 $permissiontoadd = $user->rights->webhook->target->write;
187 $permissiontodelete = $user->rights->webhook->target->delete;
189 $permissiontoread = 1;
190 $permissiontoadd = 1;
191 $permissiontodelete = 1;
200 if (empty($conf->webhook->enabled))
accessforbidden(
'Module not enabled');
208 if (
GETPOST(
'cancel',
'alpha')) {
212 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
216 $parameters = array();
217 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
222 if (empty($reshook)) {
224 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
227 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
228 foreach ($object->fields as $key => $val) {
230 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
231 $search[$key.
'_dtstart'] =
'';
232 $search[$key.
'_dtend'] =
'';
236 $search_array_options = array();
238 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
239 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
244 $objectclass =
'Target';
245 $objectlabel =
'Target';
246 $uploaddir = $conf->webhook->dir_output;
247 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
261 $title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"Targets"));
268 $sql .= $object->getFieldList(
't');
270 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
271 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
272 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
276 $parameters = array();
277 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
278 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
279 $sql = preg_replace(
'/,\s*$/',
'', $sql);
281 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
283 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
284 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
287 $parameters = array();
288 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
289 $sql .= $hookmanager->resPrint;
290 if ($object->ismultientitymanaged == 1) {
291 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
293 $sql .=
" WHERE 1 = 1";
295 foreach ($search as $key => $val) {
296 if (array_key_exists($key, $object->fields)) {
297 if ($key ==
'status' && $search[$key] == -1) {
300 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
301 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
302 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
307 if ($search[$key] !=
'') {
308 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
311 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
312 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
313 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
314 if (preg_match(
'/_dtstart$/', $key)) {
315 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
317 if (preg_match(
'/_dtend$/', $key)) {
318 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
325 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
329 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
331 $parameters = array();
332 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
333 $sql .= $hookmanager->resPrint;
361 $nbtotalofrecords =
'';
362 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
377 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
378 $resql = $db->query($sqlforcount);
379 $objforcount = $db->fetch_object(
$resql);
380 $nbtotalofrecords = $objforcount->nbtotalofrecords;
382 if (($page * $limit) > $nbtotalofrecords) {
390 $sql .= $db->order($sortfield, $sortorder);
392 $sql .= $db->plimit($limit + 1, $offset);
395 $resql = $db->query($sql);
401 $num = $db->num_rows(
$resql);
405 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
406 $obj = $db->fetch_object(
$resql);
408 header(
"Location: ".
dol_buildpath(
'/webhook/target_card.php', 1).
'?id='.$id);
415 $title = $langs->trans(
"Targets");
418 if ($mode ==
'modulesetup') {
419 require_once
'lib/webhook.lib.php';
422 $page_name =
"WebhookSetup";
424 $linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
425 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
428 print
dol_get_fiche_head($head,
'targets', $langs->trans($page_name), -1,
"webhook@webhook");
446 $arrayofselected = is_array($toselect) ? $toselect : array();
450 $param .=
'&mode='.urlencode($mode);
452 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
453 $param .=
'&contextpage='.urlencode($contextpage);
455 if ($limit > 0 && $limit != $conf->liste_limit) {
456 $param .=
'&limit='.urlencode($limit);
458 foreach ($search as $key => $val) {
459 if (is_array($search[$key]) && count($search[$key])) {
460 foreach ($search[$key] as $skey) {
462 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
465 } elseif ($search[$key] !=
'') {
466 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
469 if ($optioncss !=
'') {
470 $param .=
'&optioncss='.urlencode($optioncss);
473 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
475 $parameters = array();
476 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
477 $param .= $hookmanager->resPrint;
480 $arrayofmassactions = array(
486 if ($permissiontodelete) {
487 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
489 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
490 $arrayofmassactions = array();
492 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
494 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
495 if ($optioncss !=
'') {
496 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
498 print
'<input type="hidden" name="token" value="'.newToken().
'">';
499 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
500 print
'<input type="hidden" name="action" value="list">';
501 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
502 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
503 print
'<input type="hidden" name="page" value="'.$page.
'">';
504 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
505 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
512 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/webhook/target_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']).
'?mode=modulesetup',
'', $permissiontoadd);
514 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
"", 0, $newcardbutton,
'', $limit, 0, 0, 1);
517 $topicmail =
"SendTargetRef";
518 $modelmail =
"target";
519 $objecttmp =
new Target($db);
520 $trackid =
'xxxx'.$object->id;
521 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
524 foreach ($fieldstosearchall as $key => $val) {
525 $fieldstosearchall[$key] = $langs->trans($val);
527 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
535 $parameters = array();
536 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
537 if (empty($reshook)) {
538 $moreforfilter .= $hookmanager->resPrint;
540 $moreforfilter = $hookmanager->resPrint;
543 if (!empty($moreforfilter)) {
544 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
545 print $moreforfilter;
549 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
550 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
551 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
553 print
'<div class="div-table-responsive">';
554 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
559 print
'<tr class="liste_titre">';
560 foreach ($object->fields as $key => $val) {
561 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
562 if ($key ==
'status') {
563 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
564 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
565 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
566 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
567 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
568 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
569 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
571 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
572 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
573 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
574 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
575 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
576 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_',
'maxwidth125', 1);
577 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
578 print
'<div class="nowrap">';
579 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
581 print
'<div class="nowrap">';
582 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
584 } elseif ($key ==
'lang') {
585 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
587 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
589 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
595 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
598 $parameters = array(
'arrayfields'=>$arrayfields);
599 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
600 print $hookmanager->resPrint;
605 print
'<td class="liste_titre maxwidthsearch">';
606 $searchpicto =
$form->showFilterButtons();
611 $totalarray = array();
612 $totalarray[
'nbfield'] = 0;
616 print
'<tr class="liste_titre">';
617 foreach ($object->fields as $key => $val) {
618 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
619 if ($key ==
'status') {
620 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
621 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
622 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
623 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
624 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
625 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
626 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
628 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
629 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
630 $totalarray[
'nbfield']++;
634 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
636 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
637 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
638 print $hookmanager->resPrint;
644 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
645 $totalarray[
'nbfield']++;
650 $needToFetchEachLine = 0;
651 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
652 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
653 if (preg_match(
'/\$object/', $val)) {
654 $needToFetchEachLine++;
663 $savnbfield = $totalarray[
'nbfield'];
664 $totalarray[
'nbfield'] = 0;
665 $imaxinloop = ($limit ? min($num, $limit) : $num);
666 while ($i < $imaxinloop) {
667 $obj = $db->fetch_object(
$resql);
673 $object->setVarsFromFetchObj($obj);
675 if ($mode ==
'kanban') {
677 print
'<tr><td colspan="'.$savnbfield.
'">';
678 print
'<div class="box-flex-container">';
681 print $object->getKanbanView(
'');
682 if ($i == ($imaxinloop - 1)) {
689 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
690 foreach ($object->fields as $key => $val) {
691 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
692 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
693 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
694 } elseif ($key ==
'status') {
695 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
698 if (in_array($val[
'type'], array(
'timestamp'))) {
699 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
700 } elseif ($key ==
'ref') {
701 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
704 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
705 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
709 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
710 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'').
'>';
711 if ($key ==
'status') {
712 print $object->getLibStatut(5);
713 } elseif ($key ==
'rowid') {
714 print $object->showOutputField($val, $key, $object->id,
'');
716 print $object->showOutputField($val, $key, $object->$key,
'');
720 $totalarray[
'nbfield']++;
722 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
724 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
726 if (!isset($totalarray[
'val'])) {
727 $totalarray[
'val'] = array();
729 if (!isset($totalarray[
'val'][
't.'.$key])) {
730 $totalarray[
'val'][
't.'.$key] = 0;
732 $totalarray[
'val'][
't.'.$key] += $object->$key;
737 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
739 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
740 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
741 print $hookmanager->resPrint;
746 print
'<td class="nowrap center">';
747 if ($massactionbutton || $massaction) {
749 if (in_array($object->id, $arrayofselected)) {
752 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
756 $totalarray[
'nbfield']++;
766 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
771 foreach ($arrayfields as $key => $val) {
772 if (!empty($val[
'checked'])) {
776 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
782 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
783 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
784 print $hookmanager->resPrint;
786 print
'</table>'.
"\n";
789 print
'</form>'.
"\n";
791 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
792 $hidegeneratedfilelistifempty = 1;
793 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
794 $hidegeneratedfilelistifempty = 0;
797 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
801 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
802 $urlsource .= str_replace(
'&',
'&', $param);
804 $filedir = $diroutputmassaction;
805 $genallowed = $permissiontoread;
806 $delallowed = $permissiontoadd;
808 print $formfile->showdocuments(
'massfilesarea_webhook',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);