Bugzilla – Attachment 68587 Details for
Bug 18389
Allow using MARC modification templates in bulkmarcimport.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18690: Use MARC modification templates with bulkmarcimport.pl
Bug-18690-Use-MARC-modification-templates-with-bul.patch (text/plain), 3.98 KB, created by
Nick Clemens (kidclamp)
on 2017-10-26 10:49:24 UTC
(
hide
)
Description:
Bug 18690: Use MARC modification templates with bulkmarcimport.pl
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-10-26 10:49:24 UTC
Size:
3.98 KB
patch
obsolete
>From 92148c606732cd55f5316813ab295daa22730e21 Mon Sep 17 00:00:00 2001 >From: Jon Knight <J.P.Knight@lboro.ac.uk> >Date: Tue, 30 May 2017 18:12:15 +0100 >Subject: [PATCH] Bug 18690: Use MARC modification templates with > bulkmarcimport.pl > >When importing large numbers of MARC records from a legacy LMS to Koha >using bulkmarcimport.pl, it did not make use of the MARC modification >templates in the system (which can be useful for coversion of 852 >fields to 952 fields for item holdings for example). This patch allows >MARC modification templates to be used with bulkmarcimport.pl. > >To test: >1) Apply patch. >2) Set up a MARC modification template (in Home > Tools > MARC >modification templates) to make some changes to imported MARC >records (for example copy a subfield). >3) Take a test set of MARC records that have fields matching the >template and import them using the bulkmarcimport.pl tool. For example >if these MARC records are in testrecords.mrc and the MARC modification >template is called testtemplate use something like: > > perl misc/migration_tools/bulkmarcimport.pl -commit 1000 \\ > -file testrecords.mrc -marcmodtemplate testtemplate > >4) Check the imported records in Koha to see that the required >modifications have been applied when the MARC records are imported. >5) Sign off. > >https://bugs.koha-community.org/show_bug.cgi?id=18389 > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > misc/migration_tools/bulkmarcimport.pl | 32 ++++++++++++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > >diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl >index 29ef0fb..f71d885 100755 >--- a/misc/migration_tools/bulkmarcimport.pl >+++ b/misc/migration_tools/bulkmarcimport.pl >@@ -1,8 +1,7 @@ > #!/usr/bin/perl > # Import an iso2709 file into Koha 3 > >-use strict; >-use warnings; >+use Modern::Perl; > #use diagnostics; > BEGIN { > # find Koha's Perl modules >@@ -24,6 +23,8 @@ use C4::Koha; > use C4::Debug; > use C4::Charset; > use C4::Items; >+use C4::MarcModificationTemplates; >+ > use YAML; > use Unicode::Normalize; > use Time::HiRes qw(gettimeofday); >@@ -44,6 +45,8 @@ my $cleanisbn = 1; > my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); > my $framework = ''; > my $localcust; >+my $marc_mod_template = ''; >+my $marc_mod_template_id = -1; > > $|=1; > >@@ -80,6 +83,7 @@ GetOptions( > 'dedupbarcode' => \$dedup_barcode, > 'framework=s' => \$framework, > 'custom:s' => \$localcust, >+ 'marcmodtemplate:s' => \$marc_mod_template, > ); > $biblios ||= !$authorities; > $insert ||= !$update; >@@ -115,6 +119,19 @@ if(defined $localcust) { #local customize module > $localcust=\&customize if $localcust; > } > >+if($marc_mod_template ne '') { >+ my @templates = GetModificationTemplates(); >+ foreach my $this_template (@templates) { >+ if($this_template->{'name'} eq $marc_mod_template) { >+ $marc_mod_template_id = $this_template->{'template_id'}; >+ last; >+ } >+ } >+ if($marc_mod_template_id < 0) { >+ die "Can't located MARC modification template '$marc_mod_template'\n"; >+ } >+} >+ > my $dbh = C4::Context->dbh; > my $heading_fields=get_heading_fields(); > >@@ -264,6 +281,10 @@ RECORD: while ( ) { > } > } > SetUTF8Flag($record); >+ if($marc_mod_template_id > 0) { >+ print "Modifying MARC\n"; >+ ModifyRecordWithTemplate( $marc_mod_template_id, $record ); >+ } > &$localcust($record) if $localcust; > my $isbn; > # remove trailing - in isbn (only for biblios, of course) >@@ -805,6 +826,13 @@ If no filename is passed, LocalChanges.pm is assumed to be in the > migration_tools subdirectory. You may pass an absolute file name or a file name > from the migration_tools directory. > >+=item B<-marcmodtemplate>=I<TEMPLATE> >+ >+This parameter allows you to specify the name of an existing MARC >+modification template to apply as the MARC records are imported (these >+templates are created in the "MARC modification templates" tool in Koha). >+If not specified, no MARC modification templates are used (default). >+ > =back > > =cut >-- >2.1.4
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 18389
:
61907
|
63353
|
63469
|
63851
|
66144
|
66379
|
66498
|
68587
|
68588
|
68589
|
68590
|
68591
|
68592