69 global $conf, $user, $langs;
73 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
75 $text = $langs->trans(
"BoxLastModifiedTicketDescription", $max);
76 $this->info_box_head = array(
81 $this->info_box_contents[0][0] = array(
82 'td' =>
'class="left"',
83 'text' => $langs->trans(
"BoxLastModifiedTicketContent"),
86 if ($user->hasRight(
'ticket',
'read')) {
87 $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 ";
88 $sql .=
", type.label as type_label, category.label as category_label, severity.label as severity_label";
89 $sql .=
", s.nom as company_name, s.email as socemail, s.client, s.fournisseur";
90 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
91 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_type as type ON type.code=t.type_code";
92 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_category as category ON category.code=t.category_code";
93 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_ticket_severity as severity ON severity.code=t.severity_code";
94 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid=t.fk_soc";
96 $sql .=
" WHERE t.entity IN (".getEntity(
'ticket').
')';
100 $sql .=
" AND t.fk_soc = ".((int) $user->socid);
103 $sql .=
" ORDER BY t.tms DESC, t.rowid DESC";
104 $sql .= $this->db->plimit($max, 0);
106 $resql = $this->db->query($sql);
108 $num = $this->db->num_rows($resql);
113 $objp = $this->db->fetch_object($resql);
114 $datec = $this->db->jdate($objp->datec);
115 $datem = $this->db->jdate($objp->datem);
117 $ticket =
new Ticket($this->db);
118 $ticket->id = $objp->id;
119 $ticket->track_id = $objp->track_id;
120 $ticket->ref = $objp->ref;
121 $ticket->subject = $objp->subject;
122 $ticket->date_creation = $datec;
123 $ticket->date_modification = $datem;
126 $ticket->status = $objp->status;
127 $ticket->statut = $objp->status;
128 if ($objp->fk_soc > 0) {
129 $thirdparty =
new Societe($this->db);
130 $thirdparty->id = $objp->fk_soc;
131 $thirdparty->email = $objp->socemail;
132 $thirdparty->client = $objp->client;
133 $thirdparty->fournisseur = $objp->fournisseur;
134 $thirdparty->name = $objp->company_name;
135 $link = $thirdparty->getNomUrl(1);
144 $this->info_box_contents[$i][0] = array(
145 'td' =>
'class="nowraponall"',
146 'text' => $ticket->getNomUrl(1),
152 $this->info_box_contents[$i][$r] = array(
153 'td' =>
'class="nowrap tdoverflowmax150"',
154 'text' => $objp->subject,
155 'url' => DOL_URL_ROOT.
"/ticket/card.php?track_id=".$objp->track_id,
160 $this->info_box_contents[$i][$r] = array(
161 'td' =>
'class="tdoverflowmax150"',
168 $this->info_box_contents[$i][$r] = array(
175 $this->info_box_contents[$i][$r] = array(
176 'td' =>
'class="right nowraponall"',
177 'text' => $ticket->getLibStatut(3)
185 $this->info_box_contents[$i][0] = array(
187 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"BoxLastModifiedTicketNoRecordedTickets").
'</span>'
194 $this->info_box_contents[0][0] = array(
196 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',