Skip to content

Commit 9ebb5d3

Browse files
authored
Merge pull request #6494 from yverhenne/clean-ticket-export
Ticket : #add subject to ticket xls export
2 parents 660730f + f8899d0 commit 9ebb5d3

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

main/ticket/tickets.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function display_advanced_search_form () {
9595
$data = [
9696
[
9797
'#',
98+
get_lang('Subject'),
9899
get_lang('Status'),
99100
get_lang('Date'),
100101
get_lang('LastUpdate'),
@@ -106,10 +107,26 @@ function display_advanced_search_form () {
106107
],
107108
];
108109
$datos = $table->get_clean_html();
110+
$ticketTable = Database::get_main_table(TABLE_TICKET_TICKET);
109111
foreach ($datos as $ticket) {
110-
$ticket[0] = substr(strip_tags($ticket[0]), 0, 12);
112+
$ticketId = 0;
113+
if (preg_match('/ticket_id=(\d+)/', $ticket[0], $matches)) {
114+
$ticketId = (int) $matches[1];
115+
}
116+
$ticketCode = '';
117+
$ticketTitle = '';
118+
if ($ticketId > 0) {
119+
$sql = "SELECT code, subject FROM $ticketTable WHERE id = $ticketId";
120+
$rs = Database::query($sql);
121+
if ($row = Database::fetch_array($rs)) {
122+
$ticketCode = $row['code'];
123+
$ticketTitle = $row['subject'];
124+
}
125+
}
126+
111127
$ticket_rem = [
112-
utf8_decode(strip_tags($ticket[0])),
128+
utf8_decode($ticketCode),
129+
utf8_decode($ticketTitle),
113130
utf8_decode(api_html_entity_decode($ticket[1])),
114131
utf8_decode(strip_tags($ticket[2])),
115132
utf8_decode(strip_tags($ticket[3])),
@@ -439,4 +456,4 @@ function display_advanced_search_form () {
439456
}
440457

441458
$table->display();
442-
Display::display_footer();
459+
Display::display_footer();

0 commit comments

Comments
 (0)