26 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
58 public $errors = array();
103 if (!is_object($this->dao)) {
116 public function fetch($id = 0, $ref =
'', $track_id =
'')
119 return $this->dao->fetch($id, $ref, $track_id);
131 $this->dao->fk_statut = $this->fk_statut;
132 return $this->dao->getLibStatut($mode);
144 $this->dao->fetch($id,
'', $track_id);
146 $this->label = $this->dao->label;
160 if ($action ==
'create') {
161 return $langs->trans(
"CreateTicket");
162 } elseif ($action ==
'edit') {
163 return $langs->trans(
"EditTicket");
164 } elseif ($action ==
'view') {
165 return $langs->trans(
"TicketCard");
166 } elseif ($action ==
'add_message') {
167 return $langs->trans(
"TicketAddMessage");
169 return $langs->trans(
"TicketsManagement");
183 global $conf, $langs;
185 print
'<!-- initial message of ticket -->'.
"\n";
186 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
189 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="post">';
190 print
'<input type="hidden" name="token" value="'.newToken().
'">';
191 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
192 print
'<input type="hidden" name="action" value="set_message">';
196 print
'<div class="underbanner clearboth"></div>';
197 print
'<div class="div-table-responsive-no-min">';
198 print
'<table class="noborder centpercent margintable margintablenotop">';
199 print
'<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
200 print $langs->trans(
"InitialMessage");
202 if ($user->hasRight(
"ticket",
"manage")) {
203 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>';
208 print
'<td colspan="2">';
209 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
211 $msg =
GETPOSTISSET(
'message_initial') ?
GETPOST(
'message_initial',
'restricthtml') : $object->message;
212 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
213 $uselocalbrowser =
true;
214 $ckeditorenabledforticket = $conf->global->FCKEDITOR_ENABLE_TICKET;
215 $doleditor =
new DolEditor(
'message_initial', $msg,
'100%', 250,
'dolibarr_details',
'In',
true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9,
'95%');
216 $doleditor->Create();
220 print
'<div class="longmessagecut">';
227 print
'<div class="longmessagecut">';
237 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
238 print
'<div class="center">';
239 print
' <input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
240 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
248 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
264 global $conf, $langs, $user;
267 $ret = $this->dao->loadCacheMsgsTicket();
272 $action =
GETPOST(
'action',
'aZ09');
276 if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
277 print
'<table class="border" style="width:100%;">';
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[
'datec'],
'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);
310 print $langs->trans(
'Customer');
315 print
'<tr class="oddeven">';
316 print
'<td colspan="2">';
317 print $arraymsgs[
'message'];
325 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
339 global $conf, $langs, $user;
342 $ret = $object->loadCacheMsgsTicket();
345 if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
346 print
'<section id="cd-timeline">';
348 foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
349 if (!$arraymsgs[
'private']
350 || ($arraymsgs[
'private'] ==
"1" && $show_private)
352 print
'<div class="cd-timeline-block">';
353 print
'<div class="cd-timeline-img">';
354 print
'<img src="img/messages.png" alt="">';
355 print
'</div> <!-- cd-timeline-img -->';
357 print
'<div class="cd-timeline-content">';
358 print $arraymsgs[
'message'];
360 print
'<span class="cd-date">';
364 if ($arraymsgs[
'fk_user_action'] > 0) {
365 $userstat =
new User($this->
db);
366 $res = $userstat->fetch($arraymsgs[
'fk_user_action']);
369 print $userstat->getNomUrl(1);
373 print $langs->trans(
'Customer');
377 print
'</div> <!-- cd-timeline-content -->';
378 print
'</div> <!-- cd-timeline-block -->';
383 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
397 print
'<div class="div-table-responsive-no-min margintoponly navBarForStatus">';
398 print
'<div class="centpercent right">';
400 $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
402 $exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
407 foreach ($object->statuts_short as $status => $status_label) {
408 if (!in_array($status, $exclude_status)) {
409 print
'<div class="inline-block center marginbottomonly">';
412 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=mark_ticket_read';
414 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=confirm_set_status&token='.
newToken().
'&new_status='.$status;
417 print
'<a class="butAction butStatus marginbottomonly" href="'.$urlforbutton.
'">';
418 print $object->LibStatut($status, 3, 1).
' ';
420 print $langs->trans($object->statuts_short[$status]);
445 if (in_array(
'admin', explode(
':', $parameters[
'context']))) {
446 $this->results = array(
'ticket_send' => $langs->trans(
'MailToSendTicketMessage'));
452 $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.
Class to manage a WYSIWYG editor.
Class to manage Dolibarr users.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_nl2br($stringtoencode, $nl2brmode=0, $forxml=false)
Replace CRLF in string with a HTML BR tag.
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_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox=0, $check='restricthtml')
Sanitize a HTML to remove js and dangerous content.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Class to generate the form for creating a new ticket.
$conf db
API class for accounts.