Bug 37728: Adjust test to catch more missing 'op' in POSTed forms

The test is not catching missing op in forms that are not the first POST
form of the template.

Found when fixing the test for bug 37309. It was not catching the
missing op in the second form.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2024-08-26 11:03:05 +02:00 committed by Katrin Fischer
parent adbbbb1d8c
commit aa70b472ff
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ sub catch_missing_op {
my @lines = read_file($file);
my @errors;
return unless grep { $_ =~ m|<form| } @lines;
my ( $in_form, $closed_form, $line_open_form, $has_op, $op_value );
my ( $in_form, $line_open_form, $has_op, $op_value );
my $line_number = 0;
for my $line (@lines) {
$line_number++;
@ -65,7 +65,6 @@ sub catch_missing_op {
}
}
if ( $in_form && $line =~ m{</form} ) {
$closed_form = 0;
if ($has_op) {
if ( $op_value !~ m{^cud-} && $op_value !~ m{^\[%} ) {
push @errors, $line_open_form;
@ -73,6 +72,7 @@ sub catch_missing_op {
} else {
push @errors, $line_open_form;
}
$has_op = 0;
$in_form = 0;
}
}