From 06de5537bafdefeefc183047c384ab199bbc331b Mon Sep 17 00:00:00 2001
From: Hector Castro <hector.hecaxmmx@gmail.com>
Date: Fri, 30 Jan 2015 11:58:16 -0600
Subject: [PATCH 11/11] Bug 13642 [ENH] Adding new features for Dublin Core
 metadata Changes conditional if() for include more
 options "dc" (export.pl)

---
 catalogue/export.pl |   32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/catalogue/export.pl b/catalogue/export.pl
index e66d3f2..d47ba81 100755
--- a/catalogue/export.pl
+++ b/catalogue/export.pl
@@ -26,6 +26,12 @@ my $format=$query->param("format");
 my $error = '';
 if ($op eq "export") {
     my $biblionumber = $query->param("bib");
+    my $recommendation = $query->param("recommendation");
+    my $formats = $query->param("formats");
+    my $qualifier = $query->param("qualifier");
+    my $root_element = $query->param("root_element");
+    my $xsischemalocation = $query->param("xsischemalocation");
+    my $resource_url = $query->url(-base => 1) . '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' . $biblionumber;
         if ($biblionumber){
 
             my $marc = GetMarcBiblio($biblionumber, 1);
@@ -50,9 +56,29 @@ if ($op eq "export") {
                 $marc = marc2bibtex($marc);
                 $format = "bibtex";
             }
-            elsif ($format =~ /dc/) {
-                ($error,$marc) = marc2dcxml($marc,1);
-                $format = "dublin-core.xml";
+            elsif ($format =~ /dc/) { 
+                 SWITCH:
+                 for ($recommendation) {
+                     if (/^simple-dc-rdf/) {
+                         ($error,$marc) = marc2dcxml($recommendation, $marc, 0, 
+                         1, undef, undef, $resource_url , $formats);
+                         $format = "dublin-core." . $formats;
+                         last SWITCH; }
+                     if (/^dc-rdf/) {
+                         ($error,$marc) = marc2dcxml($recommendation, $marc, 1, 
+                         1, undef, undef, $resource_url, $formats);
+                         $format = "dublin-core." . $formats;
+                         last SWITCH; }
+                     if (/^dc-xml/) { 
+                         ($error,$marc) = marc2dcxml($recommendation, $marc, $qualifier, 
+                         1, $root_element, $xsischemalocation, undef, undef);
+                         $format = "dublin-core.xml";
+                         last SWITCH; }
+                     if (/^oai-dc/) {
+                         ($error,$marc) = marc2dcxml($recommendation, $marc);
+                         $format = "dublin-core.xml";
+                         last SWITCH; }
+                }
             }
             elsif ($format =~ /marc8/) {
                 $marc = changeEncoding($marc,"MARC","MARC21","MARC-8");
-- 
1.7.10.4