https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43844
--- Comment #2 from Arthur Suzuki <[email protected]> --- Created attachment 208416 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208416&action=edit Bug 43844: Prevent setting a hold waiting when its item is on loan Koha::Hold::set_waiting set found='W' unconditionally. Combined with C4::Reserves::ModReserveAffect (which attaches any item to the hold before calling set_waiting), this allowed a librarian to put an already-issued item into the waiting-for-pickup state from the circulation screen (op=cud-confirm_hold), even though an item on loan cannot be picked up for a hold. set_waiting now throws Koha::Exceptions::Hold::ItemOnLoan when the item attached to the hold is on loan. This is the single choke point where found='W' is set, so all callers are protected (staff UI, SIP, ILS-DI, automatic checkin, hold autofill). The check uses the same items.onloan condition as the existing AddReserve guard. All legitimate callers operate on items that are not on loan (returns/SIP/automatic checkin run after checkin, branch transfers use the transfer path, autofill runs on a shelf item), so they are unaffected. Test plan: 1. Add a biblio with one item. Check the item out to patron A. 2. Place an item-level hold on that item for patron B. 3. Circulation: scan patron B's card, then scan the item's barcode. The screen shows the item is issued to another patron and offers "Don't check out, confirm hold, and print slip". 4. Click "Confirm hold". => FAIL before the patch: the hold is set waiting (found='W') even though the item is still on loan to patron A. => SUCCESS after the patch: the hold is NOT set waiting; an error is displayed instead, and on patron B's account the hold is still "Pending" (not "Waiting") while the item stays on loan to patron A. 5. Check the item back in (Circulation > Check in, scan the barcode). => SUCCESS: the hold is set waiting (found='W') for patron B as usual; the item shows up in "Holds to pull" and can be picked up. 6. Run the unit tests: $ prove t/db_dependent/Reserves.t => SUCCESS: 73 tests pass, including the new regression subtest 'ModReserveAffect() does not set an item on loan waiting'. -- 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/
