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>
This commit is contained in:
Tomás Cohen Arazi 2015-02-10 20:30:23 -03:00
parent 792b0f764e
commit 93addad23a
4 changed files with 25 additions and 7 deletions

View file

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

View file

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

View file

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

View file

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