https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42383

--- Comment #57 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209608
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209608&action=edit
Bug 42383: (QA follow-up) Tell 'hold not found' from 'item on loan'

This patch makes Koha::Checkin->confirm_hold handle the three possible
ModReserveAffect return values explicitly:

- 1: the hold was set aside (success)
- 0: the item is on loan and the hold is not waiting. A
  Koha::Exceptions::Checkin::ItemCheckedOut exception is thrown, as
  before
- undef: the hold was not found. A new
  Koha::Exceptions::Checkin::HoldNotFound exception is thrown

Before, an undef return was reported as 'item checked out', which was
misleading. The hold not being found means it was cancelled or filled
between the check-in and the confirmation (e.g. from another
workstation): this is a conflict with the current state rather than a
no-op, as the staff member asked for something that did not happen, so
it is reported. confirm_hold now also throws HoldNotFound when the
checkin's hold is gone before calling ModReserveAffect, instead of
dying on an undefined value.

POST /checkins/{checkin_id}/hold_confirmation maps HoldNotFound to a
409 response with the 'hold_not_found' error_code.

It addresses point 12 of the QA comment.

Test plan:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Checkin.t \
           t/db_dependent/api/v1/checkins.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)

-- 
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/

Reply via email to