From: Dobrica Pavlinusic Date: Fri, 16 Jan 2015 12:24:42 +0000 (+0100) Subject: extract year filter into own sub X-Git-Url: http://git.rot13.org/?p=koha-bibliografija;a=commitdiff_plain;h=df7f21629079e538e9b0ce02c30fd4013bf38c17 extract year filter into own sub --- diff --git a/html.pl b/html.pl index 661423d..ee49703 100755 --- a/html.pl +++ b/html.pl @@ -405,8 +405,8 @@ sub author_html { } sub count_author_years { + my $years = shift; my ($authid) = @_; - my $years; foreach my $type ( keys %{ $authors->{$authid} } ) { foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) { foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) { @@ -417,24 +417,18 @@ sub count_author_years { return $years; } -foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) { - - my $first = substr( $row->{full_name}, 0, 1 ); - if ( $first ne $first_letter ) { - print $index qq{\n} if $first_letter; - $first_letter = $first; - print $index qq{

$first

\n\n} if $first_letter; + $first_letter = $first; + print $index qq{

$first

\n