Bugzilla – Attachment 127978 Details for
Bug 25539
Remove AddBiblio "defer_marc_save" option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25539: Remove AddBiblio option "defer_marc_save"
Bug-25539-Remove-AddBiblio-option-defermarcsave.patch (text/plain), 4.87 KB, created by
David Gustafsson
on 2021-11-24 14:32:56 UTC
(
hide
)
Description:
Bug 25539: Remove AddBiblio option "defer_marc_save"
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2021-11-24 14:32:56 UTC
Size:
4.87 KB
patch
obsolete
>From 0ae1f89f808f1f134c9e30e097c4dda5ee5cbada Mon Sep 17 00:00:00 2001 >From: David Gustafsson <glasklas@gmail.com> >Date: Fri, 12 Nov 2021 23:16:55 +0100 >Subject: [PATCH] Bug 25539: Remove AddBiblio option "defer_marc_save" > >Items are no longer embedded in the MARCXML and because of this the MARC data >does not need to be saved once more after changing record items data. >The "defer_marc_save" is no longer needed since bulkmarcimport.pl was the only >place this option was utilized in order to resave MARC data after possibly changing >items data. There is also a bug bulkmarcimport.pl where the record data is re-saved >without stripping items if duplicate items are found and the dedup barcodes >option is enabled that is resolved by this change. >--- > C4/Biblio.pm | 17 +---------------- > misc/migration_tools/bulkmarcimport.pl | 13 +------------ > 2 files changed, 2 insertions(+), 28 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f057c80207..bc4fc160f0 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -187,31 +187,16 @@ The first argument is a C<MARC::Record> object containing the > bib to add, while the second argument is the desired MARC > framework code. > >-This function also accepts a third, optional argument: a hashref >-to additional options. The only defined option is C<defer_marc_save>, >-which if present and mapped to a true value, causes C<AddBiblio> >-to omit the call to save the MARC in C<biblio_metadata.metadata> >-This option is provided B<only> >-for the use of scripts such as C<bulkmarcimport.pl> that may need >-to do some manipulation of the MARC record for item parsing before >-saving it and which cannot afford the performance hit of saving >-the MARC record twice. Consequently, do not use that option >-unless you can guarantee that C<ModBiblioMarc> will be called. >- > =cut > > sub AddBiblio { > my $record = shift; > my $frameworkcode = shift; > my $options = @_ ? shift : undef; >- my $defer_marc_save = 0; > if (!$record) { > carp('AddBiblio called with undefined record'); > return; > } >- if ( defined $options and exists $options->{'defer_marc_save'} and $options->{'defer_marc_save'} ) { >- $defer_marc_save = 1; >- } > > my $schema = Koha::Database->schema; > my ( $biblionumber, $biblioitemnumber ); >@@ -292,7 +277,7 @@ sub AddBiblio { > } > > # now add the record >- ModBiblioMarc( $record, $biblionumber ) unless $defer_marc_save; >+ ModBiblioMarc( $record, $biblionumber ); > > # update OAI-PMH sets > if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) { >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index 5ab289f88a..0f1f883cb4 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -548,7 +548,7 @@ RECORD: foreach my $record (@{$marc_records}) { > } > } > elsif ($insert) { >- eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework, { defer_marc_save => 1 }) }; >+ eval { ($record_id, $biblioitemnumber) = AddBiblio($record, $framework) }; > if ($@) { > warn "ERROR: Insert biblio $originalid failed: $@\n"; > printlog( { id => $originalid, op => "insert", status => "ERROR" } ) if ($logfile); >@@ -570,13 +570,6 @@ RECORD: foreach my $record (@{$marc_records}) { > $record_has_added_items = @{$itemnumbers_ref}; > > my $error_adding = $@; >- # Work on a clone so that if there are real errors, we can maybe >- # fix them up later. >- my $clone_record = $record->clone(); >- C4::Biblio::_strip_item_fields($clone_record, $framework); >- # This sets the marc fields if there was an error, and also calls >- # defer_marc_save. >- ModBiblioMarc($clone_record, $record_id, $modify_biblio_marc_options); > if ($error_adding) { > warn "ERROR: Adding items to bib $record_id failed: $error_adding"; > printlog({ id => $record_id, op => "insert items", status => "ERROR"}) if ($logfile); >@@ -624,10 +617,6 @@ RECORD: foreach my $record (@{$marc_records}) { > printlog({ id => $record_id, op => "insert items", status => "ERROR" }) if ($logfile); > # if we failed because of an exception, assume that > # the MARC columns in biblioitems were not set. >- >- # @FIXME: Why do we save here without stripping items? Besides, >- # save with stripped items has already been performed >- ModBiblioMarc($record, $record_id, $modify_biblio_marc_options); > next RECORD; > } > else { >-- >2.34.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 25539
:
105065
|
105066
|
109789
|
110260
|
110261
|
127599
|
127600
|
127601
|
127602
|
127603
|
127976
|
127977
|
127978
|
127979
|
127980
|
127981
|
133030
|
133031
|
133032
|
133034
|
133035
|
133036
|
140992
|
140993
|
140994
|
156224
|
156225
|
156226
|
160158
|
160159
|
160160
|
160489
|
160490
|
160491