+++ This bug was initially created as a clone of Bug #36271 +++ The original bug for this took on a life of its own and became broader in scope adding a series of circulation rules for the bookings system I've cloned it here to propose my original more limited-in-scope solution using existing circulation rules for loan length * renewals count. --------------------------------------------------------------- Currently, bookings are on/off at the item level, but the booking period is entirely open meaning an item can be booked for any period. We should refine this to allow libraries to control the maximum length an item can be booked for. During the original development, I suggested perhaps we should set the maximum to the loan length of the item times the max renewals from the circulation rules.. However, I didn't get much feedback as to whether this was appropriate or whether people wanted a distinct rule for these items or another alternative.
Created attachment 168950 [details] [review] Bug 37354: Set maxDate based on issuelength + renewals * renewalperiod This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules.
We'll likely want to also enforce this in the API controller level.. or perhaps at the koha object level.
Created attachment 168964 [details] [review] Bug 37354: Set maxDate based on issuelength + renewals * renewalperiod This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules.
Created attachment 168965 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates.
Created attachment 168966 [details] [review] Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod) This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules. Test plan 1) Set an item in a test biblio to 'bookable' from the items tab. 2) Note the itemtype of the above item 3) Add circulation rules for the above item type, in particular the 'Loan period', 'Renewals allowed' and 'Renewal period' options. 4) Go back to your biblio and 'Place booking'. Select a user, pickup location and item. 5) Open the booking dates flatpickr. 6) Select a start date. 7) Note that the date that is 'Loan period' + 'Renewals allowed' * 'Renewal period' is now greyed out and cannot be selected or any date beyond it either.
Created attachment 168967 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates. Test plan 1) Repeat the test plan for the previous patch 2) Note that once you have selected your first date, that date will become bold, the date a 'Loan period' after the start date will also be bold and you'll also have bold dates for the number of 'Renewals allowed' at each 'Renewal period' beyond the initial 'Loan period' date.
Created attachment 169008 [details] [review] Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod) This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules. Test plan 1) Set an item in a test biblio to 'bookable' from the items tab. 2) Note the itemtype of the above item 3) Add circulation rules for the above item type, in particular the 'Loan period', 'Renewals allowed' and 'Renewal period' options. 4) Go back to your biblio and 'Place booking'. Select a user, pickup location and item. 5) Open the booking dates flatpickr. 6) Select a start date. 7) Note that the date that is 'Loan period' + 'Renewals allowed' * 'Renewal period' is now greyed out and cannot be selected or any date beyond it either.
Created attachment 169009 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates. Test plan 1) Repeat the test plan for the previous patch 2) Note that once you have selected your first date, that date will become bold, the date a 'Loan period' after the start date will also be bold and you'll also have bold dates for the number of 'Renewals allowed' at each 'Renewal period' beyond the initial 'Loan period' date.
I would test it today but there is just a little conflict with a fresh main branch in koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js
Created attachment 169590 [details] [review] Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod) This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules. Test plan 1) Set an item in a test biblio to 'bookable' from the items tab. 2) Note the itemtype of the above item 3) Add circulation rules for the above item type, in particular the 'Loan period', 'Renewals allowed' and 'Renewal period' options. 4) Go back to your biblio and 'Place booking'. Select a user, pickup location and item. 5) Open the booking dates flatpickr. 6) Select a start date. 7) Note that the date that is 'Loan period' + 'Renewals allowed' * 'Renewal period' is now greyed out and cannot be selected or any date beyond it either.
Created attachment 169591 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates. Test plan 1) Repeat the test plan for the previous patch 2) Note that once you have selected your first date, that date will become bold, the date a 'Loan period' after the start date will also be bold and you'll also have bold dates for the number of 'Renewals allowed' at each 'Renewal period' beyond the initial 'Loan period' date.
Rebased and ready for testing again.
Created attachment 169685 [details] [review] Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod) This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules. Test plan 1) Set an item in a test biblio to 'bookable' from the items tab. 2) Note the itemtype of the above item 3) Add circulation rules for the above item type, in particular the 'Loan period', 'Renewals allowed' and 'Renewal period' options. 4) Go back to your biblio and 'Place booking'. Select a user, pickup location and item. 5) Open the booking dates flatpickr. 6) Select a start date. 7) Note that the date that is 'Loan period' + 'Renewals allowed' * 'Renewal period' is now greyed out and cannot be selected or any date beyond it either.
Created attachment 169686 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates. Test plan 1) Repeat the test plan for the previous patch 2) Note that once you have selected your first date, that date will become bold, the date a 'Loan period' after the start date will also be bold and you'll also have bold dates for the number of 'Renewals allowed' at each 'Renewal period' beyond the initial 'Loan period' date.
In testing I noticed that if you don't select an item and just leave it to the 'Any item' selection you can select whatever booking dates. Is the expected behavior? If so I can sign-off.
Created attachment 170066 [details] [review] Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod) This patch sets the flatpickr maxDate in the bookings range picker to the startdate selected + issuelength + renewals * renewalperiod circulation rules. Test plan 1) Set an item in a test biblio to 'bookable' from the items tab. 2) Note the itemtype of the above item 3) Add circulation rules for the above item type, in particular the 'Loan period', 'Renewals allowed' and 'Renewal period' options. 4) Go back to your biblio and 'Place booking'. Select a user, pickup location and item. 5) Open the booking dates flatpickr. 6) Select a start date. 7) Note that the date that is 'Loan period' + 'Renewals allowed' * 'Renewal period' is now greyed out and cannot be selected or any date beyond it either. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Created attachment 170067 [details] [review] Bug 37354: Add visual hint at usual loan periods This patch adds a visual hint to the datepicker to highlight dates that line up with normal loan and renewal lengths. We use bold to highlight such dates. Test plan 1) Repeat the test plan for the previous patch 2) Note that once you have selected your first date, that date will become bold, the date a 'Loan period' after the start date will also be bold and you'll also have bold dates for the number of 'Renewals allowed' at each 'Renewal period' beyond the initial 'Loan period' date. Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
(In reply to Sam Lau from comment #15) > In testing I noticed that if you don't select an item and just leave it to > the 'Any item' selection you can select whatever booking dates. Is the > expected behaviour? If so I can sign-off. I'm afraid I couldn't replicate this.. maybe I've fixed it already inadvertently in the work I've continued on during bug 34440.