Bug 38233 - ILS-DI GetRecords should filter out items hidden in OPAC and use OPAC MARCXML
Summary: ILS-DI GetRecords should filter out items hidden in OPAC and use OPAC MARCXML
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Cook
QA Contact: Pedro Amorim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-22 23:43 UTC by David Cook
Modified: 2024-12-16 10:51 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This updates the ILS-DI GetRecords service to use the OPAC version of the MARCXML and filter items based on their OPAC visibility. For example, if OpacHiddenItems includes "withdrawn: [1]" (hide items with a withdrawn status of 1) and hidelostitems is set to "Don't show", then an ILS_DI request for a record will not show items with a withdrawn status = 1 (Withdrawn). Previously, there was no way to hide hidden items from the ILS-DI request.
Version(s) released in:
24.11.00,24.05.06
Circulation function:


Attachments
Bug 38233: respect OPAC visibility for ILS-DI GetRecords (2.10 KB, patch)
2024-10-22 23:59 UTC, David Cook
Details | Diff | Splinter Review
Bug 38233: respect OPAC visibility for ILS-DI GetRecords (2.15 KB, patch)
2024-10-23 19:32 UTC, David Nind
Details | Diff | Splinter Review
Bug 38233: respect OPAC visibility for ILS-DI GetRecords (2.21 KB, patch)
2024-10-29 10:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38233: Add regression tests (2.08 KB, patch)
2024-10-29 10:22 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2024-10-22 23:43:03 UTC
Since ILS-DI is used primarily for discovery services, it should respect things like OpacHiddenItems and hidelostitems sysprefs.

the way to do this is to use "filter_by_visible_in_opac" and to use the "OPAC" MARCXML (ie don't embed hidden items in the MARCXML that goes out).
Comment 1 David Cook 2024-10-22 23:43:11 UTC
Fortunately, this is a super easy fix!
Comment 2 David Cook 2024-10-22 23:59:05 UTC
Created attachment 173187 [details] [review]
Bug 38233: respect OPAC visibility for ILS-DI GetRecords

This change makes the ILS-DI GetRecords service use the OPAC
version of the MARCXML and filters items based on their OPAC visibility

Test plan:
1. Apply the patch
2. koha-plack --restart kohadev
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILS-DI
and enable syspref
4. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems
and add the following:
withdrawn: [1]
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=hidelostitems
Change syspref to "Don't show"
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
7. Add a withdrawn item and a lost item with barcodes of "test1" and "test2" respectively
8. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
9. Note the items with barcodes test1 and test2 do not appear in the "items" tree and they don't
appear in the "marcxml" tree.
Comment 3 David Nind 2024-10-23 19:32:30 UTC
Created attachment 173236 [details] [review]
Bug 38233: respect OPAC visibility for ILS-DI GetRecords

This change makes the ILS-DI GetRecords service use the OPAC
version of the MARCXML and filters items based on their OPAC visibility

Test plan:
1. Apply the patch
2. koha-plack --restart kohadev
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILS-DI
and enable syspref
4. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems
and add the following:
withdrawn: [1]
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=hidelostitems
Change syspref to "Don't show"
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
7. Add a withdrawn item and a lost item with barcodes of "test1" and "test2" respectively
8. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
9. Note the items with barcodes test1 and test2 do not appear in the "items" tree and they don't
appear in the "marcxml" tree.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2024-10-23 19:58:06 UTC
Not related to this bug, but just noting.

If I set an item with for a record with a lost status = 1 (Lost), then when viewing the record in the staff interface, it sits on "Processing".

To replicate:
1. Find any record in the staff interface with an existing item and add a new item.
2. Note that when you select the "Normal" view, the holdings section lists the existing item and the new one that you created.
3. Edit the item you created and change "1 - Lost status" to "Lost".
4. Select the "Normal" view for the record again and note that a dialog box appears saying "Processing" and the holdings table does not list any items.

I've created bug 38248 for this.
Comment 5 David Cook 2024-10-23 22:11:48 UTC
(In reply to David Nind from comment #4)
> Not related to this bug, but just noting.
> 
> If I set an item with for a record with a lost status = 1 (Lost), then when
> viewing the record in the staff interface, it sits on "Processing".

Thanks for testing, David.

I meant to report that as well, so thanks for doing that. I'll take a quick look to see what other bug to link that one too.
Comment 6 Pedro Amorim 2024-10-29 09:38:16 UTC
Looking here
Comment 7 Pedro Amorim 2024-10-29 10:22:07 UTC
Created attachment 173609 [details] [review]
Bug 38233: respect OPAC visibility for ILS-DI GetRecords

This change makes the ILS-DI GetRecords service use the OPAC
version of the MARCXML and filters items based on their OPAC visibility

Test plan:
1. Apply the patch
2. koha-plack --restart kohadev
3. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=ILS-DI
and enable syspref
4. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems
and add the following:
withdrawn: [1]
5. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=hidelostitems
Change syspref to "Don't show"
6. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=29
7. Add a withdrawn item and a lost item with barcodes of "test1" and "test2" respectively
8. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
9. Note the items with barcodes test1 and test2 do not appear in the "items" tree and they don't
appear in the "marcxml" tree.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 8 Pedro Amorim 2024-10-29 10:22:09 UTC
Created attachment 173610 [details] [review]
Bug 38233: Add regression tests

prove t/db_dependent/ILSDI_Services.t

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 9 Katrin Fischer 2024-10-29 15:18:17 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 10 Lucas Gass (lukeg) 2024-12-05 18:11:36 UTC
Backported to 24.05.x for upcoming 24.05.06
Comment 11 Fridolin Somers 2024-12-16 10:51:29 UTC
I prefer not backport to 23.11.x for stability