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

--- Comment #31 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209564
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209564&action=edit
Bug 42383: Use snake_case for checkin availability keys

The checkin availability object (Koha::Item::Availability::Checkin) is
surfaced directly to the API through GET /checkins/availability and the
412 confirmation response, so its blocker/confirmation/warning keys are
API-facing values and should be standard, meaningful snake_case:

  NotIssued        -> not_issued          (confirmation)
  BlockedWithdrawn -> blocked_withdrawn    (blocker)
  BlockedLost      -> blocked_lost         (blocker)
  Wrongbranch      -> wrong_branch         (blocker)
    { Wrongbranch, Rightbranch } -> { wrong_branch, right_branch }

The keys are now documented in the checkin_availability definition.

AddReturn keeps consuming the availability object internally, and still
exposes its own legacy $messages hashref (Wrongbranch => { Wrongbranch,
Rightbranch }, NotIssued, ...) unchanged, so C4::SIP and existing
AddReturn callers/tests are unaffected: the snake_case values are mapped
back to the legacy structure where AddReturn builds $messages.

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

Assisted-by: Sonnet 4.6 (Anthropic)
Signed-off-by: Brendan Lawlor <[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/

Reply via email to