Owen Leonard
f3d99e6a13
This patch corrects permission on the export option available on catalogue pages in the staff client (detail.pl, MARCdetail.pl, etc) so that users no longer require "export_catalogue" permission. "export_catalogue" permission is required only for tools/export.pl. This patch also corrects some crazy nearby indentation. Sorry, couldn't resist. To test, visit a page like detail.pl with and without "export_catalogue" permission. It should be possible to save the record as MODS, MARCXML, MARC, etc. without error. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
63 lines
1.6 KiB
Perl
Executable file
63 lines
1.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
use strict;
|
|
#use warnings; FIXME - Bug 2505
|
|
|
|
use C4::Record;
|
|
use C4::Auth;
|
|
use C4::Output;
|
|
use C4::Biblio;
|
|
use CGI;
|
|
|
|
|
|
|
|
my $query = new CGI;
|
|
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
|
|
template_name => "tools/export.tt",
|
|
query => $query,
|
|
type => "intranet",
|
|
authnotrequired => 0,
|
|
flagsrequired => { catalogue => 1 },
|
|
debug => 1,
|
|
});
|
|
|
|
my $op=$query->param("op");
|
|
my $format=$query->param("format");
|
|
my $error = '';
|
|
if ($op eq "export") {
|
|
my $biblionumber = $query->param("bib");
|
|
if ($biblionumber){
|
|
|
|
my $marc = GetMarcBiblio($biblionumber, 1);
|
|
|
|
if ($format =~ /endnote/) {
|
|
$marc = marc2endnote($marc);
|
|
$format = 'endnote';
|
|
}
|
|
elsif ($format =~ /marcxml/) {
|
|
$marc = marc2marcxml($marc);
|
|
}
|
|
elsif ($format=~ /mods/) {
|
|
$marc = marc2modsxml($marc);
|
|
}
|
|
elsif ($format =~ /dc/) {
|
|
($error,$marc) = marc2dcxml($marc,1);
|
|
$format = "dublin-core.xml";
|
|
}
|
|
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();
|
|
}
|
|
elsif ($format =~ /marcstd/) {
|
|
C4::Charset::SetUTF8Flag($marc,1);
|
|
($error, $marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
|
|
}
|
|
print $query->header(
|
|
-type => 'application/octet-stream',
|
|
-attachment=>"bib-$biblionumber.$format");
|
|
print $marc;
|
|
}
|
|
}
|