28require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
64 public $errors = array();
110 if (!is_object($this->dao)) {
111 $this->dao =
new Ticket($this->db);
123 public function fetch(
$id = 0, $ref =
'', $track_id =
'')
126 return $this->dao->fetch(
$id, $ref, $track_id);
138 $this->dao->fk_statut = $this->fk_statut;
139 return $this->dao->getLibStatut($mode);
151 $this->dao->fetch(
$id);
153 $this->label = $this->dao->label;
167 if ($action ==
'create') {
168 return $langs->trans(
"CreateTicket");
169 } elseif ($action ==
'edit') {
170 return $langs->trans(
"EditTicket");
171 } elseif ($action ==
'view') {
172 return $langs->trans(
"TicketCard");
173 } elseif ($action ==
'add_message') {
174 return $langs->trans(
"TicketAddMessage");
176 return $langs->trans(
"TicketsManagement");
192 print
'<!-- initial message of ticket -->'.
"\n";
193 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
195 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="post">';
196 print
'<input type="hidden" name="token" value="'.newToken().
'">';
197 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
198 print
'<input type="hidden" name="action" value="set_message">';
202 print
'<div class="div-table-responsive-no-min">';
203 print
'<table class="border centpercent margintable">';
204 print
'<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
205 print $langs->trans(
"InitialMessage");
207 if ($user->hasRight(
"ticket",
"manage")) {
208 if ($action !=
'edit_message_init') {
209 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>';
211 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
212 print
' <input type="submit" class="button button-cancel smallpaddingimp" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
218 print
'<td colspan="2">';
219 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
221 $msg = GETPOSTISSET(
'message_initial') ?
GETPOST(
'message_initial',
'restricthtml') :
$object->message;
222 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
223 $uselocalbrowser =
true;
225 if (!$ckeditorenabledforticket) {
228 $doleditor =
new DolEditor(
'message_initial', $msg,
'100%', 250,
'dolibarr_details',
'In',
true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9,
'95%');
229 $doleditor->Create();
231 print
'<div class="longmessagecut small">';
245 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
261 global $langs, $user;
264 $ret = $this->dao->loadCacheMsgsTicket();
269 $action =
GETPOST(
'action',
'aZ09');
271 print
'<div class="ticketpublicarea ticketlargemargin centpercent" style="padding-top: 0">';
275 if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
276 print
'<div class="ticketpublicarea ticketlargemargin centpercent">';
278 print
'<div class="div-table-responsive-no-min">';
279 print
'<table class="border centpercent">';
281 print
'<tr class="liste_titre">';
284 print $langs->trans(
'TicketMessagesList');
289 print $langs->trans(
'User');
294 foreach ($this->dao->cache_msgs_ticket as
$id => $arraymsgs) {
295 if (!$arraymsgs[
'private']
296 || ($arraymsgs[
'private'] ==
"1" && $show_private)
299 print
'<tr class="oddeven nohover">';
300 print
'<td><strong>';
301 print
img_picto(
'',
'object_action',
'class="paddingright"').dol_print_date($arraymsgs[
'datep'],
'dayhour');
302 print
'<strong></td>';
305 if ($arraymsgs[
'fk_user_author'] > 0) {
306 $userstat =
new User($this->db);
307 $res = $userstat->fetch($arraymsgs[
'fk_user_author']);
309 print $userstat->getNomUrl(0);
311 } elseif (isset($arraymsgs[
'fk_contact_author'])) {
312 $contactstat =
new Contact($this->db);
313 $res = $contactstat->fetch(0,
null,
'', $arraymsgs[
'fk_contact_author']);
315 print $contactstat->getNomUrl(0,
'nolink');
317 print $arraymsgs[
'fk_contact_author'];
320 print
'<span class="opacitymedium">'.$langs->trans(
'Unknown').
'</span>';
326 print
'<tr class="oddeven nohover">';
327 print
'<td'.($show_user ?
' colspan="2"' :
'').
'>';
328 print $arraymsgs[
'message'];
332 $documents = array();
334 $sql =
'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id';
335 $sql .=
', ecm.filepath, ecm.filename, ecm.share';
336 $sql .=
' FROM '.MAIN_DB_PREFIX.
'ecm_files ecm';
337 $sql .=
" WHERE ecm.filepath = 'agenda/".$arraymsgs[
'id'].
"'";
338 $sql .=
' ORDER BY ecm.position ASC';
340 $resql = $this->db->query($sql);
342 if ($this->db->num_rows($resql)) {
343 while ($obj = $this->db->fetch_object($resql)) {
344 $documents[$obj->id] = $obj;
348 if (!empty($documents)) {
350 $footer =
'<div class="timeline-documents-container">';
351 foreach ($documents as $doc) {
352 if (!empty($doc->share)) {
354 $footer .=
'<span id="document_'.$doc->id.
'" class="timeline-documents" ';
355 $footer .=
' data-id="'.$doc->id.
'" ';
356 $footer .=
' data-path="'.$doc->filepath.
'"';
357 $footer .=
' data-filename="'.dol_escape_htmltag($doc->filename).
'" ';
360 $filePath = DOL_DATA_ROOT.
'/'.$doc->filepath.
'/'.$doc->filename;
362 $thumb = $arraymsgs[
'id'].
'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename,
'.')).
'_mini'.substr($doc->filename, strrpos($doc->filename,
'.'));
363 $doclink = DOL_URL_ROOT.
'/document.php?hashp='.urlencode($doc->share);
365 $mimeAttr =
' mime="'.$mime.
'" ';
367 if (in_array($mime, array(
'image/png',
'image/jpeg',
'application/pdf'))) {
368 $class .=
' documentpreview';
371 $footer .=
'<a href="'.$doclink.
'" class="btn-link '.$class.
'" target="_blank" '.$mimeAttr.
' >';
372 $footer .=
img_mime($filePath).
' '.$doc->filename;
375 $footer .=
'</span>';
379 if ($isshared == 1) {
394 print
'<div class="ticketpublicarea ticketlargemargin centpercent">';
395 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
410 global $conf, $langs, $user;
413 $ret =
$object->loadCacheMsgsTicket();
416 if (is_array(
$object->cache_msgs_ticket) && count(
$object->cache_msgs_ticket) > 0) {
417 print
'<section id="cd-timeline">';
419 foreach (
$object->cache_msgs_ticket as
$id => $arraymsgs) {
420 if (!$arraymsgs[
'private']
421 || ($arraymsgs[
'private'] ==
"1" && $show_private)
423 print
'<div class="cd-timeline-block">';
424 print
'<div class="cd-timeline-img">';
425 print
'<img src="img/messages.png" alt="">';
426 print
'</div> <!-- cd-timeline-img -->';
428 print
'<div class="cd-timeline-content">';
429 print $arraymsgs[
'message'];
431 print
'<span class="cd-date">';
435 if ($arraymsgs[
'fk_user_action'] > 0) {
436 $userstat =
new User($this->db);
437 $res = $userstat->fetch($arraymsgs[
'fk_user_action']);
440 print $userstat->getNomUrl(1);
444 print $langs->trans(
'Customer');
448 print
'</div> <!-- cd-timeline-content -->';
449 print
'</div> <!-- cd-timeline-block -->';
454 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
468 print
'<div class="div-table-responsive-no-min margintoponly navBarForStatus">';
469 print
'<div class="centpercent right">';
471 $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
473 $exclude_status = array_merge($exclude_status, array((
int)
$object->status));
476 $exclude_status[] = $object::STATUS_WAITING;
482 foreach (
$object->labelStatusShort as $status => $status_label) {
483 if (!in_array($status, $exclude_status)) {
484 print
'<div class="inline-block center margintoponly marginbottomonly">';
487 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.
$object->track_id.
'&action=set_read&token='.
newToken();
489 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.
$object->track_id.
'&action=confirm_set_status&token='.
newToken().
'&new_status='.((int) $status);
492 print
'<a class="butAction butStatus marginbottomonly" href="'.$urlforbutton.
'">';
493 print
$object->LibStatut($status, 3, 1).
' ';
495 print $langs->trans(
$object->labelStatusShort[$status]);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
$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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
Class to generate the form for creating a new ticket.