33require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/ticket/class/actions_ticket.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formticket.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
46include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
47include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
48include_once DOL_DOCUMENT_ROOT.
'/core/lib/project.lib.php';
51$langs->loadLangs(array(
"ticket",
"companies",
"other",
"projects",
"contracts"));
54$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
55$massaction =
GETPOST(
'massaction',
'alpha');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$cancel =
GETPOST(
'cancel',
'alpha');
59$toselect =
GETPOST(
'toselect',
'array:int');
60$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'ticketlist';
61$backtopage =
GETPOST(
'backtopage',
'alpha');
62$optioncss =
GETPOST(
'optioncss',
'aZ');
63$mode =
GETPOST(
'mode',
'alpha');
69$project_ref =
GETPOST(
'project_ref',
'alpha');
70$search_societe =
GETPOST(
'search_societe',
'alpha');
71$search_alias =
GETPOST(
'search_alias',
'alpha');
85$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
86$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
88if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
92$offset = $limit * $page;
99$diroutputmassaction =
$conf->ticket->dir_output.
'/temp/massgeneration/'.$user->id;
101 $hookmanager->initHooks(array(
'thirdpartyticket',
'globalcard'));
102} elseif ($projectid > 0) {
103 $hookmanager->initHooks(array(
'projectticket',
'globalcard'));
105 $hookmanager->initHooks(array(
'ticketlist'));
108$extrafields->fetch_name_optionals_label(
$object->table_element);
109$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
113 $sortfield =
"t.datec";
124$search_all = trim(
GETPOST(
"search_all",
'alphanohtml'));
126foreach (
$object->fields as $key => $val) {
128 $search[$key] =
GETPOST(
'search_'.$key,
'array:alpha');
129 } elseif (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
130 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
134 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
141$fieldstosearchall = array();
142foreach (
$object->fields as $key => $val) {
143 if (!empty($val[
'searchall'])) {
144 $fieldstosearchall[
't.'.$key] = $val[
'label'];
147$fieldstosearchall[
's.name_alias'] =
"AliasNameShort";
148$fieldstosearchall[
's.zip'] =
"Zip";
149$fieldstosearchall[
's.town'] =
"Town";
152$arrayfields = array();
153foreach (
$object->fields as $key => $val) {
155 if (!empty($val[
'visible'])) {
156 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
157 $arrayfields[
't.'.$key] = array(
158 'label' => $val[
'label'],
159 'checked' => (($visible < 0) ?
'0' :
'1'),
160 'enabled' => (string) (int) (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
161 'position' => $val[
'position'],
162 'help' => isset($val[
'help']) ? $val[
'help'] :
''
167$arrayfields[
's.name_alias'] = array(
'label' =>
'AliasNameShort',
'checked' =>
'0',
'enabled' => (
string) (
int)
isModEnabled(
'societe'),
'position' => 51);
169include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
171$parameters = array(
'arrayfields' => &$arrayfields);
172$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
179if (!$user->hasRight(
'ticket',
'read')) {
183if ($user->socid > 0) {
184 $socid = $user->socid;
188$url_page_current = DOL_URL_ROOT.
'/ticket/list.php';
191 $tmpproject =
new Project($db);
192 $tmpproject->fetch(0, $project_ref);
193 $projectid = $tmpproject->id;
194 $search_fk_project = $projectid;
197$permissiontoread = $user->hasRight(
'ticket',
'read');
198$permissiontoadd = $user->hasRight(
'ticket',
'write');
199$permissiontodelete = $user->hasRight(
'ticket',
'delete');
208if (
GETPOST(
'cancel',
'alpha')) {
212if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'presendonclose' && $massaction !=
'close') {
216$parameters = array(
'arrayfields' => &$arrayfields);
218 $parameters[
'socid'] = $socid;
221 $parameters[
'projectid'] = $projectid;
223$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
225 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
228if (empty($reshook)) {
230 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
233 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
234 foreach (
$object->fields as $key => $val) {
236 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
237 $search[$key.
'_dtstart'] =
'';
238 $search[$key.
'_dtend'] =
'';
242 $search_array_options = array();
243 $search_societe =
'';
245 $search_date_start =
'';
246 $search_date_end =
'';
247 $search_dateread_start =
'';
248 $search_dateread_end =
'';
249 $search_dateclose_start =
'';
250 $search_dateclose_end =
'';
252 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
253 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
258 $objectclass =
'Ticket';
259 $objectlabel =
'Ticket';
260 $uploaddir =
$conf->ticket->dir_output;
262 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
265 if (!$error && $massaction ==
'close' && $permissiontoadd) {
266 $objecttmp =
new Ticket($db);
270 foreach ($toselect as $toselectid) {
271 $result = $objecttmp->fetch($toselectid);
273 $result = $objecttmp->close($user);
275 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
282 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
289 setEventMessages($langs->trans(
"RecordsModified", $nbok),
null,
'mesgs');
298 if (!$error && $massaction ==
'reopen' && $permissiontoadd) {
299 $objecttmp =
new Ticket($db);
303 foreach ($toselect as $toselectid) {
304 $result = $objecttmp->fetch($toselectid);
306 if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
308 $result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED,
null,
'',
'TICKET_MODIFY');
311 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
318 $langs->load(
"errors");
319 setEventMessages($langs->trans(
"ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref),
null,
'errors');
324 setEventMessages($objecttmp->error, $objecttmp->errors,
'errors');
331 setEventMessages($langs->trans(
"RecordsModified", $nbok),
null,
'mesgs');
346$form =
new Form($db);
351$user_temp =
new User($db);
358 $socstatic->fetch($socid);
359 $moretitle = $langs->trans(
"ThirdParty") .
' - ';
360 if (
getDolGlobalString(
'MAIN_HTML_TITLE') && preg_match(
'/thirdpartynameonly/',
$conf->global->MAIN_HTML_TITLE) && $socstatic->name) {
361 $moretitle = $socstatic->name .
' - ';
365$title = $moretitle . $langs->trans(
'Tickets');
373$sql .=
$object->getFieldList(
't');
374$sql .=
", s.name_alias as thirdparty_alias";
376if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
377 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
378 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
382$parameters = array();
383$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
384$sql .= $hookmanager->resPrint;
385$sql = preg_replace(
'/,\s*$/',
'', $sql);
389$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
390if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
391 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
394$parameters = array();
395$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
396$sql .= $hookmanager->resPrint;
397$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON (t.fk_soc = s.rowid)";
398$sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
400 $sql .=
" AND t.fk_soc = ".((int) $socid);
403foreach ($search as $key => $val) {
404 $tmpkey =
't.' . $key;
405 if ($key ==
'fk_statut' && !empty($search[
'fk_statut'])) {
406 $newarrayofstatus = array();
407 if (is_array($search[
'fk_statut'])) {
408 foreach ($search[
'fk_statut'] as $key2 => $val2) {
409 if (in_array($val2, array(
'openall',
'closeall'))) {
412 $newarrayofstatus[] = $val2;
415 if ($search[
'fk_statut'] ===
'openall' || (is_array($search[
'fk_statut']) && in_array(
'openall', $search[
'fk_statut']))) {
417 $newarrayofstatus[] = Ticket::STATUS_READ;
418 $newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
419 $newarrayofstatus[] = Ticket::STATUS_IN_PROGRESS;
420 $newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
421 $newarrayofstatus[] = Ticket::STATUS_WAITING;
423 if ($search[
'fk_statut'] ===
'closeall' || (is_array($search[
'fk_statut']) && in_array(
'closeall', $search[
'fk_statut']))) {
424 $newarrayofstatus[] = Ticket::STATUS_CLOSED;
425 $newarrayofstatus[] = Ticket::STATUS_CANCELED;
427 if (count($newarrayofstatus)) {
428 $sql .=
natural_search($tmpkey, implode(
',', $newarrayofstatus), 2);
431 } elseif ($key ==
'fk_user_assign' || $key ==
'fk_user_create' || $key ==
'fk_project' || $key ==
'fk_contract') {
432 if ($search[$key] > 0) {
436 } elseif ($key ==
'type_code') {
437 $newarrayoftypecodes = is_array($search[$key]) ? $search[$key] : (!empty($search[$key]) ? explode(
',', $search[$key]) : array());
438 if (count($newarrayoftypecodes)) {
439 $sql .=
natural_search($tmpkey, implode(
',', $newarrayoftypecodes), 3);
446 if ((is_array($search[$key]) && !empty($search[$key])) || (!is_array($search[$key]) && $search[$key] !=
'')) {
451 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
453if ($search_societe) {
459if ($search_fk_project > 0) {
460 $sql .=
natural_search(
't.fk_project', (
string) $search_fk_project, 2);
462if ($search_fk_contract > 0) {
463 $sql .=
natural_search(
't.fk_contract', (
string) $search_fk_contract, 2);
465if ($search_date_start) {
466 $sql .=
" AND t.datec >= '".$db->idate($search_date_start).
"'";
468if ($search_date_end) {
469 $sql .=
" AND t.datec <= '".$db->idate($search_date_end).
"'";
471if ($search_dateread_start) {
472 $sql .=
" AND t.date_read >= '".$db->idate($search_dateread_start).
"'";
474if ($search_dateread_end) {
475 $sql .=
" AND t.date_read <= '".$db->idate($search_dateread_end).
"'";
477if ($search_dateclose_start) {
478 $sql .=
" AND t.date_close >= '".$db->idate($search_dateclose_start).
"'";
480if ($search_dateclose_end) {
481 $sql .=
" AND t.date_close <= '".$db->idate($search_dateclose_end).
"'";
484if (!$user->socid && ($mode ==
"mine" || (!$user->admin &&
getDolGlobalString(
'TICKET_LIMIT_VIEW_ASSIGNED_ONLY')))) {
485 $sql .=
" AND (t.fk_user_assign = ".((int) $user->id);
487 $sql .=
" OR t.fk_user_create = ".((int) $user->id);
493include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
495$parameters = array();
496$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
497$sql .= $hookmanager->resPrint;
500$nbtotalofrecords =
'';
503 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
504 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
505 $resql = $db->query($sqlforcount);
507 $objforcount = $db->fetch_object($resql);
508 $nbtotalofrecords = $objforcount->nbtotalofrecords;
510 dol_print_error($db);
513 if (($page * $limit) > (
int) $nbtotalofrecords) {
521$sql .= $db->order($sortfield, $sortorder);
523 $sql .= $db->plimit($limit + 1, $offset);
526$resql = $db->query($sql);
528 dol_print_error($db);
532$num = $db->num_rows($resql);
535if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
536 $obj = $db->fetch_object($resql);
538 header(
"Location: ".DOL_URL_ROOT.
'/ticket/card.php?id='.
$id);
546llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-ticket page-list bodyforlist');
548if ($socid && !$projectid && !$project_ref && $user->hasRight(
'societe',
'lire')) {
550 $res = $socstat->fetch($socid);
557 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"ThirdParty"), -1,
'company');
559 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
561 print
'<div class="fichecenter">';
563 print
'<div class="underbanner clearboth"></div>';
564 print
'<table class="border centpercent tableforfield">';
567 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
568 print $socstat->getTypeUrl(1);
572 if ($socstat->client && !empty($socstat->code_client)) {
573 print
'<tr><td class="titlefield">';
574 print $langs->trans(
'CustomerCode').
'</td><td>';
576 $tmpcheck = $socstat->check_codeclient();
577 if ($tmpcheck != 0 && $tmpcheck != -5) {
578 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
584 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
585 print
'<tr><td class="titlefield">';
586 print $langs->trans(
'SupplierCode').
'</td><td>';
588 $tmpcheck = $socstat->check_codefournisseur();
589 if ($tmpcheck != 0 && $tmpcheck != -5) {
590 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
604if ($projectid > 0 || $project_ref) {
605 $projectstat =
new Project($db);
606 if ($projectstat->fetch($projectid, $project_ref) > 0) {
607 $projectid = $projectstat->id;
608 $projectstat->fetch_thirdparty();
615 $userWrite = $projectstat->restrictedProjectArea($user,
'write');
620 print
dol_get_fiche_head($head,
'ticket', $langs->trans(
"Project"), -1, ($projectstat->public ?
'projectpub' :
'project'));
624 $linkback =
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
626 $morehtmlref =
'<div class="refidno">';
628 $morehtmlref .=
$object->title;
630 if (!empty(
$object->thirdparty->id) &&
$object->thirdparty->id > 0) {
631 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1,
'project');
633 $morehtmlref .=
'</div>';
636 if (!$user->hasRight(
'projet',
'all',
'lire')) {
637 $objectsListId =
$object->getProjectsAuthorizedForUser($user, 0, 0);
638 $object->next_prev_filter =
"rowid:IN:".$db->sanitize(count($objectsListId) ? implode(
',', array_keys($objectsListId)) :
'0');
641 dol_banner_tab($object,
'project_ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
643 print
'<div class="fichecenter">';
644 print
'<div class="underbanner clearboth"></div>';
646 print
'<table class="border tableforfield centpercent">';
649 print
'<tr><td class="titlefield">'.$langs->trans(
"Visibility").
'</td><td>';
650 if ($projectstat->public) {
651 print img_picto($langs->trans(
'SharedProject'),
'world',
'class="paddingrightonly"');
652 print $langs->trans(
'SharedProject');
654 print img_picto($langs->trans(
'PrivateProject'),
'private',
'class="paddingrightonly"');
655 print $langs->trans(
'PrivateProject');
668 print
"ErrorRecordNotFound";
672$arrayofselected = is_array($toselect) ? $toselect : array();
676 $param .=
'&mode='.urlencode($mode);
678if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
679 $param .=
'&contextpage='.urlencode($contextpage);
681if ($limit > 0 && $limit !=
$conf->liste_limit) {
682 $param .=
'&limit='.((int) $limit);
684if ($optioncss !=
'') {
685 $param .=
'&optioncss='.urlencode($optioncss);
687foreach ($search as $key => $val) {
688 if (is_array($search[$key])) {
689 foreach ($search[$key] as $skey) {
691 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
694 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
695 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
696 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
697 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
698 } elseif ($search[$key] !=
'') {
699 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
703include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
705$parameters = array(
'param' => &$param);
706$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
707$param .= $hookmanager->resPrint;
709 $param .=
'&socid='.urlencode((
string) ($socid));
711if ($search_societe) {
712 $param .=
'&search_societe='.urlencode($search_societe);
715 $param .=
'&search_alias='.urlencode($search_alias);
718 $param .=
'&projectid='.urlencode((
string) ($projectid));
720if ($contractid > 0) {
721 $param .=
'&contractid='.urlencode((
string) ($contractid));
723if ($search_date_start) {
725 $param .=
'&search_date_startday='.((int) $tmparray[
'mday']);
726 $param .=
'&search_date_startmonth='.((int) $tmparray[
'mon']);
727 $param .=
'&search_date_startyear='.((int) $tmparray[
'year']);
729if ($search_date_end) {
731 $param .=
'&search_date_endday='.((int) $tmparray[
'mday']);
732 $param .=
'&search_date_endmonth='.((int) $tmparray[
'mon']);
733 $param .=
'&search_date_endyear='.((int) $tmparray[
'year']);
735if ($search_dateread_start) {
737 $param .=
'&search_dateread_startday='.((int) $tmparray[
'mday']);
738 $param .=
'&search_dateread_startmonth='.((int) $tmparray[
'mon']);
739 $param .=
'&search_dateread_startyear='.((int) $tmparray[
'year']);
741if ($search_dateread_end) {
743 $param .=
'&search_dateread_endday='.((int) $tmparray[
'mday']);
744 $param .=
'&search_dateread_endmonth='.((int) $tmparray[
'mon']);
745 $param .=
'&search_dateread_endyear='.((int) $tmparray[
'year']);
747if ($search_dateclose_start) {
749 $param .=
'&search_dateclose_startday='.((int) $tmparray[
'mday']);
750 $param .=
'&search_dateclose_startmonth='.((int) $tmparray[
'mon']);
751 $param .=
'&search_dateclose_startyear='.((int) $tmparray[
'year']);
753if ($search_dateclose_end) {
755 $param .=
'&search_date_endday='.((int) $tmparray[
'mday']);
756 $param .=
'&search_date_endmonth='.((int) $tmparray[
'mon']);
757 $param .=
'&search_date_endyear='.((int) $tmparray[
'year']);
760$arrayofmassactions = array(
764if ($permissiontoadd) {
765 $arrayofmassactions[
'presendonclose'] = img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Close");
766 $arrayofmassactions[
'reopen'] = img_picto(
'',
'folder-open',
'class="pictofixedwidth"').$langs->trans(
"ReOpen");
768if ($permissiontodelete) {
769 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
771if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
772 $arrayofmassactions = array();
774$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
776print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
777if ($optioncss !=
'') {
778 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
780print
'<input type="hidden" name="token" value="'.newToken().
'">';
781print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
782print
'<input type="hidden" name="action" value="list">';
783print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
784print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
785print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
786print
'<input type="hidden" name="page_y" value="">';
787print
'<input type="hidden" name="mode" value="'.$mode.
'" >';
790 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
793 print
'<input type="hidden" name="projectid" value="'.$projectid.
'" >';
796$url = DOL_URL_ROOT.
'/ticket/card.php?action=create&mode=init'.($socid ?
'&socid='.$socid :
'').($projectid ?
'&origin=projet_project&originid='.$projectid :
'');
798 $url .=
'&socid='.$socid;
801$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
802$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
803$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/ticket/stats/index.php?mode=statistics&objecttype=ticket@ticket'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
805$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewTicket'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'ticket',
'write'));
812print_barre_liste($langs->trans(
'Tickets'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
814if ($mode ==
'mine') {
815 print
'<div class="opacitymedium">'.$langs->trans(
'TicketAssignedToMeInfos').
'</div><br>';
818$topicmail =
"SendTicketRef";
819$modelmail =
"ticket";
820$objecttmp =
new Ticket($db);
821$trackid =
'tic'.$object->id;
822include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
825if ($massaction ==
'presendonclose') {
826 $hidden_form = array([
828 "name" =>
"massaction",
832 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassTicketClosingSendEmail"), $langs->trans(
"ConfirmMassTicketClosingSendEmailQuestion"),
'confirm_send_close', $hidden_form, $selectedchoice, 0, 200, 500, 1);
837 foreach ($fieldstosearchall as $key => $val) {
838 $fieldstosearchall[$key] = $langs->trans($val);
839 $setupstring .= $key.
"=".$val.
";";
841 print
'<!-- Search done like if TICKET_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
842 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
850$parameters = array();
851$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
852if (empty($reshook)) {
853 $moreforfilter .= $hookmanager->resPrint;
855 $moreforfilter = $hookmanager->resPrint;
858if (!empty($moreforfilter)) {
859 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
860 print $moreforfilter;
864$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
865$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
866$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
867$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
869print
'<div class="div-table-responsive">';
870print
'<div class="div-table-responsive-inside">';
871print
'<table class="tagtable noborder nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
876print
'<tr class="liste_titre_filter">';
878if (
$conf->main_checkbox_left_column) {
879 print
'<td class="liste_titre maxwidthsearch center">';
880 $searchpicto = $form->showFilterButtons(
'left');
884foreach (
$object->fields as $key => $val) {
885 $searchkey = empty($search[$key]) ?
'' : $search[$key];
886 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
887 if ($key ==
'fk_statut') {
888 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
889 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
890 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
891 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
892 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
893 } 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'])) {
894 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
896 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
897 if ($key ==
'progress') {
898 print
'<td class="liste_titre right'.($cssforfield ?
' '.$cssforfield :
'').
'">';
899 print
'<input type="text" class="flat maxwidth50" name="search_'.$key.
'" value="'.
dol_escape_htmltag(empty($search[$key]) ?
'' : $search[$key]).
'">';
901 } elseif ($key ==
'type_code') {
902 print
'<td class="liste_titre">';
903 $formTicket->selectTypesTickets(empty($search[$key]) ?
'' : $search[$key],
'search_'.$key,
'', 2, 1, 1, 0, (!empty($val[
'css']) ? $val[
'css'] :
'maxwidth150'), 1);
905 } elseif ($key ==
'category_code') {
906 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
907 $formTicket->selectGroupTickets(
dol_escape_htmltag(empty($search[$key]) ?
'' : $search[$key]),
'search_'.$key,
'', 2, 1, 1, 0, (!empty($val[
'css']) ? $val[
'css'] :
'maxwidth150'));
909 } elseif ($key ==
'severity_code') {
910 print
'<td class="liste_titre center'.($cssforfield ?
' '.$cssforfield :
'').
'">';
911 $formTicket->selectSeveritiesTickets(
dol_escape_htmltag(empty($search[$key]) ?
'' : $search[$key]),
'search_'.$key,
'', 2, 1, 1, 0, (!empty($val[
'css']) ? $val[
'css'] :
'maxwidth150'));
913 } elseif ($key ==
'fk_user_assign' || $key ==
'fk_user_create') {
914 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
915 print $form->select_dolusers((empty($search[$key]) ?
'' : $search[$key]),
'search_'.$key, 1, null, 0,
'',
'',
'0', 0, 0,
'', 0,
'', (!empty($val[
'css']) ? $val[
'css'] :
'maxwidth100'));
917 } elseif ($key ==
'fk_statut') {
918 $arrayofstatus = array();
919 $langs->load(
"ticket");
920 $arrayofstatus[
'openall'] = array(
'id' =>
'openall',
'labelhtml' =>
'<b>-- '.$langs->trans(
'OpenAll').
'</b>',
'label' =>
'-- '.$langs->trans(
'OpenAll'));
921 foreach (
$object->labelStatusShort as $key2 => $val2) {
922 if ($key2 == Ticket::STATUS_CLOSED) {
923 $arrayofstatus[
'closeall'] = array(
'id' =>
'closeall',
'labelhtml' =>
'<b>-- '.$langs->trans(
'ClosedAll').
'</b>',
'label' =>
'-- '.$langs->trans(
'ClosedAll'));
925 $arrayofstatus[$key2] = array(
'id' => $key2,
'labelhtml' => $val2,
'label' => $val2);
927 print
'<td class="liste_titre center parentonrightofpage'.($cssforfield ?
' '.$cssforfield :
'').
'">';
931 $selectedarray =
null;
932 if (!empty($search[$key])) {
933 if (is_array($search[$key])) {
934 $selectedarray = array_values($search[$key]);
936 $selectedarray = array($search[$key]);
939 print
Form::multiselectarray(
'search_fk_statut', $arrayofstatus, $selectedarray, 0, 0,
'search_status width150 onrightofpage', 1, 0,
'',
'',
'');
941 } elseif ($key ==
"fk_soc") {
942 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.
dol_escape_htmltag($search_societe).
'"></td>';
943 } elseif ($key ==
"datec" || $key ==
'date_read' || $key ==
'date_close') {
944 print
'<td class="liste_titre center">';
945 print
'<div class="nowrap">';
948 print $form->selectDate($search_date_start ?: -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
951 print $form->selectDate($search_dateread_start ?: -1,
'search_dateread_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
954 print $form->selectDate($search_dateclose_start ?: -1,
'search_dateclose_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"From"));
957 print
'<div class="nowrap">';
960 print $form->selectDate($search_date_end ?: -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
963 print $form->selectDate($search_dateread_end ?: -1,
'search_dateread_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
966 print $form->selectDate($search_dateclose_end ?: -1,
'search_dateclose_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
971 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
972 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
973 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], $search[$key], $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
974 } elseif (strpos($val[
'type'],
'integer:') === 0) {
975 print
$object->showInputField($val, $key, !empty($search[$key]) ? $search[$key] :
"",
'',
'',
'search_',
'maxwidth150', 1);
976 } elseif (!preg_match(
'/^(date|timestamp)/', $val[
'type'])) {
977 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(empty($search[$key]) ?
'' : $search[$key]).
'">';
982 if ($key ==
'fk_soc' && !empty($arrayfields[
's.name_alias'][
'checked'])) {
983 print
'<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_alias" value="'.dolPrintHTMLForAttribute($search_alias).
'"></td>';
987include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
990$parameters = array(
'arrayfields' => $arrayfields);
991$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
992print $hookmanager->resPrint;
994if (!
$conf->main_checkbox_left_column) {
995 print
'<td class="liste_titre center maxwidthsearch">';
996 $searchpicto = $form->showFilterButtons();
1002$totalarray = array();
1003$totalarray[
'nbfield'] = 0;
1007print
'<tr class="liste_titre">';
1008if (
$conf->main_checkbox_left_column) {
1009 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1010 $totalarray[
'nbfield']++;
1012foreach (
$object->fields as $key => $val) {
1013 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1014 if ($key ==
'fk_statut' || $key ==
'severity_code') {
1015 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1016 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1017 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1018 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
1019 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
1020 } 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'])) {
1021 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
1023 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
1024 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
1025 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";
1026 $totalarray[
'nbfield']++;
1028 if ($key ==
'fk_soc' && !empty($arrayfields[
's.name_alias'][
'checked'])) {
1029 print
getTitleFieldOfList($arrayfields[
's.name_alias'][
'label'], 0, $_SERVER[
'PHP_SELF'],
's.name_alias',
'', $param,
'', $sortfield, $sortorder).
"\n";
1030 $totalarray[
'nbfield']++;
1034include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1036$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1037$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1038print $hookmanager->resPrint;
1039if (!
$conf->main_checkbox_left_column) {
1040 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1041 $totalarray[
'nbfield']++;
1047$needToFetchEachLine = 0;
1048if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
1049 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
1050 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
1051 $needToFetchEachLine++;
1060$savnbfield = $totalarray[
'nbfield'];
1061$totalarray = array();
1062$totalarray[
'nbfield'] = 0;
1063$imaxinloop = ($limit ? min($num, $limit) : $num);
1064$cacheofoutputfield = array();
1065while ($i < $imaxinloop) {
1066 $obj = $db->fetch_object($resql);
1072 $object->setVarsFromFetchObj($obj);
1073 $object->type_code = $obj->type_code;
1076 if ($mode ==
'kanban') {
1078 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1079 print
'<div class="box-flex-container kanban">';
1084 $arraydata = array();
1085 if ($obj->fk_user_assign > 0) {
1086 $user_temp->fetch($obj->fk_user_assign);
1087 $arraydata[
'user_assignment'] = $user_temp->getNomUrl(-3);
1089 $arraydata[
'selected'] = in_array(
$object->id, $arrayofselected);
1092 print
$object->getKanbanView(
'', $arraydata);
1093 if ($i == ($imaxinloop - 1)) {
1100 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1103 if (
$conf->main_checkbox_left_column) {
1104 print
'<td class="nowrap center">';
1105 if ($massactionbutton || $massaction) {
1107 if (in_array(
$object->id, $arrayofselected)) {
1110 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1114 $totalarray[
'nbfield']++;
1118 foreach (
$object->fields as $key => $val) {
1119 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
1120 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1121 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1124 if (in_array($val[
'type'], array(
'timestamp'))) {
1125 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
1127 if (in_array($key, array(
'ref',
'fk_project'))) {
1128 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
1130 if (in_array($key, array(
'subject'))) {
1131 $cssforfield =
'minwidth200 tdoverflowbydiv';
1134 if ($key ==
'fk_statut' || $key ==
'severity_code') {
1135 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1137 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
1138 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
1139 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
1140 print
' title="'.dolPrintHTMLForAttribute((
string)
$object->$key).
'"';
1143 if ($key ==
'fk_statut') {
1144 print
$object->getLibStatut(5);
1145 } elseif ($key ==
'subject') {
1146 print
'<div class="small twolinesmax lineheightsmall minwidth150 maxwidth250 classfortooltip">';
1147 print dolPrintHTML($obj->subject);
1149 } elseif ($key ==
'type_code') {
1150 $s = $langs->getLabelFromKey($db,
'TicketTypeShort'.
$object->type_code,
'c_ticket_type',
'code',
'label',
$object->type_code);
1151 print
'<span title="'.dolPrintHTMLForAttribute($s).
'">';
1154 } elseif ($key ==
'category_code') {
1155 $s = $langs->getLabelFromKey($db,
'TicketCategoryShort'.
$object->category_code,
'c_ticket_category',
'code',
'label',
$object->category_code);
1156 print
'<span title="'.dolPrintHTMLForAttribute($s).
'">';
1159 } elseif ($key ==
'severity_code') {
1160 $s = $langs->getLabelFromKey($db,
'TicketSeverityShort'.
$object->severity_code,
'c_ticket_severity',
'code',
'label',
$object->severity_code);
1161 print
'<span title="'.dolPrintHTMLForAttribute($s).
'">';
1164 } elseif ($key ==
'tms') {
1165 print
dol_print_date($db->jdate($obj->$key),
'dayhour',
'tzuser');
1166 } elseif ($key ==
'fk_user_create') {
1167 if (
$object->fk_user_create > 0) {
1168 if (isset(
$conf->cache[
'user'][
$object->fk_user_create])) {
1169 $user_temp =
$conf->cache[
'user'][
$object->fk_user_create];
1171 $user_temp =
new User($db);
1172 $user_temp->fetch(
$object->fk_user_create);
1173 $conf->cache[
'user'][
$object->fk_user_create] = $user_temp;
1175 print $user_temp->getNomUrl(-1);
1177 } elseif ($key ==
'fk_user_assign') {
1178 if (
$object->fk_user_assign > 0) {
1179 if (isset(
$conf->cache[
'user'][
$object->fk_user_assign])) {
1180 $user_temp =
$conf->cache[
'user'][
$object->fk_user_assign];
1182 $user_temp =
new User($db);
1183 $user_temp->fetch(
$object->fk_user_assign);
1184 $conf->cache[
'user'][
$object->fk_user_assign] = $user_temp;
1186 print $user_temp->getNomUrl(-1);
1188 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
1189 print
$object->showOutputField($val, $key, $db->jdate($obj->$key),
'');
1190 } elseif ($key ==
'ref') {
1191 print
$object->showOutputField($val, $key, $obj->$key,
'');
1194 $is_open = (
$object->status != Ticket::STATUS_CLOSED &&
$object->status != Ticket::STATUS_CANCELED);
1196 if ($is_open && $should_show_warning) {
1197 $date_last_msg_sent = (int)
$object->date_last_msg_sent;
1198 $hour_diff = ($now - $date_last_msg_sent) / 3600 ;
1200 if (
getDolGlobalString(
'TICKET_DELAY_BEFORE_FIRST_RESPONSE') && $date_last_msg_sent == 0) {
1201 $creation_date =
$object->datec;
1202 $hour_diff_creation = ($now - $creation_date) / 3600 ;
1203 if ($hour_diff_creation >
getDolGlobalInt(
'TICKET_DELAY_BEFORE_FIRST_RESPONSE')) {
1204 print
" " . img_picto($langs->trans(
'Late') .
' : ' . $langs->trans(
'TicketsDelayForFirstResponseTooLong',
getDolGlobalString(
'TICKET_DELAY_BEFORE_FIRST_RESPONSE')),
'warning',
'style="color: red;"', 0, 0, 0,
'',
'');
1207 print
" " . img_picto($langs->trans(
'Late') .
' : ' . $langs->trans(
'TicketsDelayFromLastResponseTooLong',
getDolGlobalString(
'TICKET_DELAY_SINCE_LAST_RESPONSE')),
'warning');
1211 $tmp = explode(
':', $val[
'type']);
1212 if ($tmp[0] ==
'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
1215 if ($key && $obj->$key && $val[
'type'] && array_key_exists($key.
'-'.$obj->$key.
'-'.$val[
'type'], $cacheofoutputfield)) {
1216 $result = $cacheofoutputfield[$key.
'-'.$obj->$key.
'-'.$val[
'type']];
1218 $result =
$object->showOutputField($val, $key, $obj->$key,
'');
1219 $cacheofoutputfield[$key.
'-'.$obj->$key.
'-'.$val[
'type']] = $result;
1222 $result =
$object->showOutputField($val, $key, $obj->$key,
'');
1229 $totalarray[
'nbfield']++;
1231 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1233 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
1235 if (!isset($totalarray[
'val'])) {
1236 $totalarray[
'val'] = array();
1238 if (!isset($totalarray[
'val'][
't.'.$key])) {
1239 $totalarray[
'val'][
't.'.$key] = 0;
1241 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
1244 if ($key ==
'fk_soc' && !empty($arrayfields[
's.name_alias'][
'checked'])) {
1245 print
'<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($obj->thirdparty_alias).
'">';
1246 print
'<span class="spantitle">'.dolPrintHTML($obj->thirdparty_alias).
'</span>';
1249 $totalarray[
'nbfield']++;
1254 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1256 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1257 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1258 print $hookmanager->resPrint;
1261 if (!
$conf->main_checkbox_left_column) {
1262 print
'<td class="nowrap center">';
1263 if ($massactionbutton || $massaction) {
1265 if (in_array(
$object->id, $arrayofselected)) {
1268 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1272 $totalarray[
'nbfield']++;
1283include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1289 foreach ($arrayfields as $key => $val) {
1290 if (!empty($val[
'checked'])) {
1294 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1300$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1301$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
1302print $hookmanager->resPrint;
1304print
'</table>'.
"\n";
1308print
'</form>'.
"\n";
1312if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1313 $hidegeneratedfilelistifempty = 1;
1314 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1315 $hidegeneratedfilelistifempty = 0;
1318 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1322 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1323 $urlsource .= str_replace(
'&',
'&', $param);
1325 $filedir = $diroutputmassaction;
1326 $genallowed = $permissiontoread;
1327 $delallowed = $permissiontoadd;
1329 print $formfile->showdocuments(
'massfilesarea_ticket',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
const STATUS_NOT_READ
Status.
Class to manage Dolibarr users.
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
GETPOSTISARRAY($paramname, $method=0)
Return true if the parameter $paramname is submit from a POST OR GET as an array.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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 a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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_get_fiche_end($notab=0)
Return tab footer of a card.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Class to generate the form for creating a new ticket.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.