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

(-)a/C4/Reports/Guided.pm (-4 / +7 lines)
Lines 220-229 sub _get_columns { Link Here
220
    $tablehash{'__first__'} = $first;
220
    $tablehash{'__first__'} = $first;
221
	push @columns, \%tablehash;
221
	push @columns, \%tablehash;
222
    while ( my $data = $sth->fetchrow_arrayref() ) {
222
    while ( my $data = $sth->fetchrow_arrayref() ) {
223
        my %temphash;
223
        my $forbidden = Koha::Report->new->check_columns( undef, $data );
224
        $temphash{'name'}        = "$tablename.$data->[0]";
224
        unless ($forbidden) {
225
        $temphash{'description'} = $columns->{$tablename}->{$data->[0]};
225
            my %temphash;
226
        push @columns, \%temphash;
226
            $temphash{'name'}        = "$tablename.$data->[0]";
227
            $temphash{'description'} = $columns->{$tablename}->{ $data->[0] };
228
            push @columns, \%temphash;
229
        }
227
    }
230
    }
228
    $sth->finish();
231
    $sth->finish();
229
    return (@columns);
232
    return (@columns);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt (+8 lines)
Lines 184-189 Link Here
184
<h3>Add new definition</h3>
184
<h3>Add new definition</h3>
185
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
185
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
186
    [% INCLUDE 'csrf-token.inc' %]
186
    [% INCLUDE 'csrf-token.inc' %]
187
[% IF ( passworderr ) %]
188
    <div class="alert alert-warning">
189
        <strong>The following error was encountered:</strong><br />
190
        The previous column selection included a password field.<br>
191
        The column cannot be used due to security risks.<br>
192
        Please make a new selection and ensure no password columns have been selected.
193
    </div>
194
[% END %]
187
<fieldset class="rows">
195
<fieldset class="rows">
188
<legend>Step 3 of 5: Choose a column</legend>
196
<legend>Step 3 of 5: Choose a column</legend>
189
<input type="hidden" name="area" value="[% area | html %]" />
197
<input type="hidden" name="area" value="[% area | html %]" />
(-)a/reports/dictionary.pl (-29 / +39 lines)
Lines 80-118 elsif ( $op eq 'cud-add_form_3' ) { Link Here
80
elsif ( $op eq 'cud-add_form_4' ) {
80
elsif ( $op eq 'cud-add_form_4' ) {
81
81
82
    # Choosing the values
82
    # Choosing the values
83
    my @columns                = $input->multi_param('columns');
83
    my @columns      = $input->multi_param('columns');
84
    my $columnstring           = join( ',', @columns );
84
    my $columnstring = join( ',', @columns );
85
    my $forbidden    = Koha::Report->new->check_columns( undef, \@columns );
85
    my @column_loop;
86
    my @column_loop;
86
    foreach my $column (@columns) {
87
    foreach my $column (@columns) {
87
        my %tmp_hash;
88
        unless ($forbidden) {
88
        $tmp_hash{'name'} = $column;
89
            my %tmp_hash;
89
        my $type = get_column_type($column);
90
            $tmp_hash{'name'} = $column;
90
        if ( $type eq 'distinct' ) {
91
            my $type = get_column_type($column);
91
            my $values = get_distinct_values($column);
92
            if ( $type eq 'distinct' ) {
92
            $tmp_hash{'values'}   = $values;
93
                my $values = get_distinct_values($column);
93
            $tmp_hash{'distinct'} = 1;
94
                $tmp_hash{'values'}   = $values;
94
95
                $tmp_hash{'distinct'} = 1;
95
        }
96
            }
96
        if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
97
            if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
97
            $tmp_hash{'date'} = 1;
98
                $tmp_hash{'date'} = 1;
98
        }
99
            }
99
        if ($type eq 'TEXT' || $type eq 'MEDIUMTEXT'){
100
            if ( $type eq 'TEXT' || $type eq 'MEDIUMTEXT' ) {
100
            $tmp_hash{'text'} = 1;
101
                $tmp_hash{'text'} = 1;
102
            }
103
            push @column_loop, \%tmp_hash;
101
        }
104
        }
102
103
        #		else {
104
        #			warn $type;#
105
        #			}
106
        push @column_loop, \%tmp_hash;
107
    }
105
    }
108
106
109
	$template->param( 'step_4' => 1,
107
    if (@column_loop) {
110
		'area' => $area,
108
        $template->param(
111
		'definition_name' => $definition_name,
109
            'step_4'                 => 1,
112
		'definition_description' => $definition_description,
110
            'area'                   => $area,
113
		'columns' => \@column_loop,
111
            'definition_name'        => $definition_name,
114
		'columnstring' => $columnstring,
112
            'definition_description' => $definition_description,
115
	);
113
            'columns'                => \@column_loop,
114
            'columnstring'           => $columnstring,
115
        );
116
    } else {
117
        my $columns = get_columns( $area, $input );
118
        $template->param(
119
            'step_3'                 => 1,
120
            'area'                   => $area,
121
            'columns'                => $columns,
122
            'definition_name'        => $definition_name,
123
            'definition_description' => $definition_description,
124
            'passworderr'            => 1,
125
        );
126
    }
116
}
127
}
117
128
118
elsif ( $op eq 'cud-add_form_5' ) {
129
elsif ( $op eq 'cud-add_form_5' ) {
119
- 

Return to bug 37784