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

(-)a/misc/stage_biblios_file.pl (-6 / +30 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2007 LibLime
6
# Parts Copyright BSZ 2011
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with this program; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
3
use strict;
21
use strict;
4
#use warnings; FIXME - Bug 2505
22
use warnings;
5
BEGIN {
23
BEGIN {
6
    # find Koha's Perl modules
24
    # find Koha's Perl modules
7
    # test carefully before changing this
25
    # test carefully before changing this
Lines 17-22 use Getopt::Long; Link Here
17
$| = 1;
35
$| = 1;
18
36
19
# command-line parameters
37
# command-line parameters
38
my $encoding = "";
20
my $match_bibs = 0;
39
my $match_bibs = 0;
21
my $add_items = 0;
40
my $add_items = 0;
22
my $input_file = "";
41
my $input_file = "";
Lines 25-38 my $want_help = 0; Link Here
25
my $no_replace ;
44
my $no_replace ;
26
45
27
my $result = GetOptions(
46
my $result = GetOptions(
47
    'encoding:s'    => \$encoding,
28
    'file:s'        => \$input_file,
48
    'file:s'        => \$input_file,
29
    'match-bibs:s'    => \$match_bibs,
49
    'match-bibs:s'  => \$match_bibs,
30
    'add-items'     => \$add_items,
50
    'add-items'     => \$add_items,
31
    'no-replace'    => \$no_replace,
51
    'no-replace'    => \$no_replace,
32
    'comment:s'     => \$batch_comment,
52
    'comment:s'     => \$batch_comment,
33
    'h|help'        => \$want_help
53
    'h|help'        => \$want_help
34
);
54
);
35
55
56
if ($encoding eq "") {
57
    $encoding = "utf8";
58
}
59
36
if (not $result or $input_file eq "" or $want_help) {
60
if (not $result or $input_file eq "" or $want_help) {
37
    print_usage();
61
    print_usage();
38
    exit 0;
62
    exit 0;
Lines 67-77 sub process_batch { Link Here
67
    }
91
    }
68
    close IN;
92
    close IN;
69
93
70
    my $marc_flavor = C4::Context->preference('marcflavour');
71
72
    print "... staging MARC records -- please wait\n";
94
    print "... staging MARC records -- please wait\n";
73
    my ($batch_id, $num_valid, $num_items, @import_errors) = 
95
    my ($batch_id, $num_valid, $num_items, @import_errors) = 
74
        BatchStageMarcRecords($marc_flavor, $marc_records, $input_file, $batch_comment, '', $add_items, 0,
96
        BatchStageMarcRecords($encoding, $marc_records, $input_file, $batch_comment, '', $add_items, 0,
75
                              100, \&print_progress_and_commit);
97
                              100, \&print_progress_and_commit);
76
    print "... finished staging MARC records\n";
98
    print "... finished staging MARC records\n";
77
99
Lines 141-146 records into the main Koha database. Link Here
141
163
142
Parameters:
164
Parameters:
143
    --file <file_name>      name of input MARC bib file
165
    --file <file_name>      name of input MARC bib file
166
    --encoding <encoding>   encoding of MARC records, default is utf8.
167
                            Other possible options are: MARC-8,
168
                            ISO_5426, ISO_6937, ISO_8859-1, EUC-KR
144
    --match-bibs <match_id> use this option to match bibs
169
    --match-bibs <match_id> use this option to match bibs
145
                            in the file with bibs already in 
170
                            in the file with bibs already in 
146
                            the database for future overlay.
171
                            the database for future overlay.
147
- 

Return to bug 7250