3 # LC_COLLATE=hr_HR.utf8 KOHA_CONF=/etc/koha/sites/ffzg/koha-conf.xml ./html.pl
9 use Data::Dump qw(dump);
16 use POSIX qw(strftime);
19 use lib '/srv/koha_ffzg';
24 my $pid_file = '/dev/shm/bibliografija.pid';
27 open(my $fh, '<', $pid_file);
29 no autodie; # it will die on kill
30 kill 0, $pid || die "$0 allready running as pid $pid";
32 open(my $fh, '>', $pid_file);
38 my $dbh = C4::Context->dbh;
41 my ($title, $data) = @_;
42 print "# $title ",dump($data), $/ if $ENV{DEBUG};
45 my $xslfilename = 'compact.xsl';
47 my $azvo_group_title = {
48 'znanstveno nastavni' => qr/(profes|docent|znanstveni savjetnik|znanstveni suradnik)/i,
49 'lektori i predavači' => qr/(lektor|predavač)/i,
50 'asistenti i novaci' => qr/(asistent|novak)/i,
53 my $department_groups = {
54 'AAB_humanističke' => qr/(anglistiku|arheologiju|antropologiju|filozofiju|fonetiku|germanistiku|hungarologiju|indologiju|slavenske|filologiju|komparativnu|kroatistiku|lingvistiku|povijest|romanistiku|talijanistiku)/i,
55 'AAC_društvene' => qr/(informacijske|pedagogiju|psihologiju|sociologiju)/i,
62 my $department_in_sum;
63 my $department_in_group;
67 my $sth_auth = $dbh->prepare(q{
70 ExtractValue(marcxml,'//datafield[@tag="100"]/subfield[@code="a"]') as full_name,
71 ExtractValue(marcxml,'//datafield[@tag="680"]/subfield[@code="a"]') as department,
72 ExtractValue(marcxml,'//datafield[@tag="680"]/subfield[@code="i"]') as academic_title
77 while( my $row = $sth_auth->fetchrow_hashref ) {
78 if ( $row->{department} !~ m/Filozofski fakultet u Zagrebu/ ) {
79 push @{ $skip->{nije_ffzg} }, $row;
82 $auth_header->{ $row->{authid} } = $row->{full_name};
83 $row->{department} =~ s/, Filozofski fakultet u Zagrebu.*$//;
84 $row->{department} =~ s/^.+\.\s*//;
85 $row->{department} =~ s/\s+$//s;
87 foreach my $title ( keys %$azvo_group_title ) {
88 if ( $row->{academic_title} =~ $azvo_group_title->{$title} ) {
94 $row->{academic_group} = $group;
95 $auth_group->{ $row->{authid} } = $group;
96 $skip->{group_stat}->{$group}++;
98 push @{ $skip->{no_academic_group} }, $row;
101 # warn "# ", dump( $row );
102 push @{ $auth_department->{ $row->{department} } }, $row->{authid};
104 $department_in_sum->{ $row->{department} }++;
105 foreach my $name ( keys %$department_groups ) {
106 my $regex = $department_groups->{$name};
107 if ( $row->{department} =~ $regex ) {
108 $department_in_group->{ $row->{department} } = $name;
114 debug 'department_in_group' => $department_in_group;
116 foreach my $department ( keys %$department_in_sum ) {
117 $department_in_sum->{$department} = 0 unless $department =~ m/(centar|croaticum|katedra|odsjek)/i;
120 debug 'auth_department' => $auth_department;
121 store $auth_department, '/dev/shm/auth_department.storable';
122 debug 'auth_group' => $auth_group;
123 debug 'department_in_sum' => $department_in_sum;
129 my $sth_select_authors = $dbh->prepare(q{
140 -- ExtractValue(marcxml,'//datafield[@tag="100"]/subfield[@code="9"]') as first_author,
141 -- ExtractValue(marcxml,'//datafield[@tag="700"]/subfield[@code="9"]') as other_authors,
142 -- ExtractValue(marcxml,'//datafield[@tag="942"]/subfield[@code="t"]') as category,
144 -- and SUBSTR(ExtractValue(marcxml,'//controlfield[@tag="008"]'),8,4) between 2008 and 2013
145 -- order by SUBSTR(ExtractValue(marcxml,'//controlfield[@tag="008"]'),8,4) desc
149 my $biblio_full_name;
152 my $parser = XML::LibXML->new();
153 $parser->recover_silently(0); # don't die when you find &, >, etc
154 my $style_doc = $parser->parse_file($xslfilename);
155 my $xslt = XML::LibXSLT->new();
156 my $parsed = $xslt->parse_stylesheet($style_doc);
161 my $biblio_author_external;
163 open(my $xml_fh, '>', '/tmp/bibliografija.xml') if $ENV{XML};
165 sub biblioitem_html {
166 my ($biblionumber, $parse_only) = @_;
168 return $biblio_html->{$biblionumber} if exists $biblio_html->{$biblionumber} && ! $parse_only;
170 my $xmlrecord = $marcxml->{$biblionumber} || confess "missing $biblionumber marcxml";
172 print $xml_fh $xmlrecord if $ENV{XML};
174 my $source = eval { $parser->parse_string($xmlrecord) };
176 # warn "SKIP $biblionumber corrupt XML";
177 push @{ $skip->{XML_corrupt} }, $biblionumber;
182 $biblio_parsed->{$biblionumber} = $source;
186 my $transformed = $parsed->transform($source);
187 $biblio_html->{$biblionumber} = $parsed->output_string( $transformed );
189 delete $biblio_parsed->{$biblionumber};
191 return $biblio_html->{$biblionumber};
194 $sth_select_authors->execute();
195 while( my $row = $sth_select_authors->fetchrow_hashref ) {
196 # warn dump($row),$/;
200 $marcxml->{ $row->{biblionumber} } = $row->{marcxml};
202 my $doc = biblioitem_html( $row->{biblionumber}, 1 );
204 # warn "ERROR can't parse MARCXML ", $row->{biblionumber}, " ", $row->{marcxml}, "\n";
208 my $root = $doc->documentElement;
210 my @leaders = $root->getElementsByLocalName('leader');
212 my $leader = $leaders[0]->textContent;
213 warn "leader $leader\n";
228 foreach my $elt ($root->getChildrenByLocalName('*')) {
229 my $tag = $elt->getAttribute('tag');
231 next unless exists $extract->{ $tag };
233 if ($elt->localname eq 'controlfield') {
234 if ( $tag eq '008' ) {
235 my $content = $elt->textContent;
236 my $year = substr($content, 7, 4 );
237 if ( $year !~ m/^\d+$/ ) {
239 push @{ $skip->{invalid_year} }, $row->{biblionumber};
241 $biblio_year->{ $row->{biblionumber} } = $data->{year} = $year;
242 $data->{'008'} = $content;
245 } elsif ($elt->localname eq 'datafield') {
247 foreach my $sfelt ($elt->getChildrenByLocalName('subfield')) {
248 my $sf = $sfelt->getAttribute('code');
249 next unless $sf =~ m/$extract->{$tag}/;
250 if ( exists $sf_data->{$sf} ) {
251 $sf_data->{$sf} .= " " . $sfelt->textContent();
253 $sf_data->{$sf} = $sfelt->textContent();
256 push @{ $data->{$tag} }, $sf_data if $sf_data;
260 if ( ! defined $data->{year} ) {
261 warn "MISSING year in ", $row->{biblionumber};
262 =for remove-year-limit
263 } elsif ( $data->{year} < 2008 ) {
264 push @{ $skip->{year_lt_2008} }, $row->{biblionumber};
266 } elsif ( $data->{year} > 2013 ) {
267 push @{ $skip->{year_gt_2013} }, $row->{biblionumber};
272 # warn "# ", $row->{biblionumber}, " data ",dump($data);
274 my $category = $data->{942}->[0]->{'t'};
276 # warn "# SKIP ", $row->{biblionumber}, " no category in ", dump($data);
277 push @{ $skip->{no_category} }, $row->{biblionumber};
283 if ( exists $data->{100} ) {
287 if ( ! exists $_->{9} ) {
288 $biblio_author_external->{ $row->{biblionumber} }++;
290 } elsif ( exists $auth_header->{ $_->{9} } ) {
297 foreach my $authid ( @first_author ) {
298 push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
300 $biblio_full_name->{ $row->{biblionumber} } = $data->{100}->[0]->{a};
305 $biblio_full_name->{ $row->{biblionumber} } ||= $data->{245}->[0]->{a};
309 if ( exists $data->{700} ) {
312 if ( ! exists $_->{9} ) {
313 $biblio_author_external->{ $row->{biblionumber} }++;
315 } elsif ( exists $auth_header->{ $_->{9} } ) {
322 foreach my $auth ( @other_authors ) {
323 my $authid = $auth->{9} || next;
324 my $type = $auth->{4} || next; #die "no 4 in ",dump($data);
326 $type_stats->{$type}++;
328 my @types = split(/[\s\/]+/, $type);
330 foreach my $type ( @types ) {
331 my $type = substr($type,0,3);
332 $type_stats->{_count_each_type}->{$type}++;
334 if ( $type =~ m/(edt|trl|com|ctb)/ ) {
335 push @{ $authors->{$authid}->{__sec}->{ $category } }, $row->{biblionumber};
336 push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber};
337 $type =~ s/(com|ctb)/_ostalo/;
338 push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber};
340 } elsif ( $type =~ m/aut/ ) {
342 $have_edt = grep { exists $_->{4} && $_->{4} =~ m/edt/ } @{ $data->{700} } if ! defined $have_edt;
344 $skip->{ have_700_edt }->{ $row->{biblionumber} }++;
346 push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
349 push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
352 # warn "# SKIP ", $row->{biblionumber}, ' no 700$4 in ', dump($data);
353 $skip->{ 'no_700$4' }->{ $row->{biblionumber} }++;
360 $biblio_data->{ $row->{biblionumber} } = $data;
364 debug 'authors' => $authors;
365 store $authors, '/dev/shm/authors.storable';
366 debug 'type_stats' => $type_stats;
367 debug 'skip' => $skip;
368 debug 'biblio_year' => $biblio_year;
369 debug 'biblio_full_name' => $biblio_full_name;
370 debug 'biblio_data' => $biblio_data;
371 debug 'biblio_author_external' => $biblio_author_external;
374 my $sth_categories = $dbh->prepare(q{
375 select authorised_value, lib from authorised_values where category = 'BIBCAT'
377 $sth_categories->execute();
378 while( my $row = $sth_categories->fetchrow_hashref ) {
379 $category_label->{ $row->{authorised_value} } = $row->{lib};
382 debug 'category_label' => $category_label;
387 <meta charset="UTF-8">
388 <title>|, join(" ", @_), qq|</title>
389 <link href="style.css" type="text/css" rel="stylesheet" />
390 <script src="//code.jquery.com/jquery-1.11.2.js"></script>
391 <script src="filters.js"></script>
399 qq|<small style="color:gray">Zadnji puta osvježeno: |,
400 strftime("%Y-%m-%d %H:%M:%S\n", localtime()),
401 qq|</body>\n</html>\n|;
404 mkdir 'html' unless -d 'html';
406 open(my $index, '>:encoding(utf-8)', 'html/index.new');
407 print $index html_title('Bibliografija Filozofskog fakulteta');
409 my $first_letter = '';
411 debug 'authors' => \@authors;
414 my ($biblionumber) = @_;
415 return qq|<li class="y|, $biblio_year->{$biblionumber}, qq|">|,
416 qq|<a href="https://koha.ffzg.hr/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber">$biblionumber</a>|,
417 biblioitem_html($biblionumber),
418 qq|<a href="https://koha.ffzg.hr:8443/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber">edit</a>|,
424 $unique->{$_}++ foreach @_;
425 return keys %$unique;
428 sub unique_biblionumber {
431 $biblio_year->{$b} <=> $biblio_year->{$a} ||
432 $biblio_full_name->{$a} cmp $biblio_full_name->{$b} ||
438 my ( $fh, $authid, $type, $label ) = @_;
440 return unless exists $authors->{$authid}->{$type};
442 print $fh qq|<a name="$type"><h2>$label</h2></a>\n|;
444 foreach my $category ( sort keys %{ $authors->{$authid}->{$type} } ) {
445 my $label = $category_label->{$category} || 'Bez kategorije';
446 print $fh qq|<a name="$type-$category"><h3>$label</h3></a>\n<ol>\n|;
447 foreach my $biblionumber ( unique_biblionumber @{ $authors->{$authid}->{$type}->{$category} } ) {
448 print $fh li_biblio( $biblionumber );
450 print $fh qq|</ol>\n|;
454 my @toc_type_label = (
455 'aut' => 'Primarno autorstvo',
456 'edt' => 'Uredništva',
457 'trl' => 'Prijevodi',
458 '_ostalo' => 'Ostalo',
462 sub count_author_years {
465 foreach my $type ( keys %{ $authors->{$authid} } ) {
466 next if $type =~ m/^_/;
467 foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) {
468 foreach my $biblionumber ( unique_biblionumber @{ $authors->{$authid}->{$type}->{$category} } ) {
469 $years->{ $biblio_year->{ $biblionumber } }->{ $type . '-' . $category }++;
476 sub html_year_selection {
478 my @authids = unique @_;
480 debug 'html_year_selection authids=', [ @authids ];
482 print $fh qq|<span id="years">Godine:\n|;
483 my $type_cat_count = {};
486 foreach my $authid ( @authids ) {
487 $years = count_author_years( $years, $authid );
490 debug 'years' => $years;
492 foreach my $year ( sort { $b <=> $a } keys %$years ) {
493 print $fh qq|<label><input name="year_selection" value="$year" type=checkbox onClick="toggle_year($year, this)" checked="checked">$year</label> \n|;
494 foreach my $type_cat ( keys %{ $years->{$year} } ) {
495 $type_cat_count->{ $type_cat } += $years->{$year}->{$type_cat};
496 my ($type,$cat) = split(/-/, $type_cat);
497 $type_cat_count->{_toc}->{$type}->{$cat}++;
498 $type_cat_count->{_toc_count}->{$type} += $years->{$year}->{$type_cat};
503 <input type=button value="all" onClick="all_years(1)">
504 <input type=button value="none" onClick="all_years(0)">
507 print $fh qq|</span>|;
512 var years = |, encode_json($years), q|;
514 var type_cat_count = |, encode_json($type_cat_count), q|;
520 debug 'type_cat_count' => $type_cat_count;
523 print $fh qq|<ul id="toc">\n|;
525 while ( $i < $#toc_type_label ) {
526 my $type = $toc_type_label[$i++] || die "type";
527 my $label = $toc_type_label[$i++] || die "label";
528 next unless exists $type_cat_count->{_toc}->{$type};
529 print $fh qq| <li class="toc" id="toc-$type"><a href="#$type">$label</a> <tt id="toc-count-$type">$type_cat_count->{_toc_count}->{$type}</tt></li>\n <ul>\n|;
530 foreach my $category ( sort keys %{ $type_cat_count->{_toc}->{$type} } ) {
531 my $label = $category_label->{$category} || 'Bez kategorije';
532 my $count = $type_cat_count->{ $type . '-' . $category };
533 my $cat_html = $category;
534 $cat_html =~ s/\./-/g;
535 print $fh qq| <li class="toc" id="toc-$category"><a href="#$type-$category">$label</a> <tt id="toc-count-$type-$cat_html">$count</tt></li>\n|;
537 print $fh qq| </ul>\n|;
539 print $fh qq|</ul>\n|;
544 foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) {
546 my $first = substr( $row->{full_name}, 0, 1 );
547 if ( $first ne $first_letter ) {
548 print $index qq{</ul>\n} if $first_letter;
549 $first_letter = $first;
550 print $index qq{<h1>$first</h1>\n<ul>\n};
552 print $index qq{<li><a href="}, $row->{authid}, qq{.html">}, $row->{full_name}, "</a></li>\n";
554 my $path = "html/$row->{authid}";
555 open(my $fh, '>:encoding(utf-8)', "$path.new");
556 print $fh html_title($row->{full_name}, "bibliografija");
557 print $fh qq|<h1>$row->{full_name} - bibliografija</h1>\n|;
559 html_year_selection $fh => $row->{authid};
562 while ( $i < $#toc_type_label ) {
563 my $type = $toc_type_label[$i++] || die "type";
564 my $label = $toc_type_label[$i++] || die "label";
565 author_html( $fh, $row->{authid}, $type => $label );
570 rename "$path.new", "$path.html";
574 print $index html_end;
576 rename 'html/index.new', 'html/index.html';
578 debug 'auth_header' => $auth_header;
581 my $department_category_author;
582 foreach my $department ( sort keys %$auth_department ) {
583 foreach my $authid ( sort @{ $auth_department->{$department} } ) {
584 my @categories = keys %{ $authors->{$authid}->{aut} };
585 push @categories, keys %{ $authors->{$authid}->{__sec} };
586 foreach my $category ( sort @categories ) {
587 push @{ $department_category_author->{$department}->{$category} }, $authid;
588 push @{ $department_category_author->{'AAA_ukupno'}->{$category} }, $authid if $department_in_sum->{$department};
589 if ( my $group = $department_in_group->{ $department } ) {
590 push @{ $department_category_author->{$group}->{$category} }, $authid;
592 $skip->{'department_not_in_group'}->{ $department }++;
598 debug 'department_category_author' => $department_category_author;
601 sub department_html {
602 my ( $fh, $department, $type, $label ) = @_;
604 print $fh qq|<a name="$type"><h2>$label</h2></a>\n|;
606 foreach my $category ( sort keys %{ $department_category_author->{$department} } ) {
608 my @authids = @{ $department_category_author->{$department}->{$category} };
609 next unless @authids;
611 my @biblionumber = unique_biblionumber map { @{ $authors->{$_}->{$type}->{$category} } } grep { exists $authors->{$_}->{$type}->{$category} } @authids;
613 next unless @biblionumber;
615 my $label = $category_label->{$category} || 'Bez kategorije';
616 print $fh qq|<a name="$type-$category"><h3>$label</h3></a>\n<ol>\n|;
618 print $fh li_biblio( $_ ) foreach @biblionumber;
626 mkdir 'html/departments' unless -d 'html/departments';
628 open(my $dep_fh, '>:encoding(utf-8)', 'html/departments/index.new');
629 print $dep_fh html_title('Odsjeci Filozofskog fakulteta u Zagrebu'), qq|<ul>\n|;
630 foreach my $department ( sort keys %$department_category_author ) {
631 my $dep = $department || 'Nema odsjeka';
632 my $dep_file = unac_string('utf-8',$dep);
633 print $dep_fh qq|<li><a href="$dep_file.html">$dep</a></li>\n|;
634 open(my $fh, '>:encoding(utf-8)', "html/departments/$dep_file.new");
636 print $fh html_title($department . ' bibliografija');
637 print $fh qq|<h1>$department bibliografija</h1>\n|;
640 foreach my $category ( sort keys %{ $department_category_author->{$department} } ) {
641 push @authids, @{ $department_category_author->{$department}->{$category} };
643 html_year_selection $fh => @authids;
646 while ( $i < $#toc_type_label ) {
647 my $type = $toc_type_label[$i++] || die "type";
648 my $label = $toc_type_label[$i++] || die "label";
649 department_html( $fh, $department, $type, $label );
654 rename "html/departments/$dep_file.new", "html/departments/$dep_file.html";
656 print $dep_fh qq|</ul>\n|, html_end;
658 rename 'html/departments/index.new', 'html/departments/index.html';
660 my $azvo_stat_biblio;
662 foreach my $department ( sort keys %$department_category_author ) {
663 foreach my $category ( sort keys %{ $department_category_author->{$department} } ) {
664 foreach my $authid ( @{ $department_category_author->{$department}->{$category} } ) {
665 my $group = $auth_group->{$authid};
667 push @{ $skip->{no_auth_group} }, $authid;
670 foreach my $type ( keys %{ $authors->{$authid} } ) {
671 next unless exists $authors->{$authid}->{$type}->{$category};
672 push @{ $azvo_stat_biblio->{ $department }->{ $category }->{ $type }->{$group} }, @{ $authors->{$authid}->{$type}->{$category} };
673 push @{ $azvo_stat_biblio->{ $department }->{ $category }->{ $type }->{''} }, @{ $authors->{$authid}->{$type}->{$category} };
676 foreach my $type ( keys %{ $azvo_stat_biblio->{ $department }->{ $category } } ) {
677 foreach my $group ( keys %{ $azvo_stat_biblio->{ $department }->{ $category }->{ $type } } ) {
678 my @biblios = unique_biblionumber @{ $azvo_stat_biblio->{ $department }->{ $category }->{ $type }->{ $group } };
679 $azvo_stat_biblio->{ $department }->{ $category }->{ $type }->{ $group } = [ @biblios ];
685 debug 'azvo_stat_biblio' => $azvo_stat_biblio;
692 open(my $report, '<:encoding(utf-8)', 'AZVO.txt');
695 if ( /^([^\t]+)\t+(.+)/ ) {
697 push @report_labels, $label;
698 my $type = [ map { m/\s+/ ? [ split(/\s+/,$_) ] : [ $_, 'aut' ] } split (/\s*\+\s*/, $2) ];
699 push @report_lines, [ $label, @$type ];
700 } elsif ( /^\t+([^\t]+):\t+(\d+)(\w*)\t*(.*)$/ ) {
701 push @{ $sub_labels->{$label} }, [ $1, $2, $3, $4 ];
703 pop (@report_labels) if ( $report_labels[ $#report_labels ] =~ m/^$label$/ ); # remove partial name
704 push @report_labels, $label . $sub_label;
710 debug 'report_lines', \@report_lines;
711 debug 'sub_labels', $sub_labels;
712 debug 'report_labels', \@report_labels;
714 my @departments = ( sort { lc($a) cmp lc($b) } keys %$azvo_stat_biblio );
716 debug 'departments' => \@departments;
719 $department2col->{ $departments[$_] } = $_ foreach ( 0 .. $#departments );
721 $label2row->{ $report_labels[$_] } = $_ foreach ( 0 .. $#report_labels );
726 my $label = shift @_;
727 my $department = shift @_;
728 my $group = shift @_;
729 my @biblionumbers = unique @_;
730 $table->{ffzg}->{$group}->[ $label2row->{ $label } ]->[ $department2col->{$department} ] = scalar @biblionumbers;
731 $table->{external}->{$group}->[ $label2row->{ $label } ]->[ $department2col->{$department} ] = scalar grep { $biblio_author_external->{$_} } @biblionumbers;
734 foreach my $group ( '', keys %$azvo_group_title ) {
736 foreach my $department ( @departments ) {
737 foreach my $line ( @report_lines ) {
738 my $label = $line->[0];
740 foreach ( 1 .. $#$line ) {
741 my ( $category, $type ) = @{ $line->[ $_ ] };
742 my $b = $azvo_stat_biblio->{ $department }->{$category}->{$type}->{$group};
743 push @biblionumbers, @$b if $b;
745 if ( $sub_labels->{$label} ) {
747 foreach my $biblionumber ( @biblionumbers ) {
748 my $data = $biblio_data->{$biblionumber} || die "can't find biblionumber $biblionumber";
749 foreach my $sub_label ( @{ $sub_labels->{$label} } ) {
750 my ( $sub_label, $field, $sf, $regex ) = @$sub_label;
752 push @{ $sub_stats->{ $sub_label } }, $biblionumber;
755 if ( $field < 100 ) {
756 if ( $data->{$field} =~ m/$regex/ ) {
757 push @{ $sub_stats->{ $sub_label } }, $biblionumber;
761 if ( exists $data->{$field}->[0]->{$sf} && $data->{$field}->[0]->{$sf} =~ m/$regex/ ) {
762 push @{ $sub_stats->{ $sub_label } }, $biblionumber;
768 foreach my $sub_label ( keys %$sub_stats ) {
769 my $full_label = $label . $sub_label;
770 table_count $full_label, $department, $group, @{ $sub_stats->{$sub_label} };
773 table_count $label, $department, $group, @biblionumbers;
780 debug 'table', $table;
782 open(my $fh, '>:encoding(utf-8)', 'html/azvo.new');
783 open(my $fh2, '>:encoding(utf-8)', 'html/azvo2.new');
790 print $fh html_title('AZVO tablica - FFZG');
791 print $fh2 html_title('AZVO tablica - kolaboracija sa FFZG');
793 foreach my $group ( keys %{ $table->{ffzg} } ) {
795 print_fh "<h1>$group</h1>" if $group;
797 print_fh "<table border=1>\n";
798 print_fh "<tr><th></th>";
799 print_fh "<th>$_</th>" foreach @departments;
802 foreach my $row ( 0 .. $#{ $table->{ffzg}->{$group} } ) {
803 print_fh "<tr><th>", $report_labels[$row], "</th>\n";
804 foreach ( 0 .. $#departments ) {
806 print $fh $table->{ffzg}->{$group}->[ $row ]->[ $_ ] || '';
807 print $fh2 $table->{external}->{$group}->[ $row ]->[ $_ ] || '';
813 print_fh "</table>\n";
820 rename 'html/azvo.new', 'html/azvo.html';
821 rename 'html/azvo2.new', 'html/azvo2.html';