koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Search.pm [rel_3_0]


From: paul poulain
Subject: [Koha-cvs] koha/C4 Search.pm [rel_3_0]
Date: Mon, 30 Oct 2006 09:52:02 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     paul poulain <tipaul>   06/10/30 09:52:02

Modified files:
        C4             : Search.pm 

Log message:
        - removing warn
        - reintroducing itemtype image

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Search.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.120.2.16&r2=1.120.2.17

Patches:
Index: Search.pm
===================================================================
RCS file: /sources/koha/koha/C4/Search.pm,v
retrieving revision 1.120.2.16
retrieving revision 1.120.2.17
diff -u -b -r1.120.2.16 -r1.120.2.17
--- Search.pm   24 Oct 2006 12:29:01 -0000      1.120.2.16
+++ Search.pm   30 Oct 2006 09:52:01 -0000      1.120.2.17
@@ -39,7 +39,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.120.2.16 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.120.2.17 $' =~ /\d+/g;
           shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 =head1 NAME
@@ -1476,8 +1476,6 @@
        chop $data->{'additionalauthors'};
        chop $data->{'additionalauthors'};
        $sth->finish;
-       use Data::Dumper;
-       warn "DATA==>".Dumper($data);
        return($data);
 } # sub bibdata
 
@@ -3156,6 +3154,16 @@
         $branches{$bdata->{'branchcode'}}= $bdata->{'branchname'};
     }
 
+    #Build itemtype hash
+    #find itemtype & itemtype image
+    my %itemtypes;
+    my $bsth=$dbh->prepare("SELECT itemtype,description,imageurl FROM 
itemtypes");
+    $bsth->execute();
+    while (my $bdata=$bsth->fetchrow_hashref){
+        $itemtypes{$bdata->{'itemtype'}}->{description}= 
$bdata->{'description'};
+        $itemtypes{$bdata->{'itemtype'}}->{imageurl} = $bdata->{'imageurl'};
+    }
+
     #search item field code
     my $sth = $dbh->prepare(
         "select tagfield from marc_subfield_structure where kohafield like 
'items.itemnumber'"
@@ -3184,7 +3192,14 @@
         $marcrecord = MARC::File::USMARC::decode($marcresults[$i]);
        
         my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
-        
+        # add image url if there is one
+        if ($itemtypes{$oldbiblio->{itemtype}}->{imageurl} =~ /^http:/) {
+            $oldbiblio->{imageurl} = 
$itemtypes{$oldbiblio->{itemtype}}->{imageurl};
+            $oldbiblio->{description} = 
$itemtypes{$oldbiblio->{itemtype}}->{description};
+        } else {
+            $oldbiblio->{imageurl} = 
getitemtypeimagesrc()."/".$itemtypes{$oldbiblio->{itemtype}}->{imageurl} if 
($itemtypes{$oldbiblio->{itemtype}}->{imageurl});
+            $oldbiblio->{description} = 
$itemtypes{$oldbiblio->{itemtype}}->{description};
+        }
                # add spans to search term in results
                foreach my $term (keys %$span_terms_hashref) {
                        #warn "term: $term";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]