From 14dbc216dc3c1e8017d1fd6afd10218b792256c2 Mon Sep 17 00:00:00 2001 From: David Gustafsson Date: Mon, 16 Oct 2023 14:53:12 +0200 Subject: [PATCH] Bug 18138: Fix tests, system preference specification and options Signed-off-by: Phil Ringnalda --- Koha/MarcModificationTemplate.pm | 2 +- admin/preferences.pl | 2 +- .../en/modules/admin/preferences/cataloguing.pref | 2 +- .../EditBiblioMarcModificationTemplatePreference.t | 11 ++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Koha/MarcModificationTemplate.pm b/Koha/MarcModificationTemplate.pm index 049f2c2d85..c04d98eb85 100644 --- a/Koha/MarcModificationTemplate.pm +++ b/Koha/MarcModificationTemplate.pm @@ -25,7 +25,7 @@ use base qw(Koha::Object); =head1 NAME -Koha::MarcModificationTemplate - Koha Marc Modification Templat Object class +Koha::MarcModificationTemplate - Koha Marc Modification Template Object class =head1 API diff --git a/admin/preferences.pl b/admin/preferences.pl index 4a34652f5b..3d6b64eb3d 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -115,7 +115,7 @@ sub _get_chunk { $add_blank = 1; } } elsif ( $options{choices} eq 'marcModTemplates' ) { - $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search }; + $options{choices} = { map { $_->template_id => $_->name } Koha::MarcModificationTemplates->search->as_list }; $add_blank = 1; } else { die 'Unrecognized source of preference values: ' . $options{'choices'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index b73e509115..ed2286c3b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -220,7 +220,7 @@ Cataloging: - - Apply the MARC modification template with name - pref: SaveBiblioMarcModificationTemplate - class: modification-templates + choices: marcModTemplates - on records saved using the staff client simple MARC editor, advanced editor or HTTP API. Display: - diff --git a/t/db_dependent/www/EditBiblioMarcModificationTemplatePreference.t b/t/db_dependent/www/EditBiblioMarcModificationTemplatePreference.t index 0d53ca6c98..0841872419 100755 --- a/t/db_dependent/www/EditBiblioMarcModificationTemplatePreference.t +++ b/t/db_dependent/www/EditBiblioMarcModificationTemplatePreference.t @@ -24,7 +24,8 @@ use MARC::Record; use XML::Simple; use C4::MarcModificationTemplates; use Koha::MarcModificationTemplates; -use C4::Biblio qw(AddBiblio ModBiblioMarc GetMarcBiblio); +use C4::Biblio qw(AddBiblio ModBiblioMarc DelBiblio); +use Koha::Biblios; eval{ use C4::Context; @@ -85,7 +86,7 @@ subtest 'Templates applied using simple and advanced MARC Editor' => sub { ); my ($biblionumber) = AddBiblio($record, ''); - my $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 }); + my $saved_record = Koha::Biblios->find($biblionumber)->metadata->record(); my $saved_record_250_field = $saved_record->field('250'); isa_ok($saved_record_250_field, 'MARC::Field', 'Field with tag 250 has been saved'); is($saved_record_250_field->subfield('a'), '250 bottles of beer on the wall', 'Field 250a has the same value passed to AddBiblio'); @@ -100,9 +101,9 @@ subtest 'Templates applied using simple and advanced MARC Editor' => sub { $agent->field('password', $password); $agent->field('userid', $user); $agent->field('branch', ''); - $agent->click_ok('', 'Login to staff client'); + $agent->click_ok('', 'Login to staff interface'); + $agent->content_lacks('Invalid username or password', 'Logged in to staff interface'); - $agent->get_ok("$intranet/cgi-bin/koha/mainpage.pl", 'Load main page'); #FIXME: Remove? $agent->get_ok("$intranet/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber", 'Load bibliographic record in simple MARC editor'); $agent->submit_form_ok( { @@ -112,7 +113,7 @@ subtest 'Templates applied using simple and advanced MARC Editor' => sub { 'Save bibliographic record using simple MARC editor' ); - $saved_record = GetMarcBiblio({ biblionumber => $biblionumber, embed_items => 0 }); + $saved_record = Koha::Biblios->find($biblionumber)->metadata->record(); $saved_record_250_field = $saved_record->field('250'); is($saved_record_250_field->subfield('a'), '251 bottles of beer on the wall', 'Field with tag 250 has been modified by MARC modification template'); -- 2.40.0