61 global $conf, $user, $langs;
65 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
67 $text = $langs->trans(
"BoxLastModifiedTicketDescription", $max);
68 $this->info_box_head = array(
69 'text' => $text.
'<a class="paddingleft" href="'.DOL_URL_ROOT.
'/ticket/list.php?sortfield=t.tms&sortorder=DESC"><span class="badge">...</span></a>',
73 $this->info_box_contents[0][0] = array(
74 'td' =>
'class="left"',
75 'text' => $langs->trans(
"BoxLastModifiedTicketContent"),
78 if ($user->hasRight(
'ticket',
'read')) {
79 $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.tms as datem, t.date_read, t.date_close, t.origin_email ";
80 $sql .=
", type.label as type_label, category.label as category_label, severity.label as severity_label";
81 $sql .=
", s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
82 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
83 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_type as type ON type.code=t.type_code";
84 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_category as category ON category.code=t.category_code";
85 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_severity as severity ON severity.code=t.severity_code";
86 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid=t.fk_soc";
88 $sql .=
" WHERE t.entity IN (".getEntity(
'ticket').
')';
92 $sql .=
" AND t.fk_soc = ".((int) $user->socid);
95 $sql .=
" ORDER BY t.tms DESC, t.rowid DESC";
96 $sql .= $this->db->plimit($max, 0);
98 $resql = $this->db->query($sql);
100 $num = $this->db->num_rows($resql);
105 $objp = $this->db->fetch_object($resql);
106 $datec = $this->db->jdate($objp->datec);
107 $datem = $this->db->jdate($objp->datem);
109 $ticket =
new Ticket($this->db);
110 $ticket->id = $objp->id;
111 $ticket->track_id = $objp->track_id;
112 $ticket->ref = $objp->ref;
113 $ticket->subject = $objp->subject;
114 $ticket->date_creation = $datec;
115 $ticket->date_modification = $datem;
118 $ticket->status = $objp->status;
119 $ticket->statut = $objp->status;
120 if ($objp->fk_soc > 0) {
121 $thirdparty =
new Societe($this->db);
122 $thirdparty->id = $objp->fk_soc;
123 $thirdparty->email = $objp->socemail;
124 $thirdparty->client = $objp->client;
125 $thirdparty->fournisseur = $objp->fournisseur;
126 $thirdparty->name = $objp->company_name;
127 $link = $thirdparty->getNomUrl(1);
136 $this->info_box_contents[$i][0] = array(
137 'td' =>
'class="nowraponall"',
138 'text' => $ticket->getNomUrl(1),
144 $this->info_box_contents[$i][$r] = array(
145 'td' =>
'class="nowrap tdoverflowmax150"',
146 'text' => $objp->subject,
147 'url' => DOL_URL_ROOT.
"/ticket/card.php?track_id=".$objp->track_id,
152 $this->info_box_contents[$i][$r] = array(
153 'td' =>
'class="tdoverflowmax150"',
160 $this->info_box_contents[$i][$r] = array(
167 $this->info_box_contents[$i][$r] = array(
168 'td' =>
'class="right nowraponall"',
169 'text' => $ticket->getLibStatut(3)
177 $this->info_box_contents[$i][0] = array(
179 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxLastModifiedTicketNoRecordedTickets").
'</span>'
186 $this->info_box_contents[0][0] = array(
188 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',