|
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 44-49
my $cleanisbn = 1;
Link Here
|
| 44 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
45 |
my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); |
| 45 |
my $framework = ''; |
46 |
my $framework = ''; |
| 46 |
my $localcust; |
47 |
my $localcust; |
|
|
48 |
my $marc_mod_template = ''; |
| 49 |
my $marc_mod_template_id = -1; |
| 47 |
|
50 |
|
| 48 |
$|=1; |
51 |
$|=1; |
| 49 |
|
52 |
|
|
Lines 80-85
GetOptions(
Link Here
|
| 80 |
'dedupbarcode' => \$dedup_barcode, |
83 |
'dedupbarcode' => \$dedup_barcode, |
| 81 |
'framework=s' => \$framework, |
84 |
'framework=s' => \$framework, |
| 82 |
'custom:s' => \$localcust, |
85 |
'custom:s' => \$localcust, |
|
|
86 |
'marcmodtemplate:s' => \$marc_mod_template, |
| 83 |
); |
87 |
); |
| 84 |
$biblios ||= !$authorities; |
88 |
$biblios ||= !$authorities; |
| 85 |
$insert ||= !$update; |
89 |
$insert ||= !$update; |
|
Lines 115-120
if(defined $localcust) { #local customize module
Link Here
|
| 115 |
$localcust=\&customize if $localcust; |
119 |
$localcust=\&customize if $localcust; |
| 116 |
} |
120 |
} |
| 117 |
|
121 |
|
|
|
122 |
if($marc_mod_template ne '') { |
| 123 |
my @templates = GetModificationTemplates(); |
| 124 |
foreach my $this_template (@templates) { |
| 125 |
if($this_template->{'name'} eq $marc_mod_template) { |
| 126 |
$marc_mod_template_id = $this_template->{'template_id'}; |
| 127 |
last; |
| 128 |
} |
| 129 |
} |
| 130 |
if($marc_mod_template_id < 0) { |
| 131 |
die "Can't located MARC modification template '$marc_mod_template'\n"; |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 118 |
my $dbh = C4::Context->dbh; |
135 |
my $dbh = C4::Context->dbh; |
| 119 |
my $heading_fields=get_heading_fields(); |
136 |
my $heading_fields=get_heading_fields(); |
| 120 |
|
137 |
|
|
Lines 264-269
RECORD: while ( ) {
Link Here
|
| 264 |
} |
281 |
} |
| 265 |
} |
282 |
} |
| 266 |
SetUTF8Flag($record); |
283 |
SetUTF8Flag($record); |
|
|
284 |
if($marc_mod_template_id > 0) { |
| 285 |
print "Modifying MARC\n"; |
| 286 |
ModifyRecordWithTemplate( $marc_mod_template_id, $record ); |
| 287 |
} |
| 267 |
&$localcust($record) if $localcust; |
288 |
&$localcust($record) if $localcust; |
| 268 |
my $isbn; |
289 |
my $isbn; |
| 269 |
# remove trailing - in isbn (only for biblios, of course) |
290 |
# remove trailing - in isbn (only for biblios, of course) |
|
Lines 805-810
If no filename is passed, LocalChanges.pm is assumed to be in the
Link Here
|
| 805 |
migration_tools subdirectory. You may pass an absolute file name or a file name |
826 |
migration_tools subdirectory. You may pass an absolute file name or a file name |
| 806 |
from the migration_tools directory. |
827 |
from the migration_tools directory. |
| 807 |
|
828 |
|
|
|
829 |
=item B<-marcmodtemplate>=I<TEMPLATE> |
| 830 |
|
| 831 |
This parameter allows you to specify the name of an existing MARC |
| 832 |
modification template to apply as the MARC records are imported (these |
| 833 |
templates are created in the "MARC modification templates" tool in Koha). |
| 834 |
If not specified, no MARC modification templates are used (default). |
| 835 |
|
| 808 |
=back |
836 |
=back |
| 809 |
|
837 |
|
| 810 |
=cut |
838 |
=cut |
| 811 |
- |
|
|