28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
34 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
36 include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
39 $langs->loadLangs(array(
"ticket",
"companies",
"other",
"projects"));
42 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
43 $massaction =
GETPOST(
'massaction',
'alpha');
44 $show_files =
GETPOST(
'show_files',
'int');
45 $confirm =
GETPOST(
'confirm',
'alpha');
46 $cancel =
GETPOST(
'cancel',
'alpha');
47 $toselect =
GETPOST(
'toselect',
'array');
48 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'ticketlist';
49 $backtopage =
GETPOST(
'backtopage',
'alpha');
50 $optioncss =
GETPOST(
'optioncss',
'aZ');
53 $msg_id =
GETPOST(
'msg_id',
'int');
54 $socid =
GETPOST(
'socid',
'int');
55 $projectid =
GETPOST(
'projectid',
'int');
56 $project_ref =
GETPOST(
'project_ref',
'alpha');
57 $search_societe =
GETPOST(
'search_societe',
'alpha');
58 $search_fk_project =
GETPOST(
'search_fk_project',
'int') ?
GETPOST(
'search_fk_project',
'int') :
GETPOST(
'projectid',
'int');
59 $search_fk_status =
GETPOST(
'search_fk_statut',
'array');
60 $search_date_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_date_startmonth',
'int'),
GETPOST(
'search_date_startday',
'int'),
GETPOST(
'search_date_startyear',
'int'));
61 $search_date_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_date_endmonth',
'int'),
GETPOST(
'search_date_endday',
'int'),
GETPOST(
'search_date_endyear',
'int'));
62 $search_dateread_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_dateread_startmonth',
'int'),
GETPOST(
'search_dateread_startday',
'int'),
GETPOST(
'search_dateread_startyear',
'int'));
63 $search_dateread_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_dateread_endmonth',
'int'),
GETPOST(
'search_dateread_endday',
'int'),
GETPOST(
'search_dateread_endyear',
'int'));
64 $search_dateclose_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_dateclose_startmonth',
'int'),
GETPOST(
'search_dateclose_startday',
'int'),
GETPOST(
'search_dateclose_startyear',
'int'));
65 $search_dateclose_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_dateclose_endmonth',
'int'),
GETPOST(
'search_dateclose_endday',
'int'),
GETPOST(
'search_dateclose_endyear',
'int'));
68 $mode =
GETPOST(
'mode',
'alpha');
71 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
72 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
73 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
75 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) { $page = 0; }
76 $offset = $limit * $page;
77 $pageprev = $page - 1;
78 $pagenext = $page + 1;
83 $diroutputmassaction = $conf->ticket->dir_output.
'/temp/massgeneration/'.$user->id;
84 if ($socid > 0) $hookmanager->initHooks(array(
'thirdpartyticket'));
85 elseif ($projectid > 0) $hookmanager->initHooks(array('projectticket'));
86 else $hookmanager->initHooks(array('ticketlist'));
88 $extrafields->fetch_name_optionals_label($object->table_element);
89 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
92 if (!$sortfield) $sortfield = "t.datec";
93 if (!$sortorder) $sortorder = "DESC";
95 if (
GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][] = 'openall';
100 foreach ($object->
fields as $key => $val)
102 if (
GETPOST(
'search_'.$key,
'alpha')) $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
106 $fieldstosearchall = array();
107 foreach ($object->fields as $key => $val)
109 if ($val[
'searchall']) $fieldstosearchall[
't.'.$key] = $val[
'label'];
111 $fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
112 $fieldstosearchall[
's.zip'] =
"Zip";
113 $fieldstosearchall[
's.town'] =
"Town";
116 $arrayfields = array();
117 foreach ($object->fields as $key => $val)
120 if (!empty($val[
'visible'])) $arrayfields[
't.'.$key] = array(
'label'=>$val[
'label'],
'checked'=>(($val[
'visible'] < 0) ? 0 : 1),
'enabled'=>$val[
'enabled'],
'position'=>$val[
'position']);
123 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
132 if (!$user->rights->ticket->read) {
141 $tmpproject =
new Project($db);
142 $tmpproject->fetch(0, $project_ref);
143 $projectid = $tmpproject->id;
144 $search_fk_project = $projectid;
147 $permissiontoread = $user->rights->ticket->read;
148 $permissiontoadd = $user->rights->ticket->write;
149 $permissiontodelete = $user->rights->ticket->delete;
158 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
159 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') { $massaction =
''; }
161 $parameters = array();
162 if ($socid > 0) $parameters[
'socid'] = $socid;
163 if ($projectid > 0) $parameters[
'projectid'] = $projectid;
164 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
165 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
170 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
173 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
175 foreach ($object->fields as $key => $val)
180 $search_array_options = array();
181 $search_date_start =
'';
182 $search_date_end =
'';
183 $search_dateread_start =
'';
184 $search_dateread_end =
'';
185 $search_dateclose_start =
'';
186 $search_dateclose_end =
'';
188 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
189 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha'))
195 $objectclass =
'Ticket';
196 $objectlabel =
'Ticket';
197 $uploaddir = $conf->ticket->dir_output;
198 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
201 if (!$error && $massaction ==
'close' && $permissiontoadd)
203 $objecttmp =
new $objectclass($db);
209 foreach ($toselect as $toselectid)
211 $result = $objecttmp->fetch($toselectid);
214 $result = $objecttmp->close($user);
230 if ($nbok > 1)
setEventMessages($langs->trans(
"RecordsModified", $nbok), null,
'mesgs');
231 else setEventMessages($langs->trans(
"RecordsModified", $nbok), null,
'mesgs');
241 if (!$error && $massaction ==
'reopen' && $permissiontoadd)
243 $objecttmp =
new $objectclass($db);
249 foreach ($toselect as $toselectid)
251 $result = $objecttmp->fetch($toselectid);
254 if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
255 $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED);
263 $langs->load(
"errors");
264 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null,
'errors');
277 if ($nbok > 1)
setEventMessages($langs->trans(
"RecordsModified", $nbok), null,
'mesgs');
278 else setEventMessages($langs->trans(
"RecordsModified", $nbok), null,
'mesgs');
294 $form =
new Form($db);
299 $user_assign =
new User($db);
300 $user_create =
new User($db);
304 $title = $langs->trans(
'TicketList');
310 foreach ($object->fields as $key => $val)
312 $sql .=
't.'.$key.
', ';
315 if (!empty($extrafields->attributes[$object->table_element][
'label']))
316 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
"ef.".$key.
' as options_'.$key.
', ' :
'');
318 $parameters = array();
319 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
320 $sql .= $hookmanager->resPrint;
321 $sql = preg_replace(
'/, $/',
'', $sql);
322 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
323 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
324 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON (t.fk_soc = s.rowid)";
325 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
328 $sql .=
" AND t.fk_soc = ".$socid;
331 foreach ($search as $key => $val)
333 if ($key ==
'fk_statut' && !empty($search[
'fk_statut']))
335 $newarrayofstatus = array();
336 foreach ($search[
'fk_statut'] as $key2 => $val2) {
337 if (in_array($val2, array(
'openall',
'closeall')))
continue;
338 $newarrayofstatus[] = $val2;
340 if ($search[
'fk_statut'] ==
'openall' || in_array(
'openall', $search[
'fk_statut'])) {
342 $newarrayofstatus[] = Ticket::STATUS_READ;
343 $newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
344 $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
345 $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
346 $newarrayofstatus[] = Ticket::STATUS_WAITING;
348 if ($search[
'fk_statut'] ==
'closeall' || in_array(
'closeall', $search[
'fk_statut'])) {
349 $newarrayofstatus[] = Ticket::STATUS_CLOSED;
350 $newarrayofstatus[] = Ticket::STATUS_CANCELED;
352 if (count($newarrayofstatus)) $sql .=
natural_search($key, join(
',', $newarrayofstatus), 2);
355 if ($key ==
'fk_user_assign' || $key ==
'fk_user_create' || $key ==
'fk_project')
357 if ($search[$key] > 0) $sql .=
natural_search($key, $search[$key], 2);
360 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
361 if ($search[$key] !=
'') $sql .=
natural_search($key, $search[$key], $mode_search);
363 if ($search_all) $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
364 if ($search_societe) $sql .=
natural_search(
's.nom', $search_societe);
365 if ($search_fk_project > 0) $sql .=
natural_search(
'fk_project', $search_fk_project, 2);
366 if ($search_date_start) $sql .=
" AND t.datec >= '".$db->idate($search_date_start).
"'";
367 if ($search_date_end) $sql .=
" AND t.datec <= '".$db->idate($search_date_end).
"'";
368 if ($search_dateread_start) $sql .=
" AND t.date_read >= '".$db->idate($search_dateread_start).
"'";
369 if ($search_dateread_end) $sql .=
" AND t.date_read <= '".$db->idate($search_dateread_end).
"'";
370 if ($search_dateclose_start) $sql .=
" AND t.date_close >= '".$db->idate($search_dateclose_start).
"'";
371 if ($search_dateclose_end) $sql .=
" AND t.date_close <= '".$db->idate($search_dateclose_end).
"'";
374 if (!$user->socid && ($mode ==
"mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
375 $sql .=
" AND (t.fk_user_assign = ".$user->id;
376 if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .=
" OR t.fk_user_create = ".$user->id;
381 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
383 $parameters = array();
384 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
385 $sql .= $hookmanager->resPrint;
387 $sql .= $db->order($sortfield, $sortorder);
390 $nbtotalofrecords =
'';
391 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
393 $resql = $db->query($sql);
394 $nbtotalofrecords = $db->num_rows(
$resql);
395 if (($page * $limit) > $nbtotalofrecords)
402 if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
404 $num = $nbtotalofrecords;
406 $sql .= $db->plimit($limit + 1, $offset);
408 $resql = $db->query($sql);
415 $num = $db->num_rows(
$resql);
419 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
421 $obj = $db->fetch_object(
$resql);
423 header(
"Location: ".DOL_URL_ROOT.
'/ticket/card.php?id='.$id);
431 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'classforhorizontalscrolloftabs');
434 if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
436 $res = $socstat->fetch($socid);
438 $tmpobject = $object;
441 $object = $tmpobject;
445 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
447 print '<div class="fichecenter">';
449 print '<div class="underbanner clearboth"></div>';
450 print '<table class="border centpercent tableforfield">';
453 if ($socstat->client && !empty($socstat->code_client)) {
454 print '<tr><td class="titlefield">';
455 print $langs->trans(
'CustomerCode').
'</td><td>';
456 print $socstat->code_client;
457 $tmpcheck = $socstat->check_codeclient();
458 if ($tmpcheck != 0 && $tmpcheck != -5) {
459 print ' <font class="error">('.$langs->trans(
"WrongCustomerCode").
')</font>';
465 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
466 print '<tr><td class="titlefield">';
467 print $langs->trans(
'SupplierCode').
'</td><td>';
468 print $socstat->code_fournisseur;
469 $tmpcheck = $socstat->check_codefournisseur();
470 if ($tmpcheck != 0 && $tmpcheck != -5) {
471 print ' <font class="error">('.$langs->trans(
"WrongSupplierCode").
')</font>';
483 if ($projectid > 0 || $project_ref) {
484 $projectstat =
new Project($db);
485 if ($projectstat->fetch($projectid, $project_ref) > 0) {
486 $projectid = $projectstat->id;
487 $projectstat->fetch_thirdparty();
489 $savobject = $object;
490 $object = $projectstat;
494 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
499 print dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), -1, ($projectstat->public ?
'projectpub' :
'project'));
503 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
505 $morehtmlref =
'<div class="refidno">';
507 $morehtmlref .= $object->title;
509 if ($object->thirdparty->id > 0)
511 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'project');
513 $morehtmlref .=
'</div>';
516 if (!$user->rights->projet->all->lire)
518 $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
519 $object->next_prev_filter =
" rowid in (".(count($objectsListId) ?join(
',', array_keys($objectsListId)) :
'0').
")";
522 dol_banner_tab($object,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
524 print '<div class="fichecenter">';
525 print '<div class="underbanner clearboth"></div>';
527 print '<table class="border tableforfield" width="100%">';
530 print '<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
531 if ($projectstat->public) {
532 print $langs->trans(
'SharedProject');
534 print $langs->trans(
'PrivateProject');
543 $object = $savobject;
545 print "ErrorRecordNotFound";
549 $arrayofselected = is_array($toselect) ? $toselect : array();
552 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
553 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
554 foreach ($search as $key => $val)
556 if (is_array($search[$key]) && count($search[$key]))
foreach ($search[$key] as $skey) $param .=
'&search_'.$key.
'[]='.urlencode($skey);
557 else $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
559 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
561 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
562 if ($socid) $param .=
'&socid='.urlencode($socid);
563 if ($projectid) $param .=
'&projectid='.urlencode($projectid);
565 if ($search_date_start) $param .=
'&search_date_start='.urlencode($search_date_start);
566 if ($search_date_end) $param .=
'&search_date_end='.urlencode($search_date_end);
567 if ($search_dateread_start) $param .=
'&search_dateread_start='.urlencode($search_dateread_start);
568 if ($search_dateread_end) $param .=
'&search_dateread_end='.urlencode($search_dateread_end);
569 if ($search_dateclose_start) $param .=
'&search_dateclose_start='.urlencode($search_dateclose_start);
570 if ($search_dateclose_end) $param .=
'&search_dateclose_end='.urlencode($search_dateclose_end);
573 $arrayofmassactions = array(
577 if ($user->rights->ticket->write) $arrayofmassactions[
'close'] = $langs->trans(
"Close");
578 if ($user->rights->ticket->write) $arrayofmassactions[
'reopen'] = $langs->trans(
"ReOpen");
579 if ($user->rights->ticket->delete) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
580 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) $arrayofmassactions = array();
581 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
583 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
584 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
585 print '<input type="hidden" name="token" value="'.newToken().
'">';
586 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
587 print '<input type="hidden" name="action" value="list">';
588 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
589 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
590 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
591 print '<input type="hidden" name="mode" value="'.$mode.
'" >';
592 if ($socid)
print '<input type="hidden" name="socid" value="'.$socid.
'" >';
593 if ($projectid)
print '<input type="hidden" name="projectid" value="'.$projectid.
'" >';
595 $url = DOL_URL_ROOT.
'/ticket/card.php?action=create'.($socid ?
'&socid='.$socid :
'').($projectid ?
'&origin=projet_project&originid='.$projectid :
'');
596 if (!empty($socid)) $url .=
'&socid='.$socid;
597 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewTicket'),
'',
'fa fa-plus-circle', $url,
'', $user->rights->ticket->write);
600 if ($socid > 0) $picto =
'';
602 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
604 if ($mode ==
'mine') {
605 print '<div class="opacitymedium">'.$langs->trans(
'TicketAssignedToMeInfos').
'</div><br>';
608 $topicmail =
"SendTicketRef";
609 $modelmail =
"ticket";
610 $objecttmp =
new Ticket($db);
611 $trackid =
'tic'.$object->id;
612 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
616 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
617 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
625 $parameters = array();
626 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
627 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
628 else $moreforfilter = $hookmanager->resPrint;
630 if (!empty($moreforfilter))
632 print '<div class="liste_titre liste_titre_bydiv centpercent">';
633 print $moreforfilter;
637 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
638 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
639 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
641 print '<div class="div-table-responsive">';
642 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
647 print '<tr class="liste_titre">';
648 foreach ($object->fields as $key => $val)
650 $cssforfield = (empty($val[
'css']) ?
'' : $val[
'css']);
651 if ($key ==
'fk_statut') $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
652 elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
653 elseif (in_array($val['
type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
654 elseif (in_array($val['type'], array('
double(24,8)', '
double(6,3)', 'integer', 'real', '
price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
655 if (!empty($arrayfields['t.'.$key]['checked'])) {
656 if ($key ==
'type_code') {
657 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
658 $formTicket->selectTypesTickets(
dol_escape_htmltag($search[$key]),
'search_'.$key.
'',
'', 2, 1, 1, 0, ($val[
'css'] ? $val[
'css'] :
'maxwidth150'));
660 } elseif ($key ==
'category_code') {
661 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
662 $formTicket->selectGroupTickets(
dol_escape_htmltag($search[$key]),
'search_'.$key.
'',
'', 2, 1, 1, 0, ($val[
'css'] ? $val[
'css'] :
'maxwidth150'));
664 } elseif ($key ==
'severity_code') {
665 print
'<td class="liste_titre center'.($cssforfield ?
' '.$cssforfield :
'').
'">';
666 $formTicket->selectSeveritiesTickets(
dol_escape_htmltag($search[$key]),
'search_'.$key.
'',
'', 2, 1, 1, 0, ($val[
'css'] ? $val[
'css'] :
'maxwidth150'));
668 } elseif ($key ==
'fk_user_assign' || $key ==
'fk_user_create') {
669 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
670 print $form->select_dolusers($search[$key],
'search_'.$key, 1, null, 0,
'',
'',
'0', 0, 0,
'', 0,
'', ($val[
'css'] ? $val[
'css'] :
'maxwidth125'));
672 } elseif ($key ==
'fk_statut') {
673 $arrayofstatus = array();
674 $arrayofstatus[
'openall'] =
'-- '.$langs->trans(
'OpenAll').
' --';
675 foreach ($object->statuts_short as $key2 => $val2)
677 if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus[
'closeall'] =
'-- '.$langs->trans(
'ClosedAll').
' --';
678 $arrayofstatus[$key2] = $val2;
680 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
682 $selectedarray = null;
683 if ($search[$key]) $selectedarray = array_values($search[$key]);
684 print
Form::multiselectarray(
'search_fk_statut', $arrayofstatus, $selectedarray, 0, 0,
'minwidth100 maxwidth150', 1, 0,
'',
'',
'');
686 } elseif ($key ==
"fk_soc") {
687 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.
dol_escape_htmltag($search_societe).
'"></td>';
688 } elseif ($key ==
"datec" || $key ==
'date_read' || $key ==
'date_close'){
689 print
'<td class="liste_titre center">';
690 print
'<div class="nowrap">';
693 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
696 print $form->selectDate($search_dateread_start ?: -1,
'search_dateread_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
699 print $form->selectDate($search_dateclose_start ?: -1,
'search_dateclose_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
702 print
'<div class="nowrap">';
705 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
708 print $form->selectDate($search_dateread_end ?: -1,
'search_dateread_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
711 print $form->selectDate($search_dateclose_end ?: -1,
'search_dateclose_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
717 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
718 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $search[$key], $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
719 elseif (strpos($val[
'type'],
'integer:') === 0) {
720 print $object->showInputField($val, $key, $search[$key],
'',
'',
'search_',
'maxwidth150', 1);
721 } elseif (!preg_match(
'/^(date|timestamp)/', $val[
'type'])) print '<input type="text" class="flat maxwidth75"
name="search_'.$key.'" value="'.
dol_escape_htmltag($search[$key]).'">';
727 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
730 $parameters = array('arrayfields'=>$arrayfields);
731 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object);
732 print $hookmanager->resPrint;
734 print '<td class="liste_titre maxwidthsearch">';
735 $searchpicto = $form->showFilterButtons();
743 print '<tr class="liste_titre">';
744 foreach ($object->
fields as $key => $val)
746 $cssforfield = (empty($val[
'css']) ?
'' : $val[
'css']);
747 if ($key ==
'fk_statut' || $key ==
'severity_code') $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
748 elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
749 elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
750 elseif (in_array($val['type'], array('
double(24,8)', '
double(6,3)', 'integer', 'real', '
price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
751 if (!empty($arrayfields['t.'.$key]['checked']))
753 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0,
$_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param,
'', $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
757 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
759 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
760 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
761 print $hookmanager->resPrint;
762 print
getTitleFieldOfList($selectedfields, 0,
$_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'maxwidthsearch center ').
"\n";
767 $needToFetchEachLine = 0;
768 if (is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0)
770 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val)
772 if (preg_match(
'/\$object/', $val)) $needToFetchEachLine++;
780 $totalarray = array();
781 $cacheofoutputfield = array();
782 while ($i < min($num, $limit))
784 $obj = $db->fetch_object(
$resql);
785 if (empty($obj))
break;
788 $object->id = $obj->rowid;
789 foreach ($object->fields as $key => $val)
791 if (property_exists($obj, $key)) $object->$key = $obj->$key;
793 $langs->load(
"ticket");
796 print
'<tr class="oddeven">';
797 foreach ($object->fields as $key => $val)
800 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
801 if (in_array($val[
'type'], array(
'timestamp'))) $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
802 if (in_array($key, array(
'ref',
'fk_project'))) $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
803 if ($key ==
'fk_statut' || $key ==
'severity_code') $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
804 if (!empty($arrayfields[
't.'.$key][
'checked']))
807 if ($cssforfield || $val[
'css']) print
' class="';
809 if ($cssforfield && $val[
'css']) print
' ';
811 if ($cssforfield || $val[
'css']) print
'"';
813 if ($key ==
'fk_statut') print $object->getLibStatut(5);
814 elseif ($key ==
'subject') {
816 print
'<span title="'.$s.
'">';
820 elseif ($key ==
'type_code') {
821 $s = $langs->getLabelFromKey($db,
'TicketTypeShort'.$object->type_code,
'c_ticket_type',
'code',
'label', $object->type_code);
822 print
'<span title="'.$s.
'">';
826 elseif ($key ==
'category_code') {
827 $s = $langs->getLabelFromKey($db,
'TicketCategoryShort'.$object->category_code,
'c_ticket_category',
'code',
'label', $object->category_code);
828 print
'<span title="'.$s.
'">';
832 elseif ($key ==
'severity_code') {
833 $s = $langs->getLabelFromKey($db,
'TicketSeverityShort'.$object->severity_code,
'c_ticket_severity',
'code',
'label', $object->severity_code);
834 print
'<span title="'.$s.
'">';
838 elseif ($key ==
'tms') print
dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
839 elseif ($key == 'fk_user_create') {
840 if ($object->fk_user_create > 0) {
841 $user_create->fetch($object->fk_user_create);
842 print $user_create->getNomUrl(-1);
844 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
846 $tmp = explode(
':', $val[
'type']);
847 if ($tmp[0] ==
'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
850 if ($key && $obj->$key && $val[
'type'] && array_key_exists($key.
'-'.$obj->$key.
'-'.$val[
'type'], $cacheofoutputfield)) {
851 $result = $cacheofoutputfield[$key.
'-'.$obj->$key.
'-'.$val[
'type']];
853 $result = $object->showOutputField($val, $key, $obj->$key,
'');
854 $cacheofoutputfield[$key.
'-'.$obj->$key.
'-'.$val[
'type']] = $result;
857 $result = $object->showOutputField($val, $key, $obj->$key,
'');
863 if (!$i) $totalarray[
'nbfield']++;
864 if (!empty($val[
'isameasure']))
866 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
867 $totalarray[
'val'][
't.'.$key] += $obj->$key;
872 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
874 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
875 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
876 print $hookmanager->resPrint;
878 print
'<td class="nowrap center">';
879 if ($massactionbutton || $massaction)
882 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
883 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
886 if (!$i) $totalarray[
'nbfield']++;
894 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
901 foreach ($arrayfields as $key => $val) {
if (!empty($val[
'checked'])) $colspan++; }
902 print
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
908 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
909 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
910 print $hookmanager->resPrint;
912 print
'</table>'.
"\n";
915 print
'</form>'.
"\n";
919 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords))
921 $hidegeneratedfilelistifempty = 1;
922 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
924 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
928 $urlsource =
$_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
929 $urlsource .= str_replace(
'&',
'&', $param);
931 $filedir = $diroutputmassaction;
932 $genallowed = $user->rights->ticket->read;
933 $delallowed = $user->rights->ticket->write;
935 print $formfile->showdocuments(
'massfilesarea_ticket',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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.
foreach($object->fields as $key=> $val) if(is_array($extrafields->attributes[$object->table_element]['label'])&&count($extrafields->attributes[$object->table_element]['label']) > 0) $object fields
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
print $_SERVER["PHP_SELF"] n
Edit parameters.
const STATUS_NOT_READ
Status.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...