Bugzilla – Attachment 171395 Details for
Bug 37618
Select patron's, then item's home library by default for pickup location when creating bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37618: (follow-up) Remove redundant api call
Bug-37618-follow-up-Remove-redundant-api-call.patch (text/plain), 3.93 KB, created by
Paul Derscheid
on 2024-09-12 13:23:17 UTC
(
hide
)
Description:
Bug 37618: (follow-up) Remove redundant api call
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-09-12 13:23:17 UTC
Size:
3.93 KB
patch
obsolete
>From ee236c2faee548f5cdf5ec8b1510978c1197dee5 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Thu, 12 Sep 2024 13:21:17 +0000 >Subject: [PATCH] Bug 37618: (follow-up) Remove redundant api call > >--- > .../prog/js/modals/place_booking.js | 54 +++++++------------ > 1 file changed, 20 insertions(+), 34 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 683aa67a7b..604e494b14 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -606,46 +606,32 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > > // Set item's home library as default if patron's home library hasn't already populated pickup_library_id > let pickup_library_id = $("#pickup_library_id").val(); >- const booking_patron_id = $("#booking_patron_id").val(); >- if (!pickup_library_id && booking_patron_id) { >- $.ajax({ >- url: >- "/api/v1/patrons?patron_id=" + >- booking_patron_id, >- dataType: "json", >- type: "GET", >- }).then(response => { >- const [booking_patron] = response; >- let is_home; >- pickup_library_id = bookable_items.find( >- ({ home_library_id, holding_library_id }) => { >- is_home = >- holding_library_id === home_library_id; >- if (is_home) { >- return ( >- home_library_id === >- booking_patron.library_id >- ); >- } >- >+ if (!pickup_library_id && booking_patron) { >+ let is_home; >+ pickup_library_id = bookable_items.find( >+ ({ home_library_id, holding_library_id }) => { >+ is_home = >+ holding_library_id === home_library_id; >+ if (is_home) { > return ( >- holding_library_id === >+ home_library_id === > booking_patron.library_id > ); > } >- )?.[ >- is_home >- ? "home_library_id" >- : "holding_library_id" >- ]; >- if (!pickup_library_id) { >- return; >+ >+ return ( >+ holding_library_id === >+ booking_patron.library_id >+ ); > } >+ )?.[is_home ? "home_library_id" : "holding_library_id"]; >+ if (!pickup_library_id) { >+ return; >+ } > >- $("#pickup_library_id") >- .val(pickup_library_id) >- .trigger("change.select2"); >- }); >+ $("#pickup_library_id") >+ .val(pickup_library_id) >+ .trigger("change.select2"); > } > > // Disable patron selection change >-- >2.46.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 37618
:
170235
|
171384
|
171394
|
171395
|
173155
|
173156
|
173157
|
176924