Bug 36428 - Current bookings are not counted in record side bar
Summary: Current bookings are not counted in record side bar
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on: 29002
Blocks: 37065
  Show dependency treegraph
 
Reported: 2024-03-26 12:58 UTC by Nick Clemens (kidclamp)
Modified: 2024-06-21 13:04 UTC (History)
7 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:
24.11.00


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
Bug 36428: Add Bookings->filter_by_active and use it for display (7.07 KB, patch)
2024-06-13 17:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 36428: Add Bookings->filter_by_active and use it for display (7.14 KB, patch)
2024-06-20 10:15 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 36428: (QA follow-up) Remove filter_by_future (3.34 KB, patch)
2024-06-20 10:15 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 36428: (QA follow-up) Add bookings_count class to patron details (1.41 KB, patch)
2024-06-20 10:15 UTC, Martin Renvoize
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
Comment 5 Sam Lau 2024-06-13 17:42:19 UTC
Created attachment 167694 [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

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 6 Martin Renvoize 2024-06-20 10:15:39 UTC
Created attachment 167929 [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

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2024-06-20 10:15:42 UTC
Created attachment 167930 [details] [review]
Bug 36428: (QA follow-up) Remove filter_by_future

I actually already started to remove this in another bug, but it makes
sense to do it here where we're introducing the 'active' filter.  I'm in
agreement that this should probably always have been an 'active' rather
than 'future' filtering.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2024-06-20 10:15:45 UTC
Created attachment 167931 [details] [review]
Bug 36428: (QA follow-up) Add bookings_count class to patron details

Somewhere along the line we lost the 'bookings_count' class in the
bookings tab display on the patron details and circulation page.

This patch restores is and as such also restores the correct count
numbers on 'place booking' and 'cancel booking' actions on those pages.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2024-06-20 10:16:07 UTC
Thanks all, glad to see this fixed.

Passing QA
Comment 10 Katrin Fischer 2024-06-21 13:04:09 UTC
Pushed for 24.11!

Well done everyone, thank you!