Koha/catalogue/export.pl
Hector Castro e3139601c6 Bug 13642 - Adding new features for Dublin Core metadata
When Koha export a bibliographic record to DC, makes it in XML format.
This XML not follows the DC-XML recommendations as should be: elements
in uppercase eg. dc:Date, dc:Creator, section 4.2, recommendation 4
explain that "The property names for the 15 DC elements should be all
lower-case." eg. dc:date, dc:creator" and section "4.3 Example - a
simple DC record", xsi:schemaLocation="http://example.org/myapp/
http://example.org/myapp/schema.xsd" schema does not exist.

NOTE: This new feature implement the XSLT transformation for OAI-DC,
SRW-DC and RDF-DC

Test plan
---------------
1) Download Dublin Core file from record detail page. Open up the file,
   and make sure that the document not follows the DC-XML
   recommendations as should be.
2) Apply patch.
3) Go to whichever bib record in OPAC or staff and click on Save >
   Dublin Core.  A modal will display, prove all options.
4) Change the system preference 'Opac ExportOptions' by enabling and
   disabling Dublin Core and try to download a record.
5) Try several bibliographic records in any format (book, magazine, DVD,
   etc.) to confirm that properly exported.
6) Test with all marc flavours.

Sponsored-by: Universidad de El Salvador

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-01-27 06:23:07 +00:00

77 lines
2.3 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 qw ( -utf8 );
use C4::Ris;
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);
$format = "marcxml";
}
elsif ($format=~ /mods/) {
$marc = marc2modsxml($marc);
$format = "mods";
}
elsif ($format =~ /ris/) {
$marc = marc2ris($marc);
$format = "ris";
}
elsif ($format =~ /bibtex/) {
$marc = marc2bibtex($marc);
$format = "bibtex";
}
elsif ($format =~ /dc$/) {
$marc = marc2dcxml(undef, undef, $biblionumber, $format);
$format = "dublin-core.xml";
}
elsif ($format =~ /marc8/) {
$marc = changeEncoding($marc,"MARC","MARC21","MARC-8");
$marc = $marc->as_usmarc();
$format = "marc8";
}
elsif ($format =~ /utf8/) {
C4::Charset::SetUTF8Flag($marc, 1);
$marc = $marc->as_usmarc();
$format = "utf8";
}
elsif ($format =~ /marcstd/) {
C4::Charset::SetUTF8Flag($marc,1);
($error, $marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
$format = "marcstd";
}
print $query->header(
-type => 'application/octet-stream',
-attachment=>"bib-$biblionumber.$format");
print $marc;
}
}