Bug 20097: Use same regex in marc2dcxml and opac-export

This regex allows: dc, oaidc, srwdc, and rdfdc.

Test plan:
[1] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=dc
[2] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=oaidc
[3] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=nodc. This one should trigger a not-supported message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2018-01-29 10:32:28 +01:00 committed by Jonathan Druart
parent 6d479dc5e5
commit f24e48577f
2 changed files with 2 additions and 2 deletions

View File

@ -294,7 +294,7 @@ sub marc2dcxml {
};
} elsif ( $record =~ /^MARC::Record/ ) { # if OK makes xslt transformation
my $xslt_engine = Koha::XSLT_Handler->new;
if ( $format =~ /oaidc|srwdc|rdfdc/ ) {
if ( $format =~ /^(dc|oaidc|srwdc|rdfdc)$/i ) {
$output = $xslt_engine->transform( $marcxml, $xsl );
} else {
croak "The format argument ($format) not accepted.\n" .

View File

@ -78,7 +78,7 @@ elsif ($format =~ /bibtex/) {
$marc = marc2bibtex($marc,$biblionumber);
$format = 'bibtex';
}
elsif ($format =~ /dc$/) {
elsif ($format =~ /^(dc|oaidc|srwdc|rdfdc)$/i ) {
# TODO: Dublin Core leaks fields marked hidden by framework.
$marc = marc2dcxml($marc, undef, $biblionumber, $format);
$format = "dublin-core.xml";