Merge branch 'bug_9174' into 3.12-master
This commit is contained in:
commit
6e13cc1aad
3 changed files with 14 additions and 6 deletions
10
C4/Koha.pm
10
C4/Koha.pm
|
@ -425,20 +425,22 @@ sub getframeworkinfo {
|
||||||
|
|
||||||
=head2 getitemtypeinfo
|
=head2 getitemtypeinfo
|
||||||
|
|
||||||
$itemtype = &getitemtype($itemtype);
|
$itemtype = &getitemtypeinfo($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
|
=cut
|
||||||
|
|
||||||
sub getitemtypeinfo {
|
sub getitemtypeinfo {
|
||||||
my ($itemtype) = @_;
|
my ($itemtype, $interface) = @_;
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth = $dbh->prepare("select * from itemtypes where itemtype=?");
|
my $sth = $dbh->prepare("select * from itemtypes where itemtype=?");
|
||||||
$sth->execute($itemtype);
|
$sth->execute($itemtype);
|
||||||
my $res = $sth->fetchrow_hashref;
|
my $res = $sth->fetchrow_hashref;
|
||||||
|
|
||||||
$res->{imageurl} = getitemtypeimagelocation( 'intranet', $res->{imageurl} );
|
$res->{imageurl} = getitemtypeimagelocation( ( ( defined $interface && $interface eq 'opac' ) ? 'opac' : 'intranet' ), $res->{imageurl} );
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ sub shelfpage {
|
||||||
#$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'};
|
#$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'};
|
||||||
#$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
|
#$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
|
||||||
$this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} );
|
$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->{'coins'} = GetCOinSBiblio( $record );
|
||||||
$this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
|
$this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
|
||||||
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour);
|
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour);
|
||||||
|
|
|
@ -7,7 +7,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use C4::Context;
|
use C4::Context;
|
||||||
|
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 6;
|
||||||
use DateTime::Format::MySQL;
|
use DateTime::Format::MySQL;
|
||||||
|
|
||||||
eval {use Test::Deep;};
|
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' );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue