Bug 36428 - Current bookings are not counted in record side bar
Summary: Current bookings are not counted in record side bar
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Style guide (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Bugs List
URL:
Keywords:
Depends on: 29002
Blocks: 37065
  Show dependency treegraph
 
Reported: 2024-03-26 12:58 UTC by Nick Clemens (kidclamp)
Modified: 2024-06-10 18:59 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 36428: Add Bookings->filter_by_active and use it for display (7.03 KB, patch)
2024-05-31 11:20 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-03-26 12:58:25 UTC
When a booking becomes active it is no longer counted in the sidebar on the biblio page.

To test:
1 - Make an item bookable from the items tab on a record details
2 - Return to details view and place a booking
3 - Note sidebar says "Bookings (1)"
4 - Make the booking current from the DB:
    UPDATE bookings SET start_date=NOW() WHERE biblio_id={biblionumber};
5 - Reload the page
6 - NOte the count is now "Bookings (0)"
Comment 1 Nick Clemens (kidclamp) 2024-05-31 11:20:37 UTC
Created attachment 167308 [details] [review]
Bug 36428: Add Bookings->filter_by_active and use it for display

Currently the bookings tab on a biblio details and patron details use 'filter_by_future'
which lists upcoming bookings.

Libraries would like to see upcoming, and active bookings in these cases, and we should add a filter
for bookings that have not ended.

NOTE: This removes the only uses of filter_by_future, but I preserve this for Martin's decision as the creator
of the bookings module

To test:
 1 - Make an item bookable from the items tab on a record details
 2 - Return to details view and place a booking
 3 - Note sidebar says "Bookings (1)"
 4 - Make the booking current from the DB:
     UPDATE bookings SET start_date=NOW() WHERE biblio_id={biblionumber};
 5 - Reload the page
 6 - Note the count is now "Bookings (0)"
 7 - View the patron's details page - note "Bookings (0)" and none listed
 8 - Apply patch
 9 - Reload biblio details, note Bookings(1)
10 - Reload patron details, note Bookings(1) and booking is listed
11 - End the booking:
     UPDATE bookings SET end_date=NOW() WHERE biblio_id={biblionumber};
12 - Confirm booking no longer listed on biblio or patron details
Comment 2 David Nind 2024-05-31 18:53:06 UTC
I followed through the test plan, but for step 12 the booking is still listed under the books section on the record details page (shows (0) in the sidebar though).

Maybe something to do with differences between desktop and KTD server times?
- KTD time: Fri May 31 06:51:09 PM UTC 2024
- Desktop time: Sat 01 Jun 2024 06:51:24 NZST

Bookings table on the record details page:

Item               Patron                       Pickup library Start date  End date    Actions
39999000011418 (1) Mary Burton (23529000651225) Centerville    05/31/2024  05/31/2024  Edit Cancel

Bookings database table:

select * from bookings;
+------------+-----------+-----------+---------+-------------------+---------------------+---------------------+
| booking_id | patron_id | biblio_id | item_id | pickup_library_id | start_date          | end_date            |
+------------+-----------+-----------+---------+-------------------+---------------------+---------------------+
|          1 |        49 |       262 |     578 | CPL               | 2024-05-31 18:39:03 | 2024-05-31 18:41:48 |
+------------+-----------+-----------+---------+-------------------+---------------------+---------------------+
1 row in set (0.001 sec)
Comment 3 Sam Lau 2024-06-03 17:51:33 UTC
I have the same issue as David. After ending the booking, the patron details page works as expected, however, the record details page booking tab still shows the booking. It also shows 0 for me in the sidebar as expected.
Comment 4 Nick Clemens (kidclamp) 2024-06-10 18:58:29 UTC
(In reply to David Nind from comment #2)
> I followed through the test plan, but for step 12 the booking is still
> listed under the books section on the record details page (shows (0) in the
> sidebar though).
> 
> Bookings table on the record details page:
> 
> Item               Patron                       Pickup library Start date 
> End date    Actions
> 39999000011418 (1) Mary Burton (23529000651225) Centerville    05/31/2024 
> 05/31/2024  Edit Cancel

This is expected -the bookings tab once loaded simply shows the most recent bookings, I only adjust the tab count and the patron page. I think it should be another bug to add a 'Show completed bookings' filter