- my $hash = eval $descript;
-
- my $feed = XML::FeedPP->new( "http://koha.ffzg.hr/cgi-bin/koha/opac-search.pl?idx=pl&format=rss2&q=$name" );
-
- my @links;
- foreach my $item ( $feed->get_item ) {
- push @links, sprintf qq|<li><a target="koha" href="%s">%s</a> %s|,
- $item->link, $item->title, $item->description
+ my $sth = $dbh->prepare(qq{
+select
+ author, title, max(bi.biblionumber) as biblionumber, count(title)
+from geo_city c
+join geo_biblioitems bi on bi.city = c.city_koha
+join biblio b on b.biblionumber = bi.biblionumber
+where c.city_koha = ? and country = ?
+group by author, title
+order by min(timestamp)
+limit $limit_books
+ });
+ $sth->execute( $city, $country );
+
+ my $rows = $sth->rows;
+ if ( $rows == $limit_books ) {
+ $rows = "more than $rows";
+ $rows = $count if $count > $rows;
+ };
+ my $books = 'books';
+ $books = 'book' if $rows == 1;
+
+ my $descript = "<b>$city</b> <em>$country</em> <small>$rows $books</small>\n<ol>";
+
+ while ( my $row = $sth->fetchrow_hashref ) {
+ $descript .= sprintf qq|<li><a target="koha" href="http://koha.ffzg.hr/cgi-bin/koha/opac-detail.pl?biblionumber=%d">%s</a> %s\n|,
+ $row->{biblionumber}, $row->{title}, $row->{author}