https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44342 Bug ID: 44342 Summary: With CirculateILL, checking in an item can mark the wrong ILL request returned, or reopen a completed one Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: ILL Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: lisette@bywatersolutions.com, pedro.amorim@openfifth.co.uk, tomascohen@gmail.com Target Milestone: --- With CirculateILL on, AddReturn finds the ILL request to mark returned with Koha::ILL::Requests->find( { biblio_id => $item->biblio->biblionumber } ); biblio_id is not unique in illrequests (a record can be linked to several requests: a repeat request for the same title, a request made against an existing record). find() on a non-unique column takes whichever row the database returns first (and DBIx::Class warns "Query returned more than one row"). The status of the request is not looked at either. So when a record has a completed request and the current, checked-out one, checking the item in can set the old COMP request back to RET and leave the real one at CHK. To reproduce (main 186bbe7): see the new subtest "Checking in with several requests on one record" in t/db_dependent/Koha/ILL/Requests.t: 1. One record with three ILL requests: COMP (oldest), REQ, CHK. 2. Check an item of that record out and back in. 3. Without the fix the COMP request becomes RET and the CHK request stays CHK, and the DBIx::Class warning is printed. Expected: the checked-out (CHK) request is marked RET; if there is none, the newest request still open; a request already RET or COMP is never changed. (The test file's "no warnings" test also fails on a koha-testing-docker without the PO files, "The PO directory has not been found"; that happens on main without this patch too.) -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.