Bug 33738 - Add bookings to the OPAC
Summary: Add bookings to the OPAC
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Paul Derscheid
QA Contact: Testopia
URL:
Keywords: rel_25_05_candidate
: 38834 (view as bug list)
Depends on: 29002 37972
Blocks: 38493
  Show dependency treegraph
 
Reported: 2023-05-15 14:49 UTC by Martin Renvoize (ashimema)
Modified: 2025-01-17 18:31 UTC (History)
10 users (show)

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


Attachments
Bug 33738: Add bookings to the OPAC (28.20 KB, patch)
2024-09-20 19:18 UTC, Paul Derscheid
Details | Diff | Splinter Review
Bug 33738 : Add bookings feature on the OPAC side (128.84 KB, patch)
2025-01-08 13:51 UTC, Thibaud Guillot (thibaud_g)
Details | Diff | Splinter Review
Bug 33738: Add bookings feature on the OPAC side (141.76 KB, patch)
2025-01-15 10:52 UTC, Thibaud Guillot (thibaud_g)
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) 2023-05-15 14:49:13 UTC
As part of the bookings workflow, we should add support for making bookings from the OPAC as a patron.
Comment 1 Paul Derscheid 2024-09-20 19:18:48 UTC
Created attachment 171841 [details] [review]
Bug 33738: Add bookings to the OPAC

This is a rough draft of an OPAC integration.
- The display of bookings already works more or less fine
    - In the patron's summary table
    - In the new bookings tab that doubles as the base for the placement modal
- The placement of new bookings is still more of a demo, because
we still need to integrate all of the logic in modals/place_booking.js
for flatpickr
    => To try it out anyway:
        1) Make an item bookable
        2) Open the OPAC
        3) Login
        4) Go to opac-detail.pl for that item's biblio
        5) Note the 'Place Booking' entry in opac-detail-sidebar.inc and click
        6) Hit '+ New booking' (this is going to change of course)
        7) Fill in some details and pick a start date (for demo purposes it just adds a week)

I'd be very interested in opinions, feedback, or follow-up patches (on vacation next week).
Comment 2 Thibaud Guillot (thibaud_g) 2024-09-26 13:33:22 UTC
Hi,

I've just tested it and liked it. I just think around the way to place a booking on the OPAC side, what do you think about adding a sort of form when patron can add many items (with barcode or by search) to make "multiple bookings on different item in one click" ? ( Maybe on a separate patch ?)
Comment 3 Thibaud Guillot (thibaud_g) 2024-09-26 13:35:48 UTC
Edit : I also wonder if it's linked to the "demo effect" but we can't make a booking on the same item (to another period).
Comment 4 Thibaud Guillot (thibaud_g) 2024-09-26 13:50:51 UTC
(In reply to Thibaud Guillot from comment #3)
> Edit : I also wonder if it's linked to the "demo effect" but we can't make a
> booking on the same item (to another period).

"Sub-Edit" : when we stay on the page after placing a booking on the item we can't see the same itemnumber in the select. We must restart the process to see it appended in the select
Comment 5 Martin Renvoize (ashimema) 2024-09-26 14:17:00 UTC
There's also my original implementation of this https://github.com/PTFS-Europe/koha/tree/bug_33738_opac_bookings now rebased.

I think we can borrow some things from that to help enhance this further too.

It's a big task, I'm not sure how best to split out the work between us.
Comment 6 Paul Derscheid 2024-09-30 13:31:32 UTC
1. I like your idea Thibaud (comment #2).

2. Responding to you, Martin (comment #5), I'd say that I'll try to merge the two implementations, picking the base parts of each one.

=> I think during the merge I can look for areas that need improvement, and line them out in a comment here. Then we can derive some additional tasks from it.
Comment 7 Thibaud Guillot (thibaud_g) 2024-09-30 14:15:48 UTC
Hi Paul,

There is precisely a patch that was submitted during KohaCon on the multiple addition of booking on items, it is bug 38019. The logic is close to this kind of functionality (multiple addition)
Comment 8 Katrin Fischer 2025-01-07 08:41:33 UTC
*** Bug 38834 has been marked as a duplicate of this bug. ***
Comment 9 Thibaud Guillot (thibaud_g) 2025-01-08 13:51:34 UTC
Created attachment 176235 [details] [review]
Bug 33738 : Add bookings feature on the OPAC side

Inspired by the work of Paul and Martin, I'm submitting this proposal for the bookings functionality on the OPAC side.
Bookings are perform as on the staff side with the api, adding, cancelling and modifying the pickup library works (normally :) ).

Test plan:
1) Apply this patch and restart_all
2) Having a bookable item
3) Go to the OPAC side and click on “Place booking” in the menu.
4) Add a booking; if there is an error, it will appear in the modal (preparation of errors linked to circulation rules).
5) Cancel or Modify pickup library

Thanks for testing
Comment 10 Paul Derscheid 2025-01-09 08:09:56 UTC
Thanks Thibaud, I will play around with it tomorrow.
Comment 11 Thibaud Guillot (thibaud_g) 2025-01-15 10:52:20 UTC
Created attachment 176548 [details] [review]
Bug 33738: Add bookings feature on the OPAC side

Inspired by the work of Paul and Martin, I'm submitting this proposal for the bookings functionality on the OPAC side.
Bookings are perform as on the staff side with the api, adding, cancelling and modifying the pickup library works (normally :) ).

Test plan:
1) Apply this patch and restart_all
2) Having a bookable item
3) Go to the OPAC side and click on “Place booking” in the menu.
4) Add a booking; if there is an error, it will appear in the modal (preparation of errors linked to circulation rules).
5) Cancel or Modify pickup library

Thanks for testing
Comment 12 Aude Charillon 2025-01-15 11:22:43 UTC
My apologies if this is obvious when testing (and I haven't taken the time to check the patch): are you creating a system preference for this similar to OPACHoldRequests, so librarians may decide whether bookings are allowed from the OPAC? Some library teams will prefer bookings to only be placed by themselves in the staff interface and not by patrons in the OPAC.
Comment 13 Thibaud Guillot (thibaud_g) 2025-01-15 11:25:45 UTC
(In reply to Aude Charillon from comment #12)
> My apologies if this is obvious when testing (and I haven't taken the time
> to check the patch): are you creating a system preference for this similar
> to OPACHoldRequests, so librarians may decide whether bookings are allowed
> from the OPAC? Some library teams will prefer bookings to only be placed by
> themselves in the staff interface and not by patrons in the OPAC.

Hello Aude,

At this moment there is no syspref to handle that. It's just a proposal for now to add bookings on the OPAC side, a kind of demo as Paul said
Comment 14 Esther Melander 2025-01-16 18:50:18 UTC
I tested this and these are my results:

I had an item that was bookable, logged in to the OPAC and searched for the title. I could see Place booking. Clicked on Place booking and it took me to the patron bookings screen. The table was empty and did not include my item.

I then clicked on +New booking. The bibliographic record/item barcode was not available in the modal. It gave me:

1. Item > Any item

2. Pickup at: No options were available

3. Booking dates: I could only select a starting date and not an end date.

I received an error message in the modal "Authorization failure. Missing required permissions(s).

I'm not sure if there were other things that I should have setup, like circulation rules?
Comment 15 Thibaud Guillot (thibaud_g) 2025-01-17 11:05:09 UTC
(In reply to Esther Melander from comment #14)
> I tested this and these are my results:
> 
> I had an item that was bookable, logged in to the OPAC and searched for the
> title. I could see Place booking. Clicked on Place booking and it took me to
> the patron bookings screen. The table was empty and did not include my item.
> 
> I then clicked on +New booking. The bibliographic record/item barcode was
> not available in the modal. It gave me:
> 
> 1. Item > Any item
> 
> 2. Pickup at: No options were available
> 
> 3. Booking dates: I could only select a starting date and not an end date.
> 
> I received an error message in the modal "Authorization failure. Missing
> required permissions(s).
> 
> I'm not sure if there were other things that I should have setup, like
> circulation rules?

Hello Esther,

Your test makes me wonder:

The behavior you mention seems to be one where the “biblio_id” parameter is missing from the url. Check that you are on a biblio record, select “place booking” then “New booking”. This behavior has been solved on another BZ (bug 38493 which adds the possibility of selecting items via their barcode if this parameter is absent).

On the other hand, the fact that you can only enter a start date corresponds to the previous behavior that Paul had written... Make sure you apply the patch and restart Koha services (restart_all from a KTD).

Thank you very much.
Comment 16 Esther Melander 2025-01-17 18:31:04 UTC
I spun up a sandbox to test. After the sandbox was created, I applied the patch and restarted services. I then rebuilt the CSS and JS.

I went through the test plan again:

1. Made an item bookable.
2. Logged in as a patron in OPAC.
3. Searched for the book.
4. In the bibliographic detail view of the book, clicked on place booking. I can see the bibliographic record ID in the URL.

I was redirected to the patron account > your bookings. The title does not show in the table. I can see the bibliographic record ID in the URL:

/cgi-bin/koha/opac-bookings.pl?biblio_id=20

5. Clicked on +New booking

Same results as described above.

There could be a problem with the sandbox? If the steps I took to build the sandbox  need adjustment, I am happy to try again.