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

(-)a/C4/Reports/Guided.pm (+1 lines)
Lines 919-924 sub GetParametersFromSQL { Link Here
919
919
920
    for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
920
    for ( my $i = 0; $i < ($#split/2) ; $i++ ) {
921
        my ($name,$authval) = split(/\|/,$split[$i*2+1]);
921
        my ($name,$authval) = split(/\|/,$split[$i*2+1]);
922
        $authval =~ s/\:all$// if $authval;
922
        push @sql_parameters, { 'name' => $name, 'authval' => $authval };
923
        push @sql_parameters, { 'name' => $name, 'authval' => $authval };
923
    }
924
    }
924
925
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (+1 lines)
Lines 701-706 canned reports and writing custom SQL reports.</p> Link Here
701
                [% ELSE %]
701
                [% ELSE %]
702
                    <li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
702
                    <li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
703
                        <select name="[%- sql_param.input.name | html -%]" tabindex="1"  size="1" id="[%- sql_param.input.id | html -%]">
703
                        <select name="[%- sql_param.input.name | html -%]" tabindex="1"  size="1" id="[%- sql_param.input.id | html -%]">
704
                        [% IF (sql_param.include_all) %]<option value="%">All</option>[% END %]
704
                        [% FOREACH value IN sql_param.input.values %]
705
                        [% FOREACH value IN sql_param.input.values %]
705
                            <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
706
                            <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
706
                        [% END %]
707
                        [% END %]
(-)a/reports/guided_reports.pl (-5 / +6 lines)
Lines 719-729 elsif ($phase eq 'Run this report'){ Link Here
719
            my @authval_errors;
719
            my @authval_errors;
720
            my %uniq_params;
720
            my %uniq_params;
721
            for(my $i=0;$i<($#split/2);$i++) {
721
            for(my $i=0;$i<($#split/2);$i++) {
722
                my ($text,$authorised_value) = split /\|/,$split[$i*2+1];
722
                my ($text,$authorised_value_all) = split /\|/,$split[$i*2+1];
723
                my $sep = $authorised_value ? "|" : "";
723
                my $sep = $authorised_value_all ? "|" : "";
724
                if( defined $uniq_params{$text.$sep.$authorised_value} ){
724
                if( defined $uniq_params{$text.$sep.$authorised_value_all} ){
725
                    next;
725
                    next;
726
                } else { $uniq_params{$text.$sep.$authorised_value} = "$i"; }
726
                } else { $uniq_params{$text.$sep.$authorised_value_all} = "$i"; }
727
                my ($authorised_value, $all) = split /:/, $authorised_value_all;
727
                my $input;
728
                my $input;
728
                my $labelid;
729
                my $labelid;
729
                if ( not defined $authorised_value ) {
730
                if ( not defined $authorised_value ) {
Lines 815-821 elsif ($phase eq 'Run this report'){ Link Here
815
                    };
816
                    };
816
                }
817
                }
817
818
818
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value };
819
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all };
819
            }
820
            }
820
            $template->param('sql'         => $sql,
821
            $template->param('sql'         => $sql,
821
                            'name'         => $name,
822
                            'name'         => $name,
(-)a/t/db_dependent/Reports/Guided.t (-3 / +4 lines)
Lines 146-158 subtest 'GetParametersFromSQL+ValidateSQLParameters' => sub { Link Here
146
        FROM old_issues
146
        FROM old_issues
147
        WHERE YEAR(timestamp) = <<Year|custom_list>> AND
147
        WHERE YEAR(timestamp) = <<Year|custom_list>> AND
148
              branchcode = <<Branch|branches>> AND
148
              branchcode = <<Branch|branches>> AND
149
              borrowernumber = <<Borrower>>
149
              borrowernumber = <<Borrower>> AND
150
              itemtype = <<Item type|itemtypes:all>>
150
    ";
151
    ";
151
152
152
    my @test_parameters_with_custom_list = (
153
    my @test_parameters_with_custom_list = (
153
        { 'name' => 'Year', 'authval' => 'custom_list' },
154
        { 'name' => 'Year', 'authval' => 'custom_list' },
154
        { 'name' => 'Branch', 'authval' => 'branches' },
155
        { 'name' => 'Branch', 'authval' => 'branches' },
155
        { 'name' => 'Borrower', 'authval' => undef }
156
        { 'name' => 'Borrower', 'authval' => undef },
157
        { 'name' => 'Item type', 'authval' => 'itemtypes' }
156
    );
158
    );
157
159
158
    is_deeply( GetParametersFromSQL($test_query_1), \@test_parameters_with_custom_list,
160
    is_deeply( GetParametersFromSQL($test_query_1), \@test_parameters_with_custom_list,
159
- 

Return to bug 23389