Bugzilla – Attachment 36136 Details for
Bug 13695
Allow ISBD format export
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13695: Add ISBD export option for the OPAC cart and lists
Bug-13695-Add-ISBD-export-option-for-the-OPAC-cart.patch (text/plain), 6.12 KB, created by
Brendan Gallagher
on 2015-02-24 06:25:55 UTC
(
hide
)
Description:
Bug 13695: Add ISBD export option for the OPAC cart and lists
Filename:
MIME Type:
Creator:
Brendan Gallagher
Created:
2015-02-24 06:25:55 UTC
Size:
6.12 KB
patch
obsolete
>From 9f9daa3b73802b7f8691a48b2f8b0e7e6a17e7d9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Tue, 10 Feb 2015 20:30:23 -0300 >Subject: [PATCH] Bug 13695: Add ISBD export option for the OPAC cart and > lists > >This patch adds the option to download records from the cart, and >lists in the ISBD format from the OPAC. > >To test (cart): >- Apply the patch >- Add several records to your OPAC cart. >- Go to your cart, and choose 'Download' >=> SUCCESS: There's an ISBD option >- Dowload and open the exported records >=> SUCCESS: The file contains the ISBD format for the records on the cart > >To test (lists): >- Add several records to a list (i did it from the cart ;-)) >- Open the list >- Choose 'Download list' >=> SUCCESS: There's an ISBD option >- Download and open the exported records >=> SUCCESS: The file contains the ISBD format for the records on the list. > >- Sign off :-D > >Sponsored-by: Orex Digital > >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> >--- > .../bootstrap/en/modules/opac-downloadcart.tt | 1 + > .../bootstrap/en/modules/opac-downloadshelf.tt | 1 + > opac/opac-downloadcart.pl | 16 ++++++++++++---- > opac/opac-downloadshelf.pl | 14 +++++++++++--- > 4 files changed, 25 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt >index 8536c46..9f1f65d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt >@@ -14,6 +14,7 @@ > <option value="">-- Choose format --</option> > <option value="ris">RIS (Zotero, EndNote, others)</option> > <option value="bibtex">BibTeX</option> >+ <option value="isbd">ISBD</option> > <option value="iso2709">MARC</option> > [% FOREACH csv_profile IN csv_profiles %] > <option value="[% csv_profile.export_format_id %]">CSV - [% csv_profile.profile %]</option> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >index 128cec2..a9c53f9 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt >@@ -53,6 +53,7 @@ > <option value="">-- Choose format --</option> > <option value="ris">RIS (Zotero, EndNote, others)</option> > <option value="bibtex">BibTeX</option> >+ <option value="isbd">ISBD</option> > <option value="iso2709">MARC</option> > [% FOREACH csv_profile IN csv_profiles %] > <option value="[% csv_profile.export_format_id |html %]">CSV - [% csv_profile.profile |html %]</option> >diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl >index 98a7f3c..5164c2e 100755 >--- a/opac/opac-downloadcart.pl >+++ b/opac/opac-downloadcart.pl >@@ -52,8 +52,10 @@ if ($bib_list && $format) { > > my @bibs = split( /\//, $bib_list ); > >- my $marcflavour = C4::Context->preference('marcflavour'); >+ my $marcflavour = C4::Context->preference('marcflavour'); > my $output; >+ my $extension; >+ my $type; > > # CSV > if ($format =~ /^\d+$/) { >@@ -76,6 +78,11 @@ if ($bib_list && $format) { > elsif ($format eq 'bibtex') { > $output .= marc2bibtex($record, $biblio); > } >+ elsif ( $format eq 'isbd' ) { >+ $output .= GetISBDView($biblio, "opac"); >+ $extension = "txt"; >+ $type = "text/plain"; >+ } > } > } > >@@ -83,9 +90,10 @@ if ($bib_list && $format) { > $format = "csv" if ($format =~ m/^\d+$/); > > print $query->header( >- -type => 'application/octet-stream', >- -'Content-Transfer-Encoding' => 'binary', >- -attachment=>"cart.$format"); >+ -type => ($type) ? $type : 'application/octet-stream', >+ -'Content-Transfer-Encoding' => 'binary', >+ -attachment => ($extension) ? "cart.$format.$extension" : "cart.$format" >+ ); > print $output; > > } else { >diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl >index 7a6b1dd..0230eba 100755 >--- a/opac/opac-downloadshelf.pl >+++ b/opac/opac-downloadshelf.pl >@@ -57,6 +57,8 @@ if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh > my ($items, $totitems) = GetShelfContents($shelfid); > my $marcflavour = C4::Context->preference('marcflavour'); > my $output; >+ my $extension; >+ my $type; > > # CSV > if ($format =~ /^\d+$/) { >@@ -83,6 +85,11 @@ if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh > elsif ($format eq 'bibtex') { > $output .= marc2bibtex($record, $biblionumber); > } >+ elsif ( $format eq 'isbd' ) { >+ $output .= GetISBDView($biblionumber, "opac"); >+ $extension = "txt"; >+ $type = "text/plain"; >+ } > } > } > >@@ -90,9 +97,10 @@ if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh > $format = "csv" if ($format =~ m/^\d+$/); > > print $query->header( >- -type => 'application/octet-stream', >- -'Content-Transfer-Encoding' => 'binary', >- -attachment=>"shelf.$format"); >+ -type => ($type) ? $type : 'application/octet-stream', >+ -'Content-Transfer-Encoding' => 'binary', >+ -attachment => ($extension) ? "shelf.$format.$extension" : "shelf.$format" >+ ); > print $output; > > } else { >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13695
:
35818
|
35819
|
35820
|
36134
|
36135
|
36136
|
37304
|
37305
|
37306