27require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
63 public $errors = array();
109 if (!is_object($this->dao)) {
110 $this->dao =
new Ticket($this->db);
122 public function fetch($id = 0, $ref =
'', $track_id =
'')
125 return $this->dao->fetch($id, $ref, $track_id);
137 $this->dao->fk_statut = $this->fk_statut;
138 return $this->dao->getLibStatut($mode);
150 $this->dao->fetch($id);
152 $this->label = $this->dao->label;
166 if ($action ==
'create') {
167 return $langs->trans(
"CreateTicket");
168 } elseif ($action ==
'edit') {
169 return $langs->trans(
"EditTicket");
170 } elseif ($action ==
'view') {
171 return $langs->trans(
"TicketCard");
172 } elseif ($action ==
'add_message') {
173 return $langs->trans(
"TicketAddMessage");
175 return $langs->trans(
"TicketsManagement");
189 global $conf, $langs;
191 print
'<!-- initial message of ticket -->'.
"\n";
192 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
194 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="post">';
195 print
'<input type="hidden" name="token" value="'.newToken().
'">';
196 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
197 print
'<input type="hidden" name="action" value="set_message">';
201 print
'<div class="div-table-responsive-no-min">';
202 print
'<table class="noborder centpercent margintable margintable">';
203 print
'<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
204 print $langs->trans(
"InitialMessage");
206 if ($user->hasRight(
"ticket",
"manage")) {
207 print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=edit_message_init&token='.newToken().
'&track_id='.$object->track_id.
'">'.
img_edit($langs->trans(
'Modify')).
'</a>';
212 print
'<td colspan="2">';
213 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
215 $msg = GETPOSTISSET(
'message_initial') ?
GETPOST(
'message_initial',
'restricthtml') : $object->message;
216 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
217 $uselocalbrowser =
true;
219 $doleditor =
new DolEditor(
'message_initial', $msg,
'100%', 250,
'dolibarr_details',
'In',
true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9,
'95%');
220 $doleditor->Create();
222 print
'<div class="longmessagecut">';
232 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
233 print
'<div class="center">';
234 print
' <input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
235 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
243 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
259 global $langs, $user;
262 $ret = $this->dao->loadCacheMsgsTicket();
267 $action =
GETPOST(
'action',
'aZ09');
269 print
'<div class="ticketpublicarea ticketlargemargin centpercent" style="padding-top: 0">';
273 if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
274 print
'<div class="ticketpublicarea ticketlargemargin centpercent">';
276 print
'<div class="div-table-responsive-no-min">';
277 print
'<table class="border centpercent">';
279 print
'<tr class="liste_titre">';
282 print $langs->trans(
'TicketMessagesList');
287 print $langs->trans(
'User');
292 foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) {
293 if (!$arraymsgs[
'private']
294 || ($arraymsgs[
'private'] ==
"1" && $show_private)
297 print
'<tr class="oddeven">';
298 print
'<td><strong>';
299 print
img_picto(
'',
'object_action',
'class="paddingright"').dol_print_date($arraymsgs[
'datep'],
'dayhour');
300 print
'<strong></td>';
303 if ($arraymsgs[
'fk_user_author'] > 0) {
304 $userstat =
new User($this->db);
305 $res = $userstat->fetch($arraymsgs[
'fk_user_author']);
307 print $userstat->getNomUrl(0);
309 } elseif (isset($arraymsgs[
'fk_contact_author'])) {
310 $contactstat =
new Contact($this->db);
311 $res = $contactstat->fetch(0,
null,
'', $arraymsgs[
'fk_contact_author']);
313 print $contactstat->getNomUrl(0,
'nolink');
315 print $arraymsgs[
'fk_contact_author'];
318 print $langs->trans(
'Customer');
323 print
'<tr class="oddeven">';
324 print
'<td colspan="2">';
325 print $arraymsgs[
'message'];
329 $documents = array();
331 $sql =
'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id';
332 $sql .=
', ecm.filepath, ecm.filename, ecm.share';
333 $sql .=
' FROM '.MAIN_DB_PREFIX.
'ecm_files ecm';
334 $sql .=
" WHERE ecm.filepath = 'agenda/".$arraymsgs[
'id'].
"'";
335 $sql .=
' ORDER BY ecm.position ASC';
337 $resql = $this->db->query($sql);
339 if ($this->db->num_rows($resql)) {
340 while ($obj = $this->db->fetch_object($resql)) {
341 $documents[$obj->id] = $obj;
345 if (!empty($documents)) {
347 $footer =
'<div class="timeline-documents-container">';
348 foreach ($documents as $doc) {
349 if (!empty($doc->share)) {
351 $footer .=
'<span id="document_'.$doc->id.
'" class="timeline-documents" ';
352 $footer .=
' data-id="'.$doc->id.
'" ';
353 $footer .=
' data-path="'.$doc->filepath.
'"';
354 $footer .=
' data-filename="'.dol_escape_htmltag($doc->filename).
'" ';
357 $filePath = DOL_DATA_ROOT.
'/'.$doc->filepath.
'/'.$doc->filename;
359 $thumb = $arraymsgs[
'id'].
'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename,
'.')).
'_mini'.substr($doc->filename, strrpos($doc->filename,
'.'));
360 $doclink = DOL_URL_ROOT.
'/document.php?hashp='.urlencode($doc->share);
362 $mimeAttr =
' mime="'.$mime.
'" ';
364 if (in_array($mime, array(
'image/png',
'image/jpeg',
'application/pdf'))) {
365 $class .=
' documentpreview';
368 $footer .=
'<a href="'.$doclink.
'" class="btn-link '.$class.
'" target="_blank" '.$mimeAttr.
' >';
369 $footer .=
img_mime($filePath).
' '.$doc->filename;
372 $footer .=
'</span>';
376 if ($isshared == 1) {
391 print
'<div class="ticketpublicarea ticketlargemargin centpercent">';
392 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
407 global $conf, $langs, $user;
410 $ret = $object->loadCacheMsgsTicket();
413 if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
414 print
'<section id="cd-timeline">';
416 foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
417 if (!$arraymsgs[
'private']
418 || ($arraymsgs[
'private'] ==
"1" && $show_private)
420 print
'<div class="cd-timeline-block">';
421 print
'<div class="cd-timeline-img">';
422 print
'<img src="img/messages.png" alt="">';
423 print
'</div> <!-- cd-timeline-img -->';
425 print
'<div class="cd-timeline-content">';
426 print $arraymsgs[
'message'];
428 print
'<span class="cd-date">';
432 if ($arraymsgs[
'fk_user_action'] > 0) {
433 $userstat =
new User($this->db);
434 $res = $userstat->fetch($arraymsgs[
'fk_user_action']);
437 print $userstat->getNomUrl(1);
441 print $langs->trans(
'Customer');
445 print
'</div> <!-- cd-timeline-content -->';
446 print
'</div> <!-- cd-timeline-block -->';
451 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
465 print
'<div class="div-table-responsive-no-min margintoponly navBarForStatus">';
466 print
'<div class="centpercent right">';
468 $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
470 $exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
475 foreach ($object->labelStatusShort as $status => $status_label) {
476 if (!in_array($status, $exclude_status)) {
477 print
'<div class="inline-block center marginbottomonly">';
480 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=set_read&token='.newToken();
482 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=confirm_set_status&token='.newToken().
'&new_status='.((int) $status);
485 print
'<a class="butAction butStatus marginbottomonly" href="'.$urlforbutton.
'">';
486 print $object->LibStatut($status, 3, 1).
' ';
488 print $langs->trans($object->labelStatusShort[$status]);
513 if (in_array(
'admin', explode(
':', $parameters[
'context']))) {
514 $this->results = array(
'ticket_send' => $langs->trans(
'MailToSendTicketMessage'));
520 $this->errors[] =
'Error message';
Class Actions of the module ticket.
viewTicketMessages($show_private, $show_user, $object)
View html list of message for ticket.
getTitle($action='')
Get action title.
__construct($db)
Constructor.
emailElementlist($parameters, &$object, &$action, $hookmanager)
Hook to add email element template.
$errno
Numero de l'erreur.
fetch($id=0, $ref='', $track_id='')
Fetch object.
viewTicketOriginalMessage($user, $action, $object)
Show ticket original message.
viewTicketTimelineMessages($show_private, $show_user, Ticket $object)
View list of message for ticket with timeline display.
getInstanceDao()
Instantiation of DAO class.
getLibStatut($mode=0)
Print statut.
viewStatusActions(Ticket $object)
Print html navbar with link to set ticket status.
getInfo($id)
Get ticket info.
Parent class of all other hook actions classes.
Class to manage a WYSIWYG editor.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dolPrintHTML($s, $allowiframe=0)
Return a string ready to be output on HTML page To use text inside an attribute, you can simply use d...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Class to generate the form for creating a new ticket.