From 0602126043c644fd33c92157558e0110b2442cc1 Mon Sep 17 00:00:00 2001 From: Pawel Date: Wed, 17 Dec 2025 13:47:33 +0000 Subject: [PATCH 1/3] Added appropriate error for blank field name heading in record imports --- lib/GADS/Import.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/GADS/Import.pm b/lib/GADS/Import.pm index 62d45364c..dfaaa8f9b 100644 --- a/lib/GADS/Import.pm +++ b/lib/GADS/Import.pm @@ -267,8 +267,10 @@ sub _build_fields my @fields; my $column_id = $self->layout->column_id; + my $col_count = 0; foreach my $field (@$fields_in) { + $col_count++; if ( ( ($self->update_unique && $self->update_unique == $column_id->id) || @@ -298,6 +300,8 @@ sub _build_fields $search->{name} = $field if !$self->short_names; $search->{name_short} = $field if $self->short_names; my $f_rs = $self->schema->resultset('Layout')->search($search); + error __x"Empty field name in import headings (Column {column})", column => $col_count + if !$field; error __x"Layout has more than one field named {name}", name => $field if $f_rs->count > 1; error __x"Field '{name}' in import headings not found in table", name => $field From c777096f8052169892ef2e0d6f901ebf2cac724d Mon Sep 17 00:00:00 2001 From: pawelw Date: Wed, 17 Dec 2025 15:31:15 +0000 Subject: [PATCH 2/3] Fix formatting on $col_count in _build_fields sub --- lib/GADS/Import.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/GADS/Import.pm b/lib/GADS/Import.pm index dfaaa8f9b..f9666a114 100644 --- a/lib/GADS/Import.pm +++ b/lib/GADS/Import.pm @@ -267,7 +267,7 @@ sub _build_fields my @fields; my $column_id = $self->layout->column_id; - my $col_count = 0; + my $col_count = 0; foreach my $field (@$fields_in) { $col_count++; From 87ddf70819e96f673ac99c965a3c5961799076b3 Mon Sep 17 00:00:00 2001 From: Pawel Date: Wed, 17 Dec 2025 16:12:35 +0000 Subject: [PATCH 3/3] Updated logic statement with regex to consider all whitespace characters --- lib/GADS/Import.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/GADS/Import.pm b/lib/GADS/Import.pm index f9666a114..7f9db2fca 100644 --- a/lib/GADS/Import.pm +++ b/lib/GADS/Import.pm @@ -301,7 +301,7 @@ sub _build_fields $search->{name_short} = $field if $self->short_names; my $f_rs = $self->schema->resultset('Layout')->search($search); error __x"Empty field name in import headings (Column {column})", column => $col_count - if !$field; + unless $field =~ /^\s*$/; error __x"Layout has more than one field named {name}", name => $field if $f_rs->count > 1; error __x"Field '{name}' in import headings not found in table", name => $field