From 0ba9aab76bdcc16ff00d8888cbf6a8145a329a07 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 1 Mar 2011 14:01:32 +0100 Subject: [PATCH] Fix for Bug 4290 - search for author in repository Reimplementation of Nahuel's patch from 2010-03-02 Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack --- C4/Breeding.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 2b737290ef..9003f9acb3 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -169,7 +169,7 @@ C 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) { -- 2.39.5