Bugzilla – Attachment 181295 Details for
Bug 39414
Item type not retained when editing a booking
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39414: Retain item type selection when editing a booking
Bug-39414-Retain-item-type-selection-when-editing-.patch (text/plain), 4.10 KB, created by
Lucas Gass (lukeg)
on 2025-04-22 15:54:10 UTC
(
hide
)
Description:
Bug 39414: Retain item type selection when editing a booking
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-04-22 15:54:10 UTC
Size:
4.10 KB
patch
obsolete
>From ee464b09f6a1d39ef07a888031df28951e863f3f Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 22 Apr 2025 15:51:20 +0000 >Subject: [PATCH] Bug 39414: Retain item type selection when editing a booking > >To test: >1. Place a booking on an item. >2. Click on edit to open the Edit booking modal. >3. The item type will be de-selected, and the booking dates calendar will be locked until the item type is re-selected. >4. APPLY PATCH >5. Try steps 1 - 3 again, this time the proper item type should be selected and the date field will not be locked. >6. Try creating a new booking, making sure everything still works as excepted. >--- > koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js | 9 +++++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >index b214f681fc7..f9e4c193785 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >@@ -377,7 +377,7 @@ > let is_cancelled = row.status === "cancelled"; > [% IF CAN_user_circulate_manage_bookings %] > if (!is_cancelled) { >- result += '<button type="button" class="btn btn-default btn-xs edit-action" data-bs-toggle="modal" data-bs-target="#placeBookingModal" data-booking="%s" data-biblionumber="%s" data-itemnumber="%s" data-patron="%s" data-pickup_library="%s" data-start_date="%s" data-end_date="%s"><i class="fa fa-pencil" aria-hidden="true"></i> %s</button>'.format(row.booking_id, biblionumber, row.item_id, row.patron_id, row.pickup_library_id, row.start_date, row.end_date, _("Edit")); >+ result += '<button type="button" class="btn btn-default btn-xs edit-action" data-bs-toggle="modal" data-bs-target="#placeBookingModal" data-booking="%s" data-biblionumber="%s" data-itemnumber="%s" data-patron="%s" data-pickup_library="%s" data-start_date="%s" data-end_date="%s" data-item_type_id="%s"><i class="fa fa-pencil" aria-hidden="true"></i> %s</button>'.format(row.booking_id, biblionumber, row.item_id, row.patron_id, row.pickup_library_id, row.start_date, row.end_date, row.item.item_type_id, _("Edit")); > result += '<button type="button" class="btn btn-default btn-xs cancel-action" data-bs-toggle="modal" data-bs-target="#cancelBookingModal" data-booking="%s"><i class="fa fa-trash" aria-hidden="true"></i> %s</button>'.format(row.booking_id, _("Cancel")); > } > [% END %] >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 84330c3960b..47b1f0be10f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -35,6 +35,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > booking_item_id = button.data("itemnumber"); > let start_date = button.data("start_date"); > let end_date = button.data("end_date"); >+ let item_type_id = button.data("item_type_id"); > > // Get booking id if this is an edit > booking_id = button.data("booking"); >@@ -198,6 +199,7 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > }); > function setLocationsPicker(response) { > let $pickupSelect = $("#pickup_library_id"); >+ let $itemTypeSelect = $("#booking_itemtype"); > let bookableItemnumbers = bookable_items.map(function (object) { > return object.item_id; > }); >@@ -236,6 +238,13 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > } else { > $pickupSelect.val(null).trigger("change"); > } >+ >+ // If item_type_id already exists, pre-select >+ if (item_type_id) { >+ $itemTypeSelect.val(item_type_id).trigger("change"); >+ } else { >+ $itemTypeSelect.val(null).trigger("change"); >+ } > } > > // Itemtype select2 >-- >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 39414
:
181295
|
181377