https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43879
--- Comment #6 from David Nind <[email protected]> --- Created attachment 208838 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208838&action=edit Bug 43879: Reindex the record when a withdrawn item blocks the return If the item is not checked out but has items.onloan set, AddReturn clears onloan with skip_record_index, as the record is reindexed at the end of the function. When the item is withdrawn and BlockReturnOfWithdrawnItems blocks the return, AddReturn returned early, before that reindex, so the search results kept showing the item as checked out. This patch reindexes the record before that early return when onloan has been cleared, the same way the Wrongbranch early return already does. When RecordLocalUseOnReturn is enabled, the localuse store already reindexes the record, so it is not reindexed a second time. Note: this only affects items that are NOT checked out (no row in the issues table) but still have items.onloan set. If the item is really checked out, blocking the return keeps the checkout, which is the expected behaviour, so do not check the item out to test this. Steps to follow: 1. Make sure the search index is updated automatically: in KTD with Elasticsearch, check that the indexer is running (koha-es-indexer --status kohadev, or --start kohadev). 2. Enable BlockReturnOfWithdrawnItems and disable RecordLocalUseOnReturn (the defaults in KTD). 3. Take an item that is not checked out, set it as withdrawn and set items.onloan directly in the database, for example: SELECT COUNT(*) FROM issues WHERE itemnumber = X; -- must be 0 UPDATE items SET withdrawn = 1, onloan = CURDATE() WHERE itemnumber = X; and reindex its record: misc/search_tools/rebuild_elasticsearch.pl -b --bnumber <biblionumber> 4. Search the catalog: the item is shown as checked out. 5. Check the item in: the return is blocked (item withdrawn). SELECT onloan FROM items WHERE itemnumber = X; -- now NULL but the search results still show the item as checked out. 6. Apply the patch and restart_all (or restart Plack). 7. Repeat steps 3 to 5. Now the search results no longer show the item as checked out, only as withdrawn. 8. Enable RecordLocalUseOnReturn and repeat steps 3 to 5: local use is recorded and the record is reindexed (only once). 9. prove t/db_dependent/Circulation.t Signed-off-by: Adolfo RodrÃguez <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: David Nind <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
