Bug 40622: Use OPAC MARCXML for ILS-DI GetRecords

This change makes it so that the ILS-DI GetRecords output for
"marcxml" will contain the OPAC version of the record.

Test plan:
0. Apply the patches
1. prove t/db_dependent/ILSDI_Services.t
2. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=29
3. Click "Settings" to change the framework to Default, and click "Save"
4. Go to http://localhost:8081/cgi-bin/koha/admin/marc_subfields_structure.pl
?op=add_form&tagfield=245&tagsubfield=a&frameworkcode=#subafield
5. Untick the "OPAC" box and click "Save changes"
6. Go to system preferences
7. Change "ILS-DI" to "Enable"
8. Change "ILS-DI:AuthorizedIPs" to 0.0.0.0/0
9. Go to http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetRecords&id=29
10. Note that you cannot see the title in the MARCXML.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 02aba8c0b2)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
David Cook 2025-08-21 01:34:49 +00:00 committed by Paul Derscheid
parent 1e35ae3e20
commit 0ec1ea7fc8
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 21 additions and 3 deletions

View File

@ -34,6 +34,8 @@ use C4::Reserves qw (AddReserve ModReserve ModReserveAffect ModReserveStatus)
use Koha::AuthUtils;
use Koha::DateUtils qw( dt_from_string );
use Koha::MarcSubfieldStructures;
BEGIN {
use_ok(
'C4::ILSDI::Services',
@ -800,7 +802,7 @@ subtest 'Holds test with start_date and end_date' => sub {
subtest 'GetRecords' => sub {
plan tests => 10;
plan tests => 11;
$schema->storage->txn_begin;
@ -817,12 +819,24 @@ subtest 'GetRecords' => sub {
}
);
my $item = $builder->build_sample_item(
my $biblio = $builder->build_sample_biblio(
{
library => $branch1->{branchcode},
title => 'This is an awesome title',
}
);
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
library => $branch1->{branchcode},
}
);
my $framework_f245a = Koha::MarcSubfieldStructures->find(
{ frameworkcode => $biblio->frameworkcode, tagfield => "245", tagsubfield => "a" } );
$framework_f245a->hidden('8');
$framework_f245a->store();
my $patron = $builder->build(
{
source => 'Borrower',
@ -855,6 +869,10 @@ subtest 'GetRecords' => sub {
my $reply = C4::ILSDI::Services::GetRecords($cgi);
my $opac_marcxml = $reply->{record}->[0]->{marcxml};
my @title_matches = ( $opac_marcxml =~ m/This is an awesome title/g );
is( scalar @title_matches, 0, 'Title hidden in output as expected' );
my $transfer = $item->get_transfer;
my $expected = {
datesent => $transfer->datesent,