Lines 31-36
BEGIN {
Link Here
|
31 |
use C4::Context; |
31 |
use C4::Context; |
32 |
use C4::ImportBatch; |
32 |
use C4::ImportBatch; |
33 |
use C4::Matcher; |
33 |
use C4::Matcher; |
|
|
34 |
use C4::MarcModificationTemplates; |
34 |
use Getopt::Long; |
35 |
use Getopt::Long; |
35 |
|
36 |
|
36 |
$| = 1; |
37 |
$| = 1; |
Lines 48-53
my $no_replace;
Link Here
|
48 |
my $format = 'ISO2709'; |
49 |
my $format = 'ISO2709'; |
49 |
my $no_create; |
50 |
my $no_create; |
50 |
my $item_action = 'always_add'; |
51 |
my $item_action = 'always_add'; |
|
|
52 |
my $marc_mod_template = ''; |
53 |
my $marc_mod_template_id = undef; |
51 |
|
54 |
|
52 |
my $result = GetOptions( |
55 |
my $result = GetOptions( |
53 |
'encoding:s' => \$encoding, |
56 |
'encoding:s' => \$encoding, |
Lines 60-68
my $result = GetOptions(
Link Here
|
60 |
'no-create' => \$no_create, |
63 |
'no-create' => \$no_create, |
61 |
'comment:s' => \$batch_comment, |
64 |
'comment:s' => \$batch_comment, |
62 |
'authorities' => \$authorities, |
65 |
'authorities' => \$authorities, |
|
|
66 |
'marcmodtemplate:s' => \$marc_mod_template, |
63 |
'h|help' => \$want_help |
67 |
'h|help' => \$want_help |
64 |
); |
68 |
); |
65 |
|
69 |
|
|
|
70 |
if($marc_mod_template ne '') { |
71 |
my @templates = GetModificationTemplates(); |
72 |
foreach my $this_template (@templates) { |
73 |
if($this_template->{'name'} eq $marc_mod_template) { |
74 |
$marc_mod_template_id = $this_template->{'template_id'}; |
75 |
last; |
76 |
} |
77 |
} |
78 |
if($marc_mod_template_id < 0) { |
79 |
die "Can't located MARC modification template '$marc_mod_template'\n"; |
80 |
} |
81 |
} |
82 |
|
66 |
$record_type = 'auth' if ($authorities); |
83 |
$record_type = 'auth' if ($authorities); |
67 |
|
84 |
|
68 |
if (not $result or $input_file eq "" or $want_help) { |
85 |
if (not $result or $input_file eq "" or $want_help) { |
Lines 92-97
process_batch({
Link Here
|
92 |
no_replace => $no_replace, |
109 |
no_replace => $no_replace, |
93 |
no_create => $no_create, |
110 |
no_create => $no_create, |
94 |
item_action => $item_action, |
111 |
item_action => $item_action, |
|
|
112 |
marc_mod_template_id => $marc_mod_template_id, |
95 |
}); |
113 |
}); |
96 |
$dbh->commit(); |
114 |
$dbh->commit(); |
97 |
|
115 |
|
Lines 116-122
sub process_batch {
Link Here
|
116 |
print "... staging MARC records -- please wait\n"; |
134 |
print "... staging MARC records -- please wait\n"; |
117 |
#FIXME: We should really allow the use of marc modification frameworks and to_marc plugins here if possible |
135 |
#FIXME: We should really allow the use of marc modification frameworks and to_marc plugins here if possible |
118 |
my ($batch_id, $num_valid_records, $num_items, @import_errors) = |
136 |
my ($batch_id, $num_valid_records, $num_items, @import_errors) = |
119 |
BatchStageMarcRecords($record_type, $params->{encoding}, $marc_records, $params->{input_file}, undef, undef, $params->{batch_comment}, '', $params->{add_items}, 0, |
137 |
BatchStageMarcRecords($record_type, $params->{encoding}, $marc_records, $params->{input_file}, $params->{'marc_mod_template_id'}, undef, $params->{batch_comment}, '', $params->{add_items}, 0, |
120 |
100, \&print_progress_and_commit); |
138 |
100, \&print_progress_and_commit); |
121 |
print "... finished staging MARC records\n"; |
139 |
print "... finished staging MARC records\n"; |
122 |
|
140 |
|
Lines 218-223
Parameters:
Link Here
|
218 |
the record batch; if the comment |
236 |
the record batch; if the comment |
219 |
has spaces in it, surround the |
237 |
has spaces in it, surround the |
220 |
comment with quotation marks. |
238 |
comment with quotation marks. |
|
|
239 |
--marcmodtemplate <TEMPLATE> |
240 |
This parameter allows you to specify the |
241 |
name of an existing MARC modification |
242 |
template to apply as the MARC records are |
243 |
imported (these templates are created in |
244 |
the "MARC modification templates" tool in |
245 |
Koha). If not specified, no MARC modification |
246 |
templates are used (default). |
221 |
--help or -h show this message. |
247 |
--help or -h show this message. |
222 |
_USAGE_ |
248 |
_USAGE_ |
223 |
} |
249 |
} |
224 |
- |
|
|