[Koha-bugs] [Bug 16826] Add API routes for getting item availability and holdability

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jul 11 17:33:57 CEST 2016


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

--- Comment #3 from Lari Taskula <larit at student.uef.fi> ---
Created attachment 53271
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53271&action=edit
Bug 16826: Add API route for getting item availability

GET /availability/items?itemnumber=123
GET /availability/items?itemnumber=123+456+789
GET /availability/items?biblionumber=321
GET /availability/items?biblionumber=321+654+987

This patch adds above routes for checking item availability. The route does not
require login and does not consider patron status, as its purpose is to be fast
and efficient in checking general availability of item(s), much like in a
typical
search. Because of this, this route does not tell us whether item is holdable
or
available for checkout for a specific patron. Patron-specific availability will
be introduced in another patch.

For this route, item is NOT available if:
- item on loan,
- item reserved,
- item withdrawn,
- item lost,
- item restricted,
- item or itemtype not for loan

Depending on system preference, item may or may not be available:
- item damaged (depending on AllowHoldsOnDamagedItems),

The returned information is some necessary item information combined with:
- available (bool)
- availability_description ((array of strings) reasons for possible
  restrictions to availability, such as ["notforloan"])
- hold_queue_length (int)
- expected_available ((string) due date if onloan)

Possible values in availability_description are an empty array and any of:
"onloan", "reserved", "damaged", "withdrawn", "itemlost", "restricted",
"notforloan", "ordered"

Patch adds $item->get_availability() in Koha::Items and introduces a new
Koha::Item::Availability class where we can store item-related availability
information. Includes REST tests and unit tests for new subroutines in
Koha::Item and Koha::Item::Availability.

To test:
1. Play around with an item. Place a hold on it, checkout, set it damaged etc.
2. Make GET requests to /api/v1/availability/items?itemnumber=YYY, where
   YYY is an existing itemnumber. You can also try with biblionumber=XXX
   query parameter, where XXX is an existing biblionumber.
3. Check that the availability status is as described in the patch
   description above. Also make sure reasons for unavailability are in
   availability_description.
4. Repeat steps 1-3 until you are confident route works as expected.
5. Run the following tests:
   - t/Koha/Item/Availability.t
   - t/db_dependent/Items.t
   - t/db_dependent/api/v1/availability.t

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list