Jonathan Druart
6f204fdf96
There is a "debug" parameter we are passing from the controller scripts to C4::Auth::get_template_and_user, but it's not actually used! Test plan: Confirm the assumption Review the changes from this patch Generated with: perl -p -i -e 's#\s*debug\s*=\>\s*(0|1),?\s*##gms' **/*.pl git checkout misc/devel/update_dbix_class_files.pl # Wrong catch + Manual fix in acqui/neworderempty.pl Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
49 lines
1.3 KiB
Perl
Executable file
49 lines
1.3 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
use Modern::Perl;
|
|
|
|
use C4::Record;
|
|
use C4::Auth;
|
|
use C4::Output;
|
|
use C4::AuthoritiesMarc;
|
|
use CGI qw ( -utf8 );
|
|
|
|
my $query = CGI->new;
|
|
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|
{
|
|
template_name => "tools/export.tt",
|
|
query => $query,
|
|
type => "intranet",
|
|
flagsrequired => { catalogue => 1 },
|
|
}
|
|
);
|
|
|
|
my $op = $query->param("op");
|
|
my $format = $query->param("format");
|
|
my $error = '';
|
|
if ( $op eq "export" ) {
|
|
my $authid = $query->param("authid");
|
|
if ($authid) {
|
|
|
|
my $marc = GetAuthority($authid);
|
|
|
|
if ( $format =~ /marcxml/ ) {
|
|
$marc = marc2marcxml($marc, 'UTF-8', C4::Context->preference("marcflavour") eq 'UNIMARC' ? 'UNIMARCAUTH' : 'MARC21' );
|
|
}
|
|
elsif ($format=~ /mads/) {
|
|
$marc = marc2madsxml($marc);
|
|
}
|
|
elsif ( $format =~ /marc8/ ) {
|
|
$marc = changeEncoding( $marc, "MARC", "MARC21", "MARC-8" );
|
|
$marc = $marc->as_usmarc();
|
|
}
|
|
elsif ( $format =~ /utf8/ ) {
|
|
C4::Charset::SetUTF8Flag( $marc, 1 );
|
|
$marc = $marc->as_usmarc();
|
|
}
|
|
print $query->header(
|
|
-type => 'application/octet-stream',
|
|
-attachment => "auth-$authid.$format"
|
|
);
|
|
print $marc;
|
|
}
|
|
}
|