View | Details | Raw Unified | Return to bug 27510
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_27510_download_report_html_format.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReportUserCSS','',NULL,'','free')});
5
6
    # Always end with this (adjust the bug info)
7
    NewVersion( $DBversion, 27510, "Download the report in HTML format");
8
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +2 lines)
Lines 722-726 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
722
('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
722
('XSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on intranet','Free'),
723
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
723
('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'),
724
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
724
('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'),
725
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo')
725
('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'),
726
('ReportUserCSS','',NULL,'Add CSS to be included on the report in HTML format.','free')
726
;
727
;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref (+6 lines)
Lines 181-183 Staff interface: Link Here
181
                  yes: Show
181
                  yes: Show
182
                  no: "Don't show"
182
                  no: "Don't show"
183
            - a search field pulldown for 'Search the catalog' boxes.
183
            - a search field pulldown for 'Search the catalog' boxes.
184
        -
185
            - "Include the following CSS on the report in HTML format:"
186
            - pref: ReportUserCSS
187
              type: textarea
188
              syntax: css
189
              class: code
(-)a/reports/guided_reports.pl (-1 / +36 lines)
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;
42
43
43
=head1 NAME
44
=head1 NAME
44
45
Lines 952-957 elsif ($phase eq 'Export'){ Link Here
952
                $content .= $_ while <$ods_fh>;
953
                $content .= $_ while <$ods_fh>;
953
                unlink $ods_filepath;
954
                unlink $ods_filepath;
954
            }
955
            }
956
            elsif ( $format eq 'html' ) {
957
                $type = 'text/html';
958
                $content = _to_html($sth, $input);
959
            }
955
        }
960
        }
956
        print $input->header(
961
        print $input->header(
957
            -type => $type,
962
            -type => $type,
Lines 1123-1125 sub get_prepped_report { Link Here
1123
    }
1128
    }
1124
    return $sql,$headers;
1129
    return $sql,$headers;
1125
}
1130
}
1126
- 
1131
1132
sub _to_html {
1133
    my ($sth, $input) = @_;
1134
    my $header_type = "application/x-download";
1135
    my $file = $input->param('reportname') . ".html";
1136
    my @head = header_cell_values($sth);
1137
    my $con = join(" ", @head);
1138
    my $cols = scalar @head;
1139
    my $h1 = "<h1>" . $input->param('reportname') . "</h1>";
1140
    my $css = C4::Context->preference('ReportUserCSS');
1141
    if ($css eq ''){
1142
        $css =
1143
            "table, th, td {
1144
                border: 1px solid black;
1145
            }
1146
            table {
1147
                border-collapse: collapse;
1148
            }";
1149
    }
1150
    my $content = "<style>" . $css . "</style>";
1151
    my $table = HTML::Table->new(
1152
        -cols => $cols,
1153
    );
1154
    $table->addSectionRow('thead', 0, @head);
1155
    $table->setSectionRCellsHead('thead', 0, 1);
1156
    while (my $row = $sth->fetchrow_arrayref()) {
1157
        $table->addSectionRow( 'tbody', 0, @$row );
1158
    }
1159
    $content .= $h1 . $table;
1160
    return $content;
1161
}

Return to bug 27510