View | Details | Raw Unified | Return to bug 11278
Collapse All | Expand All

(-)a/misc/migration_tools/bulkmarcimport.pl (-6 / +28 lines)
Lines 31-41 use Getopt::Long; Link Here
31
use IO::File;
31
use IO::File;
32
use Pod::Usage;
32
use Pod::Usage;
33
33
34
my $localcust= $FindBin::Bin.'/LocalChanges.pm';
35
$localcust= -e $localcust? $localcust: undef;
36
require $localcust if $localcust;
37
$localcust=\&customize if $localcust;
38
39
use open qw( :std :encoding(UTF-8) );
34
use open qw( :std :encoding(UTF-8) );
40
binmode( STDOUT, ":encoding(UTF-8)" );
35
binmode( STDOUT, ":encoding(UTF-8)" );
41
my ( $input_marc_file, $number, $offset) = ('',0,0);
36
my ( $input_marc_file, $number, $offset) = ('',0,0);
Lines 44-49 my ( $insert, $filters, $update, $all, $yamlfile, $authtypes ); Link Here
44
my $cleanisbn = 1;
39
my $cleanisbn = 1;
45
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode);
40
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode);
46
my $framework = '';
41
my $framework = '';
42
my $localcust;
47
43
48
$|=1;
44
$|=1;
49
45
Lines 78-83 GetOptions( Link Here
78
    'yaml:s'        => \$yamlfile,
74
    'yaml:s'        => \$yamlfile,
79
    'dedupbarcode' => \$dedup_barcode,
75
    'dedupbarcode' => \$dedup_barcode,
80
    'framework=s' => \$framework,
76
    'framework=s' => \$framework,
77
    'custom:s'    => \$localcust,
81
);
78
);
82
$biblios ||= !$authorities;
79
$biblios ||= !$authorities;
83
$insert  ||= !$update;
80
$insert  ||= !$update;
Lines 92-97 if ($version || ($input_marc_file eq '')) { Link Here
92
    exit;
89
    exit;
93
}
90
}
94
91
92
if(defined $localcust) { #local customize module
93
    if(!-e $localcust) {
94
        $localcust= $localcust||'LocalChanges'; #default name
95
        $localcust=~ s/^.*\/([^\/]+)$/$1/; #extract file name only
96
        $localcust=~ s/\.pm$//;           #remove extension
97
        my $fqcust= $FindBin::Bin."/$localcust.pm"; #try migration_tools dir
98
        if(-e $fqcust) {
99
            $localcust= $fqcust;
100
        }
101
        else {
102
            print "WARNING: customize module $localcust.pm not found!\n";
103
            exit;
104
        }
105
    }
106
    require $localcust if $localcust;
107
    $localcust=\&customize if $localcust;
108
}
109
95
my $dbh = C4::Context->dbh;
110
my $dbh = C4::Context->dbh;
96
my $heading_fields=get_heading_fields();
111
my $heading_fields=get_heading_fields();
97
112
Lines 742-747 This is the code for the framework that the requested records will have attached Link Here
742
to them when they are created. If not specified, then the default framework
757
to them when they are created. If not specified, then the default framework
743
will be used.
758
will be used.
744
759
760
=item B<-custom>=I<MODULE>
761
762
This parameter allows you to use a local module with a customize subroutine
763
that is called for each MARC record.
764
If no filename is passed, LocalChanges.pm is assumed to be in the
765
migration_tools subdirectory. You may pass an absolute file name or a file name
766
from the migration_tools directory.
767
745
=back
768
=back
746
769
747
=cut
770
=cut
748
- 

Return to bug 11278