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

(-)a/C4/Reports/Guided.pm (-5 / +7 lines)
Lines 219-229 sub _get_columns { Link Here
219
    return [
219
    return [
220
        map {
220
        map {
221
            my $column_name = $_->{Field};
221
            my $column_name = $_->{Field};
222
            {
222
            my $forbidden   = Koha::Report->new->check_columns( undef, [ $column_name ] );
223
                name        => sprintf( "%s.%s", $table_name, $column_name ),
223
            $forbidden ? () : (
224
                description => $all_columns->{$table_name}->{$column_name},
224
                {
225
            };
225
                    name        => sprintf( "%s.%s", $table_name, $column_name ),
226
226
                    description => $all_columns->{$table_name}->{$column_name},
227
                }
228
            );
227
        } @$columns
229
        } @$columns
228
    ];
230
    ];
229
}
231
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt (+10 lines)
Lines 150-155 Link Here
150
        <h3>Add new definition</h3>
150
        <h3>Add new definition</h3>
151
        <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
151
        <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
152
            [% INCLUDE 'csrf-token.inc' %]
152
            [% INCLUDE 'csrf-token.inc' %]
153
154
            [% IF ( passworderr ) %]
155
                <div class="alert alert-warning">
156
                    <strong>The following error was encountered:</strong><br />
157
                    The previous column selection included a password field.<br>
158
                    The column cannot be used due to security risks.<br>
159
                    Please make a new selection and ensure no password columns have been selected.
160
                </div>
161
            [% END %]
162
153
            <fieldset class="rows"
163
            <fieldset class="rows"
154
                ><legend>Step 1 of 5: Name the new definition</legend
164
                ><legend>Step 1 of 5: Name the new definition</legend
155
                ><ol>
165
                ><ol>
(-)a/reports/dictionary.pl (-27 / +38 lines)
Lines 79-116 if ( $op eq 'add_form' ) { Link Here
79
    # Choosing the values
79
    # Choosing the values
80
    my @columns      = $input->multi_param('columns');
80
    my @columns      = $input->multi_param('columns');
81
    my $columnstring = join( ',', @columns );
81
    my $columnstring = join( ',', @columns );
82
    my $forbidden    = Koha::Report->new->check_columns( undef, \@columns );
82
    my @column_loop;
83
    my @column_loop;
83
    foreach my $column (@columns) {
84
    foreach my $column (@columns) {
84
        my %tmp_hash;
85
        unless ($forbidden) {
85
        $tmp_hash{'name'} = $column;
86
            my %tmp_hash;
86
        my $type = get_column_type($column);
87
            $tmp_hash{'name'} = $column;
87
        if ( $type eq 'distinct' ) {
88
            my $type = get_column_type($column);
88
            my $values = get_distinct_values($column);
89
            if ( $type eq 'distinct' ) {
89
            $tmp_hash{'values'}   = $values;
90
                my $values = get_distinct_values($column);
90
            $tmp_hash{'distinct'} = 1;
91
                $tmp_hash{'values'}   = $values;
92
                $tmp_hash{'distinct'} = 1;
91
93
94
            }
95
            if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
96
                $tmp_hash{'date'} = 1;
97
            }
98
            if ( $type eq 'TEXT' || $type eq 'MEDIUMTEXT' ) {
99
                $tmp_hash{'text'} = 1;
100
            }
101
            push @column_loop, \%tmp_hash;
92
        }
102
        }
93
        if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
94
            $tmp_hash{'date'} = 1;
95
        }
96
        if ( $type eq 'TEXT' || $type eq 'MEDIUMTEXT' ) {
97
            $tmp_hash{'text'} = 1;
98
        }
99
100
        #		else {
101
        #			warn $type;#
102
        #			}
103
        push @column_loop, \%tmp_hash;
104
    }
103
    }
105
104
106
    $template->param(
105
    if (@column_loop) {
107
        'step_4'                 => 1,
106
        $template->param(
108
        'area'                   => $area,
107
            'step_4'                 => 1,
109
        'definition_name'        => $definition_name,
108
            'area'                   => $area,
110
        'definition_description' => $definition_description,
109
            'definition_name'        => $definition_name,
111
        'columns'                => \@column_loop,
110
            'definition_description' => $definition_description,
112
        'columnstring'           => $columnstring,
111
            'columns'                => \@column_loop,
113
    );
112
            'columnstring'           => $columnstring,
113
        );
114
    } else {
115
        my $columns = get_columns( $area, $input );
116
        $template->param(
117
            'step_3'                 => 1,
118
            'area'                   => $area,
119
            'definition_name'        => $definition_name,
120
            'definition_description' => $definition_description,
121
            'columns'                => \@column_loop,
122
            'columnstring'           => $columnstring,
123
            'passworderr'            => 1,
124
        );
125
    }
114
126
115
} elsif ( $op eq 'cud-add_form_5' ) {
127
} elsif ( $op eq 'cud-add_form_5' ) {
116
128
117
- 

Return to bug 37784