From d146420bffe46cc0840538947a842a86c81172ca Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 21 Aug 2025 01:34:49 +0000 Subject: [PATCH] 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. --- t/db_dependent/ILSDI_Services.t | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t index e439df02ba..160df7803b 100755 --- a/t/db_dependent/ILSDI_Services.t +++ b/t/db_dependent/ILSDI_Services.t @@ -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 $biblio = $builder->build_sample_biblio( + { + title => 'This is an awesome title', + } + ); + my $item = $builder->build_sample_item( { - library => $branch1->{branchcode}, + 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, -- 2.39.5