-=head2 GetBookSeller
-
-@results = &GetBookSeller($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<@results> is an array of references-to-hash, whose keys are the fields of of the
-aqbooksellers table in the Koha database.
-
-=cut
-
-# FIXME: This function is badly named. It should be something like
-# SearchBookSellersByName. It is NOT a singular return value.
-
-sub GetBookSeller($) {
- my ($searchstring) = @_;
- my $dbh = C4::Context->dbh;
- my $query = "SELECT * FROM aqbooksellers WHERE name LIKE ?";
- my $sth =$dbh->prepare($query);
- $sth->execute( "%$searchstring%" );
- my @results;
- # count how many baskets this bookseller has.
- # if it has none, the bookseller can be deleted
- my $sth2 = $dbh->prepare("SELECT count(*) FROM aqbasket WHERE booksellerid=?");
- while ( my $data = $sth->fetchrow_hashref ) {
- $sth2->execute($data->{id});
- $data->{basketcount} = $sth2->fetchrow();
- push( @results, $data );
- }
- $sth->finish;
- return @results ;
-}
-
-
-sub GetBookSellerFromId($) {
- my $id = shift or return;
- my $dbh = C4::Context->dbh();
- my $query = "SELECT * FROM aqbooksellers WHERE id = ?";
- my $sth =$dbh->prepare($query);
- $sth->execute( $id );
- if (my $data = $sth->fetchrow_hashref()){
- my $sth2 = $dbh->prepare("SELECT count(*) FROM aqbasket WHERE booksellerid=?");
- $sth2->execute($id);
- $data->{basketcount}=$sth2->fetchrow();
- return $data;
- }
- return;
-}
-#-----------------------------------------------------------------#
-