diff --git a/bookcount.pl b/bookcount.pl
index cc563a0885..74fd1ad493 100755
--- a/bookcount.pl
+++ b/bookcount.pl
@@ -29,6 +29,7 @@ use C4::Context;
use C4::Search;
use C4::Circulation::Circ2;
use C4::Output;
+use HTML::Template;
# get all the data ....
my %env;
@@ -59,56 +60,31 @@ if (not $lastmove) {
$count = issuessince($itm ,$lastdate);
}
-
# make the page ...
-print $input->header;
+my $template = gettemplate("bookcount.tmpl");
-
-print startpage;
-print startmenu('report');
-print center;
-
-print <<"EOF";
-
-$data->{'title'} ($data->{'author'})
-
-
-
- |
- BARCODE $idata->{'barcode'} |
-
-
-
-
-Home Branch: $homebranch
-Current Branch: $holdingbranch
-Date arrived at current branch: $lastdate
-Number of issues since since the above date : $count
-
-
-| Branch | No. of Issues | Last seen at branch |
-EOF
+my @branchloop;
foreach my $branchcode (keys %$branches) {
- my $issues = issuesat($itm, $branchcode);
+ my %linebranch;
+ $linebranch{issues} = issuesat($itm, $branchcode);
my $date = lastseenat($itm, $branchcode);
- my $seen = slashdate($date);
- print << "EOF";
-| $branches->{$branchcode}->{'branchname'} |
- $issues | $seen |
-EOF
+ $linebranch{seen} = slashdate($date);
+ $linebranch{branchname}=$branches->{$branchcode}->{'branchname'};
+ push(@branchloop,\%linebranch);
}
-print <<"EOF";
-
- |
-
-EOF
-
-
-print endmenu('report');
-print endpage;
+$template->param( bib => $bib,
+ title => $data->{'title'},
+ author => $data->{'author'},
+ barcode => $idata->{'barcode'},
+ homebranch =>$homebranch,
+ holdingbranch => $holdingbranch,
+ lastdate => $lastdate,
+ count => $count,
+ branchloop => \@branchloop);
+print "Content-Type: text/html\n\n", $template->output;
##############################################
# This stuff should probably go into C4::Search