26require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/fichinter/class/fichinter.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
59 public $errors = array();
104 if (!is_object($this->dao)) {
105 $this->dao =
new Ticket($this->db);
117 public function fetch($id = 0, $ref =
'', $track_id =
'')
120 return $this->dao->fetch($id, $ref, $track_id);
132 $this->dao->fk_statut = $this->fk_statut;
133 return $this->dao->getLibStatut($mode);
145 $this->dao->fetch($id,
'', $track_id);
147 $this->label = $this->dao->label;
161 if ($action ==
'create') {
162 return $langs->trans(
"CreateTicket");
163 } elseif ($action ==
'edit') {
164 return $langs->trans(
"EditTicket");
165 } elseif ($action ==
'view') {
166 return $langs->trans(
"TicketCard");
167 } elseif ($action ==
'add_message') {
168 return $langs->trans(
"TicketAddMessage");
170 return $langs->trans(
"TicketsManagement");
184 global $conf, $langs;
186 print
'<!-- initial message of ticket -->'.
"\n";
187 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
190 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="post">';
191 print
'<input type="hidden" name="token" value="'.newToken().
'">';
192 print
'<input type="hidden" name="track_id" value="'.$object->track_id.
'">';
193 print
'<input type="hidden" name="action" value="set_message">';
197 print
'<div class="underbanner clearboth"></div>';
198 print
'<div class="div-table-responsive-no-min">';
199 print
'<table class="noborder centpercent margintable margintablenotop">';
200 print
'<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
201 print $langs->trans(
"InitialMessage");
203 if ($user->hasRight(
"ticket",
"manage")) {
204 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>';
209 print
'<td colspan="2">';
210 if ($user->hasRight(
'ticket',
'manage') && $action ==
'edit_message_init') {
212 $msg = GETPOSTISSET(
'message_initial') ?
GETPOST(
'message_initial',
'restricthtml') : $object->message;
213 include_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
214 $uselocalbrowser =
true;
216 $doleditor =
new DolEditor(
'message_initial', $msg,
'100%', 250,
'dolibarr_details',
'In',
true, $uselocalbrowser, $ckeditorenabledforticket, ROWS_9,
'95%');
217 $doleditor->Create();
221 print
'<div class="longmessagecut">';
228 print
'<div class="longmessagecut">';
238 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
239 print
'<div class="center">';
240 print
' <input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
241 print
' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
249 if (!empty($user->rights->ticket->manage) && $action ==
'edit_message_init') {
265 global $conf, $langs, $user;
268 $ret = $this->dao->loadCacheMsgsTicket();
273 $action =
GETPOST(
'action',
'aZ09');
277 if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
278 print
'<table class="border" style="width:100%;">';
280 print
'<tr class="liste_titre">';
283 print $langs->trans(
'TicketMessagesList');
288 print $langs->trans(
'User');
293 foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) {
294 if (!$arraymsgs[
'private']
295 || ($arraymsgs[
'private'] ==
"1" && $show_private)
298 print
'<tr class="oddeven">';
299 print
'<td><strong>';
300 print
img_picto(
'',
'object_action',
'class="paddingright"').dol_print_date($arraymsgs[
'datep'],
'dayhour');
301 print
'<strong></td>';
304 if ($arraymsgs[
'fk_user_author'] > 0) {
305 $userstat =
new User($this->db);
306 $res = $userstat->fetch($arraymsgs[
'fk_user_author']);
308 print $userstat->getNomUrl(0);
310 } elseif (isset($arraymsgs[
'fk_contact_author'])) {
311 $contactstat =
new Contact($this->db);
312 $res = $contactstat->fetch(0,
null,
'', $arraymsgs[
'fk_contact_author']);
314 print $contactstat->getNomUrl(0,
'nolink');
316 print $arraymsgs[
'fk_contact_author'];
319 print $langs->trans(
'Customer');
324 print
'<tr class="oddeven">';
325 print
'<td colspan="2">';
326 print $arraymsgs[
'message'];
334 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
348 global $conf, $langs, $user;
351 $ret = $object->loadCacheMsgsTicket();
354 if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) {
355 print
'<section id="cd-timeline">';
357 foreach ($object->cache_msgs_ticket as $id => $arraymsgs) {
358 if (!$arraymsgs[
'private']
359 || ($arraymsgs[
'private'] ==
"1" && $show_private)
361 print
'<div class="cd-timeline-block">';
362 print
'<div class="cd-timeline-img">';
363 print
'<img src="img/messages.png" alt="">';
364 print
'</div> <!-- cd-timeline-img -->';
366 print
'<div class="cd-timeline-content">';
367 print $arraymsgs[
'message'];
369 print
'<span class="cd-date">';
373 if ($arraymsgs[
'fk_user_action'] > 0) {
374 $userstat =
new User($this->db);
375 $res = $userstat->fetch($arraymsgs[
'fk_user_action']);
378 print $userstat->getNomUrl(1);
382 print $langs->trans(
'Customer');
386 print
'</div> <!-- cd-timeline-content -->';
387 print
'</div> <!-- cd-timeline-block -->';
392 print
'<div class="info">'.$langs->trans(
'NoMsgForThisTicket').
'</div>';
406 print
'<div class="div-table-responsive-no-min margintoponly navBarForStatus">';
407 print
'<div class="centpercent right">';
409 $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED);
411 $exclude_status = array_merge($exclude_status, array(intval($object->fk_statut)));
416 foreach ($object->statuts_short as $status => $status_label) {
417 if (!in_array($status, $exclude_status)) {
418 print
'<div class="inline-block center marginbottomonly">';
421 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=set_read&token='.newToken();
423 $urlforbutton = $_SERVER[
'PHP_SELF'].
'?track_id='.$object->track_id.
'&action=confirm_set_status&token='.newToken().
'&new_status='.((int) $status);
426 print
'<a class="butAction butStatus marginbottomonly" href="'.$urlforbutton.
'">';
427 print $object->LibStatut($status, 3, 1).
' ';
429 print $langs->trans($object->statuts_short[$status]);
454 if (in_array(
'admin', explode(
':', $parameters[
'context']))) {
455 $this->results = array(
'ticket_send' => $langs->trans(
'MailToSendTicketMessage'));
461 $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 $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_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)
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.
dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox=0, $check='restricthtml')
Sanitize a HTML to remove js and dangerous content.
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.