&& $authorised_values->{ $this_authorised_value->{'category'} } eq $this_authorised_value->{'authorised_value'} ) {
# warn ( Data::Dumper->Dump( [ $this_authorised_value ], [ 'this_authorised_value' ] ) );
if ( defined $this_authorised_value->{'imageurl'} ) {
- push @imagelist, { imageurl => C4::Koha::getitemtypeimagesrc( 'intranet' ) . '/' . $this_authorised_value->{'imageurl'},
+ push @imagelist, { imageurl => C4::Koha::getitemtypeimagelocation( 'intranet', $this_authorised_value->{'imageurl'} ),
label => $this_authorised_value->{'lib'},
category => $this_authorised_value->{'category'},
value => $this_authorised_value->{'authorised_value'}, };
use strict;
use C4::Context;
use C4::Output;
+use URI::Split qw(uri_split);
use vars qw($VERSION @ISA @EXPORT $DEBUG);
&get_notforloan_label_of
&getitemtypeimagedir
&getitemtypeimagesrc
+ &getitemtypeimagelocation
&GetAuthorisedValues
&GetAuthorisedValueCategories
&GetKohaAuthorisedValues
}
}
+sub getitemtypeimagelocation($$) {
+ my ( $src, $image ) = @_;
+
+ return if ( !$image );
+
+ my $scheme = ( uri_split( $image ) )[0];
+
+ return $image if ( $scheme );
+
+ return getitemtypeimagesrc( $src ) . '/' . $image;
+}
+
=head3 _getImagesFromDirectory
Find all of the image files in a directory in the filesystem
$oldbiblio->{result_number} = $i + 1;
# add imageurl to itemtype if there is one
- if ( $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} =~ /^http:/ ) {
- $oldbiblio->{imageurl} =
- $itemtypes{ $oldbiblio->{itemtype} }->{imageurl};
- } else {
- $oldbiblio->{imageurl} =
- getitemtypeimagesrc() . "/"
- . $itemtypes{ $oldbiblio->{itemtype} }->{imageurl}
- if ( $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
- }
+ $oldbiblio->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
+
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{biblionumber} ) );
$oldbiblio->{authorised_value_images} = $biblio_authorised_value_images;
my $aisbn = $oldbiblio->{'isbn'};
$onloan_items->{$key}->{branchname} = $item->{branchname};
$onloan_items->{$key}->{location} = $shelflocations->{ $item->{location} };
$onloan_items->{$key}->{itemcallnumber} = $item->{itemcallnumber};
- $onloan_items->{$key}->{imageurl} = getitemtypeimagesrc() . "/" . $itemtypes{ $item->{itype} }->{imageurl};
+ $onloan_items->{$key}->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $item->{itype} }->{imageurl} );
# if something's checked out and lost, mark it as 'long overdue'
if ( $item->{itemlost} ) {
$onloan_items->{$prefix}->{longoverdue}++;
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value;
$other_items->{$key}->{count}++ if $item->{homebranch};
$other_items->{$key}->{location} = $shelflocations->{ $item->{location} };
- $other_items->{$key}->{imageurl} = getitemtypeimagesrc() . "/" . $itemtypes{ $item->{itype} }->{imageurl};
+ $other_items->{$key}->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $item->{itype} }->{imageurl} );
}
# item is available
else {
$available_items->{$prefix}->{$_} = $item->{$_};
}
$available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
- $available_items->{$prefix}->{imageurl} = getitemtypeimagesrc() . "/" . $itemtypes{ $item->{itype} }->{imageurl};
+ $available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $item->{itype} }->{imageurl} );
}
}
} # notforloan, item level and biblioitem level
$row_data{category} = $results->[$i]{'category'};
$row_data{authorised_value} = $results->[$i]{'authorised_value'};
$row_data{lib} = $results->[$i]{'lib'};
- $row_data{imageurl} = getitemtypeimagesrc('intranet') . '/' . $results->[$i]{'imageurl'};
+ $row_data{imageurl} = getitemtypeimagelocation( 'intranet', $results->[$i]{'imageurl'} );
$row_data{edit} = "$script_name?op=add_form&id=".$results->[$i]{'id'};
$row_data{delete} = "$script_name?op=delete_confirm&searchfield=$searchfield&id=".$results->[$i]{'id'};
push(@loop_data, \%row_data);
my @loop;
foreach my $itemtype ( @{$results}[ $first .. $last ] ) {
$itemtype->{toggle} = ($toggle++ % 2) ? 0 : 1 ;
- $itemtype->{imageurl} = getitemtypeimagesrc('intranet') . "/$itemtype->{imageurl}";
+ $itemtype->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtype->{imageurl} );
$itemtype->{rentalcharge} = sprintf( '%.2f', $itemtype->{rentalcharge} );
push( @loop, $itemtype );
}
GetLatestSerials( $subscription->{subscriptionid}, 3 );
push @subs, \%cell;
}
-$dat->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $dat->{itemtype} }{imageurl};
+$dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }{imageurl} );
$dat->{'count'} = scalar @items;
my $shelflocations = GetKohaAuthorisedValues('items.location', $fw);
my $collections = GetKohaAuthorisedValues('items.ccode' , $fw);
# format some item fields for display
$item->{ $item->{'publictype'} } = 1;
- $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $item->{itype} }{imageurl};
+ $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
foreach (qw(datedue datelastseen onloan)) {
$item->{$_} = format_date($item->{$_});
}
my @itemtypesloop;
my $selected=1;
my $cnt;
-my $imgdir = getitemtypeimagesrc('intranet');
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
my %row =( number=>$cnt++,
- imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
+ imageurl=> getitemtypeimagelocation( 'intranet', $itemtypes->{$thisitemtype}->{'imageurl'} ),
ccl => $itype_or_itemtype,
code => $thisitemtype,
selected => $selected,
for my $thisitemtype (@$advsearchtypes) {
my %row =(
number=>$cnt++,
- imageurl=> $thisitemtype->{'imageurl'}?($imgdir."/".$thisitemtype->{'imageurl'}):"",
+ imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ),
ccl => $advanced_search_types,
code => $thisitemtype->{authorised_value},
selected => $selected,
my $itemtypeinfo = getitemtypeinfo($itemtype);
$row{'itemtype_description'} = $itemtypeinfo->{description};
- $row{'itemtype_image'} = $itemtypeinfo->{imageurl};
+ $row{'itemtype_image'} = getitemtypelocation( 'opac', $itemtypeinfo->{imageurl} );
$row{'charge'} = sprintf( "%.2f", $charge );
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
-my $imgdir = getitemtypeimagesrc();
my $itemtypes = GetItemTypes();
# imageurl:
my $itemtype = $dat->{'itemtype'};
if ( $itemtype ) {
- $dat->{'imageurl'} = $imgdir."/".$itemtypes->{$itemtype}->{'imageurl'};
+ $dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
}
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'});
my $ccode= $itm->{'ccode'};
$itm->{'ccode'} = $collections->{$ccode} if(defined($collections) && exists($collections->{$ccode}));
$itm->{'location_description'} = $shelflocations->{$itm->{'location'} };
- $itm->{'imageurl'} = $imgdir."/".$itemtypes->{ $itm->{itype} }->{'imageurl'};
+ $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
$itm->{'description'} = $itemtypes->{$itemtype}->{'description'};
$itemfields{ccode} = 1 if($itm->{ccode});
$itemfields{enumchron} = 1 if($itm->{enumchron});
$template->param($borr);
-my $imgdir = getitemtypeimagesrc();
my $itemtypes = GetItemTypes();
# get the record
$line{volumeddesc} = $issues->[$i]->{'volumeddesc'};
$line{counter} = $i + 1;
$line{'description'} = $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'description'};
- $line{imageurl} = $imgdir."/".$itemtypes->{ $issues->[$i]->{'itemtype'} }->{'imageurl'};
+ $line{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $issues->[$i]->{'itemtype'} }->{'imageurl'} );
push( @loop_reading, \%line );
}
while (my $wait_hashref = $sth2->fetchrow_hashref) {
$item->{waitingdate} = format_date($wait_hashref->{waitingdate});
}
- $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $item->{itype} }{imageurl};
+ $item->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $item->{itype} }{imageurl} );
push @{ $biblioitem->{itemloop} }, $item;
}
my @itemtypesloop;
my $selected=1;
my $cnt;
-my $imgdir = getitemtypeimagesrc('opac');
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
my %row =( number=>$cnt++,
- imageurl=> $itemtypes->{$thisitemtype}->{'imageurl'}?($imgdir."/".$itemtypes->{$thisitemtype}->{'imageurl'}):"",
+ imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
ccl => $itype_or_itemtype,
code => $thisitemtype,
selected => $selected,
for my $thisitemtype (@$advsearchtypes) {
my %row =(
number=>$cnt++,
- imageurl=> $thisitemtype->{'imageurl'}?($imgdir."/".$thisitemtype->{'imageurl'}):"",
+ imageurl=> getitemtypeimagelocation( 'opac', $thisitemtype->{'imageurl'} ),
ccl => $advanced_search_types,
code => $thisitemtype->{authorised_value},
selected => $selected,
my $overdues_count = 0;
my @overdues;
my @issuedat;
-my $imgdir = getitemtypeimagesrc();
my $itemtypes = GetItemTypes();
foreach my $issue ( @$issues ) {
if($count%2 eq 0){ $issue->{'toggle'} = 1; } else { $issue->{'toggle'} = 0; }
# imageurl:
my $itemtype = $issue->{'itemtype'};
if ( $itemtype ) {
- $issue->{'imageurl'} = $imgdir."/".$itemtypes->{$itemtype}->{'imageurl'};
+ $issue->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
$issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
}
$issue->{date_due} = format_date($issue->{date_due});
{
my $item = $iteminfos_of->{$itemnumber};
$item->{itypename} = $itemtypes->{ $item->{itype} }{description};
- $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $item->{itype} }{imageurl};
+ $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
$item->{homebranchname} =
$branches->{ $item->{homebranch} }{branchname};
my @itemtypesloop;
my $selected=1;
my $cnt;
- my $imgdir = getitemtypeimagesrc('intranet');
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
my %row =(
code => $thisitemtype,
my @itemtypesloop;
my $selected=1;
my $cnt;
- my $imgdir = getitemtypeimagesrc('intranet');
foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
my %row =(
code => $thisitemtype,