Lines 1-8
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
# Import an iso2709 file into Koha 3 |
2 |
# Import an iso2709 file into Koha 3 |
3 |
|
3 |
|
4 |
use strict; |
4 |
use Modern::Perl; |
5 |
use warnings; |
|
|
6 |
#use diagnostics; |
5 |
#use diagnostics; |
7 |
BEGIN { |
6 |
BEGIN { |
8 |
# find Koha's Perl modules |
7 |
# find Koha's Perl modules |
Lines 24-29
use C4::Koha;
Link Here
|
24 |
use C4::Debug; |
23 |
use C4::Debug; |
25 |
use C4::Charset; |
24 |
use C4::Charset; |
26 |
use C4::Items; |
25 |
use C4::Items; |
|
|
26 |
use C4::MarcModificationTemplates; |
27 |
|
27 |
use YAML; |
28 |
use YAML; |
28 |
use Unicode::Normalize; |
29 |
use Unicode::Normalize; |
29 |
use Time::HiRes qw(gettimeofday); |
30 |
use Time::HiRes qw(gettimeofday); |
Lines 43-48
my $cleanisbn = 1;
Link Here
|
43 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
44 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
44 |
my $framework = ''; |
45 |
my $framework = ''; |
45 |
my $localcust; |
46 |
my $localcust; |
|
|
47 |
my $marc_mod_template = ''; |
48 |
my $marc_mod_template_id = -1; |
46 |
|
49 |
|
47 |
$|=1; |
50 |
$|=1; |
48 |
|
51 |
|
Lines 79-84
GetOptions(
Link Here
|
79 |
'dedupbarcode' => \$dedup_barcode, |
82 |
'dedupbarcode' => \$dedup_barcode, |
80 |
'framework=s' => \$framework, |
83 |
'framework=s' => \$framework, |
81 |
'custom:s' => \$localcust, |
84 |
'custom:s' => \$localcust, |
|
|
85 |
'marcmodtemplate:s' => \$marc_mod_template, |
82 |
); |
86 |
); |
83 |
$biblios ||= !$authorities; |
87 |
$biblios ||= !$authorities; |
84 |
$insert ||= !$update; |
88 |
$insert ||= !$update; |
Lines 114-119
if(defined $localcust) { #local customize module
Link Here
|
114 |
$localcust=\&customize if $localcust; |
118 |
$localcust=\&customize if $localcust; |
115 |
} |
119 |
} |
116 |
|
120 |
|
|
|
121 |
if($marc_mod_template ne '') { |
122 |
my @templates = GetModificationTemplates(); |
123 |
foreach my $this_template (@templates) { |
124 |
if($this_template->{'name'} eq $marc_mod_template) { |
125 |
$marc_mod_template_id = $this_template->{'template_id'}; |
126 |
last; |
127 |
} |
128 |
} |
129 |
if($marc_mod_template_id < 0) { |
130 |
die "Can't located MARC modification template '$marc_mod_template'\n"; |
131 |
} |
132 |
} |
133 |
|
117 |
my $dbh = C4::Context->dbh; |
134 |
my $dbh = C4::Context->dbh; |
118 |
my $heading_fields=get_heading_fields(); |
135 |
my $heading_fields=get_heading_fields(); |
119 |
|
136 |
|
Lines 263-268
RECORD: while ( ) {
Link Here
|
263 |
} |
280 |
} |
264 |
} |
281 |
} |
265 |
SetUTF8Flag($record); |
282 |
SetUTF8Flag($record); |
|
|
283 |
if($marc_mod_template_id > 0) { |
284 |
print "Modifying MARC\n"; |
285 |
ModifyRecordWithTemplate( $marc_mod_template_id, $record ); |
286 |
} |
266 |
&$localcust($record) if $localcust; |
287 |
&$localcust($record) if $localcust; |
267 |
my $isbn; |
288 |
my $isbn; |
268 |
# remove trailing - in isbn (only for biblios, of course) |
289 |
# remove trailing - in isbn (only for biblios, of course) |
Lines 802-807
If no filename is passed, LocalChanges.pm is assumed to be in the
Link Here
|
802 |
migration_tools subdirectory. You may pass an absolute file name or a file name |
823 |
migration_tools subdirectory. You may pass an absolute file name or a file name |
803 |
from the migration_tools directory. |
824 |
from the migration_tools directory. |
804 |
|
825 |
|
|
|
826 |
=item B<-marcmodtemplate>=I<TEMPLATE> |
827 |
|
828 |
This parameter allows you to specify the name of an existing MARC |
829 |
modification template to apply as the MARC records are imported (these |
830 |
templates are created in the "MARC modification templates" tool in Koha). |
831 |
If not specified, no MARC modification templates are used (default). |
832 |
|
805 |
=back |
833 |
=back |
806 |
|
834 |
|
807 |
=cut |
835 |
=cut |
808 |
- |
|
|