X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=html.pl;h=28da23f578ed0541f9e9a767d7dbf9184d3432f9;hb=0ef375d61858198a781fbbc9479662b040c6de4f;hp=661423d6e9fab457866f625053eef268ae4b4c49;hpb=0cdbd10b14a8e99c23973238c47238c81b11f7ec;p=koha-bibliografija diff --git a/html.pl b/html.pl index 661423d..28da23f 100755 --- a/html.pl +++ b/html.pl @@ -14,6 +14,7 @@ use Carp qw(confess); use utf8; use JSON; use POSIX qw(strftime); +use Storable; use lib '/srv/koha_ffzg'; use C4::Context; @@ -103,6 +104,7 @@ foreach my $department ( keys %$department_in_sum ) { } debug 'auth_department' => $auth_department; +store $auth_department, '/dev/shm/auth_department.storable'; debug 'auth_group' => $auth_group; debug 'department_in_sum' => $department_in_sum; @@ -130,6 +132,7 @@ where =cut my $biblio_year; +my $biblio_full_name; my $type_stats; my $parser = XML::LibXML->new(); @@ -200,6 +203,7 @@ while( my $row = $sth_select_authors->fetchrow_hashref ) { my $extract = { '008' => undef, '100' => '(9|a)', + '245' => 'a', '680' => 'i', '700' => '(9|4|a)', '942' => '(t|r|v)' @@ -279,10 +283,13 @@ while( my $row = $sth_select_authors->fetchrow_hashref ) { foreach my $authid ( @first_author ) { push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber}; } + $biblio_full_name->{ $row->{biblionumber} } = $data->{100}->[0]->{a}; } else { $have_100 = 0; } + $biblio_full_name->{ $row->{biblionumber} } ||= $data->{245}->[0]->{a}; + my $have_edt; if ( exists $data->{700} ) { @@ -331,9 +338,11 @@ while( my $row = $sth_select_authors->fetchrow_hashref ) { } debug 'authors' => $authors; +store $authors, '/dev/shm/authors.storable'; debug 'type_stats' => $type_stats; debug 'skip' => $skip; debug 'biblio_year' => $biblio_year; +debug 'biblio_full_name' => $biblio_full_name; debug 'biblio_data' => $biblio_data; debug 'biblio_author_external' => $biblio_author_external; @@ -385,6 +394,17 @@ sub li_biblio { qq|\n|; } +sub unique_biblionumber { + my @v = @_; + my $u; + $u->{$_}++ foreach @v; + return sort { + $biblio_year->{$b} <=> $biblio_year->{$a} || + $biblio_full_name->{$a} cmp $biblio_full_name->{$b} || + $a <=> $b + } keys %$u; +} + sub author_html { my ( $fh, $authid, $type, $label ) = @_; @@ -395,18 +415,17 @@ sub author_html { foreach my $category ( sort keys %{ $authors->{$authid}->{$type} } ) { my $label = $category_label->{$category} || 'Bez kategorije'; print $fh qq|

$label

\n\n|; } } + 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 +436,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