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

(-)a/C4/Reports/Guided.pm (-1 / +1 lines)
Lines 974-980 sub GetParametersFromSQL { Link Here
974
974
975
    for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
975
    for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
976
        my ($name,$authval) = split(/\|/,$split[$i*2+1]);
976
        my ($name,$authval) = split(/\|/,$split[$i*2+1]);
977
        $authval =~ s/\:all$// if $authval;
977
        $authval =~ s/\:all$|\:in$// if $authval;
978
        push @sql_parameters, { 'name' => $name, 'authval' => $authval };
978
        push @sql_parameters, { 'name' => $name, 'authval' => $authval };
979
    }
979
    }
980
980
(-)a/Koha/Report.pm (-1 / +1 lines)
Lines 169-175 sub prep_report { Link Here
169
        #        }
169
        #        }
170
        #    ) if $quoted;
170
        #    ) if $quoted;
171
        #}
171
        #}
172
        unless ( $split[ $i * 2 + 1 ] =~ /\|\s*list\s*$/ && $quoted ) {
172
        unless ( $split[ $i * 2 + 1 ] =~ /\|\s*list\s*$|\s*\:in\s*$/ && $quoted ) {
173
            $quoted = C4::Context->dbh->quote($quoted);
173
            $quoted = C4::Context->dbh->quote($quoted);
174
        }
174
        }
175
        else {
175
        else {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-2 / +22 lines)
Lines 849-855 Link Here
849
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?op=edit_formid=[% id | uri %]" class="btn btn-primary">Edit SQL</a>
849
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?op=edit_formid=[% id | uri %]" class="btn btn-primary">Edit SQL</a>
850
                        </fieldset>
850
                        </fieldset>
851
                    [% ELSE #  IF ( auth_val_error ) %]
851
                    [% ELSE #  IF ( auth_val_error ) %]
852
                        <form method="get" action='/cgi-bin/koha/reports/guided_reports.pl'>
852
                        <form method="get" action='/cgi-bin/koha/reports/guided_reports.pl' id='report_param_form'>
853
                            <input type='hidden' name='id' value="[% id | html %]" />
853
                            <input type='hidden' name='id' value="[% id | html %]" />
854
                            <h1>Enter parameters for report [% name | html %]:</h1>
854
                            <h1>Enter parameters for report [% name | html %]:</h1>
855
                            [% IF ( notes ) %]
855
                            [% IF ( notes ) %]
Lines 876-885 Link Here
876
                                        [% ELSE %]
876
                                        [% ELSE %]
877
                                            <li>
877
                                            <li>
878
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
878
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
879
                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
879
                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" [%- sql_param.select_multiple | html -%]>
880
                                                    [% IF (sql_param.include_all) %]
880
                                                    [% IF (sql_param.include_all) %]
881
                                                        <option value="%">All</option>
881
                                                        <option value="%">All</option>
882
                                                    [% END %]
882
                                                    [% END %]
883
                                                    [% IF (sql_param.select_multiple) %]
884
                                                        <option value="null" hidden></option>
885
                                                    [% END %]
883
                                                    [% FOREACH value IN sql_param.input.values %]
886
                                                    [% FOREACH value IN sql_param.input.values %]
884
                                                        <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
887
                                                        <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
885
                                                    [% END %]
888
                                                    [% END %]
Lines 1541-1546 Link Here
1541
1544
1542
    <script>
1545
    <script>
1543
1546
1547
        //  if the report param form has multiselects override default form submission
1548
        if( $('#report_param_form').find('select[multiple]').length ) {
1549
            $('#report_param_form').find('select[multiple]').each( function (i) {
1550
                $(this).on('change', function() {
1551
                    var $selected = $(this).val().join('\n');
1552
                    $(this).find('option:first').val($selected);
1553
                });
1554
            });
1555
1556
            $('#report_param_form').on('submit', function(e) {
1557
                $('#report_param_form').find('select[multiple]').each( function (i) {
1558
                    var $selected = $('option:first', this).val();
1559
                    $(this).val($selected);
1560
                });
1561
            });
1562
        }
1563
1544
        function hide_bar_element() {
1564
        function hide_bar_element() {
1545
            $('#chart-column-horizontal').hide()
1565
            $('#chart-column-horizontal').hide()
1546
            $('.chart-column-group').each(function( index ) {
1566
            $('.chart-column-group').each(function( index ) {
(-)a/reports/guided_reports.pl (-3 / +9 lines)
Lines 798-804 if ($op eq 'run'){ Link Here
798
                if( defined $uniq_params{$text.$sep.$authorised_value_all} ){
798
                if( defined $uniq_params{$text.$sep.$authorised_value_all} ){
799
                    next;
799
                    next;
800
                } else { $uniq_params{$text.$sep.$authorised_value_all} = "$i"; }
800
                } else { $uniq_params{$text.$sep.$authorised_value_all} = "$i"; }
801
                my ($authorised_value, $all) = split /:/, $authorised_value_all;
801
                my ($authorised_value, $param_options) = split /:/, $authorised_value_all;
802
                my $all;
803
                my $multiple;
804
                if ( $param_options eq "all" ) {
805
                    $all = "all";
806
                } elsif ( $param_options eq "in" ) {
807
                    $multiple = "multiple";
808
                }
802
                my $input;
809
                my $input;
803
                my $labelid;
810
                my $labelid;
804
                if ( not defined $authorised_value ) {
811
                if ( not defined $authorised_value ) {
Lines 917-923 if ($op eq 'run'){ Link Here
917
                    };
924
                    };
918
                }
925
                }
919
926
920
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all };
927
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all, 'select_multiple' => $multiple };
921
            }
928
            }
922
            $template->param('sql'         => $sql,
929
            $template->param('sql'         => $sql,
923
                            'name'         => $name,
930
                            'name'         => $name,
924
- 

Return to bug 35746