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->[0]] );
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 (+10 lines)
Lines 140-145 Link Here
140
<h3>Add new definition</h3>
140
<h3>Add new definition</h3>
141
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
141
<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
142
    [% INCLUDE 'csrf-token.inc' %]
142
    [% INCLUDE 'csrf-token.inc' %]
143
144
    [% IF ( passworderr ) %]
145
        <div class="alert alert-warning">
146
            <strong>The following error was encountered:</strong><br />
147
            The previous column selection included a password field.<br />
148
            The column cannot be used due to security risks.<br />
149
            Please make a new selection and ensure no password columns have been selected.
150
        </div>
151
    [% END %]
152
143
<fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
153
<fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
144
<li>
154
<li>
145
<label for="definition_name">Definition name:</label>
155
<label for="definition_name">Definition name:</label>
(-)a/reports/dictionary.pl (-27 / +40 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;
95
                $tmp_hash{'distinct'} = 1;
94
96
97
            }
98
            if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
99
                $tmp_hash{'date'} = 1;
100
            }
101
            if ( $type eq 'TEXT' || $type eq 'MEDIUMTEXT' ) {
102
                $tmp_hash{'text'} = 1;
103
            }
104
            push @column_loop, \%tmp_hash;
95
        }
105
        }
96
        if ( $type eq 'DATE' || $type eq 'DATETIME' ) {
106
    }
97
            $tmp_hash{'date'} = 1;
98
        }
99
        if ($type eq 'TEXT' || $type eq 'MEDIUMTEXT'){
100
            $tmp_hash{'text'} = 1;
101
        }
102
107
103
        #		else {
108
    if (@column_loop) {
104
        #			warn $type;#
109
        $template->param(
105
        #			}
110
            'step_4'                 => 1,
106
        push @column_loop, \%tmp_hash;
111
            'area'                   => $area,
112
            'definition_name'        => $definition_name,
113
            'definition_description' => $definition_description,
114
            'columns'                => \@column_loop,
115
            'columnstring'           => $columnstring,
116
        );
117
    } else {
118
        my $columns = get_columns( $area, $input );
119
        $template->param(
120
            'step_3'                 => 1,
121
            'area'                   => $area,
122
            'definition_name'        => $definition_name,
123
            'definition_description' => $definition_description,
124
            'columns'                => \@column_loop,
125
            'columnstring'           => $columnstring,
126
            'passworderr'            => 1,
127
        );
107
    }
128
    }
108
129
109
	$template->param( 'step_4' => 1,
110
		'area' => $area,
111
		'definition_name' => $definition_name,
112
		'definition_description' => $definition_description,
113
		'columns' => \@column_loop,
114
		'columnstring' => $columnstring,
115
	);
116
}
130
}
117
131
118
elsif ( $op eq 'cud-add_form_5' ) {
132
elsif ( $op eq 'cud-add_form_5' ) {
119
- 

Return to bug 37784