Trivial correction to comment.
[koha_gimpoz] / C4 / Koha.pm
index a32062a..10fccbe 100644 (file)
@@ -43,7 +43,6 @@ BEGIN {
                &getFacets
                &displayServers
                &getnbpages
-               &getitemtypeimagesrcfromurl
                &get_infos_of
                &get_notforloan_label_of
                &getitemtypeimagedir
@@ -244,7 +243,7 @@ build a HTML select with the following code :
 
 sub GetItemTypes {
 
-    # returns a reference to a hash of references to branches...
+    # returns a reference to a hash of references to itemtypes...
     my %itemtypes;
     my $dbh   = C4::Context->dbh;
     my $query = qq|
@@ -442,21 +441,11 @@ sub getitemtypeinfo {
     $sth->execute($itemtype);
     my $res = $sth->fetchrow_hashref;
 
-    $res->{imageurl} = getitemtypeimagesrcfromurl( $res->{imageurl} );
+    $res->{imageurl} = getitemtypeimagelocation( 'intranet', $res->{imageurl} );
 
     return $res;
 }
 
-sub getitemtypeimagesrcfromurl {
-    my ($imageurl) = @_;
-
-    if ( defined $imageurl and $imageurl !~ m/^http/ ) {
-        $imageurl = getitemtypeimagesrc() . '/' . $imageurl;
-    }
-
-    return $imageurl;
-}
-
 =head2 getitemtypeimagedir
 
 =over
@@ -474,23 +463,19 @@ returns the full path to the appropriate directory containing images.
 =cut
 
 sub getitemtypeimagedir {
-       my $src = shift;
-        $src = 'opac' unless defined $src;
-
+       my $src = shift || 'opac';
        if ($src eq 'intranet') {
                return C4::Context->config('intrahtdocs') . '/' .C4::Context->preference('template') . '/img/itemtypeimg';
-       }
-       else {
+       } else {
                return C4::Context->config('opachtdocs') . '/' . C4::Context->preference('template') . '/itemtypeimg';
        }
 }
 
 sub getitemtypeimagesrc {
-        my $src = shift;
+       my $src = shift || 'opac';
        if ($src eq 'intranet') {
                return '/intranet-tmpl' . '/' . C4::Context->preference('template') . '/img/itemtypeimg';
-       } 
-       else {
+       } else {
                return '/opac-tmpl' . '/' . C4::Context->preference('template') . '/itemtypeimg';
        }
 }
@@ -498,7 +483,7 @@ sub getitemtypeimagesrc {
 sub getitemtypeimagelocation($$) {
        my ( $src, $image ) = @_;
 
-       return if ( !$image );
+       return '' if ( !$image );
 
        my $scheme = ( uri_split( $image ) )[0];
 
@@ -1006,18 +991,16 @@ sub GetAuthValCode {
 
 =head2 GetAuthorisedValues
 
-$authvalues = GetAuthorisedValues($category);
+$authvalues = GetAuthorisedValues([$category], [$selected]);
 
-this function get all authorised values from 'authosied_value' table into a reference to array which
-each value containt an hashref.
+This function returns all authorised values from the'authosied_value' table in a reference to array of hashrefs.
 
-Set C<$category> on input args if you want to limits your query to this one. This params is not mandatory.
+C<$category> returns authorised values for just one category (optional).
 
 =cut
 
 sub GetAuthorisedValues {
     my ($category,$selected) = @_;
-       my $count = 0;
        my @results;
     my $dbh      = C4::Context->dbh;
     my $query    = "SELECT * FROM authorised_values";
@@ -1029,8 +1012,7 @@ sub GetAuthorisedValues {
                if ($selected eq $data->{'authorised_value'} ) {
                        $data->{'selected'} = 1;
                }
-               $results[$count] = $data;
-               $count++;
+        push @results, $data;
        }
     #my $data = $sth->fetchall_arrayref({});
     return \@results; #$data;