fix for bug 1771: Template errors with remote itemtype image
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 4 Nov 2008 17:44:35 +0000 (18:44 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 4 Nov 2008 17:44:35 +0000 (18:44 +0100)
This adds a new function, getitemtypeimagelocation, that returns the image
unmodified for absolute urls and returns the proper intranet or opac path
otherwise. It also updates all of the relevant files to use that function.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Conflicts:

C4/Koha.pm
catalogue/search.pl
opac/opac-search.pl

C4/Koha.pm
members/moremember.pl
opac/opac-search.pl

index b5e87f6..699c0cd 100644 (file)
@@ -483,7 +483,7 @@ sub getitemtypeimagesrc {
 sub getitemtypeimagelocation($$) {
        my ( $src, $image ) = @_;
 
-       return '' if ( !$image );
+       return if ( !$image );
 
        my $scheme = ( uri_split( $image ) )[0];
 
index 478969b..ea49ea4 100755 (executable)
@@ -240,7 +240,7 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
 
     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 );
 
index ddccb84..21dc131 100755 (executable)
@@ -138,7 +138,7 @@ 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++,
-                               ccl => $itype_or_itemtype,
+               ccl => $itype_or_itemtype,
                 code => $thisitemtype,
                 selected => $selected,
                 description => $itemtypes->{$thisitemtype}->{'description'},
@@ -153,8 +153,8 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
     my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
        for my $thisitemtype (@$advsearchtypes) {
                my %row =(
-                               number=>$cnt++,
-                               ccl => $advanced_search_types,
+               number=>$cnt++,
+               ccl => $advanced_search_types,
                 code => $thisitemtype->{authorised_value},
                 selected => $selected,
                 description => $thisitemtype->{'lib'},