Bugzilla – Attachment 183209 Details for
Bug 39916
The 'Place booking' modal should have cypress tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39916: Fix booking modal redraw issue
Bug-39916-Fix-booking-modal-redraw-issue.patch (text/plain), 8.90 KB, created by
Martin Renvoize (ashimema)
on 2025-06-12 14:51:49 UTC
(
hide
)
Description:
Bug 39916: Fix booking modal redraw issue
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-06-12 14:51:49 UTC
Size:
8.90 KB
patch
obsolete
>From 39a73245f3593d12bb2d1597725154a166bc8e3e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 3 Jun 2025 21:46:36 +0100 >Subject: [PATCH] Bug 39916: Fix booking modal redraw issue > >Fixes an issue where the booking modal's date picker and form fields >were not properly updating when switching between different booking >scenarios or after form submissions. > >The fix ensures proper redraw and state management of the flatpickr >component and associated form elements. >--- > .../prog/js/modals/place_booking.js | 87 ++++++++++--------- > 1 file changed, 44 insertions(+), 43 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 634cce0c36e..8b9f2d91b0c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -93,29 +93,29 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > let $patron = $("<span></span>") > .append( > "" + >- (patron.surname >- ? escape_str(patron.surname) + ", " >- : "") + >- (patron.firstname >- ? escape_str(patron.firstname) + " " >- : "") + >- (patron.cardnumber >- ? " (" + escape_str(patron.cardnumber) + ")" >- : "") + >- "<small>" + >- (patron.date_of_birth >- ? ' <span class="age_years">' + >- $get_age(patron.date_of_birth) + >- " " + >- __("years") + >- "</span>" >- : "") + >- (patron.library >- ? ' <span class="ac-library">' + >- escape_str(patron.library.name) + >- "</span>" >- : "") + >- "</small>" >+ (patron.surname >+ ? escape_str(patron.surname) + ", " >+ : "") + >+ (patron.firstname >+ ? escape_str(patron.firstname) + " " >+ : "") + >+ (patron.cardnumber >+ ? " (" + escape_str(patron.cardnumber) + ")" >+ : "") + >+ "<small>" + >+ (patron.date_of_birth >+ ? ' <span class="age_years">' + >+ $get_age(patron.date_of_birth) + >+ " " + >+ __("years") + >+ "</span>" >+ : "") + >+ (patron.library >+ ? ' <span class="ac-library">' + >+ escape_str(patron.library.name) + >+ "</span>" >+ : "") + >+ "</small>" > ) > .addClass(loggedInClass); > return $patron; >@@ -170,6 +170,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > if (changed) { > periodPicker.clear(); > } >+ periodPicker.set("disable", periodPicker.config.disable); > periodPicker.redraw(); > > // Enable flatpickr now we have data we need >@@ -211,10 +212,10 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > ) { > let option = $( > '<option value="' + >- pickup_location.library_id + >- '">' + >- pickup_location.name + >- "</option>" >+ pickup_location.library_id + >+ '">' + >+ pickup_location.name + >+ "</option>" > ); > > option.attr( >@@ -413,8 +414,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > if ( > !$("#booking_itemtype").find( > "option[value='" + >- item.item_type.item_type_id + >- "']" >+ item.item_type.item_type_id + >+ "']" > ).length > ) { > // Create a DOM Option and de-select by default >@@ -458,7 +459,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > } > > // iterate existing bookings >- for (booking of bookings) { >+ for (let booking of bookings) { > // Skip if we're editing this booking > if ( > booking_id && >@@ -752,7 +753,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > for (let i = 0; i < renewalsAllowed; i++) { > nextDate.setDate( > nextDate.getDate() + >- parseInt(renewalLength) >+ parseInt(renewalLength) > ); > boldDates.push(new Date(nextDate)); > } >@@ -932,8 +933,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > ); > const startDate = periodPicker.selectedDates[0] > ? dayjs(periodPicker.selectedDates[0]).startOf( >- "day" >- ) >+ "day" >+ ) > : null; > > const leadStart = startDate >@@ -959,7 +960,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > dayElem.classList.toggle( > "leadRange", > elemDate.isSameOrAfter(leadStart) && >- elemDate.isBefore(leadEnd) >+ elemDate.isBefore(leadEnd) > ); > dayElem.classList.toggle( > "leadRangeEnd", >@@ -972,7 +973,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > dayElem.classList.toggle( > "trailRange", > elemDate.isAfter(trailStart) && >- elemDate.isSameOrBefore(trailEnd) >+ elemDate.isSameOrBefore(trailEnd) > ); > dayElem.classList.toggle( > "trailRangeEnd", >@@ -1195,8 +1196,8 @@ $("#placeBookingForm").on("submit", function (e) { > // Set feedback > $("#transient_result").replaceWith( > '<div id="transient_result" class="alert alert-info">' + >- __("Booking successfully placed") + >- "</div>" >+ __("Booking successfully placed") + >+ "</div>" > ); > > // Close modal >@@ -1206,8 +1207,8 @@ $("#placeBookingForm").on("submit", function (e) { > posting.fail(function (data) { > $("#booking_result").replaceWith( > '<div id="booking_result" class="alert alert-danger">' + >- __("Failure") + >- "</div>" >+ __("Failure") + >+ "</div>" > ); > }); > } else { >@@ -1264,8 +1265,8 @@ $("#placeBookingForm").on("submit", function (e) { > // Set feedback > $("#transient_result").replaceWith( > '<div id="transient_result" class="alert alert-info">' + >- __("Booking successfully updated") + >- "</div>" >+ __("Booking successfully updated") + >+ "</div>" > ); > > // Close modal >@@ -1275,8 +1276,8 @@ $("#placeBookingForm").on("submit", function (e) { > putting.fail(function (data) { > $("#booking_result").replaceWith( > '<div id="booking_result" class="alert alert-danger">' + >- __("Failure") + >- "</div>" >+ __("Failure") + >+ "</div>" > ); > }); > } >-- >2.49.0
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 39916
:
182515
|
182516
|
182545
|
182546
|
182635
|
182636
|
182637
|
182771
|
182772
|
182773
|
183206
|
183207
|
183208
| 183209 |
183210