Bug 37393 - Bundle items don't show their host in the staff interface
Summary: Bundle items don't show their host in the staff interface
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Michał
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-17 12:57 UTC by Michał
Modified: 2024-07-18 18:00 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 37393: fix "In bundle:" link not showing for items in staff interface (3.62 KB, patch)
2024-07-17 13:08 UTC, Michał
Details | Diff | Splinter Review
Bug 37393: fix "In bundle:" link not showing for items in staff interface (3.67 KB, patch)
2024-07-18 18:00 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michał 2024-07-17 12:57:06 UTC
If you add an item to a bundle, it's supposed to show "Not for loan (Added to bundle); In bundle: <bundle title>". This works in OPAC, but not in staff interface.

The cause is 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.

To reproduce:

1. Have two biblio records
record 1 = normal record, not a collection
record 2 = in leader 000, 7- Bibliographic level must be set to c- Collection

2. Add an item with some kind of barcode to each.

3. In record 2 in staff interface, next to the item, click "Manage bundle" and then "Add to bundle", enter the barcode of the item of record 1, and confirm.

4. Open record 1 in OPAC, you will see that the item is not for loan/part of bundle, you will see "In bundle:" followed by a link to record 2.

5. Open record 1 in staff interface, you will see that the "In bundle:" link is missing! (that's the bug)
Comment 1 Michał 2024-07-17 13:08:45 UTC
Created attachment 169081 [details] [review]
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
Comment 2 Roman Dolny 2024-07-18 18:00:43 UTC
Created attachment 169162 [details] [review]
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>