Bugzilla – Attachment 173620 Details for
Bug 37354
Bookings should respect circulation rules for max loan periods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod)
Bug-37354-Set-maxDate-based-on-issuelength--renewa.patch (text/plain), 3.71 KB, created by
Nick Clemens (kidclamp)
on 2024-10-29 12:11:05 UTC
(
hide
)
Description:
Bug 37354: Set maxDate based on issuelength + (renewals * renewalperiod)
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-10-29 12:11:05 UTC
Size:
3.71 KB
patch
obsolete
>From cf700dc4a9a956cf1083f8542db0eab871bf59ed Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Sun, 14 Jul 2024 07:39:33 +0100 >Subject: [PATCH] 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> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/js/modals/place_booking.js | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >index 90b35e06a80..500bfcdf391 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -132,8 +132,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > // Lead and Trail days syncing > let leadDays = 0; > let trailDays = 0; >+ let lengthDays; > function getCirculationRules() { >- let rules_url = "/api/v1/circulation_rules"; > $.ajax({ > url: rules_url, > type: "GET", >@@ -142,10 +142,12 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > patron_category_id: booking_patron.category_id, > item_type_id: booking_itemtype_id, > library_id: pickup_library_id, >- rules: "bookings_lead_period,bookings_trail_period", >+ rules: "bookings_lead_period,bookings_trail_period,issuelength,renewalsallowed,renewalperiod" > }, > success: function (response) { > let rules = response[0]; >+ let renewalLength = rules.renewalsallowed * rules.renewalperiod; >+ lengthDays = rules.issuelength + renewalLength; > leadDays = rules.bookings_lead_period; > trailDays = rules.bookings_trail_period; > >@@ -676,8 +678,17 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > dateStr, > instance > ) { >+ // Start date selected >+ if (selectedDates[0] && !selectedDates[1]) { >+ // Calculate the maximum date based on the selected start date >+ const maxDate = new Date(selectedDates[0]); >+ maxDate.setDate(maxDate.getDate() + lengthDays ); >+ >+ // Update the maxDate option of the flatpickr instance >+ instance.set('maxDate', maxDate); >+ } > // Range set, update hidden fields and set available items >- if (selectedDates[0] && selectedDates[1]) { >+ else if (selectedDates[0] && selectedDates[1]) { > // set form fields from picker > let picker_start = dayjs(selectedDates[0]); > let picker_end = dayjs(selectedDates[1]).endOf( >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37354
:
168950
|
168964
|
168965
|
168966
|
168967
|
169008
|
169009
|
169590
|
169591
|
169685
|
169686
|
170066
|
170067
|
172890
|
172891
|
173137
|
173210
| 173620 |
173621
|
173622
|
173623