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 740-745
This is the code for the framework that the requested records will have attached
Link Here
|
740 |
to them when they are created. If not specified, then the default framework |
755 |
to them when they are created. If not specified, then the default framework |
741 |
will be used. |
756 |
will be used. |
742 |
|
757 |
|
|
|
758 |
=item B<-custom>=I<MODULE> |
759 |
|
760 |
This parameter allows you to use a local module with a customize subroutine |
761 |
that is called for each MARC record. |
762 |
If no filename is passed, LocalChanges.pm is assumed to be in the |
763 |
migration_tools subdirectory. You may pass an absolute file name or a file name |
764 |
from the migration_tools directory. |
765 |
|
743 |
=back |
766 |
=back |
744 |
|
767 |
|
745 |
=cut |
768 |
=cut |
746 |
- |
|
|