From 0e6d8b1d1ad7930eaeff28db224af29bdc585dc3 Mon Sep 17 00:00:00 2001 From: bob_lyon Date: Wed, 13 Dec 2006 20:02:34 +0000 Subject: [PATCH] Adding in missing subroutine bookseller --- C4/Acquisition.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4879446e9d..339828acee 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -63,6 +63,7 @@ orders, basket and parcels. &GetHistory &ModOrder &ModReceiveOrder &GetSingleOrder + &bookseller ); @@ -959,6 +960,39 @@ sub GetHistory { return \@order_loop, $total_qty, $total_price, $total_qtyreceived; } +#------------------------------------------------------------# + +=head3 bookseller + +=over 4 + +($count, @results) = &bookseller($searchstring); + +Looks up a book seller. C<$searchstring> may be either a book seller +ID, or a string to look for in the book seller's name. + +C<$count> is the number of elements in C<@results>. C<@results> is an +array of references-to-hash, whose keys are the fields of of the +aqbooksellers table in the Koha database. + +=back + +=cut + +sub bookseller { + my ($searchstring) = @_; + my $dbh = C4::Context->dbh; + my $sth = + $dbh->prepare("Select * from aqbooksellers where name like ? or id = ?"); + $sth->execute( "$searchstring%", $searchstring ); + my @results; + while ( my $data = $sth->fetchrow_hashref ) { + push( @results, $data ); + } + $sth->finish; + return ( scalar(@results), @results ); +} + END { } # module clean-up code here (global destructor) 1; -- 2.39.5