Bug 35944

Summary: Bookings is not taken into account in CanBookBeRenewed
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: CirculationAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: david, fridolin.somers, gmcharlt, kyle.m.hall, lucas, m.de.rooy, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.05
Circulation function:
Bug Depends on: 35248    
Bug Blocks: 34440    
Attachments: Bug 35944: Unit tests
Bug 35944: Add booking handling to CanBookBeRenewed
Bug 35944: Unit tests
Bug 35944: Add booking handling to CanBookBeRenewed
Bug 35944: Add message to SIP renewal attempt
Bug 35944: Add link to 'booked' biblio in checkouts table
Bug 35944: Unit tests
Bug 35944: Add booking handling to CanBookBeRenewed
Bug 35944: Add message to SIP renewal attempt
Bug 35944: Add link to 'booked' biblio in checkouts table
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Bug 35944: (QA follow-up) Tidy
Bug 35944: Unit tests
Bug 35944: Add booking handling to CanBookBeRenewed
Bug 35944: Add message to SIP renewal attempt
Bug 35944: Add link to 'booked' biblio in checkouts table
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Bug 35944: (QA follow-up) Tidy

Description Martin Renvoize (ashimema) 2024-01-30 14:17:12 UTC
I missed renewals booking checks in the original submission.. it needs adding to prevent renewals that would overlap with a future booking.
Comment 1 Martin Renvoize (ashimema) 2024-02-25 11:15:25 UTC
Created attachment 162407 [details] [review]
Bug 35944: Unit tests
Comment 2 Martin Renvoize (ashimema) 2024-02-25 11:15:27 UTC
Created attachment 162408 [details] [review]
Bug 35944: Add booking handling to CanBookBeRenewed

This patch adds a bookings check to CanBookBeRenewed
Comment 3 David Nind 2024-02-26 06:50:49 UTC
Created attachment 162417 [details] [review]
Bug 35944: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2024-02-26 06:50:52 UTC
Created attachment 162418 [details] [review]
Bug 35944: Add booking handling to CanBookBeRenewed

This patch adds a bookings check to CanBookBeRenewed

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2024-02-26 06:52:24 UTC
Note: With the patch applied, and a booking made so that the item can't be renewed - text displayed under '0 booked' says "(5 of 5 renewals remaining)".

Testing notes (using KTD):

1. Make an item bookable:
   - Find a record with items
   - Go to the details page
   - Go to the items tab
   - For the item priority, change bookable to 'Yes'

2. Check out the item to a patron

3. Make a booking for another patron for a period that would be covered by the next renewal:
   - From the record page, select 'Place booking'
   - Select a patron
   - Select a period (starting date and ending date)
   - Submit

4. Renew the item - it is renewed, even though it is also booked during the period covered by the renewal

5. Cancel the booking and check in the item.

6. Apply the patch (including all the dependencies), updatedatabase, restart_all

7. Repeat steps 2 and 3

8. Should be unable to renew the item - should show 'booked' instead of the normal check box to select the item for renewal.

9. Tests should pass before and after the patch is applied: prove t/db_dependent/Circulation.t
Comment 6 Martin Renvoize (ashimema) 2024-02-26 09:28:35 UTC
Created attachment 162423 [details] [review]
Bug 35944: Add message to SIP renewal attempt

This patch adds a replacement for 'booked' to the SIP renewal handling
so we can display 'Item is booked for another borrower'.
Comment 7 Martin Renvoize (ashimema) 2024-02-26 09:28:37 UTC
Created attachment 162424 [details] [review]
Bug 35944: Add link to 'booked' biblio in checkouts table

This patch updates the checkouts table so handle 'booked' items
including linking to the biblio booking details page.
Comment 8 Martin Renvoize (ashimema) 2024-02-26 09:43:26 UTC
Just a couple of minor follow-ups to improve translatability in the checkouts table and properly handle things in SIP.

Thanks for testing David :)
Comment 9 Martin Renvoize (ashimema) 2024-02-26 12:27:07 UTC
*** Bug 36040 has been marked as a duplicate of this bug. ***
Comment 10 Marcel de Rooy 2024-03-01 08:47:10 UTC
There is a whole dependency tree still in PQA for this one. Skipping for now.
Comment 11 Nick Clemens (kidclamp) 2024-03-15 11:40:23 UTC
Created attachment 163201 [details] [review]
Bug 35944: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Nick Clemens (kidclamp) 2024-03-15 11:40:26 UTC
Created attachment 163202 [details] [review]
Bug 35944: Add booking handling to CanBookBeRenewed

This patch adds a bookings check to CanBookBeRenewed

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 Nick Clemens (kidclamp) 2024-03-15 11:40:29 UTC
Created attachment 163203 [details] [review]
Bug 35944: Add message to SIP renewal attempt

This patch adds a replacement for 'booked' to the SIP renewal handling
so we can display 'Item is booked for another borrower'.
Comment 14 Nick Clemens (kidclamp) 2024-03-15 11:40:32 UTC
Created attachment 163204 [details] [review]
Bug 35944: Add link to 'booked' biblio in checkouts table

This patch updates the checkouts table so handle 'booked' items
including linking to the biblio booking details page.
Comment 15 Nick Clemens (kidclamp) 2024-03-15 11:40:35 UTC
Created attachment 163205 [details] [review]
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Comment 16 Nick Clemens (kidclamp) 2024-03-15 11:40:38 UTC
Created attachment 163206 [details] [review]
Bug 35944: (QA follow-up) Tidy
Comment 17 Nick Clemens (kidclamp) 2024-03-15 11:41:55 UTC
Very minor rebase, small follow-up to address performance concerns - could you just give a nod Martin?
Comment 18 Nick Clemens (kidclamp) 2024-03-15 11:47:45 UTC
Created attachment 163208 [details] [review]
Bug 35944: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 Nick Clemens (kidclamp) 2024-03-15 11:47:48 UTC
Created attachment 163209 [details] [review]
Bug 35944: Add booking handling to CanBookBeRenewed

This patch adds a bookings check to CanBookBeRenewed

Signed-off-by: David Nind <david@davidnind.com>
Comment 20 Nick Clemens (kidclamp) 2024-03-15 11:47:51 UTC
Created attachment 163210 [details] [review]
Bug 35944: Add message to SIP renewal attempt

This patch adds a replacement for 'booked' to the SIP renewal handling
so we can display 'Item is booked for another borrower'.
Comment 21 Nick Clemens (kidclamp) 2024-03-15 11:47:54 UTC
Created attachment 163211 [details] [review]
Bug 35944: Add link to 'booked' biblio in checkouts table

This patch updates the checkouts table so handle 'booked' items
including linking to the biblio booking details page.
Comment 22 Nick Clemens (kidclamp) 2024-03-15 11:47:57 UTC
Created attachment 163212 [details] [review]
Bug 35944: (QA follow-up) Check if there are bookings before other calculations
Comment 23 Nick Clemens (kidclamp) 2024-03-15 11:48:00 UTC
Created attachment 163213 [details] [review]
Bug 35944: (QA follow-up) Tidy
Comment 24 Martin Renvoize (ashimema) 2024-03-15 11:57:19 UTC
Very happy with the follow-up, it gets my vote :)
Comment 25 Katrin Fischer 2024-03-15 14:40:17 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 26 Fridolin Somers 2024-03-18 09:25:40 UTC
Waiting for Bug 35248 backport
Comment 27 Fridolin Somers 2024-04-17 09:25:34 UTC
Pushed to 23.11.x for 23.11.05
Comment 28 Lucas Gass (lukeg) 2024-05-13 14:46:18 UTC
Not needed in 23.05.x