Lines 33-39
use C4::Record;
Link Here
|
33 |
my $query = new CGI; |
33 |
my $query = new CGI; |
34 |
|
34 |
|
35 |
my $clean; |
35 |
my $clean; |
36 |
my $output_format; |
|
|
37 |
my $dont_export_items; |
36 |
my $dont_export_items; |
38 |
my $deleted_barcodes; |
37 |
my $deleted_barcodes; |
39 |
my $timestamp; |
38 |
my $timestamp; |
Lines 44-50
my $op = $query->param("op") || '';
Link Here
|
44 |
my $filename = $query->param("filename") || 'koha.mrc'; |
43 |
my $filename = $query->param("filename") || 'koha.mrc'; |
45 |
my $dbh = C4::Context->dbh; |
44 |
my $dbh = C4::Context->dbh; |
46 |
my $marcflavour = C4::Context->preference("marcflavour"); |
45 |
my $marcflavour = C4::Context->preference("marcflavour"); |
47 |
my $format = $query->param("format") || $query->param("output_format") || 'iso2709'; |
46 |
my $output_format = $query->param("format") || $query->param("output_format") || 'iso2709'; |
48 |
|
47 |
|
49 |
# Checks if the script is called from commandline |
48 |
# Checks if the script is called from commandline |
50 |
my $commandline = not defined $ENV{GATEWAY_INTERFACE}; |
49 |
my $commandline = not defined $ENV{GATEWAY_INTERFACE}; |
Lines 94-100
_USAGE_
Link Here
|
94 |
} |
93 |
} |
95 |
|
94 |
|
96 |
# Default parameters values : |
95 |
# Default parameters values : |
97 |
$output_format ||= 'marc'; |
|
|
98 |
$timestamp ||= ''; |
96 |
$timestamp ||= ''; |
99 |
$dont_export_items ||= 0; |
97 |
$dont_export_items ||= 0; |
100 |
$deleted_barcodes ||= 0; |
98 |
$deleted_barcodes ||= 0; |
Lines 114-119
else {
Link Here
|
114 |
|
112 |
|
115 |
} |
113 |
} |
116 |
|
114 |
|
|
|
115 |
# Default value for output_format is 'iso2709' |
116 |
$output_format ||= 'iso2709'; |
117 |
# Retrocompatibility for the format parameter |
118 |
$output_format = 'iso2709' if $output_format eq 'marc'; |
119 |
|
117 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
120 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
118 |
{ |
121 |
{ |
119 |
template_name => "tools/export.tt", |
122 |
template_name => "tools/export.tt", |
Lines 142-148
if ( C4::Context->preference("IndependentBranches")
Link Here
|
142 |
my $backupdir = C4::Context->config('backupdir'); |
145 |
my $backupdir = C4::Context->config('backupdir'); |
143 |
|
146 |
|
144 |
if ( $op eq "export" ) { |
147 |
if ( $op eq "export" ) { |
145 |
if ( $format eq "iso2709" or $format eq "xml" ) { |
148 |
if ( $output_format eq "iso2709" or $output_format eq "xml" ) { |
146 |
my $charset = 'utf-8'; |
149 |
my $charset = 'utf-8'; |
147 |
my $mimetype = 'application/octet-stream'; |
150 |
my $mimetype = 'application/octet-stream'; |
148 |
binmode STDOUT, ':encoding(UTF-8)'; |
151 |
binmode STDOUT, ':encoding(UTF-8)'; |
Lines 163-170
if ( $op eq "export" ) {
Link Here
|
163 |
) unless ($commandline); |
166 |
) unless ($commandline); |
164 |
|
167 |
|
165 |
$record_type = $query->param("record_type") unless ($commandline); |
168 |
$record_type = $query->param("record_type") unless ($commandline); |
166 |
$output_format = $query->param("output_format") || 'marc' |
|
|
167 |
unless ($commandline); |
168 |
my $export_remove_fields = $query->param("export_remove_fields"); |
169 |
my $export_remove_fields = $query->param("export_remove_fields"); |
169 |
my @biblionumbers = $query->param("biblionumbers"); |
170 |
my @biblionumbers = $query->param("biblionumbers"); |
170 |
my @itemnumbers = $query->param("itemnumbers"); |
171 |
my @itemnumbers = $query->param("itemnumbers"); |
Lines 433-439
if ( $op eq "export" ) {
Link Here
|
433 |
|
434 |
|
434 |
exit; |
435 |
exit; |
435 |
} |
436 |
} |
436 |
elsif ( $format eq "csv" ) { |
437 |
elsif ( $output_format eq "csv" ) { |
437 |
my @biblionumbers = uniq $query->param("biblionumbers"); |
438 |
my @biblionumbers = uniq $query->param("biblionumbers"); |
438 |
my @itemnumbers = $query->param("itemnumbers"); |
439 |
my @itemnumbers = $query->param("itemnumbers"); |
439 |
my $output = |
440 |
my $output = |
440 |
- |
|
|