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 <roman.dolny@jezuici.pl>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7df4eda9ec)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Michał Kula 2024-07-17 13:05:02 +00:00 committed by wainuiwitikapark
parent a567f9b818
commit ba49b71340
2 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -241,9 +241,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 %]
@ -559,11 +557,9 @@
nodes += '<span class="restricted">(%s)</span>'.format(escape_str(av_restricted.get(row.restricted_status.toString())));
}
[% IF bundlesEnabled %]
if ( row.in_bundle ) {
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
}
[% END %]
if ( row.in_bundle ) {
nodes += '<span class="bundled">%s</span>'.format(_("In bundle: %s").format($biblio_to_html(row.bundle_host.biblio, { link: true })));
}
return nodes;
}
},