|
Lines 38-43
my $dont_export_items;
Link Here
|
| 38 |
my $deleted_barcodes; |
38 |
my $deleted_barcodes; |
| 39 |
my $timestamp; |
39 |
my $timestamp; |
| 40 |
my $record_type; |
40 |
my $record_type; |
|
|
41 |
my $id_list_file; |
| 41 |
my $help; |
42 |
my $help; |
| 42 |
my $op = $query->param("op") || ''; |
43 |
my $op = $query->param("op") || ''; |
| 43 |
my $filename = $query->param("filename") || 'koha.mrc'; |
44 |
my $filename = $query->param("filename") || 'koha.mrc'; |
|
Lines 60-71
if ( $commandline ) {
Link Here
|
| 60 |
'clean' => \$clean, |
61 |
'clean' => \$clean, |
| 61 |
'filename=s' => \$filename, |
62 |
'filename=s' => \$filename, |
| 62 |
'record-type=s' => \$record_type, |
63 |
'record-type=s' => \$record_type, |
|
|
64 |
'id_list_file=s' => \$id_list_file, |
| 63 |
'help|?' => \$help |
65 |
'help|?' => \$help |
| 64 |
); |
66 |
); |
| 65 |
|
67 |
|
| 66 |
if ($help) { |
68 |
if ($help) { |
| 67 |
print <<_USAGE_; |
69 |
print <<_USAGE_; |
| 68 |
export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--clean] --filename=outputfile |
70 |
export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--clean] [--id_list_file=PATH] --filename=outputfile |
| 69 |
|
71 |
|
| 70 |
|
72 |
|
| 71 |
--format=FORMAT FORMAT is either 'xml' or 'marc' (default) |
73 |
--format=FORMAT FORMAT is either 'xml' or 'marc' (default) |
|
Lines 82-87
export.pl [--format=format] [--date=date] [--record-type=TYPE] [--dont_export_it
Link Here
|
| 82 |
specified). Used only if TYPE is 'bibs' |
84 |
specified). Used only if TYPE is 'bibs' |
| 83 |
|
85 |
|
| 84 |
--clean removes NSE/NSB |
86 |
--clean removes NSE/NSB |
|
|
87 |
|
| 88 |
--id_list_file=PATH PATH is an absolute path to a file containing a list of |
| 89 |
IDs(biblionumber or authid) with only one ID per line. |
| 90 |
This IDs list works as a filter: it's compatible with |
| 91 |
other parameters |
| 85 |
_USAGE_ |
92 |
_USAGE_ |
| 86 |
exit; |
93 |
exit; |
| 87 |
} |
94 |
} |
|
Lines 93-98
_USAGE_
Link Here
|
| 93 |
$deleted_barcodes ||= 0; |
100 |
$deleted_barcodes ||= 0; |
| 94 |
$clean ||= 0; |
101 |
$clean ||= 0; |
| 95 |
$record_type ||= "bibs"; |
102 |
$record_type ||= "bibs"; |
|
|
103 |
$id_list_file ||= 0; |
| 96 |
|
104 |
|
| 97 |
# Redirect stdout |
105 |
# Redirect stdout |
| 98 |
open STDOUT, '>', $filename if $filename; |
106 |
open STDOUT, '>', $filename if $filename; |
|
Lines 196-201
if ( $op eq "export" ) {
Link Here
|
| 196 |
my $starting_authid = $query->param('starting_authid'); |
204 |
my $starting_authid = $query->param('starting_authid'); |
| 197 |
my $ending_authid = $query->param('ending_authid'); |
205 |
my $ending_authid = $query->param('ending_authid'); |
| 198 |
my $authtype = $query->param('authtype'); |
206 |
my $authtype = $query->param('authtype'); |
|
|
207 |
my $filefh; |
| 208 |
if ($commandline) { |
| 209 |
open $filefh,"<", $id_list_file or die "cannot open $id_list_file: $!"; |
| 210 |
} else { |
| 211 |
$filefh = $query->upload("id_list_file"); |
| 212 |
} |
| 213 |
my %id_filter; |
| 214 |
if ($filefh) { |
| 215 |
while (my $number=<$filefh>){ |
| 216 |
$number=~s/[\r\n]*$//; |
| 217 |
$id_filter{$number}=1 if $number=~/^\d+$/; |
| 218 |
} |
| 219 |
} |
| 199 |
|
220 |
|
| 200 |
if ( $record_type eq 'bibs' and not @biblionumbers ) { |
221 |
if ( $record_type eq 'bibs' and not @biblionumbers ) { |
| 201 |
if ($timestamp) { |
222 |
if ($timestamp) { |
|
Lines 308-313
if ( $op eq "export" ) {
Link Here
|
| 308 |
push @recordids, map { |
329 |
push @recordids, map { |
| 309 |
map { $$_[0] } $_ |
330 |
map { $$_[0] } $_ |
| 310 |
} @{ $sth->fetchall_arrayref }; |
331 |
} @{ $sth->fetchall_arrayref }; |
|
|
332 |
@recordids = grep { exists($id_filter{$_}) } @recordids if scalar(%id_filter); |
| 311 |
} |
333 |
} |
| 312 |
|
334 |
|
| 313 |
my $xml_header_written = 0; |
335 |
my $xml_header_written = 0; |
| 314 |
- |
|
|