Bugzilla – Attachment 103876 Details for
Bug 25306
Unnecessary update of framework in ModBiblioMarc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25306: Remove framework paramter from ModBiblioMarc
Bug-25306-Remove-framework-paramter-from-ModBiblio.patch (text/plain), 8.74 KB, created by
Nick Clemens (kidclamp)
on 2020-04-28 18:37:08 UTC
(
hide
)
Description:
Bug 25306: Remove framework paramter from ModBiblioMarc
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-04-28 18:37:08 UTC
Size:
8.74 KB
patch
obsolete
>From 264ba561b70f8b81cebbb4ac63915d9787b57117 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 28 Apr 2020 18:36:49 +0000 >Subject: [PATCH] Bug 25306: Remove framework paramter from ModBiblioMarc > >--- > C4/Biblio.pm | 14 ++++---------- > C4/Items.pm | 3 --- > misc/batchRepairMissingBiblionumbers.pl | 2 +- > misc/migration_tools/22_to_30/missing090field.pl | 2 +- > misc/migration_tools/22_to_30/rebuild_leader.pl | 2 +- > misc/migration_tools/22_to_30/rebuild_unimarc_100.pl | 2 +- > misc/migration_tools/bulkmarcimport.pl | 6 +++--- > misc/migration_tools/switch_marc21_series_info.pl | 2 +- > t/db_dependent/Biblio/ModBiblioMarc.t | 2 +- > 9 files changed, 13 insertions(+), 22 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 8f8da1006e..6292ca466f 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -226,7 +226,7 @@ sub AddBiblio { > _koha_marc_update_biblioitem_cn_sort( $record, $olddata, $frameworkcode ); > > # now add the record >- ModBiblioMarc( $record, $biblionumber, $frameworkcode ) unless $defer_marc_save; >+ ModBiblioMarc( $record, $biblionumber ) unless $defer_marc_save; > > # update OAI-PMH sets > if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { >@@ -314,7 +314,7 @@ sub ModBiblio { > _koha_marc_update_biblioitem_cn_sort( $record, $oldbiblio, $frameworkcode ); > > # update the MARC record (that now contains biblio and items) with the new record data >- &ModBiblioMarc( $record, $biblionumber, $frameworkcode ); >+ &ModBiblioMarc( $record, $biblionumber ); > > # modify the other koha tables > _koha_modify_biblio( $dbh, $oldbiblio, $frameworkcode ); >@@ -3116,7 +3116,7 @@ sub _koha_delete_biblio_metadata { > > =head2 ModBiblioMarc > >- &ModBiblioMarc($newrec,$biblionumber,$frameworkcode); >+ &ModBiblioMarc($newrec,$biblionumber); > > Add MARC XML data for a biblio to koha > >@@ -3127,7 +3127,7 @@ Function exported, but should NOT be used, unless you really know what you're do > sub ModBiblioMarc { > # pass the MARC::Record to this function, and it will create the records in > # the marcxml field >- my ( $record, $biblionumber, $frameworkcode ) = @_; >+ my ( $record, $biblionumber ) = @_; > if ( !$record ) { > carp 'ModBiblioMarc passed an undefined record'; > return; >@@ -3137,12 +3137,6 @@ sub ModBiblioMarc { > $record = $record->clone(); > my $dbh = C4::Context->dbh; > my @fields = $record->fields(); >- if ( !$frameworkcode ) { >- $frameworkcode = ""; >- } >- my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?"); >- $sth->execute( $frameworkcode, $biblionumber ); >- $sth->finish; > my $encoding = C4::Context->preference("marcflavour"); > > # deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode >diff --git a/C4/Items.pm b/C4/Items.pm >index a162ac5dec..aefacc6a31 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -276,9 +276,6 @@ sub AddItemBatchFromMarc { > $record->delete_field($item_field); > } > >- # update the MARC biblio >- # $biblionumber = ModBiblioMarc( $record, $biblionumber, $frameworkcode ); >- > return (\@itemnumbers, \@errors); > } > >diff --git a/misc/batchRepairMissingBiblionumbers.pl b/misc/batchRepairMissingBiblionumbers.pl >index 695c45291c..1110e53504 100755 >--- a/misc/batchRepairMissingBiblionumbers.pl >+++ b/misc/batchRepairMissingBiblionumbers.pl >@@ -26,7 +26,7 @@ $sth->execute(); > while (my ($biblionumber,$biblioitemnumber,$frameworkcode)=$sth->fetchrow ){ > my $record = GetMarcBiblio({ biblionumber => $biblionumber }); > C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber); >- my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber, $frameworkcode )}; >+ my $biblionumber = eval {ModBiblioMarc( $record, $biblionumber )}; > if($@){ > print "Problem with biblionumber : $biblionumber\n"; > exit -1; >diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl >index dd28111c69..b54bf9285d 100755 >--- a/misc/migration_tools/22_to_30/missing090field.pl >+++ b/misc/migration_tools/22_to_30/missing090field.pl >@@ -73,7 +73,7 @@ sub MARCmodbiblionumber{ > > > if ($update){ >- &ModBiblioMarc($record,$biblionumber,''); >+ &ModBiblioMarc($record,$biblionumber); > print "\n modified : $biblionumber \n"; > } > >diff --git a/misc/migration_tools/22_to_30/rebuild_leader.pl b/misc/migration_tools/22_to_30/rebuild_leader.pl >index ded81b3730..524465ff88 100755 >--- a/misc/migration_tools/22_to_30/rebuild_leader.pl >+++ b/misc/migration_tools/22_to_30/rebuild_leader.pl >@@ -49,7 +49,7 @@ foreach ($record->field('995')) { > $record->delete_field($_); > } > if ($update){ >- &ModBiblioMarc($record,'',$biblionumber); >+ &ModBiblioMarc($record,$biblionumber); > print "$biblionumber \n"; > } > >diff --git a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl >index 3b3e3cdd91..0988e5631d 100755 >--- a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl >+++ b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl >@@ -56,7 +56,7 @@ sub MARCmodrecord { > $record->insert_fields_ordered(MARC::Field->new(100,"","","a"=>"$string")); > } > if ($update){ >- &ModBiblioMarc($record,$biblionumber,''); >+ &ModBiblioMarc($record,$biblionumber); > print "\r$biblionumber" unless ( $biblionumber % 100 ); > } > >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index 6ab4b3fcf4..7d0bccf4eb 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -454,7 +454,7 @@ RECORD: while ( ) { > $biblioitemnumber = Koha::Biblios->find( $biblionumber )->biblioitem->biblioitemnumber; > }; > if ($update) { >- eval { ModBiblio( $record, $biblionumber, GetFrameworkCode($biblionumber) ) }; >+ eval { ModBiblio( $record, $biblionumber, $framework ) }; > if ($@) { > warn "ERROR: Edit biblio $biblionumber failed: $@\n"; > printlog( { id => $id || $originalid || $biblionumber, op => "update", status => "ERROR" } ) if ($logfile); >@@ -467,7 +467,7 @@ RECORD: while ( ) { > } > } else { > if ($insert) { >- eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '', { defer_marc_save => 1 } ) }; >+ eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, $framework, { defer_marc_save => 1 } ) }; > if ($@) { > warn "ERROR: Adding biblio $biblionumber failed: $@\n"; > printlog( { id => $id || $originalid || $biblionumber, op => "insert", status => "ERROR" } ) if ($logfile); >@@ -489,7 +489,7 @@ RECORD: while ( ) { > C4::Biblio::_strip_item_fields($clone_record, ''); > # This sets the marc fields if there was an error, and also calls > # defer_marc_save. >- ModBiblioMarc( $clone_record, $biblionumber, $framework ); >+ ModBiblioMarc( $clone_record, $biblionumber ); > if ( $error_adding ) { > warn "ERROR: Adding items to bib $biblionumber failed: $error_adding"; > printlog({id=>$id||$originalid||$biblionumber, op=>"insertitem",status=>"ERROR"}) if ($logfile); >diff --git a/misc/migration_tools/switch_marc21_series_info.pl b/misc/migration_tools/switch_marc21_series_info.pl >index 0bad3f2a54..6c6c32fa47 100755 >--- a/misc/migration_tools/switch_marc21_series_info.pl >+++ b/misc/migration_tools/switch_marc21_series_info.pl >@@ -222,7 +222,7 @@ while ( my ( $biblionumber ) = $bibs_sth->fetchrow ) { > else { > print "."; > } >- ModBiblioMarc( $biblio, $biblionumber, $framework ); >+ ModBiblioMarc( $biblio, $biblionumber ); > } > print "\n"; > >diff --git a/t/db_dependent/Biblio/ModBiblioMarc.t b/t/db_dependent/Biblio/ModBiblioMarc.t >index 3eaf4f73b3..aca6d4ae78 100644 >--- a/t/db_dependent/Biblio/ModBiblioMarc.t >+++ b/t/db_dependent/Biblio/ModBiblioMarc.t >@@ -40,7 +40,7 @@ subtest "Check MARC field length calculation" => sub { > ); > > is( $record->leader, ' 'x24, 'No leader lengths' ); >- C4::Biblio::ModBiblioMarc( $record, $biblio->{biblionumber}, '' ); >+ C4::Biblio::ModBiblioMarc( $record, $biblio->{biblionumber} ); > my $savedrec = C4::Biblio::GetMarcBiblio({ biblionumber => $biblio->{biblionumber} }); > like( substr($savedrec->leader,0,5), qr/^\d{5}$/, 'Record length found' ); > like( substr($savedrec->leader,12,5), qr/^\d{5}$/, 'Base address found' ); >-- >2.11.0
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 25306
:
103876
|
114900
|
114923
|
115010
|
115011