From 6cee99c7a05e1efccb2302ec0f9916282f4b854a 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 Signed-off-by: Roman Dolny Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit 7df4eda9ecb478c5d6dc5672998d2616f14c83f2) Signed-off-by: Paul Derscheid --- 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 036179cfa9..6502a4f67d 100644 --- a/api/v1/swagger/paths/biblios.yaml +++ b/api/v1/swagger/paths/biblios.yaml @@ -472,6 +472,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 9fa81b87f7..f6ce0667c3 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 @@ -245,9 +245,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 %] @@ -568,11 +566,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; } },