35 $langs->load(
"ticket");
40 $head[$h][0] = DOL_URL_ROOT.
'/admin/ticket.php';
41 $head[$h][1] = $langs->trans(
"TicketSettings");
42 $head[$h][2] =
'settings';
45 $head[$h][0] = DOL_URL_ROOT.
'/admin/ticket_extrafields.php';
46 $head[$h][1] = $langs->trans(
"ExtraFieldsTicket");
47 $head[$h][2] =
'attributes';
50 $head[$h][0] = DOL_URL_ROOT.
'/admin/ticket_public.php';
51 $head[$h][1] = $langs->trans(
"PublicInterface");
52 $head[$h][2] =
'public';
78 global $db, $langs, $conf, $user;
82 $head[$h][0] = DOL_URL_ROOT.
'/ticket/card.php?action=view&track_id='.$object->track_id;
83 $head[$h][1] = $langs->trans(
"Ticket");
84 $head[$h][2] =
'tabTicket';
87 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid)) {
88 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
89 $head[$h][0] = DOL_URL_ROOT.
'/ticket/contact.php?track_id='.$object->track_id;
90 $head[$h][1] = $langs->trans(
'ContactsAddresses');
91 if ($nbContact > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
92 $head[$h][2] =
'contact';
99 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
100 $upload_dir = $conf->ticket->dir_output.
"/".$object->ref;
102 $head[$h][0] =
dol_buildpath(
'/ticket/document.php', 1).
'?id='.$object->id;
103 $head[$h][1] = $langs->trans(
"Documents");
105 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbFiles.
'</span>';
108 $head[$h][2] =
'tabTicketDocument';
113 $ticketViewType =
"messaging";
114 if (empty($_SESSION[
'ticket-view-type'])) {
115 $_SESSION[
'ticket-view-type'] = $ticketViewType;
117 $ticketViewType = $_SESSION[
'ticket-view-type'];
120 if ($ticketViewType ==
"messaging") {
121 $head[$h][0] = DOL_URL_ROOT.
'/ticket/messaging.php?track_id='.$object->track_id;
124 $head[$h][0] = DOL_URL_ROOT.
'/ticket/agenda.php?track_id='.$object->track_id;
126 $head[$h][1] = $langs->trans(
'Events');
127 if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
130 $head[$h][1] .= $langs->trans(
"Agenda");
132 $head[$h][2] =
'tabTicketLogs';
148 global $conf, $langs;
150 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
155 $url =
dol_buildpath(
'/public/ticket/view.php', 3).
'?track_id='.$object->track_id.
'&email='.$email;
159 if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
160 $out .=
'<span class="opacitymedium">'.$langs->trans(
"PublicInterfaceNotEnabled").
'</span>';
162 $out .=
img_picto(
'',
'object_globe.png').
' '.$langs->trans(
"TicketPublicAccess").
':<br>';
164 $out .=
'<input type="text" id="directpubliclink" class="quatrevingtpercent" value="'.$url.
'">';
167 $out .=
'<span class="opacitymedium">'.$langs->trans(
"TicketNotCreatedFromPublicInterface").
'</span>';
183 $chaine =
"abcdefghijklmnopqrstuvwxyz123456789";
184 srand((
double) microtime() * 1000000);
185 for ($i = 0; $i < $car; $i++) {
186 $string .= $chaine[rand() % strlen($chaine)];
202 function llxHeaderTicket($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'')
204 global $user, $conf, $langs, $mysoc;
206 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1);
208 print '<body id="mainbody" class="publicnewticketform">';
209 print '<div class="center">';
212 if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO) || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
214 if (!empty($conf->global->TICKET_SHOW_COMPANY_LOGO)) {
215 $urllogo = DOL_URL_ROOT.
'/theme/common/login_logo.png';
217 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small)) {
218 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_small);
219 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$mysoc->logo)) {
220 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$mysoc->logo);
221 } elseif (is_readable(DOL_DOCUMENT_ROOT.
'/theme/dolibarr_logo.svg')) {
222 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_logo.svg';
228 if ($urllogo || !empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
229 print '<div class="backgreypublicpayment">';
230 print '<div class="logopublicpayment">';
232 print '<a href="'.($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE :
dol_buildpath(
'/public/ticket/index.php', 1)).
'">';
233 print '<img id="dolpaymentlogo" src="'.$urllogo.
'"';
237 if (!empty($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC)) {
238 print '<div class="clearboth"></div><strong>'.($conf->global->TICKET_PUBLIC_INTERFACE_TOPIC ? $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC : $langs->trans(
"TicketSystem")).
'</strong>';
241 if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
242 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref?utm_medium=website&utm_source=poweredby" href="https://www.dolibarr.org" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
249 print '<div class="ticketlargemargin">';
271 function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon =
'', $noprint = 0, $actioncode =
'', $donetodo =
'done', $filters = array(), $sortfield =
'a.datep,a.id', $sortorder =
'DESC')
276 global $param, $massactionbutton;
281 if (!is_object($filterobj) && !is_object($objcon))
dol_print_error(
'',
'BadParameter');
287 $sortfield_list = explode(
',', $sortfield);
288 $sortfield_label_list = array(
'a.id' =>
'id',
'a.datep' =>
'dp',
'a.percent' =>
'percent');
289 $sortfield_new_list = array();
290 foreach ($sortfield_list as $sortfield_value) {
291 $sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)];
293 $sortfield_new = implode(
',', $sortfield_new_list);
295 if (!empty($conf->agenda->enabled)) {
297 if (is_object($objcon) && $objcon->id > 0) {
298 $sql =
"SELECT DISTINCT a.id, a.label as label,";
300 $sql =
"SELECT a.id, a.label as label,";
302 $sql .=
" a.datep as dp,";
303 $sql .=
" a.note as message,";
304 $sql .=
" a.datep2 as dp2,";
305 $sql .=
" a.percent as percent, 'action' as type,";
306 $sql .=
" a.fk_element, a.elementtype,";
307 $sql .=
" a.fk_contact,";
308 $sql .=
" c.code as acode, c.libelle as alabel, c.picto as apicto,";
309 $sql .=
" u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
310 if (is_object($filterobj) && get_class($filterobj) ==
'Societe') {
311 $sql .=
", sp.lastname, sp.firstname";
312 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
313 $sql .=
", m.lastname, m.firstname";
314 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
316 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
318 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
320 } elseif (is_object($filterobj) && get_class($filterobj) ==
'BOM') {
322 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contrat') {
325 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a";
326 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u on u.rowid = a.fk_user_action";
327 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_actioncomm as c ON a.fk_action = c.id";
329 $force_filter_contact =
false;
330 if (is_object($objcon) && $objcon->id > 0) {
331 $force_filter_contact =
true;
332 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"actioncomm_resources as r ON a.id = r.fk_actioncomm";
333 $sql .=
" AND r.element_type = '".$db->escape($objcon->table_element).
"' AND r.fk_element = ".$objcon->id;
336 if (is_object($filterobj) && get_class($filterobj) ==
'Societe') {
337 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"socpeople as sp ON a.fk_contact = sp.rowid";
338 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Dolresource') {
339 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"element_resources as er";
340 $sql .=
" ON er.resource_type = 'dolresource'";
341 $sql .=
" AND er.element_id = a.id";
342 $sql .=
" AND er.resource_id = ".$filterobj->id;
343 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
344 $sql .=
", ".MAIN_DB_PREFIX.
"adherent as m";
345 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
346 $sql .=
", ".MAIN_DB_PREFIX.
"commande_fournisseur as o";
347 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
348 $sql .=
", ".MAIN_DB_PREFIX.
"product as o";
349 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
350 $sql .=
", ".MAIN_DB_PREFIX.
"ticket as o";
351 } elseif (is_object($filterobj) && get_class($filterobj) ==
'BOM') {
352 $sql .=
", ".MAIN_DB_PREFIX.
"bom_bom as o";
353 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contrat') {
354 $sql .=
", ".MAIN_DB_PREFIX.
"contrat as o";
357 $sql .=
" WHERE a.entity IN (".getEntity(
'agenda').
")";
358 if ($force_filter_contact ===
false) {
359 if (is_object($filterobj) && in_array(get_class($filterobj), array(
'Societe',
'Client',
'Fournisseur')) && $filterobj->id) {
360 $sql .=
" AND a.fk_soc = ".$filterobj->id;
361 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Project' && $filterobj->id) {
362 $sql .=
" AND a.fk_project = ".$filterobj->id;
363 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
364 $sql .=
" AND a.fk_element = m.rowid AND a.elementtype = 'member'";
365 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
366 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
367 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
368 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
369 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
370 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'product'";
371 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
372 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
373 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
374 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
375 } elseif (is_object($filterobj) && get_class($filterobj) ==
'BOM') {
376 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
377 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
378 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Contrat') {
379 $sql .=
" AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
380 if ($filterobj->id) $sql .=
" AND a.fk_element = ".$filterobj->id;
385 if (!empty($actioncode)) {
386 if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
387 if ($actioncode ==
'AC_NON_AUTO') {
388 $sql .=
" AND c.type != 'systemauto'";
389 } elseif ($actioncode ==
'AC_ALL_AUTO') {
390 $sql .=
" AND c.type = 'systemauto'";
392 if ($actioncode ==
'AC_OTH') {
393 $sql .=
" AND c.type != 'systemauto'";
394 } elseif ($actioncode ==
'AC_OTH_AUTO') {
395 $sql .=
" AND c.type = 'systemauto'";
399 if ($actioncode ==
'AC_NON_AUTO') $sql .=
" AND c.type != 'systemauto'";
400 elseif ($actioncode ==
'AC_ALL_AUTO') $sql .=
" AND c.type = 'systemauto'";
401 else $sql .=
" AND c.code = '".$db->escape($actioncode).
"'";
404 if ($donetodo ==
'todo') $sql .=
" AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now).
"'))";
405 elseif ($donetodo ==
'done') $sql .=
" AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now).
"'))";
406 if (is_array($filters) && $filters[
'search_agenda_label']) $sql .=
natural_search(
'a.label', $filters[
'search_agenda_label']);
410 if (!empty($conf->mailing->enabled) && !empty($objcon->email)
411 && (empty($actioncode) || $actioncode ==
'AC_OTH_AUTO' || $actioncode ==
'AC_EMAILING'))
413 $langs->load(
"mails");
415 $sql2 =
"SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
416 $sql2 .=
", null as fk_element, '' as elementtype, null as contact_id";
417 $sql2 .=
", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
418 $sql2 .=
", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
419 if (is_object($filterobj) && get_class($filterobj) ==
'Societe') {
420 $sql2 .=
", '' as lastname, '' as firstname";
421 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Adherent') {
422 $sql2 .=
", '' as lastname, '' as firstname";
423 } elseif (is_object($filterobj) && get_class($filterobj) ==
'CommandeFournisseur') {
424 $sql2 .=
", '' as ref";
425 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Product') {
426 $sql2 .=
", '' as ref";
427 } elseif (is_object($filterobj) && get_class($filterobj) ==
'Ticket') {
428 $sql2 .=
", '' as ref";
430 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"mailing as m, ".MAIN_DB_PREFIX.
"mailing_cibles as mc, ".MAIN_DB_PREFIX.
"user as u";
431 $sql2 .=
" WHERE mc.email = '".$db->escape($objcon->email).
"'";
432 $sql2 .=
" AND mc.statut = 1";
433 $sql2 .=
" AND u.rowid = m.fk_user_valid";
434 $sql2 .=
" AND mc.fk_mailing=m.rowid";
437 if (!empty($sql) && !empty($sql2)) {
438 $sql = $sql.
" UNION ".$sql2;
439 } elseif (empty($sql) && !empty($sql2)) {
445 $sql .= $db->order($sortfield_new, $sortorder);
447 dol_syslog(
"company.lib::show_actions_done", LOG_DEBUG);
448 $resql = $db->query($sql);
451 $num = $db->num_rows(
$resql);
454 $obj = $db->fetch_object(
$resql);
456 if ($obj->type ==
'action') {
458 $contactaction->id = $obj->id;
459 $result = $contactaction->fetchResources();
462 setEventMessage(
"company.lib::show_actions_done Error fetch ressource",
'errors');
468 if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone =
'todo';
470 $histo[$numaction] = array(
472 'tododone'=>$tododone,
474 'datestart'=>$db->jdate($obj->dp),
475 'dateend'=>$db->jdate($obj->dp2),
477 'message'=>$obj->message,
478 'percent'=>$obj->percent,
480 'userid'=>$obj->user_id,
481 'login'=>$obj->user_login,
482 'userfirstname'=>$obj->user_firstname,
483 'userlastname'=>$obj->user_lastname,
484 'userphoto'=>$obj->user_photo,
486 'contact_id'=>$obj->fk_contact,
487 'socpeopleassigned' => $contactaction->socpeopleassigned,
488 'lastname'=>$obj->lastname,
489 'firstname'=>$obj->firstname,
490 'fk_element'=>$obj->fk_element,
491 'elementtype'=>$obj->elementtype,
493 'acode'=>$obj->acode,
494 'alabel'=>$obj->alabel,
495 'libelle'=>$obj->alabel,
496 'apicto'=>$obj->apicto
499 $histo[$numaction] = array(
503 'datestart'=>$db->jdate($obj->dp),
504 'dateend'=>$db->jdate($obj->dp2),
506 'message'=>$obj->message,
507 'percent'=>$obj->percent,
508 'acode'=>$obj->acode,
510 'userid'=>$obj->user_id,
511 'login'=>$obj->user_login,
512 'userfirstname'=>$obj->user_firstname,
513 'userlastname'=>$obj->user_lastname,
514 'userphoto'=>$obj->user_photo
529 if (empty($conf->agenda->enabled)) {
530 $langs->loadLangs(array(
"admin",
"errors"));
531 $out =
info_admin($langs->trans(
"WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv(
"Module2400Name")), 0, 0,
'warning');
534 if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {
535 $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
537 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
538 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
539 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
540 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
545 $userstatic =
new User($db);
546 $contactstatic =
new Contact($db);
547 $userGetNomUrlCache = array();
549 $out .=
'<div class="filters-container" >';
550 $out .=
'<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
551 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
553 if ($objcon && get_class($objcon) ==
'Contact' &&
554 (is_null($filterobj) || get_class($filterobj) ==
'Societe')) {
555 $out .=
'<input type="hidden" name="id" value="'.$objcon->id.
'" />';
557 $out .=
'<input type="hidden" name="id" value="'.$filterobj->id.
'" />';
559 if ($filterobj && get_class($filterobj) ==
'Societe') $out .=
'<input type="hidden" name="socid" value="'.$filterobj->id.
'" />';
563 $out .=
'<div class="div-table-responsive-no-min">';
564 $out .=
'<table class="noborder borderbottom centpercent">';
566 $out .=
'<tr class="liste_titre">';
572 $out .=
'<th class="liste_titre"><strong class="hideonsmartphone">'.$langs->trans(
"Search").
' : </strong></th>';
574 $out .=
'<th class="liste_titre"></th>';
576 $out .=
'<th class="liste_titre">'.$langs->trans(
"Type").
' ';
577 $out .=
$formactions->select_type_actions($actioncode,
"actioncode",
'', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1,
'minwidth200imp');
579 $out .=
'<th class="liste_titre maxwidth100onsmartphone">';
580 $out .=
'<input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters[
'search_agenda_label'].
'" placeholder="'.$langs->trans(
"Label").
'">';
583 $out .=
'<th class="liste_titre width50 middle">';
584 $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0,
'checkforselect', 1);
585 $out .= $searchpicto;
597 $out .=
'<ul class="timeline">';
601 if (get_class($filterobj) ==
'Societe') $tmp .=
'<a href="'.DOL_URL_ROOT.
'/comm/action/list.php?action=show_list&socid='.$filterobj->id.
'&status=done">';
602 $tmp .= ($donetodo !=
'done' ? $langs->trans(
"ActionsToDoShort") :
'');
603 $tmp .= ($donetodo !=
'done' && $donetodo !=
'todo' ?
' / ' :
'');
604 $tmp .= ($donetodo !=
'todo' ? $langs->trans(
"ActionsDoneShort") :
'');
606 if (get_class($filterobj) ==
'Societe') $tmp .=
'</a>';
615 $actualCycleDate =
false;
617 foreach ($histo as $key=>$value)
619 $actionstatic->fetch($histo[$key][
'id']);
621 $actionstatic->type_picto = $histo[$key][
'apicto'];
622 $actionstatic->type_code = $histo[$key][
'acode'];
624 $url = DOL_URL_ROOT.
'/comm/action/card.php?id='.$histo[$key][
'id'];
626 $tmpa =
dol_getdate($histo[$key][
'datestart'],
false);
627 if ($actualCycleDate !== $tmpa[
'year'].
'-'.$tmpa[
'yday']) {
628 $actualCycleDate = $tmpa[
'year'].
'-'.$tmpa[
'yday'];
629 $out .=
'<!-- timeline time label -->';
630 $out .=
'<li class="time-label">';
631 $out .=
'<span class="timeline-badge-date">';
632 $out .=
dol_print_date($histo[$key][
'datestart'],
'daytext',
'tzuserrel', $langs);
635 $out .=
'<!-- /.timeline-label -->';
639 $out .=
'<!-- timeline item -->'.
"\n";
640 $out .=
'<li class="timeline-code-'.strtolower($actionstatic->code).
'">';
644 $out .=
'<div class="timeline-item">'.
"\n";
646 $out .=
'<span class="timeline-header-action">';
648 if (isset($histo[$key][
'type']) && $histo[$key][
'type'] ==
'mailing') {
649 $out .=
'<a class="timeline-btn" href="'.DOL_URL_ROOT.
'/comm/mailing/card.php?id='.$histo[$key][
'id'].
'">'.
img_object($langs->trans(
"ShowEMailing"),
"email").
' ';
650 $out .= $histo[$key][
'id'];
653 $out .= $actionstatic->getNomUrl(1, -1,
'valignmiddle').
' ';
661 if ($user->rights->agenda->allactions->create ||
662 (($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && $user->rights->agenda->myactions->create))
664 $out .=
'<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.
'/comm/action/card.php?action=edit&id='.$actionstatic->id.
'"><i class="fa fa-pencil" title="'.$langs->trans(
"Modify").
'" ></i></a>';
669 $out .=
'<span class="time"><i class="fa fa-clock-o"></i> ';
670 $out .=
dol_print_date($histo[$key][
'datestart'],
'dayhour',
'tzuserrel');
671 if ($histo[$key][
'dateend'] && $histo[$key][
'dateend'] != $histo[$key][
'datestart']) {
672 $tmpa =
dol_getdate($histo[$key][
'datestart'],
true);
673 $tmpb =
dol_getdate($histo[$key][
'dateend'],
true);
674 if ($tmpa[
'mday'] == $tmpb[
'mday'] && $tmpa[
'mon'] == $tmpb[
'mon'] && $tmpa[
'year'] == $tmpb[
'year']) {
675 $out .=
'-'.dol_print_date($histo[$key][
'dateend'],
'hour',
'tzuserrel');
677 $out .=
'-'.dol_print_date($histo[$key][
'dateend'],
'dayhour',
'tzuserrel');
681 if ($histo[$key][
'percent'] == 0 && $histo[$key][
'datestart'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) $late = 1;
682 if ($histo[$key][
'percent'] == 0 && !$histo[$key][
'datestart'] && $histo[$key][
'dateend'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) $late = 1;
683 if ($histo[$key][
'percent'] > 0 && $histo[$key][
'percent'] < 100 && $histo[$key][
'dateend'] && $histo[$key][
'dateend'] < ($now - $delay_warning)) $late = 1;
684 if ($histo[$key][
'percent'] > 0 && $histo[$key][
'percent'] < 100 && !$histo[$key][
'dateend'] && $histo[$key][
'datestart'] && $histo[$key][
'datestart'] < ($now - $delay_warning)) $late = 1;
685 if ($late) $out .=
img_warning($langs->trans(
"Late")).
' ';
689 $out .=
'<h3 class="timeline-header">';
692 $out .=
'<span class="messaging-author">';
693 if ($histo[$key][
'userid'] > 0)
695 if (!isset($userGetNomUrlCache[$histo[$key][
'userid']])) {
696 $userstatic->fetch($histo[$key][
'userid']);
697 $userGetNomUrlCache[$histo[$key][
'userid']] = $userstatic->getNomUrl(-1,
'', 0, 0, 16, 0,
'firstelselast',
'');
699 $out .= $userGetNomUrlCache[$histo[$key][
'userid']];
704 $out .=
' <span class="messaging-title">';
706 if ($actionstatic->code ==
'TICKET_MSG') {
707 $out .= $langs->trans(
'TicketNewMessage');
708 } elseif ($actionstatic->code ==
'TICKET_MSG_PRIVATE') {
709 $out .= $langs->trans(
'TicketNewMessage').
' <em>('.$langs->trans(
'Private').
')</em>';
711 if (isset($histo[$key][
'type']) && $histo[$key][
'type'] ==
'action') {
712 $transcode = $langs->trans(
"Action".$histo[$key][
'acode']);
713 $libelle = ($transcode !=
"Action".$histo[$key][
'acode'] ? $transcode : $histo[$key][
'alabel']);
714 $libelle = $histo[$key][
'note'];
715 $actionstatic->id = $histo[$key][
'id'];
718 if (isset($histo[$key][
'type']) && $histo[$key][
'type'] ==
'mailing') {
719 $out .=
'<a href="'.DOL_URL_ROOT.
'/comm/mailing/card.php?id='.$histo[$key][
'id'].
'">'.
img_object($langs->trans(
"ShowEMailing"),
"email").
' ';
720 $transcode = $langs->trans(
"Action".$histo[$key][
'acode']);
721 $libelle = ($transcode !=
"Action".$histo[$key][
'acode'] ? $transcode :
'Send mass mailing');
730 if (!empty($histo[$key][
'message'])
731 && $actionstatic->code !=
'AC_TICKET_CREATE'
732 && $actionstatic->code !=
'AC_TICKET_MODIFY'
735 $out .=
'<div class="timeline-body">';
736 $out .= $histo[$key][
'message'];
744 if (isset($histo[$key][
'socpeopleassigned']) && is_array($histo[$key][
'socpeopleassigned']) && count($histo[$key][
'socpeopleassigned']) > 0) {
746 foreach ($histo[$key][
'socpeopleassigned'] as $cid => $Tab) {
748 $result = $contact->fetch($cid);
755 $contactList .= !empty($contactList) ?
', ' :
'';
756 $contactList .= $contact->getNomUrl(1);
757 if (isset($histo[$key][
'acode']) && $histo[$key][
'acode'] ==
'AC_TEL') {
758 if (!empty($contact->phone_pro))
759 $contactList .=
'('.dol_print_phone($contact->phone_pro).
')';
764 $footer .= $langs->trans(
'ActionOnContact').
' : '.$contactList;
765 } elseif (empty($objcon->id) && isset($histo[$key][
'contact_id']) && $histo[$key][
'contact_id'] > 0) {
767 $result = $contact->fetch($histo[$key][
'contact_id']);
773 $footer .= $contact->getNomUrl(1);
774 if (isset($histo[$key][
'acode']) && $histo[$key][
'acode'] ==
'AC_TEL') {
775 if (!empty($contact->phone_pro))
776 $footer .=
'('.dol_print_phone($contact->phone_pro).
')';
782 if (!empty($documents))
784 $footer .=
'<div class="timeline-documents-container">';
785 foreach ($documents as $doc)
787 $footer .=
'<span id="document_'.$doc->id.
'" class="timeline-documents" ';
788 $footer .=
' data-id="'.$doc->id.
'" ';
789 $footer .=
' data-path="'.$doc->filepath.
'"';
790 $footer .=
' data-filename="'.dol_escape_htmltag($doc->filename).
'" ';
793 $filePath = DOL_DATA_ROOT.
'/'.$doc->filepath.
'/'.$doc->filename;
795 $file = $actionstatic->id.
'/'.$doc->filename;
796 $thumb = $actionstatic->id.
'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename,
'.')).
'_mini'.substr($doc->filename, strrpos($doc->filename,
'.'));
797 $doclink =
dol_buildpath(
'document.php', 1).
'?modulepart=actions&attachment=0&file='.urlencode($file).
'&entity='.$conf->entity;
798 $viewlink =
dol_buildpath(
'viewimage.php', 1).
'?modulepart=actions&file='.urlencode($thumb).
'&entity='.$conf->entity;
800 $mimeAttr =
' mime="'.$mime.
'" ';
802 if (in_array($mime, array(
'image/png',
'image/jpeg',
'application/pdf'))) {
803 $class .=
' documentpreview';
806 $footer .=
'<a href="'.$doclink.
'" class="btn-link '.$class.
'" target="_blank" '.$mimeAttr.
' >';
807 $footer .=
img_mime($filePath).
' '.$doc->filename;
810 $footer .=
'</span>';
815 if (!empty($footer)) {
816 $out .=
'<div class="timeline-footer">'.$footer.
'</div>';
819 $out .=
'</div>'.
"\n";
822 $out .=
'<!-- END timeline item -->';
829 if ($noprint)
return $out;
842 global $conf, $langs;
843 $out =
'<!-- timeline icon -->'.
"\n";
844 $iconClass =
'fa fa-comments';
849 if ($histo[$key][
'percent'] == -1) {
850 $colorClass =
'timeline-icon-not-applicble';
851 $pictoTitle = $langs->trans(
'StatusNotApplicable');
852 } elseif ($histo[$key][
'percent'] == 0) {
853 $colorClass =
'timeline-icon-todo';
854 $pictoTitle = $langs->trans(
'StatusActionToDo').
' (0%)';
855 } elseif ($histo[$key][
'percent'] > 0 && $histo[$key][
'percent'] < 100) {
856 $colorClass =
'timeline-icon-in-progress';
857 $pictoTitle = $langs->trans(
'StatusActionInProcess').
' ('.$histo[$key][
'percent'].
'%)';
858 } elseif ($histo[$key][
'percent'] >= 100) {
859 $colorClass =
'timeline-icon-done';
860 $pictoTitle = $langs->trans(
'StatusActionDone').
' (100%)';
863 if ($actionstatic->code ==
'AC_TICKET_CREATE') {
864 $iconClass =
'fa fa-ticket';
865 } elseif ($actionstatic->code ==
'AC_TICKET_MODIFY') {
866 $iconClass =
'fa fa-pencilxxx';
867 } elseif ($actionstatic->code ==
'TICKET_MSG') {
868 $iconClass =
'fa fa-comments';
869 } elseif ($actionstatic->code ==
'TICKET_MSG_PRIVATE') {
870 $iconClass =
'fa fa-mask';
871 } elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
872 if ($actionstatic->type_picto) {
873 $img_picto =
img_picto(
'', $actionstatic->type_picto);
875 if ($actionstatic->type_code ==
'AC_RDV') {
876 $iconClass =
'fa fa-handshake';
877 } elseif ($actionstatic->type_code ==
'AC_TEL') {
878 $iconClass =
'fa fa-phone';
879 } elseif ($actionstatic->type_code ==
'AC_FAX') {
880 $iconClass =
'fa fa-fax';
881 } elseif ($actionstatic->type_code ==
'AC_EMAIL') {
882 $iconClass =
'fa fa-envelope';
883 } elseif ($actionstatic->type_code ==
'AC_INT') {
884 $iconClass =
'fa fa-shipping-fast';
885 } elseif ($actionstatic->type_code ==
'AC_OTH_AUTO') {
886 $iconClass =
'fa fa-robot';
887 } elseif (!preg_match(
'/_AUTO/', $actionstatic->type_code)) {
888 $iconClass =
'fa fa-robot';
893 $out .=
'<i class="'.$iconClass.
' '.$colorClass.
'" title="'.$pictoTitle.
'">'.$img_picto.
'</i>'.
"\n";
907 $documents = array();
909 $sql =
'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
910 $sql .=
' FROM '.MAIN_DB_PREFIX.
'ecm_files ecm';
911 $sql .=
' WHERE ecm.filepath = \'agenda/'.$object->id.
'\'';
913 $sql .=
' ORDER BY ecm.position ASC';
915 $resql = $db->query($sql);
917 if ($db->num_rows(
$resql)) {
918 while ($obj = $db->fetch_object(
$resql)) {
919 $documents[$obj->id] = $obj;
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon= '', $noprint=0, $actioncode= '', $donetodo= 'done', $filters=array(), $sortfield= 'a.datep, a.id', $sortorder= 'DESC')
Show html area with actions for ticket messaging.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action== 'set') elseif($action== 'specimen') elseif($action== 'setmodel') elseif($action== 'del') elseif($action== 'setdoc') $formactions
View.
Class to manage agenda events (actions)
ticket_prepare_head($object)
Build tabs for a Ticket object.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
setEventMessage($mesgs, $style= 'mesgs')
Set event message in dol_events session object.
top_htmlhead($head, $title= '', $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
getTicketTimelineIcon($actionstatic, &$histo, $key)
Get timeline icon.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getTicketActionCommEcmList($object)
getTicketActionCommEcmList
img_mime($file, $titlealt= '', $morecss= '')
Show MIME img of a file.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
ticketAdminPrepareHead()
Build tabs for admin page.
dol_mimetype($file, $default= 'application/octet-stream', $mode=0)
Return mime type of a file.
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
llxHeaderTicket($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs= '', $arrayofcss= '')
Show header for public pages.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
generate_random_id($car=16)
Generate a random id.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
showDirectPublicLink($object)
Return string with full Url.
ajax_autoselect($htmlname, $addlink= '')
Make content of an input box selected when we click into input field.
print $_SERVER["PHP_SELF"]
Edit parameters.
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_trunc($string, $size=40, $trunc= 'right', $stringencoding= 'UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.