For some kinds of ILL you need to create records and items for materials the library receives through ILL, so they ca be lent to patrons in the regular way. Normally, you do not want these records to display or be searchable in the OPAC, because they are not part of the collection of the library. My guess is most libraries will solve this by creating an itemtype called something like ILL, and use OpacHiddenItems to hide these records from browsing and searching in the OPAC.
When such an item is on loan to the patron it does show up in "my summary" in the OPAC, but the link from the title leads to a 404, which is not ideal.
A couple of different solutions come to mind:
1. Detect that the item on loan is hidden and don't display the link
2. Detect that the item on loan is hidden and display the record in some other way than through a link to the regular OPAC detail view, for example in a pop-up.
*** Bug 27734 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of bug 27734 ***