View | Details | Raw Unified | Return to bug 9174
Collapse All | Expand All

(-)a/C4/Koha.pm (-4 / +6 lines)
Lines 425-444 sub getframeworkinfo { Link Here
425
425
426
=head2 getitemtypeinfo
426
=head2 getitemtypeinfo
427
427
428
  $itemtype = &getitemtype($itemtype);
428
  $itemtype = &getitemtype($itemtype, [$interface]);
429
429
430
Returns information about an itemtype.
430
Returns information about an itemtype. The optional $interface argument
431
sets which interface ('opac' or 'intranet') to return the imageurl for.
432
Defaults to intranet.
431
433
432
=cut
434
=cut
433
435
434
sub getitemtypeinfo {
436
sub getitemtypeinfo {
435
    my ($itemtype) = @_;
437
    my ($itemtype, $interface) = @_;
436
    my $dbh        = C4::Context->dbh;
438
    my $dbh        = C4::Context->dbh;
437
    my $sth        = $dbh->prepare("select * from itemtypes where itemtype=?");
439
    my $sth        = $dbh->prepare("select * from itemtypes where itemtype=?");
438
    $sth->execute($itemtype);
440
    $sth->execute($itemtype);
439
    my $res = $sth->fetchrow_hashref;
441
    my $res = $sth->fetchrow_hashref;
440
442
441
    $res->{imageurl} = getitemtypeimagelocation( 'intranet', $res->{imageurl} );
443
    $res->{imageurl} = getitemtypeimagelocation( ( $interface eq 'opac' ? 'opac' : 'intranet' ), $res->{imageurl} );
442
444
443
    return $res;
445
    return $res;
444
}
446
}
(-)a/C4/VirtualShelves/Page.pm (-1 / +1 lines)
Lines 262-268 sub shelfpage { Link Here
262
                    #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype}  }->{'imageurl'};
262
                    #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype}  }->{'imageurl'};
263
                    #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
263
                    #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
264
                    $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} );
264
                    $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} );
265
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'} )->{'imageurl'};
265
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
266
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
266
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
267
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
267
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
268
                    $this_item->{'normalized_upc'}  = GetNormalizedUPC(       $record,$marcflavour);
268
                    $this_item->{'normalized_upc'}  = GetNormalizedUPC(       $record,$marcflavour);
(-)a/t/db_dependent/Koha.t (-2 / +7 lines)
Lines 7-13 use strict; Link Here
7
use warnings;
7
use warnings;
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 5;
10
use Test::More tests => 6;
11
use DateTime::Format::MySQL;
11
use DateTime::Format::MySQL;
12
12
13
eval {use Test::Deep;};
13
eval {use Test::Deep;};
Lines 63-68 subtest 'Authorized Values Tests' => sub { Link Here
63
    }
63
    }
64
};
64
};
65
65
66
subtest 'Itemtype info Tests' => sub {
67
    like ( getitemtypeinfo('BK')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on unspecified interface returns intranet imageurl (legacy behavior)' );
68
    like ( getitemtypeinfo('BK', 'intranet')->{'imageurl'}, qr/intranet-tmpl/, 'getitemtypeinfo on "intranet" interface returns intranet imageurl' );
69
    like ( getitemtypeinfo('BK', 'opac')->{'imageurl'}, qr/opac-tmpl/, 'getitemtypeinfo on "opac" interface returns opac imageurl' );
70
};
71
66
72
67
73
68
74
69
- 

Return to bug 9174