Bugzilla – Attachment 165996 Details for
Bug 36120
Add pickup locations to bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36120: Account for both pickup_location and date selection in items
Bug-36120-Account-for-both-pickuplocation-and-date.patch (text/plain), 4.28 KB, created by
Martin Renvoize (ashimema)
on 2024-05-01 15:03:56 UTC
(
hide
)
Description:
Bug 36120: Account for both pickup_location and date selection in items
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-05-01 15:03:56 UTC
Size:
4.28 KB
patch
obsolete
>From 9aa97db62a60b2ad82c2089be642a40adb4decb3 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 21 Mar 2024 15:34:59 +0000 >Subject: [PATCH] Bug 36120: Account for both pickup_location and date > selection in items > >This patch ensures we account for both pickup location and date >selections having taken place before an item selection is pondered. We >now correctly disable item options given both conditions rather than it >being a race between the two. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/js/modals/place_booking.js | 24 ++++++++++++++++--- > 1 file changed, 21 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 dc6e0b85c14..385604350b9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -254,6 +254,11 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > false, > false > ); >+ newOption.setAttribute( >+ "data-available", >+ true >+ ); >+ > // Append it to the select > $("#booking_item_id").append(newOption); > } >@@ -459,9 +464,13 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > let option = $(this); > let item_id = option.val(); > if (valid_items.includes(parseInt(item_id))) { >- option.prop("disabled", false); >+ option.attr("data-pickup", true); >+ if (option.data("available")) { >+ option.prop("disabled", false); >+ } > } else { > option.prop("disabled", true); >+ option.attr("data-pickup", false); > } > }); > $("#booking_item_id").trigger("change.select2"); >@@ -526,9 +535,13 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > ); > }) > ) { >+ option.attr("data-available", false); > option.prop("disabled", true); > } else { >- option.prop("disabled", false); >+ option.attr("data-available", true); >+ if (option.data("pickup")) { >+ option.prop("disabled", false); >+ } > } > }); > $("#booking_item_id").trigger("change.select2"); >@@ -536,7 +549,10 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > // Range not set, reset field options > else { > $("#booking_item_id > option").each(function () { >- $(this).prop("disabled", false); >+ let option = $(this); >+ if (option.data("pickup")) { >+ option.prop("disabled", false); >+ } > }); > $("#booking_item_id").trigger("change.select2"); > } >@@ -774,9 +790,11 @@ $("#placeBookingForm").on("submit", function (e) { > $("#placeBookingModal").on("hidden.bs.modal", function (e) { > $("#booking_patron_id").val(null).trigger("change"); > $("#booking_patron_id").empty(); >+ booking_patron = undefined; > $("#booking_item_id").val(0).trigger("change"); > $("#pickup_library_id").val(null).trigger("change"); > $("#pickup_library_id").empty(); >+ $("#pickup_library_id").prop("disabled", true); > $("#period").get(0)._flatpickr.clear(); > $("#booking_start_date").val(""); > $("#booking_end_date").val(""); >-- >2.44.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 36120
:
162911
|
162912
|
162914
|
162915
|
162916
|
162917
|
162918
|
162919
|
162920
|
162921
|
162922
|
162923
|
162924
|
162925
|
162926
|
162927
|
162928
|
162976
|
163218
|
163219
|
163220
|
163221
|
163222
|
163223
|
163224
|
163435
|
163436
|
163437
|
163438
|
163439
|
163440
|
163441
|
163442
|
163443
|
163444
|
163445
|
163446
|
163447
|
163448
|
163565
|
163566
|
163567
|
163568
|
163569
|
163570
|
163571
|
163603
|
163604
|
163605
|
163606
|
163607
|
163608
|
163609
|
163610
|
163611
|
163612
|
163613
|
163635
|
163636
|
165140
|
165175
|
165176
|
165177
|
165178
|
165179
|
165180
|
165181
|
165182
|
165183
|
165184
|
165185
|
165186
|
165187
|
165188
|
165214
|
165215
|
165216
|
165419
|
165420
|
165421
|
165422
|
165423
|
165424
|
165425
|
165426
|
165427
|
165428
|
165429
|
165430
|
165431
|
165432
|
165433
|
165434
|
165435
|
165984
|
165985
|
165986
|
165987
|
165988
|
165989
|
165990
|
165991
|
165992
|
165993
|
165994
|
165995
| 165996 |
165997
|
165998
|
165999
|
166000
|
166001
|
166002