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: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Michał
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-17 12:57 UTC by Michał
Modified: 2024-12-29 03:57 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the item status for an item in a bundle, shown in the staff interface's holdings table. If an item is part of a bundle, the item status should show as "Not for loan (Added to bundle). In bundle: [Title and link to record it is bundled with]". It was not showing the "In bundle: [...]" text and link to the bundled item. (Note: This fixes the staff interface, the OPAC correctly shows the text and link. To use the bundle feature: 1) For a record's leader, set position "7- Bibliographic level" to "c- Collection". 2) Use the "Manage bundle" action for the record's item, and add items to the bundle.)
Version(s) released in:
25.05.00,24.11.01,24.05.06
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
Bug 37393: fix "In bundle:" link not showing for items in staff interface (3.76 KB, patch)
2024-11-22 10:20 UTC, Marcel de Rooy
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>
Comment 3 Marcel de Rooy 2024-11-15 08:29:18 UTC
Please fix email address of commit author
Comment 4 Michał 2024-11-15 14:22:41 UTC
The e-mail is configured as intended, this is GitHub e-mails that assign commit attribution to users (https://github.com/Koha-Community/Koha/commits?author=mkibp) on the site while providing privacy protection at the same time: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address

I have previously contributed to Koha several times with this e-mail provided and there's nothing in the contribution guidelines that would hint against that, so I don't see a reason for this to be a hindrance.

Otherwise a "real" reachable e-mail may be extracted from commits by bots and then spammed to death, while real people would comment on the offending commit's Bug on the Bugzilla if they wanted to reach out to the author and CC'd people about the changes that were previously introduced, as does happen sometimes. E-mails from Bugzilla can also be nicely filtered by people and sorted into folders on their e-mail client/servers and assigned into "conversation history" view, while random personal e-mails wouldn't.
Comment 5 Marcel de Rooy 2024-11-18 07:25:54 UTC
(In reply to Michał from comment #4)
> The e-mail is configured as intended, this is GitHub e-mails that assign
> commit attribution to users
> (https://github.com/Koha-Community/Koha/commits?author=mkibp) on the site
> while providing privacy protection at the same time:
> https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-
> personal-account-on-github/managing-email-preferences/setting-your-commit-
> email-address
> 
> I have previously contributed to Koha several times with this e-mail
> provided and there's nothing in the contribution guidelines that would hint
> against that, so I don't see a reason for this to be a hindrance.
> 
> Otherwise a "real" reachable e-mail may be extracted from commits by bots
> and then spammed to death, while real people would comment on the offending
> commit's Bug on the Bugzilla if they wanted to reach out to the author and
> CC'd people about the changes that were previously introduced, as does
> happen sometimes. E-mails from Bugzilla can also be nicely filtered by
> people and sorted into folders on their e-mail client/servers and assigned
> into "conversation history" view, while random personal e-mails wouldn't.

Thanks for explaining.
Comment 6 Marcel de Rooy 2024-11-22 10:19:44 UTC
(In reply to Michał from comment #0)

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

The way this bundlesEnabled variable is filled, is quite obscure. It is actually done here:
    $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
To me it read more like 'feature enabled' but it indeed depends on the leader.
Your code looks good to me.
Comment 7 Marcel de Rooy 2024-11-22 10:20:40 UTC
Created attachment 174918 [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>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Marcel de Rooy 2024-11-22 10:21:18 UTC
Martin, care to have a quick look at this one?
Comment 9 Katrin Fischer 2024-12-03 16:29:30 UTC
(In reply to Marcel de Rooy from comment #8)
> Martin, care to have a quick look at this one?

*ping*
Comment 10 Katrin Fischer 2024-12-04 15:31:48 UTC
I had to stare at it for a while, but I think I get it now.

This removes the checks from parts, where we don't expect a set record as it's about displaying the bundled items, not the bundle item...
Comment 11 Katrin Fischer 2024-12-04 15:33:24 UTC
Pushed for 25.05!

Well done everyone, thank you!
Comment 12 Martin Renvoize (ashimema) 2024-12-04 16:51:56 UTC
Agreed, I finally found a moment and it looks solid.
Comment 13 Paul Derscheid 2024-12-10 16:02:51 UTC
Nice work everyone!

Pushed to 24.11.x for 24.11.01
Comment 14 Wainui Witika-Park 2024-12-17 01:12:30 UTC
Backported to 24.05.x for 24.05.06
Comment 15 Fridolin Somers 2024-12-18 15:35:52 UTC
Not for 23.11.x
Comment 16 David Nind 2024-12-29 03:57:07 UTC
Manual updates
--------------

The bundle feature is documented at https://koha-community.org/manual/latest/en/html/circulation.html#circulating-bundles

This is a bug that fixes something that is not working as it should, so normally no manual update would be required.

However, the screenshots need updating, so I have left the "Needs documenting" status.