Browse Source

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>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
3.20.x
Tomás Cohen Arazi 9 years ago
parent
commit
93addad23a
  1. 1
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadcart.tt
  2. 1
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-downloadshelf.tt
  3. 16
      opac/opac-downloadcart.pl
  4. 14
      opac/opac-downloadshelf.pl

1
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>

1
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>

16
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 {

14
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 {

Loading…
Cancel
Save