From 5943801b154158e71368cf85aab669ea0bd0cb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kula?= <148193449+mkibp@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:05:02 +0000 Subject: [PATCH] Bug 37393: fix "In bundle:" link not showing for items in staff interface The cause was erroneous check `[% IF bundlesEnabled %]` before the parent bundle information is requested+shown. The `bundlesEnabled` variable checks if the current biblio ITSELF is of collection type, so should only be used for whether to show the button to add new items to the bundle items, NOT for querying whether current item is part of a bundle, as the items that make up the bundle aren't of collection type themselves. The second fixed problem was that `bundle_host` didn't contain `.biblio` subitem (which'd contain the actual host biblio title) as the JavaScript code assumed, and it wasn't possible to request it with the API either. Test plan: please follow the reproduction instructions from bug and ensure that the described issue is gone. If you run into an error 400 on the detail page, you need to refresh API definitions, in kts shell you'drun: redocly bundle --ext json api/v1/swagger/swagger.yaml --output api/v1/swagger/swagger_bundle.json koha-plack --restart kohadev --- api/v1/swagger/paths/biblios.yaml | 1 + .../html_helpers/tables/items/catalogue_detail.inc | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/api/v1/swagger/paths/biblios.yaml b/api/v1/swagger/paths/biblios.yaml index 2da90e27d6..e8b9b0e7cf 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -443,6 +443,7 @@ - item_type - in_bundle - bundle_host + - bundle_host.biblio - bundle_items_lost+count - bundle_items_not_lost+count - course_item.course_reserves.course diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index 18a2c36630..e570d67cac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -223,9 +223,7 @@ [% IF Koha.Preference('UseRecalls') %] embed.push('recall', 'recall+strings', 'recall.patron') [% END %] - [% IF bundlesEnabled %] - embed.push('in_bundle', 'bundle_host', 'bundle_items_lost+count', 'bundle_items_not_lost+count'); - [% END %] + embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count'); [% IF Koha.Preference('UseCourseReserves') %] embed.push('course_item.course_reserves.course'); [% END %] @@ -541,11 +539,9 @@ nodes += '(%s)'.format(escape_str(av_restricted.get(row.restricted_status.toString()))); } - [% IF bundlesEnabled %] - if ( row.in_bundle ) { - nodes += '%s'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); - } - [% END %] + if ( row.in_bundle ) { + nodes += '%s'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true }))); + } return nodes; } }, -- 2.39.2