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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc (-1 / +7 lines)
Lines 1-4 Link Here
1
<div id="makechart">
1
<div id="makechart" style="display:none;">
2
    [% supposed_x = header_row.shift.cell %]
2
    [% supposed_x = header_row.shift.cell %]
3
3
4
    <fieldset>
4
    <fieldset>
Lines 28-33 Link Here
28
                </select>
28
                </select>
29
            </li>
29
            </li>
30
30
31
            <div>
32
                <label for="include-all">Include all rows (ignore pagination)</label>
33
                <input id="include-all" name="chart-include-all" type="checkbox">
34
            </div>
35
36
31
            <label for="exclude-last">Exclude last line (Rollup)</label>
37
            <label for="exclude-last">Exclude last line (Rollup)</label>
32
            <input id="exclude-last" name="chart-exclude-last" type="checkbox">
38
            <input id="exclude-last" name="chart-exclude-last" type="checkbox">
33
39
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc (+4 lines)
Lines 62-67 Link Here
62
                <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_hid" href="#"><i class="fa fa-eye"></i> Show SQL code</a>
62
                <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_hid" href="#"><i class="fa fa-eye"></i> Show SQL code</a>
63
                <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide SQL code</a>
63
                <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide SQL code</a>
64
            </div>
64
            </div>
65
            <div class="btn-group">
66
                <a class="btn btn-default btn-sm toggle_chart_settings" id="toggle_chart_settings_hid" href="#"><i class="fa fa-eye"></i> Show chart settings</a>
67
                <a class="btn btn-default btn-sm toggle_chart_settings" id="toggle_chart_settings_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide chart settings</a>
68
            </div>
65
        [% END %]
69
        [% END %]
66
70
67
    [% END %]
71
    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (+6 lines)
Lines 912-917 Link Here
912
912
913
            <h2>Leaflet</h2>
913
            <h2>Leaflet</h2>
914
            <p>The <a href="http://leafletjs.com">Leaflet</a> JavaScript library by Vladimir Agafonkinis licensed under the <a href="https://github.com/Leaflet/Leaflet/blob/master/LICENSE">BSD License</a>.</p>
914
            <p>The <a href="http://leafletjs.com">Leaflet</a> JavaScript library by Vladimir Agafonkinis licensed under the <a href="https://github.com/Leaflet/Leaflet/blob/master/LICENSE">BSD License</a>.</p>
915
916
            <h2>D3.js</h2>
917
            <p><a href="https://d3js.org/">D3.js v3.5.17</a> is a JavaScript library for manipulating documents based on data. It is under the <a href="https://github.com/d3/d3/blob/master/LICENSE">BSD 3-clause Licence</a></p>
918
919
            <h2>C3.js</h2>
920
            <p><a href="http://c3js.org/">C3.js v0.4.11</a> is a D3-based reusable chart library under the <a href="https://opensource.org/licenses/mit-license.php">MIT licence</a></p>
915
        </div>
921
        </div>
916
922
917
        <div id="translations">
923
        <div id="translations">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-4 / +17 lines)
Lines 206-211 $("#delColumn").on("click",function(){ Link Here
206
        $("#toggle_sql_vis").toggle();
206
        $("#toggle_sql_vis").toggle();
207
    });
207
    });
208
208
209
    $(".toggle_chart_settings").click(function(){
210
        $("#makechart").toggle();
211
        $("#toggle_chart_settings_hid").toggle();
212
        $("#toggle_chart_settings_vis").toggle();
213
    });
214
209
    $("#table_reports").delegate(".confirmdelete", 'click', function(){
215
    $("#table_reports").delegate(".confirmdelete", 'click', function(){
210
        $(this).parents('tr').attr("class","warn");
216
        $(this).parents('tr').attr("class","warn");
211
        if(confirm(_("Are you sure you want to delete this saved report?"))){
217
        if(confirm(_("Are you sure you want to delete this saved report?"))){
Lines 963-969 canned reports and writing custom SQL reports.</p> Link Here
963
            $('#draw-chart').click(function() {
969
            $('#draw-chart').click(function() {
964
970
965
                var btn_text = $("#draw-chart").html();
971
                var btn_text = $("#draw-chart").html();
966
                $("#draw-chart").html(_('Loading...'));
972
                $("#draw-chart").html(_("Loading..."));
967
973
968
                var x_elements = $('select[name="x"]').val();
974
                var x_elements = $('select[name="x"]').val();
969
                var y_elements = [];
975
                var y_elements = [];
Lines 973-979 canned reports and writing custom SQL reports.</p> Link Here
973
979
974
                //var headers = [% header_row.json %];
980
                //var headers = [% header_row.json %];
975
                headers = [% header_row.json %];
981
                headers = [% header_row.json %];
976
                var results = [% results.json %]
982
983
                var results;
984
                if ($('input[name="chart-include-all"]').prop('checked')) {
985
                    results = [% allresults.json %]
986
                }
987
                else {
988
                    results = [% results.json %]
989
                }
977
990
978
                if ($('input[name="chart-exclude-last"]').prop('checked')) {
991
                if ($('input[name="chart-exclude-last"]').prop('checked')) {
979
                    results.splice(-1, 1);
992
                    results.splice(-1, 1);
Lines 1037-1042 canned reports and writing custom SQL reports.</p> Link Here
1037
<div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql |html %]</pre></div>
1050
<div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql |html %]</pre></div>
1038
</br>
1051
</br>
1039
1052
1053
[% INCLUDE 'chart.inc' %]
1054
1040
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1055
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1041
    <input type="hidden" name="phase" value="Run this report"/>
1056
    <input type="hidden" name="phase" value="Run this report"/>
1042
    <input type="hidden" name="reports" value="[% report_id %]"/>
1057
    <input type="hidden" name="reports" value="[% report_id %]"/>
Lines 1069-1076 canned reports and writing custom SQL reports.</p> Link Here
1069
[% END %]
1084
[% END %]
1070
</table>
1085
</table>
1071
1086
1072
[% INCLUDE 'chart.inc' %]
1073
1074
[% END %]
1087
[% END %]
1075
[% END %]
1088
[% END %]
1076
1089
(-)a/reports/guided_reports.pl (-1 / +7 lines)
Lines 676-681 elsif ($phase eq 'Run this report'){ Link Here
676
        $notes = $report->{notes};
676
        $notes = $report->{notes};
677
677
678
        my @rows = ();
678
        my @rows = ();
679
        my @allrows = ();
679
        # if we have at least 1 parameter, and it's not filled, then don't execute but ask for parameters
680
        # if we have at least 1 parameter, and it's not filled, then don't execute but ask for parameters
680
        if ($sql =~ /<</ && !@sql_params) {
681
        if ($sql =~ /<</ && !@sql_params) {
681
            # split on ??. Each odd (2,4,6,...) entry should be a parameter to fill
682
            # split on ??. Each odd (2,4,6,...) entry should be a parameter to fill
Lines 801-806 elsif ($phase eq 'Run this report'){ Link Here
801
                $sql =~ s/<<$split[$i*2+1]>>/$quoted/;
802
                $sql =~ s/<<$split[$i*2+1]>>/$quoted/;
802
            }
803
            }
803
            my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id );
804
            my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id );
805
            my ($sth2, $errors2) = execute_query($sql);
804
            my $total = nb_rows($sql) || 0;
806
            my $total = nb_rows($sql) || 0;
805
            unless ($sth) {
807
            unless ($sth) {
806
                die "execute_query failed to return sth for report $report_id: $sql";
808
                die "execute_query failed to return sth for report $report_id: $sql";
Lines 811-816 elsif ($phase eq 'Run this report'){ Link Here
811
                    my @cells = map { +{ cell => $_ } } @$row;
813
                    my @cells = map { +{ cell => $_ } } @$row;
812
                    push @rows, { cells => \@cells };
814
                    push @rows, { cells => \@cells };
813
                }
815
                }
816
                while (my $row = $sth2->fetchrow_arrayref()) {
817
                    my @cells = map { +{ cell => $_ } } @$row;
818
                    push @allrows, { cells => \@cells };
819
                }
814
            }
820
            }
815
821
816
            my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
822
            my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
Lines 820-825 elsif ($phase eq 'Run this report'){ Link Here
820
            }
826
            }
821
            $template->param(
827
            $template->param(
822
                'results' => \@rows,
828
                'results' => \@rows,
829
                'allresults' => \@allrows,
823
                'sql'     => $sql,
830
                'sql'     => $sql,
824
                original_sql => $original_sql,
831
                original_sql => $original_sql,
825
                'id'      => $report_id,
832
                'id'      => $report_id,
826
- 

Return to bug 17282