Bugzilla – Attachment 181040 Details for
Bug 37829
Allow additional fields for bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37829: Add additional fields support to modal, tables
Bug-37829-Add-additional-fields-support-to-modal-t.patch (text/plain), 26.72 KB, created by
Paul Derscheid
on 2025-04-16 16:31:11 UTC
(
hide
)
Description:
Bug 37829: Add additional fields support to modal, tables
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2025-04-16 16:31:11 UTC
Size:
26.72 KB
patch
obsolete
>From 90fa958c957e2d9dfa785dac0c6ff4f30a385b15 Mon Sep 17 00:00:00 2001 >From: Paul Derscheid <paul.derscheid@lmscloud.de> >Date: Wed, 16 Apr 2025 15:41:05 +0000 >Subject: [PATCH] Bug 37829: Add additional fields support to modal, tables > >To test: >1) Setup: > a) Apply the db seed provided: > koha-mysql < test_bug_37829.sql > > --- or --- > > b) Setup authorised values and additional fields manually: > i) Navigate to Administration -> Authorized Values and click '+ New Category'. > ii) Define a new authorised value category (e.g., prefix with BOOKINGS_ for easy identification). > iii) Click '+ Add a new authorized value'. > iv) Add a value, filling in at least 'Authorized Value' and 'Description'. > v) Save the value. > vi) Navigate to Administration -> Additional Fields. > vii) Click 'Bookings (bookings)'. > viii)Click '+ New field'. > ix) Add a plain text field (fill 'Name' and save). > x) Add a repeatable text field. > xi) Add a field tied to your previously created authorized value category. > xii) Add another field tied to any authorised value (e.g., YES_NO) and make it repeatable. > >2) Item Configuration: > Make an item bookable. Either: > a) Navigate to Administration -> Item types, select an item type (e.g., BK), and check 'bookable'. > b) Navigate to the 'Items' view for a specific item (catalogue/moredetail.pl) and set Priority -> Bookable -> 'Yes'. > >3) Create Booking: > Click the 'Place booking' button on the item's record. The configured additional fields should load dynamically in the modal. > >4) Fill and Save Booking: > Fill out the default booking fields and then the additional fields. Use the 'Remove' and 'New' buttons for repeatable fields. Save the booking. > >5) Verify Display in Tables: > Confirm that the additional fields for the booking are displayed correctly in the following locations: > a) The bookings table within the bibliographic record's detail view. > b) The 'Check out' view (circ/circulation.pl -> Bookings tab). > c) The 'Patron's details' view (members/moremember.pl -> Bookings tab). > d) The 'Bookings to collect' view (circ/pendingbookings.pl) (adjust filters if necessary). > >6) Verify Edit/Move Functionality: > Return to the bookings view of the bibliographic record. > a) Verify the additional fields are correctly pre-filled and saved when you move the booking using the timeline component. > b) Verify the additional fields are correctly pre-filled and saved when you edit the booking using the edit button in the bookings table. > >7) Repeat Testing: > Repeat steps 4 through 6.b with additional bookings to ensure consistency. > >8) Sign-off and/or give your feedback. > >Here's some things I'd would still like to improve/try: >- Incorporate the neighboring additional-fields-entry.js to have a single library for additional fields >- Restructure the buttons to be consistent with other usage of additional fields in Koha (noticed this way to late) >- Test this with the freshly added support for additional fields on branches (libraries) >- Make the additional field values searchable in the table >- Clean up and DRY some of the JSDoc types (but this could easily become its own tree of bugs if done from the source :D) >- Use mockData.js for the mocha tests instead of hardcoding them > >I actually need this for a customer and the current state will be alright for that, but now it's good enough to work and improve it together. >--- > .../prog/en/modules/bookings/list.tt | 83 +++++++++++++++++-- > .../prog/en/modules/catalogue/ISBDdetail.tt | 1 + > .../prog/en/modules/catalogue/MARCdetail.tt | 1 + > .../prog/en/modules/catalogue/detail.tt | 1 + > .../prog/en/modules/catalogue/imageviewer.tt | 1 + > .../en/modules/catalogue/labeledMARCdetail.tt | 1 + > .../prog/en/modules/catalogue/moredetail.tt | 1 + > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/circ/pendingbookings.tt | 34 +++++++- > .../prog/en/modules/members/moremember.tt | 1 + > .../prog/js/modals/place_booking.js | 43 +++++++++- > .../intranet-tmpl/prog/js/tables/bookings.js | 32 ++++++- > 12 files changed, 188 insertions(+), 12 deletions(-) > >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 b214f681fc..d12de36f23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt >@@ -73,6 +73,7 @@ > <script> > dayjs.extend(window.dayjs_plugin_isSameOrBefore); > </script> >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% Asset.js("js/cancel_booking_modal.js") | $raw %] > [% Asset.js("js/combobox.js") | $raw %] >@@ -91,11 +92,23 @@ > }); > var bookings = $.ajax({ > url: '/api/v1/biblios/%s/bookings?_per_page=-1'.format(biblionumber), >- headers: { 'x-koha-embed': 'patron' }, >+ headers: { 'x-koha-embed': ['patron', 'extended_attributes'] }, > dataType: 'json', > type: 'GET', > }); >- >+ var extended_attribute_types; >+ var authorised_values; >+ AdditionalFields.fetchAndProcessExtendedAttributes("booking") >+ .then(types => { >+ extended_attribute_types = types; >+ const catArray = Object.values(types) >+ .map(attr => attr.authorised_value_category_name) >+ .filter(Boolean); >+ return AdditionalFields.fetchAndProcessAuthorizedValues(catArray); >+ }) >+ .then(values => { >+ authorised_values = values; >+ }); > $.when(items, bookings).then( > function(items, bookings){ > var itemsSet = new vis.DataSet([{ >@@ -123,6 +136,7 @@ > pickup_library: booking.pickup_library_id, > start: dayjs(booking.start_date).toDate(), > end: dayjs(booking.end_date).toDate(), >+ extended_attributes: booking.extended_attributes, > content: !isActive ? `<s>${patronContent}</s>` : patronContent, > [% IF CAN_user_circulate_manage_bookings %] > editable: booking.status !== "cancelled" ? { remove: true, updateTime: true } : false, >@@ -190,7 +204,23 @@ > // set end datetime hours and minutes to the end of the day > let endDate = dayjs(data.end).endOf('day'); > >- $('#placeBookingModal').modal('show', $('<button data-booking="'+data.id+'" data-biblionumber="[% biblionumber | uri %]" data-itemnumber="'+data.group+'" data-patron="'+data.patron+'" data-pickup_library="'+data.pickup_library+'" data-start_date="'+startDate.toISOString()+'" data-end_date="'+endDate.toISOString()+'">')); >+ // Get the current booking to preserve extended attributes >+ let currentBooking = bookingsSet.get(data.id); >+ let extendedAttributes = currentBooking.extended_attributes || []; >+ >+ $('#placeBookingModal').modal('show', $(`<button >+ data-booking="${data.id}" >+ data-biblionumber="[% biblionumber | uri %]" >+ data-itemnumber="${data.group}" >+ data-patron="${data.patron}" >+ data-pickup_library="${data.pickup_library}" >+ data-start_date="${startDate.toISOString()}" >+ data-end_date="${endDate.toISOString()}" >+ data-extended_attributes='${JSON.stringify(extendedAttributes.map(attribute => ({ >+ field_id: attribute.field_id, >+ value: attribute.value >+ })))}' >+ >`)); > $('#placeBookingModal').on('hide.bs.modal', function(e) { > if (update_success) { > update_success = 0; >@@ -246,7 +276,8 @@ > "embed": [ > "item", > "patron", >- "pickup_library" >+ "pickup_library", >+ "extended_attributes", > ], > "columns": [{ > "data": "booking_id", >@@ -366,6 +397,20 @@ > return $date(row.end_date); > } > }, >+ { >+ data: "extended_attributes", >+ title: _("Additional fields"), >+ searchable: false, >+ orderable: false, >+ render: function (data, type, row, meta) { >+ return AdditionalFields.renderExtendedAttributesValues( >+ data, >+ extended_attribute_types, >+ authorised_values, >+ row.booking_id >+ ).join("<br>"); >+ }, >+ }, > { > "data": "", > "title": _("Actions"), >@@ -377,8 +422,34 @@ > 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 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")); >+ result += ` >+ <button type="button" class="btn btn-default btn-xs edit-action" >+ data-bs-toggle="modal" >+ data-bs-target="#placeBookingModal" >+ data-booking="${row.booking_id}" >+ data-biblionumber="${biblionumber}" >+ data-itemnumber="${row.item_id}" >+ data-patron="${row.patron_id}" >+ data-pickup_library="${row.pickup_library_id}" >+ data-start_date="${row.start_date}" >+ data-end_date="${row.end_date}" >+ data-extended_attributes='${JSON.stringify(row.extended_attributes >+ .filter(attribute => attribute.record_id == row.booking_id) >+ .map(attribute => ({ >+ field_id: attribute.field_id, >+ value: attribute.value >+ }) >+ ))}' >+ > >+ <i class="fa fa-pencil" aria-hidden="true"></i> ${_("Edit")} >+ </button>`; >+ result += ` >+ <button type="button" class="btn btn-default btn-xs cancel-action" >+ data-bs-toggle="modal" >+ data-bs-target="#cancelBookingModal" >+ data-booking="${row.booking_id}"> >+ <i class="fa fa-trash" aria-hidden="true"></i> ${_("Cancel")} >+ </button>`; > } > [% END %] > return result; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >index 8fdd39fb2c..6cf4f4785d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >@@ -85,6 +85,7 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% Asset.js("js/browser.js") | $raw %] > [% IF ( Koha.Preference('CatalogConcerns') ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >index 0b7138a255..b837f3176f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >@@ -209,6 +209,7 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% Asset.js("js/browser.js") | $raw %] > [% IF ( Koha.Preference('CatalogConcerns') ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 801f7dad1e..8c91bc2ded 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1712,6 +1712,7 @@ > [% INCLUDE 'js-patron-format.inc' %] > [% INCLUDE 'js-biblio-format.inc' %] > [% Asset.js("js/browser.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > <script> > var browser; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >index 0bb0a483a0..ecbc7870b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >@@ -139,6 +139,7 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% IF ( Koha.Preference('CatalogConcerns') ) %] > <script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >index 3e83f4e01c..d51369abb1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >@@ -98,6 +98,7 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% Asset.js("js/browser.js") | $raw %] > [% IF ( Koha.Preference('CatalogConcerns') ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index e6ca9c6ae9..2fd310c5bf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -577,6 +577,7 @@ > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] > [% Asset.js("js/catalog.js") | $raw %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/modals/place_booking.js") | $raw %] > [% Asset.js("js/browser.js") | $raw %] > [% Asset.js("js/checkout_renewals_modal.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index ad2dcc6412..4b14f9ff9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1098,6 +1098,7 @@ > [% END %] > [% Asset.js("js/holds.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/cancel_booking_modal.js") | $raw %] > [% Asset.js("js/combobox.js") | $raw %] > [% INCLUDE 'js-biblio-format.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt >index ec56c04849..cdbffb7fd1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt >@@ -116,9 +116,23 @@ > [% INCLUDE 'js-biblio-format.inc' %] > [% INCLUDE 'js-date-format.inc' %] > [% INCLUDE 'js-patron-format.inc' %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > <script> > let table_settings = [% TablesSettings.GetTableSettings( 'circ', 'bookings', 'bookings-to-collect', 'json' ) | $raw %]; > $(document).ready(function() { >+ var extended_attribute_types; >+ var authorised_values; >+ AdditionalFields.fetchAndProcessExtendedAttributes("booking") >+ .then(types => { >+ extended_attribute_types = types; >+ const catArray = Object.values(types) >+ .map(attr => attr.authorised_value_category_name) >+ .filter(Boolean); >+ return AdditionalFields.fetchAndProcessAuthorizedValues(catArray); >+ }) >+ .then(values => { >+ authorised_values = values; >+ }); > > let additional_filters = { > start_date: function() { >@@ -174,7 +188,8 @@ > "item+strings", > "item.checkout", > "patron", >- "pickup_library" >+ "pickup_library", >+ "extended_attributes" > ], > "order": [[ 7, "asc" ]], > "columns": [{ >@@ -268,7 +283,22 @@ > "render": function(data, type, row, meta) { > return $date(row.start_date) + ' - ' + $date(row.end_date); > } >- }] >+ }, >+ { >+ data: "extended_attributes", >+ title: _("Additional fields"), >+ searchable: false, >+ orderable: false, >+ render: function (data, type, row, meta) { >+ return AdditionalFields.renderExtendedAttributesValues( >+ data, >+ extended_attribute_types, >+ authorised_values, >+ row.booking_id >+ ).join("<br>"); >+ }, >+ }, >+ ] > }, table_settings, 1, additional_filters, filters_options); > > /** Date filtering */ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 16c2b33380..3bc15fb97b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -780,6 +780,7 @@ > [% END %] > [% Asset.js("js/holds.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >+ [% Asset.js("js/additional-fields.js") | $raw %] > [% Asset.js("js/cancel_booking_modal.js") | $raw %] > [% Asset.js("js/combobox.js") | $raw %] > [% INCLUDE 'js-biblio-format.inc' %] >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 84330c3960..e38342e14a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/place_booking.js >@@ -7,6 +7,17 @@ let bookable_items, > booking_patron, > booking_itemtype_id; > >+// Initialize AdditionalFields module >+const additionalFields = AdditionalFields.init({ >+ containerId: "booking_extended_attributes", >+ resourceType: "booking", >+ selectors: { >+ repeatableFieldClass: "repeatable-field", >+ inputClass: "extended-attribute", >+ fieldPrefix: "extended_attributes", >+ }, >+}); >+ > function containsAny(integers1, integers2) { > // Create a hash set to store integers from the second array > let integerSet = {}; >@@ -35,6 +46,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 extended_attributes = button.data("extended_attributes"); > > // Get booking id if this is an edit > booking_id = button.data("booking"); >@@ -47,6 +59,15 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > $("#booking_id").val(""); > } > >+ additionalFields >+ .fetchExtendedAttributes("booking") >+ .then(response => >+ additionalFields.renderExtendedAttributes( >+ response, >+ extended_attributes >+ ) >+ ); >+ > // Patron select2 > $("#booking_patron_id").kohaSelect({ > dropdownParent: $(".modal-content", "#placeBookingModal"), >@@ -332,6 +353,9 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > biblionumber + > "&_per_page=-1" + > '&q={"status":{"-in":["new","pending","active"]}}', >+ headers: { >+ "x-koha-embed": ["extended_attributes"], >+ }, > dataType: "json", > type: "GET", > }); >@@ -1047,7 +1071,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > booking_item_id, > start_date, > end_date, >- periodPicker >+ periodPicker, >+ extended_attributes > ); > }, > function (jqXHR, textStatus, errorThrown) { >@@ -1060,7 +1085,8 @@ $("#placeBookingModal").on("show.bs.modal", function (e) { > booking_item_id, > start_date, > end_date, >- periodPicker >+ periodPicker, >+ extended_attributes > ); > } > }); >@@ -1070,7 +1096,8 @@ function setFormValues( > booking_item_id, > start_date, > end_date, >- periodPicker >+ periodPicker, >+ extended_attributes > ) { > // If passed patron, pre-select > if (patron_id) { >@@ -1123,6 +1150,11 @@ function setFormValues( > if (booking_item_id) { > $("#booking_item_id").val(booking_item_id).trigger("change"); > } >+ >+ // If passed extended attributes, set them >+ if (extended_attributes) { >+ additionalFields.setValues(extended_attributes); >+ } > } > > $("#placeBookingForm").on("submit", function (e) { >@@ -1146,6 +1178,7 @@ $("#placeBookingForm").on("submit", function (e) { > biblio_id: biblio_id, > item_id: item_id != 0 ? item_id : null, > patron_id: $("#booking_patron_id").find(":selected").val(), >+ extended_attributes: additionalFields.getValues(), > }) > ); > >@@ -1215,6 +1248,7 @@ $("#placeBookingForm").on("submit", function (e) { > biblio_id: biblio_id, > item_id: item_id != 0 ? item_id : null, > patron_id: $("#booking_patron_id").find(":selected").val(), >+ extended_attributes: additionalFields.getValues(), > }), > }); > >@@ -1300,4 +1334,7 @@ $("#placeBookingModal").on("hidden.bs.modal", function (e) { > $("#booking_start_date").val(""); > $("#booking_end_date").val(""); > $("#booking_id").val(""); >+ >+ // Clear additional fields >+ additionalFields.clear(); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >index 21c1b94ac7..3dd65b8189 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/tables/bookings.js >@@ -26,13 +26,29 @@ $(document).ready(function () { > }; > > if (!bookings_table) { >+ var extended_attribute_types; >+ var authorised_values; >+ AdditionalFields.fetchAndProcessExtendedAttributes("booking") >+ .then(types => { >+ extended_attribute_types = types; >+ const catArray = Object.values(types) >+ .map(attr => attr.authorised_value_category_name) >+ .filter(Boolean); >+ return AdditionalFields.fetchAndProcessAuthorizedValues( >+ catArray >+ ); >+ }) >+ .then(values => { >+ authorised_values = values; >+ }); >+ > var bookings_table_url = "/api/v1/bookings"; > bookings_table = $("#bookings_table").kohaTable( > { > ajax: { > url: bookings_table_url, > }, >- embed: ["biblio", "item", "patron"], >+ embed: ["biblio", "item", "patron", "extended_attributes"], > columns: [ > { > data: "booking_id", >@@ -94,6 +110,20 @@ $(document).ready(function () { > return $date(row.end_date); > }, > }, >+ { >+ data: "extended_attributes", >+ title: _("Additional fields"), >+ searchable: false, >+ orderable: false, >+ render: function (data, type, row, meta) { >+ return AdditionalFields.renderExtendedAttributesValues( >+ data, >+ extended_attribute_types, >+ authorised_values, >+ row.booking_id >+ ).join("<br>"); >+ }, >+ }, > { > data: "", > title: __("Actions"), >-- >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 37829
:
181034
|
181035
|
181036
|
181037
|
181038
|
181039
| 181040 |
181041
|
181042
|
181043