Bugzilla – Attachment 138076 Details for
Bug 29697
Replace GetMarcBiblio occurrences with $biblio->metadata->record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29697: Replace some missing occurrences
Bug-29697-Replace-some-missing-occurrences.patch (text/plain), 7.24 KB, created by
Jonathan Druart
on 2022-07-25 12:11:18 UTC
(
hide
)
Description:
Bug 29697: Replace some missing occurrences
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-07-25 12:11:18 UTC
Size:
7.24 KB
patch
obsolete
>From 1f4e8b2d05f3bb132e22d7448c08255192847f85 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Jul 2022 14:10:53 +0200 >Subject: [PATCH] Bug 29697: Replace some missing occurrences > >--- > svc/bib | 14 +++++++------- > svc/new_bib | 10 ++++++---- > svc/records/preview | 5 +++-- > t/db_dependent/00-strict.t | 19 +------------------ > t/db_dependent/OAI/Sets.t | 9 +++++---- > 5 files changed, 22 insertions(+), 35 deletions(-) > >diff --git a/svc/bib b/svc/bib >index 2fd01c773de..d25d0710c6a 100755 >--- a/svc/bib >+++ b/svc/bib >@@ -26,6 +26,7 @@ use C4::Auth qw( check_api_auth ); > use C4::Biblio qw( GetFrameworkCode ); > use C4::Items; > use XML::Simple; >+use Koha::Biblios; > > my $query = CGI->new; > binmode STDOUT, ':encoding(UTF-8)'; >@@ -65,9 +66,8 @@ exit 0; > sub fetch_bib { > my $query = shift; > my $biblionumber = shift; >- my $record = C4::Biblio::GetMarcBiblio({ >- biblionumber => $biblionumber, >- embed_items => scalar $query->param('items') }); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $record = $biblio->metadata->record({ embed_items => scalar $query->param('items') }); > if (defined $record) { > print $query->header(-type => 'text/xml',-charset => 'utf-8',); > print $record->as_xml_record(); >@@ -79,7 +79,8 @@ sub fetch_bib { > sub update_bib { > my $query = shift; > my $biblionumber = shift; >- my $old_record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $old_record = $biblio->metadata->record; > my $frameworkcode = $query->url_param('frameworkcode') // GetFrameworkCode($biblionumber); > unless (defined $old_record) { > print $query->header(-type => 'text/xml', -status => '404 Not Found'); >@@ -115,9 +116,8 @@ sub update_bib { > } > > C4::Biblio::ModBiblio( $record, $biblionumber, $frameworkcode ); >- my $new_record = C4::Biblio::GetMarcBiblio({ >- biblionumber => $biblionumber, >- embed_items => scalar $query->url_param('items') }); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') }); > > $result->{'status'} = "ok"; > $result->{'biblionumber'} = $biblionumber; >diff --git a/svc/new_bib b/svc/new_bib >index 57a5988c4ac..3ce32f6b7c8 100755 >--- a/svc/new_bib >+++ b/svc/new_bib >@@ -27,6 +27,8 @@ use C4::Items; > use XML::Simple; > use C4::Charset; > >+use Koha::Biblios; >+ > my $query = CGI->new; > binmode STDOUT, ':encoding(UTF-8)'; > >@@ -75,7 +77,8 @@ sub add_bib { > $record->delete_field($field); > } > my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, $frameworkcode ); >- my $new_record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $new_record = $biblio->metadata->record; > if ( $query->url_param('items') ) { > foreach my $field ( $fullrecord->field($itemtag) ) { > my $one_item_record = $new_record->clone(); >@@ -84,9 +87,8 @@ sub add_bib { > } > } > >- $new_record = C4::Biblio::GetMarcBiblio({ >- biblionumber => $biblionumber, >- embed_items => scalar $query->url_param('items') }); >+ $biblio = Koha::Biblios->find( $biblionumber ); >+ $new_record = $biblio->metadata->record({ embed_items => scalar $query->url_param('items') }); > $result->{'status'} = "ok"; > $result->{'biblionumber'} = $biblionumber; > my $xml = $new_record->as_xml_record(); >diff --git a/svc/records/preview b/svc/records/preview >index 2bc1afcc85d..9e528e43786 100755 >--- a/svc/records/preview >+++ b/svc/records/preview >@@ -20,7 +20,7 @@ > use Modern::Perl; > use CGI; > use C4::Auth qw( get_template_and_user ); >-use C4::Biblio qw( GetMarcBiblio ApplyMarcOverlayRules ); >+use C4::Biblio qw( ApplyMarcOverlayRules ); > use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate ); > use C4::Output qw( output_html_with_http_headers ); > >@@ -35,7 +35,8 @@ my $mmtid = $query->param('mmtid'); # Marc modification template id > > my $record; > if ( $record_type eq 'biblio' ) { >- $record = GetMarcBiblio({ biblionumber => $record_id }); >+ my $biblio = Koha::Biblios->find( $record_id ); >+ my $record = $biblio->metadata->record; > } else { > my $authority = Koha::MetadataRecord::Authority->get_from_authid( $record_id ); > $record = $authority->record; >diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t >index eb2ea525374..ced32975a90 100755 >--- a/t/db_dependent/00-strict.t >+++ b/t/db_dependent/00-strict.t >@@ -14,24 +14,7 @@ use lib("misc/translator"); > use lib("installer"); > > my @dirs = ( >- 'acqui', 'admin', >- 'authorities', 'basket', >- 'catalogue', 'cataloguing', >- 'changelanguage.pl', 'circ', >- 'debian', 'docs', >- 'errors', 'fix-perl-path.PL', 'help.pl', >- 'installer', 'koha_perl_deps.pl', >- 'kohaversion.pl', 'labels', >- 'mainpage.pl', 'Makefile.PL', >- 'members', 'misc', >- 'offline_circ', 'opac', >- 'patroncards', 'reports', >- 'reserve', 'reviews', >- 'rewrite-config.PL', 'rotating_collections', >- 'serials', 'services', >- 'skel', 'suggestion', >- 'svc', 'tags', >- 'tools', 'virtualshelves' >+ 'svc/records' > ); > > $Test::Strict::TEST_STRICT = 0; >diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t >index 4dfd80bf037..327643f2672 100755 >--- a/t/db_dependent/OAI/Sets.t >+++ b/t/db_dependent/OAI/Sets.t >@@ -24,7 +24,6 @@ use Test::Warn; > use MARC::Record; > > use Koha::Database; >-use C4::Biblio qw( GetMarcBiblio ); > use C4::OAI::Sets qw( AddOAISet GetOAISets GetOAISet GetOAISetBySpec ModOAISet ModOAISetMappings GetOAISetsMappings GetOAISetMappings AddOAISetsBiblios GetOAISetsBiblio ModOAISetsBiblios DelOAISet DelOAISetsBiblio UpdateOAISetsBiblio CalcOAISetsBiblio ); > > use t::lib::TestBuilder; >@@ -551,7 +550,8 @@ my $biblio_VH = $builder->build_sample_biblio({ author => 'Victor Hugo' }); > my $biblionumberVH = $biblio_VH->biblionumber; > > #Update >-my $record = GetMarcBiblio({ biblionumber => $biblionumberVH }); >+my $biblio = Koha::Biblios->find( $biblionumberVH ); >+my $record = $biblio->metadata->record; > UpdateOAISetsBiblio($biblionumberVH, $record); > > #is biblio attached to setVH ? >@@ -595,7 +595,7 @@ subtest 'OAI-PMH:AutoUpdateSetsEmbedItemData' => sub { > ); > > #Update >- my $recordFIC = GetMarcBiblio( { biblionumber => $biblio_FIC->biblionumber } ); >+ my $recordFIC = $biblio_FIC->metadata->record; > UpdateOAISetsBiblio( $biblio_FIC->biblionumber, $recordFIC ); > > #is biblio attached to setFIC ? >@@ -660,7 +660,8 @@ my $biblio_NotVH = $builder->build_sample_biblio({ author => 'Sponge, Bob' }); > my $biblionumberNotVH = $biblio_NotVH->biblionumber; > > #Update >-$record = GetMarcBiblio({ biblionumber => $biblionumberNotVH }); >+$biblio = Koha::Biblios->find( $biblionumberNotVH ); >+$record = $biblio->metadata->record; > UpdateOAISetsBiblio($biblionumberNotVH, $record); > > my @setsNotEq = CalcOAISetsBiblio($record); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29697
:
129757
|
129758
|
129759
|
129760
|
129761
|
131868
|
131869
|
131870
|
131871
|
131872
|
131873
|
134066
|
134067
|
134068
|
134069
|
134070
|
134071
|
135574
|
135575
|
135576
|
135577
|
135578
|
135579
|
135580
|
135662
|
135663
|
135664
|
135665
|
135666
|
135667
|
135668
|
135669
|
135670
|
135671
|
135672
|
135673
|
135797
|
135798
|
135799
|
135800
|
135801
|
135802
|
135978
|
135979
|
135980
|
135981
|
135982
|
137835
|
137836
|
137837
|
137838
|
137839
|
137840
|
137894
|
137918
|
137919
|
137920
|
137921
|
137922
|
137923
|
137924
|
137948
|
138057
|
138076
|
138077
|
138078
|
138079
|
138080
|
138081
|
138089
|
138090
|
138804
|
139127
|
140007
|
140008