Bugzilla – Attachment 168964 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.04 KB, created by
Martin Renvoize (ashimema)
on 2024-07-15 10:08:44 UTC
(
hide
)
Description:
Bug 37354: Set maxDate based on issuelength + renewals * renewalperiod
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-07-15 10:08:44 UTC
Size:
3.04 KB
patch
obsolete
>From e962e2499d7aa2b65c97e320ebf183ac24fa712e 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. >--- > .../prog/js/modals/place_booking.js | 18 +++++++++++++++--- > 1 file changed, 15 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 323009d5905..e7e828b1c59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -133,6 +133,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > // Lead and Trail days syncing > let leadDays = 0; > let trailDays = 0; >+ let lengthDays; > function setBufferDays() { > let rules_url = "/api/v1/circulation_rules"; > $.ajax({ >@@ -143,10 +144,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 rules = response[0]; >+ let renewalLength = rules.renewalsallowed * rules.renewalperiod; >+ lengthDays = rules.issuelength + renewalLength; > leadDays = rules.bookings_lead_period; > trailDays = rules.bookings_trail_period; > }, >@@ -668,8 +671,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.45.2
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