Fix for Bug 4290 - search for author in repository
authorOwen Leonard <oleonard@myacpl.org>
Tue, 1 Mar 2011 13:01:32 +0000 (14:01 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Sat, 5 Mar 2011 19:22:06 +0000 (08:22 +1300)
Reimplementation of Nahuel's patch from 2010-03-02

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Breeding.pm

index 2b73729..9003f9a 100644 (file)
@@ -169,7 +169,7 @@ C<import_biblios> tables of the Koha database.
 =cut
 
 sub BreedingSearch {
-    my ($title,$isbn,$z3950random) = @_;
+    my ($search,$isbn,$z3950random) = @_;
     my $dbh   = C4::Context->dbh;
     my $count = 0;
     my ($query,@bind);
@@ -185,12 +185,13 @@ sub BreedingSearch {
         $query .= "z3950random = ?";
         @bind=($z3950random);
     } else {
+        $search =~ s/(\s+)/\%/g;
         @bind=();
-        if ($title) {
-            $query .= "title like ?";
-            push(@bind,"$title%");
+    if ($search) {
+            $query .= "title like ? OR author like ?";
+            push(@bind,"%$search%", "%$search%");
         }
-        if ($title && $isbn) {
+        if ($search && $isbn) {
             $query .= " and ";
         }
         if ($isbn) {