64 global
$conf, $user, $langs;
68 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
70 $text = $langs->trans(
"BoxLastTicketDescription", $max);
71 $this->info_box_head = array(
72 'text' => $text.
'<a class="paddingleft" href="'.DOL_URL_ROOT.
'/ticket/list.php?sortfield=t.datec&sortorder=DESC"><span class="badge">...</span></a>',
76 $this->info_box_contents[0][0] = array(
77 'td' =>
'class="left"',
78 'text' => $langs->trans(
"BoxLastTicketContent"),
81 if ($user->hasRight(
'ticket',
'read')) {
82 $sql =
"SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut as status, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email,";
83 $sql .=
" type.label as type_label, category.label as category_label, severity.label as severity_label,";
84 $sql .=
" s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
85 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
86 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_type as type ON type.code=t.type_code";
87 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_category as category ON category.code=t.category_code";
88 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_severity as severity ON severity.code=t.severity_code";
89 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid=t.fk_soc";
90 $sql .=
" WHERE t.entity IN (".getEntity(
'ticket').
")";
94 $sql .=
" AND t.fk_soc= ".((int) $user->socid);
99 $sql .=
" ORDER BY t.datec DESC, t.rowid DESC ";
100 $sql .= $this->db->plimit($max, 0);
102 $resql = $this->db->query($sql);
104 $num = $this->db->num_rows($resql);
109 $objp = $this->db->fetch_object($resql);
111 $datec = $this->db->jdate($objp->datec);
116 $ticket =
new Ticket($this->db);
117 $ticket->id = $objp->id;
118 $ticket->track_id = $objp->track_id;
119 $ticket->ref = $objp->ref;
120 $ticket->fk_statut = $objp->status;
121 $ticket->status = $objp->status;
122 $ticket->subject = $objp->subject;
123 if ($objp->fk_soc > 0) {
124 $thirdparty =
new Societe($this->db);
125 $thirdparty->id = $objp->fk_soc;
126 $thirdparty->email = $objp->socemail;
127 $thirdparty->client = $objp->client;
128 $thirdparty->fournisseur = $objp->fournisseur;
129 $thirdparty->name = $objp->company_name;
130 $link = $thirdparty->getNomUrl(1);
132 $link =
'<span title="'.$objp->origin_email.
'">'.
dol_print_email($objp->origin_email).
'</span>';
138 $this->info_box_contents[$i][$r] = array(
139 'td' =>
'class="nowraponall"',
140 'text' => $ticket->getNomUrl(1),
146 $this->info_box_contents[$i][$r] = array(
147 'td' =>
'class="tdoverflowmax200"',
149 'url' => DOL_URL_ROOT.
"/ticket/card.php?track_id=".urlencode($objp->track_id),
154 $this->info_box_contents[$i][$r] = array(
155 'td' =>
'class="tdoverflowmax100"',
162 $this->info_box_contents[$i][$r] = array(
169 $this->info_box_contents[$i][$r] = array(
170 'td' =>
'class="right nowraponall"',
171 'text' => $ticket->getLibStatut(3),
179 $this->info_box_contents[$i][0] = array(
'td' =>
'',
'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxLastTicketNoRecordedTickets").
'</span>');
185 $this->info_box_contents[0][0] = array(
'td' =>
'',
186 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>');