Bug 35944 - Bookings is not taken into account in CanBookBeRenewed
Summary: Bookings is not taken into account in CanBookBeRenewed
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
: 36040 (view as bug list)
Depends on: 35248
Blocks: 34440
  Show dependency treegraph
 
Reported: 2024-01-30 14:17 UTC by Martin Renvoize (ashimema)
Modified: 2024-05-13 14:46 UTC (History)
7 users (show)

See Also:
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:


Attachments
Bug 35944: Unit tests (2.26 KB, patch)
2024-02-25 11:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35944: Add booking handling to CanBookBeRenewed (1.73 KB, patch)
2024-02-25 11:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35944: Unit tests (2.30 KB, patch)
2024-02-26 06:50 UTC, David Nind
Details | Diff | Splinter Review
Bug 35944: Add booking handling to CanBookBeRenewed (1.77 KB, patch)
2024-02-26 06:50 UTC, David Nind
Details | Diff | Splinter Review
Bug 35944: Add message to SIP renewal attempt (1.09 KB, patch)
2024-02-26 09:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35944: Add link to 'booked' biblio in checkouts table (1.52 KB, patch)
2024-02-26 09:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35944: Unit tests (2.30 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add booking handling to CanBookBeRenewed (1.73 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add message to SIP renewal attempt (1.09 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add link to 'booked' biblio in checkouts table (1.52 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: (QA follow-up) Check if there are bookings before other calculations (2.79 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: (QA follow-up) Tidy (3.36 KB, patch)
2024-03-15 11:40 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Unit tests (2.30 KB, patch)
2024-03-15 11:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add booking handling to CanBookBeRenewed (1.73 KB, patch)
2024-03-15 11:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add message to SIP renewal attempt (1.09 KB, patch)
2024-03-15 11:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: Add link to 'booked' biblio in checkouts table (1.52 KB, patch)
2024-03-15 11:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: (QA follow-up) Check if there are bookings before other calculations (1.83 KB, patch)
2024-03-15 11:47 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 35944: (QA follow-up) Tidy (3.36 KB, patch)
2024-03-15 11:48 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 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