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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (+17 lines)
Lines 579-584 canned reports and writing custom SQL reports.</p> Link Here
579
[% IF ( notes ) %]<p>[% notes %]</p>[% END %]
579
[% IF ( notes ) %]<p>[% notes %]</p>[% END %]
580
[% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
580
[% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
581
<pre id="sql_output">[% sql |html %]</pre>
581
<pre id="sql_output">[% sql |html %]</pre>
582
583
<form>
584
    <input type="hidden" name="phase" value="Run this report"/>
585
    <input type="hidden" name="reports" value="[% report_id %]"/>
586
587
    <label for="limit">Rows per page: </label>
588
    <select name="limit">
589
        <option value="[% limit %]">[% limit %]</option>
590
        [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
591
        [% FOREACH l IN limits %]
592
                <option value="[% l %]">[% l %]</option>
593
        [% END %]
594
    </select>
595
596
    <input type="submit" value="Update" />
597
</form>
598
582
<div class="pages">[% pagination_bar %]</div>
599
<div class="pages">[% pagination_bar %]</div>
583
[% UNLESS ( errors ) %]
600
[% UNLESS ( errors ) %]
584
<table>
601
<table>
(-)a/reports/guided_reports.pl (-3 / +7 lines)
Lines 523-529 elsif ( $phase eq 'Save Report' ) { Link Here
523
523
524
elsif ($phase eq 'Run this report'){
524
elsif ($phase eq 'Run this report'){
525
    # execute a saved report
525
    # execute a saved report
526
    my $limit      = 20; # page size. # TODO: move to DB or syspref?
526
    my $limit      = $input->param('limit') || 20;
527
    my $offset     = 0;
527
    my $offset     = 0;
528
    my $report_id  = $input->param('reports');
528
    my $report_id  = $input->param('reports');
529
    my @sql_params = $input->param('sql_params');
529
    my @sql_params = $input->param('sql_params');
Lines 532-537 elsif ($phase eq 'Run this report'){ Link Here
532
        $offset = ($input->param('page') - 1) * $limit;
532
        $offset = ($input->param('page') - 1) * $limit;
533
    }
533
    }
534
534
535
    $template->param(
536
        'limit'   => $limit,
537
        'report_id' => $report_id,
538
    );
539
535
    my ( $sql, $type, $name, $notes );
540
    my ( $sql, $type, $name, $notes );
536
    if (my $report = get_saved_report($report_id)) {
541
    if (my $report = get_saved_report($report_id)) {
537
        $sql   = $report->{savedsql};
542
        $sql   = $report->{savedsql};
Lines 654-660 elsif ($phase eq 'Run this report'){ Link Here
654
            }
659
            }
655
660
656
            my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
661
            my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
657
            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&amp;phase=Run%20this%20report";
662
            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&amp;phase=Run%20this%20report&amp;limit=$limit";
658
            if (@sql_params) {
663
            if (@sql_params) {
659
                $url = join('&amp;sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params);
664
                $url = join('&amp;sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params);
660
            }
665
            }
661
- 

Return to bug 9417