Bug 22445: Custom cover images - opac shelfbrowser

Test plan:
Go to the detail page of a bibliographic record (at the OPAC)
and confirm the at custom cover images are displayed in the shelf
browser

Sponsored-by: Orex Digital
Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2019-10-22 14:56:53 +01:00
parent e3b90c4cb9
commit 2bf7ddd112
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 16 additions and 19 deletions

View File

@ -25,6 +25,7 @@ use warnings;
use C4::Biblio;
use C4::Context;
use C4::Koha;
use Koha::Biblios;
use Koha::Libraries;
use vars qw(@ISA @EXPORT @EXPORT_OK);
@ -220,14 +221,17 @@ sub GetShelfInfo {
my $marcflavour = C4::Context->preference("marcflavour");
my @valid_items;
for my $item ( @items ) {
my $this_biblio = GetBibData($item->{biblionumber});
next unless defined $this_biblio;
$item->{'title'} = $this_biblio->{'title'};
$item->{'subtitle'} = $this_biblio->{'subtitle'},
$item->{'medium'} = $this_biblio->{'medium'};
$item->{'part_number'} = $this_biblio->{'part_number'};
$item->{'part_name'} = $this_biblio->{'part_name'};
my $this_record = GetMarcBiblio({ biblionumber => $this_biblio->{'biblionumber'} });
my $biblio = Koha::Biblios->find( $item->{biblionumber} );
next unless defined $biblio;
$item->{biblio_object} = $biblio;
$item->{biblionumber} = $biblio->biblionumber;
$item->{title} = $biblio->title;
$item->{subtitle} = $biblio->subtitle;
$item->{medium} = $biblio->medium;
$item->{part_number} = $biblio->part_number;
$item->{part_name} = $biblio->part_name;
my $this_record = GetMarcBiblio({ biblionumber => $biblio->biblionumber });
$item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
$item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
$item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
@ -237,15 +241,4 @@ sub GetShelfInfo {
return @valid_items;
}
# Fetches some basic biblio data needed by the shelf stuff
sub GetBibData {
my ($bibnum) = @_;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT biblionumber, title, subtitle, medium, part_number, part_name FROM biblio WHERE biblionumber=?");
$sth->execute($bibnum);
my $bib = $sth->fetchrow_hashref();
return $bib;
}
1;

View File

@ -61,6 +61,10 @@
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
<img alt="Cover image" src="[% item.biblio_object.custom_cover_image_url | url %]" />
[% END %]
</a>
</td>
[% END %]