|
Lines 39-44
use Koha::Libraries;
Link Here
|
| 39 |
use Koha::Patron::Categories; |
39 |
use Koha::Patron::Categories; |
| 40 |
use Koha::SharedContent; |
40 |
use Koha::SharedContent; |
| 41 |
use Koha::Util::OpenDocument; |
41 |
use Koha::Util::OpenDocument; |
|
|
42 |
use HTML::Table; |
| 43 |
use utf8; |
| 42 |
|
44 |
|
| 43 |
=head1 NAME |
45 |
=head1 NAME |
| 44 |
|
46 |
|
|
Lines 952-957
elsif ($phase eq 'Export'){
Link Here
|
| 952 |
$content .= $_ while <$ods_fh>; |
954 |
$content .= $_ while <$ods_fh>; |
| 953 |
unlink $ods_filepath; |
955 |
unlink $ods_filepath; |
| 954 |
} |
956 |
} |
|
|
957 |
elsif ( $format eq 'html' ) { |
| 958 |
$type = 'text/html'; |
| 959 |
$content = _to_html($sth, $input); |
| 960 |
} |
| 955 |
} |
961 |
} |
| 956 |
print $input->header( |
962 |
print $input->header( |
| 957 |
-type => $type, |
963 |
-type => $type, |
|
Lines 1123-1125
sub get_prepped_report {
Link Here
|
| 1123 |
} |
1129 |
} |
| 1124 |
return $sql,$headers; |
1130 |
return $sql,$headers; |
| 1125 |
} |
1131 |
} |
| 1126 |
- |
1132 |
|
|
|
1133 |
sub _to_html { |
| 1134 |
my ($sth, $input) = @_; |
| 1135 |
my $header_type = "application/x-download"; |
| 1136 |
my $rep_name = Encode::encode_utf8($input->param('reportname')); |
| 1137 |
my $file = $rep_name . ".html"; |
| 1138 |
my $html_start = |
| 1139 |
"<!DOCTYPE html> |
| 1140 |
<html> |
| 1141 |
<head> |
| 1142 |
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> |
| 1143 |
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> |
| 1144 |
<title>$rep_name - Koha</title>"; |
| 1145 |
my $html_end = |
| 1146 |
"\n</body> |
| 1147 |
\n</html>"; |
| 1148 |
my $h1 = "\n<h1>" . $rep_name . "</h1>"; |
| 1149 |
my @head = header_cell_values($sth); |
| 1150 |
my $con = join(" ", @head); |
| 1151 |
my $cols = scalar @head; |
| 1152 |
|
| 1153 |
my $css = C4::Context->preference('ReportUserCSS'); |
| 1154 |
if ($css eq ''){ |
| 1155 |
$css = |
| 1156 |
"\ntable, th, td { |
| 1157 |
border: 1px solid black; |
| 1158 |
} |
| 1159 |
table { |
| 1160 |
border-collapse: collapse; |
| 1161 |
}"; |
| 1162 |
} |
| 1163 |
my $content = $html_start; |
| 1164 |
$content .= |
| 1165 |
"\n<style>" . |
| 1166 |
$css . |
| 1167 |
"\n</style>" . |
| 1168 |
"\n</head> |
| 1169 |
\n<body>"; |
| 1170 |
my $table = HTML::Table->new( |
| 1171 |
-cols => $cols, |
| 1172 |
); |
| 1173 |
$table->addSectionRow('thead', 0, @head); |
| 1174 |
$table->setSectionRCellsHead('thead', 0, 1); |
| 1175 |
my ($tmp_str, @tmp_arr); |
| 1176 |
while (my $row = $sth->fetchrow_arrayref()) { |
| 1177 |
$tmp_str = join ('*replace*', @$row); |
| 1178 |
$tmp_str = Encode::encode_utf8($tmp_str); |
| 1179 |
@tmp_arr = split (/\*replace\*/, $tmp_str); |
| 1180 |
$table->addSectionRow( 'tbody', 0, @tmp_arr); |
| 1181 |
} |
| 1182 |
$content .= $h1 . $table . $html_end; |
| 1183 |
return $content; |
| 1184 |
} |