Issue 422 Calendar Open In Inbox Link - edmozley/freeitsm GitHub Wiki
๐ #422 Open in inbox on the tickets calendar did not open the ticket
GitHub #422, reported by @pappas81 ยท Tickets ยท fixed in 5.9.1 (#3115)
What you saw
On Tickets โ Calendar, clicking a scheduled ticket opens a small window with its details and an Open in inbox link. The link went to the ticket list, but not to the ticket.
What was wrong
The ticket list opens a ticket from the address when it carries ?ticket_id=. The calendar built its link with a different name:
// assets/js/calendar.js (before)
document.getElementById('ticketModalLink').href = `${inboxUrl}?ticket=${ticket.id}`;
?ticket=6 means nothing to the ticket list, so it opened with nothing selected.
@pappas81 pointed out it was probably a search-and-replace job and asked whether other links had the same fault - a good question, because a wrong name in one place is often a wrong name in several.
It was one place, not several
Every link in the app that opens the ticket list with a parameter was searched for ?ticket=. Two turned up:
- the calendar's Open in inbox - wrong;
- a ticket's Consumables link,
asset-management/consumables/?ticket=- right: that page reads$_GET['ticket']and checks you may see the ticket. It is a different page with its own parameter name, so it was left alone.
The fix
// assets/js/calendar.js (after)
document.getElementById('ticketModalLink').href = `${inboxUrl}?ticket_id=${ticket.id}`;
๐ Files
| File | Change |
|---|---|
๐ก assets/js/calendar.js |
?ticket_id= |
๐ฃ tickets/calendar.php |
calendar.js?v=12 |
How it was verified
The ticket list's own reader was checked for the name it expects (ticket_id), and the search above was run over every PHP and JavaScript file.
What this means for you
Upgrade to 5.9.1 and hard-refresh (Ctrl-F5), so the browser loads the new calendar script.