[Koha-patches] [PATCH 2/3] Bug 13695: Add ISBD export option to OPAC (detail)

Tomas Cohen Arazi tomascohen at gmail.com
Wed Feb 11 00:46:31 CET 2015


This patch adds the option to export a record (from within the
OPAC record detail page) in the ISBD format.

To test:
- Enable ISBD on the OpacExportOptions syspref
- Look for a record on your opac
- On the detail page, notice there's a new ISBD option for 'Save record'
- Choose ISBD
=> SUCCESS: a file containing the ISBD format for the record is downloaded

Sponsored-by: Orex Digital
---
 .../opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc   |  1 +
 opac/opac-export.pl                                           | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc
index 3efa10c..88640ac 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc
@@ -54,6 +54,7 @@
                                             [% CASE 'marcstd' %]MARC (Unicode/UTF-8, Standard)
                                             [% CASE 'mods' %]MODS (XML)
                                             [% CASE 'ris' %]RIS
+                                            [% CASE 'isbd' %]ISBD
                                         [% END %]
                                     </a>
                                 </li>
diff --git a/opac/opac-export.pl b/opac/opac-export.pl
index 707392f..3d983f9 100755
--- a/opac/opac-export.pl
+++ b/opac/opac-export.pl
@@ -79,6 +79,10 @@ elsif ($format =~ /marcstd/) {
     ($error,$marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
     $format = 'marcstd';
 }
+elsif ( $format =~ /isbd/ ) {
+    $marc   = GetISBDView($biblionumber, "opac");
+    $format = 'isbd';
+}
 else {
     $error= "Format $format is not supported.";
 }
@@ -96,6 +100,13 @@ else {
             -type => 'application/marc',
             -charset=>'ISO-2022',
             -attachment=>"bib-$biblionumber.$format");
+    }
+    elsif ( $format eq 'isbd' ) {
+        print $query->header(
+            -type       => 'text/plain',
+            -charset    => 'utf-8',
+            -attachment =>  "bib-$biblionumber.txt"
+        );
     }else{
         print $query->header(
             -type => 'application/octet-stream',
-- 
2.3.0



More information about the Koha-patches mailing list