From 309c00ce42dcfa085e8f32963bd29bd258942489 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 21 Nov 2013 13:36:13 +0100 Subject: [PATCH] Bug 11278: [EXAMPLE: DO_NOT_PUSH] Example LocalChanges.pm Content-Type: text/plain; charset=utf-8 This patch adds a LocalChanges.pm to migration_tools. To illustrate the concept of record customization during bulkmarcimport. --- misc/migration_tools/LocalChanges.pm | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) create mode 100644 misc/migration_tools/LocalChanges.pm diff --git a/misc/migration_tools/LocalChanges.pm b/misc/migration_tools/LocalChanges.pm new file mode 100644 index 0000000..0387d08 --- /dev/null +++ b/misc/migration_tools/LocalChanges.pm @@ -0,0 +1,25 @@ +use strict; +use warnings; + +use MARC::Field; + +sub customize { + my ($record)= @_; +#this is ONLY EXAMPLE code; please create your own customizations here + + #We clear e.g. field 001 + my $f1= $record->field('001'); + my $oldid= $f1->data(); + $f1->update(''); + #We add a 005 if it does not exist + if( !$record->field('005') ) { + $f1=MARC::Field->new('005', '00000000000000.00'); + $record->insert_fields_ordered($f1); + } + #We add e.g. a local note 590 + $f1=MARC::Field->new('590','','',a=>'Old id:'.$oldid); + $record->insert_fields_ordered($f1); + +} + +1; -- 1.7.7.6