Bugzilla – Attachment 14937 Details for
Bug 9174
Item type image does not display for biblio-level itemtypes in list display in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9174: Fix itemtype image display in OPAC lists
Bug-9174-Fix-itemtype-image-display-in-OPAC-lists.patch (text/plain), 4.54 KB, created by
Mason James
on 2013-01-30 07:55:04 UTC
(
hide
)
Description:
Bug 9174: Fix itemtype image display in OPAC lists
Filename:
MIME Type:
Creator:
Mason James
Created:
2013-01-30 07:55:04 UTC
Size:
4.54 KB
patch
obsolete
>From 32d49d481f0e971377ca196f554559257081f113 Mon Sep 17 00:00:00 2001 >From: Jared Camins-Esakov <jcamins@cpbibliography.com> >Date: Thu, 29 Nov 2012 16:58:27 -0500 >Subject: [PATCH] Bug 9174: Fix itemtype image display in OPAC lists >Content-Type: text/plain; charset="utf-8" >http://koha-community.org > >Prior to this patch, C4::VirtualShelves::Page did not make sure that >the itemtype images that it chose when displaying itemtype images for >biblio-level itemtypes were for the correct interface, so >even on the OPAC the Intranet icons were requested. On standard >installations, intranet-tmpl is not available to the OPAC. > >To test: >1) Set noItemTypeImages to "Show" and item-level_items to "biblio record" >2) Create a list and add an item with the default item type (942$c in > MARC21) set to something with an itemtype image associated with it. >3) View the list in the OPAC. >4) If you are an a standard install, the itemtype image will be a broken > link. If on a dev install, you can confirm with Firebug or the like > that the image is pulled from /intranet-tmpl. >5) Apply patch. >6) Run `prove t/db_dependent/Koha.t` to confirm that the behavior of the > routine used to retrieve the image URL is correct. (Note that you > must have an item type with the code 'BK') >7) Refresh the list, noting that the display is now correct/the image is > pulled from opac-tmpl. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >It works as expected. All tests in Koha.t passed. >Signed-off-by: Mason James <mtj@kohaaloha.com> >--- > C4/Koha.pm | 10 ++++++---- > C4/VirtualShelves/Page.pm | 2 +- > t/db_dependent/Koha.t | 8 +++++++- > 3 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 3892468..f7c0011 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -425,20 +425,22 @@ sub getframeworkinfo { > > =head2 getitemtypeinfo > >- $itemtype = &getitemtype($itemtype); >+ $itemtype = &getitemtype($itemtype, [$interface]); > >-Returns information about an itemtype. >+Returns information about an itemtype. The optional $interface argument >+sets which interface ('opac' or 'intranet') to return the imageurl for. >+Defaults to intranet. > > =cut > > sub getitemtypeinfo { >- my ($itemtype) = @_; >+ my ($itemtype, $interface) = @_; > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare("select * from itemtypes where itemtype=?"); > $sth->execute($itemtype); > my $res = $sth->fetchrow_hashref; > >- $res->{imageurl} = getitemtypeimagelocation( 'intranet', $res->{imageurl} ); >+ $res->{imageurl} = getitemtypeimagelocation( ( $interface eq 'opac' ? 'opac' : 'intranet' ), $res->{imageurl} ); > > return $res; > } >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 6a4d431..586384d 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -262,7 +262,7 @@ sub shelfpage { > #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'}; > #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'}; > $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} ); >- $this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'} )->{'imageurl'}; >+ $this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'}; > $this_item->{'coins'} = GetCOinSBiblio( $record ); > $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'})); > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour); >diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t >index 6ade4a7..aea5245 100644 >--- a/t/db_dependent/Koha.t >+++ b/t/db_dependent/Koha.t >@@ -7,7 +7,7 @@ use strict; > use warnings; > use C4::Context; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use DateTime::Format::MySQL; > > eval {use Test::Deep;}; >@@ -63,6 +63,12 @@ subtest 'Authorized Values Tests' => sub { > } > }; > >+subtest 'Itemtype info Tests' => sub { >+ like ( getitemtypeinfo('BK')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on unspecified interface returns intranet imageurl (legacy behavior)' ); >+ like ( getitemtypeinfo('BK', 'intranet')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on "intranet" interface returns intranet imageurl' ); >+ like ( getitemtypeinfo('BK', 'opac')->{'imageurl'}, qr/opac-tmpl/, 'getitemtypeinfo on "opac" interface returns opac imageurl' ); >+}; >+ > > > >-- >1.7.2.5
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 9174
:
13791
|
13911
|
14347
|
14351
|
14937
|
14938
|
15022