Bug 37784: (QA follow-up) Bail out to new definition

The code went back to step 3 but the error message is not there.
It is easier to go back to the start: no need to fetch columns.
And this is now an exception; it will only come up when trying
malicious things.

Also turned foreach and unless forbidden around. No need to go
into the loop when we found a forbidden field.

Test plan:
See first patch. You should see the message now.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Marcel de Rooy 2025-03-14 09:31:57 +00:00 committed by Katrin Fischer
parent 8a86f5e7cd
commit 7738fcbb88
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -81,8 +81,8 @@ if ( $op eq 'add_form' ) {
my $columnstring = join( ',', @columns ); my $columnstring = join( ',', @columns );
my $forbidden = Koha::Report->new->check_columns( undef, \@columns ); my $forbidden = Koha::Report->new->check_columns( undef, \@columns );
my @column_loop; my @column_loop;
foreach my $column (@columns) { unless ($forbidden) {
unless ($forbidden) { foreach my $column (@columns) {
my %tmp_hash; my %tmp_hash;
$tmp_hash{'name'} = $column; $tmp_hash{'name'} = $column;
my $type = get_column_type($column); my $type = get_column_type($column);
@ -112,16 +112,7 @@ if ( $op eq 'add_form' ) {
'columnstring' => $columnstring, 'columnstring' => $columnstring,
); );
} else { } else {
my $columns = get_columns( $area, $input ); $template->param( 'new_dictionary' => 1, passworderr => 1 );
$template->param(
'step_3' => 1,
'area' => $area,
'definition_name' => $definition_name,
'definition_description' => $definition_description,
'columns' => \@column_loop,
'columnstring' => $columnstring,
'passworderr' => 1,
);
} }
} elsif ( $op eq 'cud-add_form_5' ) { } elsif ( $op eq 'cud-add_form_5' ) {