Bug 32037

Summary: Circulation module in action logs has bad links for deleted items
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: ToolsAssignee: Nick Clemens (kidclamp) <nick>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, lucas, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.09, 21.11.16
Circulation function:
Attachments: Bug 32037: Check for existence of object before building link
Bug 32037: Check for existence of object before building link
Bug 32037: Check for existence of object before building link

Description Nick Clemens (kidclamp) 2022-10-28 14:42:30 UTC
The action log viewer attempts to build links to items/biblios etc.

These links are broken when the item is deleted

We are fetching the object to determine link values, so we should simply display the info field when no object is found
Comment 1 Nick Clemens (kidclamp) 2022-10-28 14:50:47 UTC
Created attachment 142775 [details] [review]
Bug 32037: Check for existence of object before building link

This patch adds a check on the existence of the object and passes this to the template

I also drop a level of IF by moving to ELSIF

To test:
 1 - Enable ReturnLog amd IssueLog
 2 - Checkout an item to a patron
 3 - Return it
 4 - View 'Modification log' tab of the borrwer
 5 - Note item links, test them, they work
 6 - Delete the item
 7 - Reload and try links again, they do not work
 8 - Apply patch
 9 - Reload, no more links
10 - Checkout and return another item
11 - This one has links, and they work as before
Comment 2 David Nind 2022-10-28 20:47:30 UTC
Created attachment 142790 [details] [review]
Bug 32037: Check for existence of object before building link

This patch adds a check on the existence of the object and passes this to the template

I also drop a level of IF by moving to ELSIF

To test:
 1 - Enable ReturnLog amd IssueLog
 2 - Checkout an item to a patron
 3 - Return it
 4 - View 'Modification log' tab of the borrwer
 5 - Note item links, test them, they work
 6 - Delete the item
 7 - Reload and try links again, they do not work
 8 - Apply patch
 9 - Reload, no more links
10 - Checkout and return another item
11 - This one has links, and they work as before

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Katrin Fischer 2022-11-02 12:32:43 UTC
Nick, Nick, Nick... Assignee! :)
Comment 4 Katrin Fischer 2022-11-02 17:27:29 UTC
Created attachment 143021 [details] [review]
Bug 32037: Check for existence of object before building link

This patch adds a check on the existence of the object and passes this to the template

I also drop a level of IF by moving to ELSIF

To test:
 1 - Enable ReturnLog amd IssueLog
 2 - Checkout an item to a patron
 3 - Return it
 4 - View 'Modification log' tab of the borrwer
 5 - Note item links, test them, they work
 6 - Delete the item
 7 - Reload and try links again, they do not work
 8 - Apply patch
 9 - Reload, no more links
10 - Checkout and return another item
11 - This one has links, and they work as before

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi (tcohen) 2022-11-04 22:25:50 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass (lukeg) 2023-01-18 21:16:42 UTC
Backpoted to 22.05.x for upcoming 22.05.09
Comment 7 Arthur Suzuki 2023-01-26 09:54:40 UTC
pushed to 21.11.x for 21.11.16
Comment 8 Wainui Witika-Park 2023-03-15 01:28:07 UTC
Not backported to 21.05.x