Bug 35906 - Add bookable option on itemtypes
Summary: Add bookable option on itemtypes
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Thibaud Guillot (thibaud_g)
QA Contact: Paul Derscheid
URL:
Keywords: release-notes-needed
Depends on: 35248
Blocks: 38205 38434
  Show dependency treegraph
 
Reported: 2024-01-25 13:11 UTC by Thibaud Guillot (thibaud_g)
Modified: 2024-11-19 14:22 UTC (History)
12 users (show)

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


Attachments
Bug 35906: Add bookable option on itemtype (8.26 KB, patch)
2024-01-25 13:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.34 KB, patch)
2024-01-30 14:07 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.48 KB, patch)
2024-02-05 09:48 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (13.68 KB, patch)
2024-02-09 10:29 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.37 KB, patch)
2024-02-16 16:44 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906 : Add unit test (2.14 KB, patch)
2024-02-23 09:00 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.37 KB, patch)
2024-02-26 17:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.14 KB, patch)
2024-02-26 17:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (19.27 KB, patch)
2024-02-26 17:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.33 KB, patch)
2024-02-26 17:22 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.97 KB, patch)
2024-02-26 19:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.33 KB, patch)
2024-02-26 19:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (899 bytes, patch)
2024-02-26 19:28 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.45 KB, patch)
2024-03-18 08:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.14 KB, patch)
2024-03-18 08:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.98 KB, patch)
2024-03-18 08:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.33 KB, patch)
2024-03-18 08:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (899 bytes, patch)
2024-03-18 08:42 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.30 KB, patch)
2024-03-20 14:54 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.14 KB, patch)
2024-03-20 14:54 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.98 KB, patch)
2024-03-20 14:54 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.33 KB, patch)
2024-03-20 14:54 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (899 bytes, patch)
2024-03-20 14:54 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.30 KB, patch)
2024-04-10 08:13 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.14 KB, patch)
2024-04-10 08:13 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (23.04 KB, patch)
2024-04-10 08:13 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.33 KB, patch)
2024-04-10 08:13 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (899 bytes, patch)
2024-04-10 08:14 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (follow-up) fix missing bracket after rebase (652 bytes, patch)
2024-04-10 08:16 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (follow-up) rebased it (1.32 KB, patch)
2024-04-10 08:22 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (follow-up) rebased it (1.37 KB, patch)
2024-04-23 18:48 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.31 KB, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.14 KB, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.46 KB, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (3.00 KB, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (899 bytes, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (follow-up) rebased it (1.37 KB, patch)
2024-05-17 07:38 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (22.33 KB, patch)
2024-06-26 08:11 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (3.00 KB, patch)
2024-06-26 08:11 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (1.99 KB, patch)
2024-06-26 08:11 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.39 KB, patch)
2024-06-26 15:13 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.26 KB, patch)
2024-06-26 15:13 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.28 KB, patch)
2024-06-26 15:13 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (951 bytes, patch)
2024-06-26 15:13 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Schema dump (5.03 KB, patch)
2024-06-26 15:13 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.39 KB, patch)
2024-08-09 13:35 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.26 KB, patch)
2024-08-09 13:35 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.44 KB, patch)
2024-08-09 13:35 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (951 bytes, patch)
2024-08-09 13:36 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.38 KB, patch)
2024-08-09 13:36 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.39 KB, patch)
2024-08-22 08:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.26 KB, patch)
2024-08-22 08:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.37 KB, patch)
2024-08-22 08:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (951 bytes, patch)
2024-08-22 08:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Schema dump (4.37 KB, patch)
2024-08-22 08:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.37 KB, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.25 KB, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.34 KB, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (949 bytes, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: Schema dump (3.46 KB, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Add bookable option for API (851 bytes, patch)
2024-09-27 15:31 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Ensure we return effective_bookable (1.20 KB, patch)
2024-10-18 08:11 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Unit tests for effective_bookable (2.72 KB, patch)
2024-10-18 10:41 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.43 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.31 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.40 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (1008 bytes, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Schema dump (3.51 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Add bookable option for API (910 bytes, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Ensure we return effective_bookable (1.26 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Tidy admin/itemtypes.pl, Items.t (13.75 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem (3.21 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Tidy block in TestBuilder.pm (1.17 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Correct type on added bookable column (1013 bytes, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Unit tests for effective_bookable (2.77 KB, patch)
2024-10-18 10:59 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Add bookable option on itemtype (12.43 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Add unit test (2.31 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Remove preference and add override handling (22.40 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Fix item-type schema (1008 bytes, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: Schema dump (3.51 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Add bookable option for API (910 bytes, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Ensure we return effective_bookable (1.26 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Tidy admin/itemtypes.pl, Items.t (13.75 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem (3.21 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Tidy block in TestBuilder.pm (1.17 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Correct type on added bookable column (1013 bytes, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Unit tests for effective_bookable (2.77 KB, patch)
2024-10-25 09:29 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 35906: (QA follow-up) Remove use of IF NOT EXISTS (1.29 KB, patch)
2024-11-01 21:06 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Thibaud Guillot (thibaud_g) 2024-01-25 13:11:24 UTC
Hello everyone,

In connection with bug 29002, which introduces the new "booking" feature, I'd like to suggest an improvement mentioned in the ticket: adding this option to an itemtype.
Comment 1 Thibaud Guillot (thibaud_g) 2024-01-25 13:31:37 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens (kidclamp) 2024-01-25 14:30:09 UTC
This uses the record level item type to determine bookability even if item-level_itypes is set to specific item. This means a record can be defined as bookable, then have no items that can be booked, so booking fails.

I also think the dropdown to set an item as bookable/not bookable should be disabled when the itemtype is set to 'Bookable'

The warning when an itemtype is not set to bookable and the item is seems strange to me too.

Maybe the option should be read "If checked, all items of this type will be enabled for future bookings, otherwise bookable status can be defined per item"
Comment 3 Thibaud Guillot (thibaud_g) 2024-01-26 10:49:35 UTC
Thank you nick for your feedback. I've changed the "visual" problems with the dropdown and the messages.


I was just wondering about the impact of itemtype on linked item bookings. I'd certainly change the checkbox for defining whether the itemtype is bookable by a select to have a behavior like : 
- Do not define => NULL, keeping the current operation with the possibility of defining each item as bookable
- Bookable => 1 all linked items are bookable
- Bookable => 0 items not bookable

which would then lead us to use Items->filter_by_bookable with the right filters to obtain bookable items by their direct bookable status or by the bookable status of their itemtype.

It would be necessary to create a foreign-key relationship between these tables, as this is not currently the case, and I wonder why... would there be any obstacle to doing so?
Comment 4 Thibaud Guillot (thibaud_g) 2024-01-30 14:07:22 UTC Comment hidden (obsolete)
Comment 5 Thibaud Guillot (thibaud_g) 2024-01-30 14:11:49 UTC
(In reply to Thibaud Guillot from comment #3)
> Thank you nick for your feedback. I've changed the "visual" problems with
> the dropdown and the messages.
> 

Sorry for previous mispelling Nick*

I've tried to come up with a workaround to avoid these table relationship problems.

Using a new system preference, we choose whether the future booking option attribute is activated on the item or on the itemtype. I've taken into account your comments on inconsistent messages and how to view the select on the item if the system preference is set to "itemtype".

I look forward to hearing from you :) Thanks a lot!
Comment 6 Thibaud Guillot (thibaud_g) 2024-02-05 09:48:16 UTC
Created attachment 161744 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 7 Thibaud Guillot (thibaud_g) 2024-02-09 10:29:17 UTC
Created attachment 161961 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 8 Martin Renvoize (ashimema) 2024-02-16 16:44:30 UTC
Created attachment 162242 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 9 Martin Renvoize (ashimema) 2024-02-16 16:45:24 UTC
Rebased on the tree..

We need unit test updates for the changes to filter_by_bookable too
Comment 10 Thibaud Guillot (thibaud_g) 2024-02-23 09:00:51 UTC
Created attachment 162365 [details] [review]
Bug 35906 : Add unit test
Comment 11 Martin Renvoize (ashimema) 2024-02-26 14:53:08 UTC
I'm considering this a little at the moment.

I'm wondering if we aught to be following the patterns already put in place by filter_by_for_hold a little more.

i.e. should this be in the circulation rules table rather than pushed into the item type management page.

Also.. I'm envisaging that we don't actually need the pref to force libaries to pick on or the other setting.  We could effectively build the query as 'item.bookable = 1 OR ( item.booking = undef AND item.itype NOT IN bookable_itypes )'
Comment 12 Martin Renvoize (ashimema) 2024-02-26 17:22:12 UTC
Created attachment 162465 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 13 Martin Renvoize (ashimema) 2024-02-26 17:22:15 UTC
Created attachment 162466 [details] [review]
Bug 35906: Add unit test
Comment 14 Martin Renvoize (ashimema) 2024-02-26 17:22:18 UTC
Created attachment 162467 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 15 Martin Renvoize (ashimema) 2024-02-26 17:22:21 UTC
Created attachment 162468 [details] [review]
Bug 35906: Schema dump
Comment 16 Martin Renvoize (ashimema) 2024-02-26 17:23:26 UTC
I still have a little more to do here.. Mostly to update the test.

Do you agree with the alternate approach proposed in the followup?  It allows for setting at itemtype level and optionally overriding at item level should one wish to do so.
Comment 17 Martin Renvoize (ashimema) 2024-02-26 19:19:03 UTC
Created attachment 162469 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 18 Martin Renvoize (ashimema) 2024-02-26 19:19:06 UTC
Created attachment 162470 [details] [review]
Bug 35906: Schema dump
Comment 19 Martin Renvoize (ashimema) 2024-02-26 19:28:33 UTC
Created attachment 162472 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 20 Martin Renvoize (ashimema) 2024-02-29 11:58:34 UTC
I think with my follow-ups we can satisfy all interested parties... just looking for a signoff now.
Comment 21 Martin Renvoize (ashimema) 2024-03-07 12:14:13 UTC
Do you think this approach will satisfy your sponsors Thibaud?  If so, I'd love to see a signoff from them for the feature set as a whole then we can get it through QA :)
Comment 22 Thibaud Guillot (thibaud_g) 2024-03-07 16:17:07 UTC
Hello Martin,

Thanks for your feedback, so I asked him to test it as soon as possible and SO (I hope so)
Comment 23 Martin Renvoize (ashimema) 2024-03-18 08:42:14 UTC
Created attachment 163291 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 24 Martin Renvoize (ashimema) 2024-03-18 08:42:16 UTC
Created attachment 163292 [details] [review]
Bug 35906: Add unit test
Comment 25 Martin Renvoize (ashimema) 2024-03-18 08:42:19 UTC
Created attachment 163293 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 26 Martin Renvoize (ashimema) 2024-03-18 08:42:22 UTC
Created attachment 163294 [details] [review]
Bug 35906: Schema dump
Comment 27 Martin Renvoize (ashimema) 2024-03-18 08:42:25 UTC
Created attachment 163295 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 28 Martin Renvoize (ashimema) 2024-03-18 08:51:20 UTC
Just a quick rebase as it stopped applying when most fo the dependencies were pushed.
Comment 29 Thibaud Guillot (thibaud_g) 2024-03-20 14:54:19 UTC
Created attachment 163547 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Edit an itemtype, there is a new checkbox to add 'bookable' option
6) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
7) You now have a new setting on the item bookable option to 'Follow
   itemtype"

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 30 Thibaud Guillot (thibaud_g) 2024-03-20 14:54:22 UTC
Created attachment 163548 [details] [review]
Bug 35906: Add unit test
Comment 31 Thibaud Guillot (thibaud_g) 2024-03-20 14:54:26 UTC
Created attachment 163549 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 32 Thibaud Guillot (thibaud_g) 2024-03-20 14:54:29 UTC
Created attachment 163550 [details] [review]
Bug 35906: Schema dump
Comment 33 Thibaud Guillot (thibaud_g) 2024-03-20 14:54:32 UTC
Created attachment 163551 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 34 Thibaud Guillot (thibaud_g) 2024-03-20 14:56:26 UTC
Test plan update (syspref removal)
Comment 35 Thibaud Guillot (thibaud_g) 2024-04-10 08:13:40 UTC
Created attachment 164579 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Edit an itemtype, there is a new checkbox to add 'bookable' option
6) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
7) You now have a new setting on the item bookable option to 'Follow
   itemtype"

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 36 Thibaud Guillot (thibaud_g) 2024-04-10 08:13:45 UTC
Created attachment 164580 [details] [review]
Bug 35906: Add unit test
Comment 37 Thibaud Guillot (thibaud_g) 2024-04-10 08:13:50 UTC
Created attachment 164581 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 38 Thibaud Guillot (thibaud_g) 2024-04-10 08:13:55 UTC
Created attachment 164582 [details] [review]
Bug 35906: Schema dump
Comment 39 Thibaud Guillot (thibaud_g) 2024-04-10 08:14:00 UTC
Created attachment 164583 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 40 Thibaud Guillot (thibaud_g) 2024-04-10 08:16:19 UTC
Created attachment 164584 [details] [review]
Bug 35906: (follow-up) fix missing bracket after rebase
Comment 41 Thibaud Guillot (thibaud_g) 2024-04-10 08:22:26 UTC
Created attachment 164585 [details] [review]
Bug 35906: (follow-up) rebased it
Comment 42 ByWater Sandboxes 2024-04-23 18:48:32 UTC
Created attachment 165437 [details] [review]
Bug 35906: (follow-up) rebased it

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 43 Esther Melander 2024-04-23 18:50:24 UTC
Works according to test plan. Just a few notes:

I tested this by changing the Book item type to allow for bookings. However, when I searched for Books, the Bookable dropdown for the item was not updated for existing items. I still had to go in and manually update the option to Follow item type. This is probably correct for existing items. There is not a way to update this via batch item modification for existing items (Bug 35671).

However, adding a new item does default to Follow item type in the Bookable dropdown. I was able to place a booking for the item.

Library limitations appear to work. In a consortium, if one library wants an item type like Books to be bookable and another does not, they will have to create separate item types with library limitations.

If I change the item type like Books to be bookable by item type, book some items, and then go and change those items to not be bookable, the bookings/bookings tab disappears from the bibliographic detail view. In this scenario, the bookings should not disappear even though the item type is no longer bookable. Perhaps a separate bug.

I did not understand step 8, other than I could see the behavior difference in the item detail page with the bookable option by item type enabled versus not.
Comment 44 David Nind 2024-05-16 20:09:52 UTC
The patch no longer applies 8-(...

git bz apply 35906

Bug 35906 - Add bookable option on itemtypes

164579 - Bug 35906: Add bookable option on itemtype
164580 - Bug 35906: Add unit test
164581 - Bug 35906: Remove preference and add override handling
164582 - Bug 35906: Schema dump
164583 - Bug 35906: (QA follow-up) Fix item-type schema
165437 - Bug 35906: (follow-up) rebased it

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 35906: Add bookable option on itemtype
Using index info to reconstruct a base tree...
M	Koha/Items.pm
M	Koha/REST/V1/Biblios.pm
M	installer/data/mysql/kohastructure.sql
M	installer/data/mysql/mandatory/sysprefs.sql
M	koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
M	koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
Auto-merging installer/data/mysql/mandatory/sysprefs.sql
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging Koha/REST/V1/Biblios.pm
CONFLICT (content): Merge conflict in Koha/REST/V1/Biblios.pm
Auto-merging Koha/Items.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 35906: Add bookable option on itemtype
Comment 45 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:05 UTC
Created attachment 166866 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Edit an itemtype, there is a new checkbox to add 'bookable' option
6) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
7) You now have a new setting on the item bookable option to 'Follow
   itemtype"

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 46 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:08 UTC
Created attachment 166867 [details] [review]
Bug 35906: Add unit test
Comment 47 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:11 UTC
Created attachment 166868 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.
Comment 48 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:13 UTC
Created attachment 166869 [details] [review]
Bug 35906: Schema dump
Comment 49 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:16 UTC
Created attachment 166870 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 50 Thibaud Guillot (thibaud_g) 2024-05-17 07:38:19 UTC
Created attachment 166871 [details] [review]
Bug 35906: (follow-up) rebased it

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 51 David Nind 2024-05-19 05:08:46 UTC
Patch now applies again, so back to ready for QA.
Comment 52 Lucas Gass (lukeg) 2024-06-24 19:26:24 UTC
Patch no longer applies.
Comment 53 Thibaud Guillot (thibaud_g) 2024-06-26 08:11:43 UTC
Created attachment 168120 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Edit an itemtype, there is a new checkbox to add 'bookable' option
6) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
7) You now have a new setting on the item bookable option to 'Follow
   itemtype"

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Comment 54 Thibaud Guillot (thibaud_g) 2024-06-26 08:11:46 UTC
Created attachment 168121 [details] [review]
Bug 35906: Schema dump
Comment 55 Thibaud Guillot (thibaud_g) 2024-06-26 08:11:50 UTC
Created attachment 168122 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema
Comment 56 Martin Renvoize (ashimema) 2024-06-26 15:13:28 UTC
Created attachment 168160 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 57 Martin Renvoize (ashimema) 2024-06-26 15:13:32 UTC
Created attachment 168161 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 58 Martin Renvoize (ashimema) 2024-06-26 15:13:36 UTC
Created attachment 168162 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 59 Martin Renvoize (ashimema) 2024-06-26 15:13:39 UTC
Created attachment 168163 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 60 Martin Renvoize (ashimema) 2024-06-26 15:13:43 UTC
Created attachment 168164 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 61 Martin Renvoize (ashimema) 2024-06-26 15:14:43 UTC
I restored the signoff lines in my rebase.. you also removed a function in your rebase in error I believe.
Comment 62 Thibaud Guillot (thibaud_g) 2024-06-28 07:33:41 UTC
(In reply to Martin Renvoize from comment #61)
> I restored the signoff lines in my rebase.. you also removed a function in
> your rebase in error I believe.

Oh sorry it was my mistake, I had squashed some commits about adding then removing the syspref and I must have forgotten some lines... thanks
Comment 63 Thibaud Guillot (thibaud_g) 2024-08-09 13:35:53 UTC
Created attachment 170187 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 64 Thibaud Guillot (thibaud_g) 2024-08-09 13:35:56 UTC
Created attachment 170188 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 65 Thibaud Guillot (thibaud_g) 2024-08-09 13:35:59 UTC
Created attachment 170189 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 66 Thibaud Guillot (thibaud_g) 2024-08-09 13:36:02 UTC
Created attachment 170190 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 67 Thibaud Guillot (thibaud_g) 2024-08-09 13:36:05 UTC
Created attachment 170191 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 69 Martin Renvoize (ashimema) 2024-08-22 08:26:03 UTC
Created attachment 170582 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 70 Martin Renvoize (ashimema) 2024-08-22 08:26:07 UTC
Created attachment 170583 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 71 Martin Renvoize (ashimema) 2024-08-22 08:26:10 UTC
Created attachment 170584 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 72 Martin Renvoize (ashimema) 2024-08-22 08:26:13 UTC
Created attachment 170585 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 73 Martin Renvoize (ashimema) 2024-08-22 08:26:16 UTC
Created attachment 170586 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 74 Martin Renvoize (ashimema) 2024-08-22 08:26:54 UTC
Corrected rebase.. now there's just a small number of QA script fails we need to look into rather than outright breakage :)
Comment 75 Paul Derscheid 2024-08-22 08:30:44 UTC Comment hidden (obsolete)
Comment 76 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:31 UTC
Created attachment 172127 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 77 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:34 UTC
Created attachment 172128 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 78 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:37 UTC
Created attachment 172129 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 79 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:40 UTC
Created attachment 172130 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 80 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:43 UTC
Created attachment 172131 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Comment 81 Thibaud Guillot (thibaud_g) 2024-09-27 15:31:46 UTC
Created attachment 172132 [details] [review]
Bug 35906: (QA follow-up) Add bookable option for API
Comment 82 Kristi 2024-10-01 16:29:51 UTC
Looks like this one has been signed off. Can it be updated to a signed off status?
Comment 83 Martin Renvoize (ashimema) 2024-10-18 07:54:37 UTC
We probably aught to add a unit test for effective_bookable here
Comment 84 Martin Renvoize (ashimema) 2024-10-18 08:11:02 UTC
Created attachment 172941 [details] [review]
Bug 35906: (QA follow-up) Ensure we return effective_bookable

The API wasn't including the effective_bookable value in responses

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 85 Martin Renvoize (ashimema) 2024-10-18 08:19:40 UTC
We should support the ?bookable filter on the plain /api/v1/items endpoint too.

Also.. I'm tempted to rename it 'effective_bookable' to more clearly distinguish been effective bookable and localised item bookable fields.

I'd love to see this also taken account of within q= as well as the local param option.. that could be a future follow-up though.
Comment 86 Paul Derscheid 2024-10-18 08:22:19 UTC
I agree, that would be clearer.
Comment 87 Martin Renvoize (ashimema) 2024-10-18 10:41:16 UTC
Created attachment 172945 [details] [review]
Bug 35906: (QA follow-up) Unit tests for effective_bookable
Comment 88 Paul Derscheid 2024-10-18 10:59:09 UTC
Created attachment 172950 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 89 Paul Derscheid 2024-10-18 10:59:13 UTC
Created attachment 172951 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 90 Paul Derscheid 2024-10-18 10:59:16 UTC
Created attachment 172952 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 91 Paul Derscheid 2024-10-18 10:59:19 UTC
Created attachment 172953 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 92 Paul Derscheid 2024-10-18 10:59:22 UTC
Created attachment 172954 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 93 Paul Derscheid 2024-10-18 10:59:26 UTC
Created attachment 172955 [details] [review]
Bug 35906: (QA follow-up) Add bookable option for API

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 94 Paul Derscheid 2024-10-18 10:59:29 UTC
Created attachment 172956 [details] [review]
Bug 35906: (QA follow-up) Ensure we return effective_bookable

The API wasn't including the effective_bookable value in responses

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 95 Paul Derscheid 2024-10-18 10:59:32 UTC
Created attachment 172957 [details] [review]
Bug 35906: (QA follow-up) Tidy admin/itemtypes.pl, Items.t

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 96 Paul Derscheid 2024-10-18 10:59:35 UTC
Created attachment 172958 [details] [review]
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 97 Paul Derscheid 2024-10-18 10:59:38 UTC
Created attachment 172959 [details] [review]
Bug 35906: (QA follow-up) Tidy block in TestBuilder.pm

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 98 Paul Derscheid 2024-10-18 10:59:42 UTC
Created attachment 172960 [details] [review]
Bug 35906: (QA follow-up) Correct type on added bookable column

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 99 Paul Derscheid 2024-10-18 10:59:45 UTC
Created attachment 172961 [details] [review]
Bug 35906: (QA follow-up) Unit tests for effective_bookable

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 100 Paul Derscheid 2024-10-18 11:00:39 UTC
Please have another look, but I think this is PQA!
Comment 101 Katrin Fischer 2024-10-25 09:20:44 UTC
I am sorry, this currently no longer applies. Please rebase ASAP!


Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 35906: Add bookable option on itemtype
Applying: Bug 35906: Add unit test
Applying: Bug 35906: Remove preference and add override handling
error: sha1 information is lacking or useless (Koha/Items.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 35906: Remove preference and add override handling
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-35906-Remove-preference-and-add-override-handl-7ip612hr.patch
Comment 102 Paul Derscheid 2024-10-25 09:29:21 UTC
Created attachment 173324 [details] [review]
Bug 35906: Add bookable option on itemtype

Actually new "booking" feature can be set on an item but no directly on
an itemtype. This patch adds this possibility.

Test plan:
1) Test this new feature on an item as it were currently working.
2) Apply this patch
3) Run updatedatabase.pl
4) Reload Schema by running update_dbix_class_files.pl
5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option
7) Test it with item with this itemtype, if there is 1 item at least you
   will see 'Booking' tab.
8) You can change syspref to 'item' to see the current behavior

Note: When item-level_booking is set on 'itemtype' you can change
dropdown option to 'No' on item bookable option.

Sponsored by: Association de Gestion des Œuvres Sociales d'Inria (AGOS)
Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 103 Paul Derscheid 2024-10-25 09:29:25 UTC
Created attachment 173325 [details] [review]
Bug 35906: Add unit test

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 104 Paul Derscheid 2024-10-25 09:29:28 UTC
Created attachment 173326 [details] [review]
Bug 35906: Remove preference and add override handling

This patch updates the bookable nature of items to allow setting at the
itemtype level and then overriding that setting at item level should you
so wish to do so.

We also now properly handle the item_level-itypes preference such that
we look at item or biblioitem level appropriately.

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 105 Paul Derscheid 2024-10-25 09:29:31 UTC
Created attachment 173327 [details] [review]
Bug 35906: (QA follow-up) Fix item-type schema

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 106 Paul Derscheid 2024-10-25 09:29:35 UTC
Created attachment 173328 [details] [review]
Bug 35906: Schema dump

Signed-off-by: Esther <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 107 Paul Derscheid 2024-10-25 09:29:38 UTC
Created attachment 173329 [details] [review]
Bug 35906: (QA follow-up) Add bookable option for API

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 108 Paul Derscheid 2024-10-25 09:29:41 UTC
Created attachment 173330 [details] [review]
Bug 35906: (QA follow-up) Ensure we return effective_bookable

The API wasn't including the effective_bookable value in responses

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 109 Paul Derscheid 2024-10-25 09:29:44 UTC
Created attachment 173331 [details] [review]
Bug 35906: (QA follow-up) Tidy admin/itemtypes.pl, Items.t

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 110 Paul Derscheid 2024-10-25 09:29:48 UTC
Created attachment 173332 [details] [review]
Bug 35906: (QA follow-up) Refactor (slightly) to reduce complexity in Koha/Item(s).pm, catalogue/updateitem

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 111 Paul Derscheid 2024-10-25 09:29:51 UTC
Created attachment 173333 [details] [review]
Bug 35906: (QA follow-up) Tidy block in TestBuilder.pm

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 112 Paul Derscheid 2024-10-25 09:29:54 UTC
Created attachment 173334 [details] [review]
Bug 35906: (QA follow-up) Correct type on added bookable column

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 113 Paul Derscheid 2024-10-25 09:29:58 UTC
Created attachment 173335 [details] [review]
Bug 35906: (QA follow-up) Unit tests for effective_bookable

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Comment 114 Katrin Fischer 2024-10-25 13:38:22 UTC
1) Documentation

Test plan is really outdated:

5) Change new syspref 'item-level_booking' to 'itemtype'
6) Edit an itemtype, there is a new checkbox to add 'bookable' option

There is no such system preference (which is good). Please provide release notes and some documentation step by step for the documentation team.

2) Database update

Whenever adding a new column, you need to use AFTER or BEFORE to make sure the sequence matches in updated and new installations.

(Fixed in a follow-up)
Comment 115 Katrin Fischer 2024-10-25 13:38:55 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 116 Katrin Fischer 2024-10-30 12:22:32 UTC
It turns out that the "IF NOT EXISTS" pattern for ALTER TABLE doesn't play well with MySQL8 - can you please replace with our usual check?

ALTER TABLE itemtypes ADD IF NOT EXISTS bookable INT(1) DEFAULT 0 AFTER automatic_checkin
Comment 117 Tomás Cohen Arazi (tcohen) 2024-11-01 21:06:33 UTC
Created attachment 173893 [details] [review]
Bug 35906: (QA follow-up) Remove use of IF NOT EXISTS

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 118 Katrin Fischer 2024-11-13 16:25:11 UTC
Thibaud, can you provide a follow-up for the bug 35906 please?
Comment 119 Katrin Fischer 2024-11-14 09:39:30 UTC
(In reply to Katrin Fischer from comment #118)
> Thibaud, can you provide a follow-up for the bug 35906 please?

Sorry, wrong bug number. It's Bug 38434 - (Bug 35906 follow-up) dbrev different from kohastructure.sql
Comment 120 Lucas Gass (lukeg) 2024-11-18 23:08:36 UTC
Enhancement, no 24.05.x backport