Skip to content

Conversation

@pawelwlod
Copy link

Throw an error to the user if a field name heading is blank, alongside the column number in the CSV file being imported.

@pawelwlod pawelwlod changed the title Added appropriate error for blank field name heading in record imports Added appropriate error for blank field name heading in record imports (D1099) Dec 17, 2025
$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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use unless $field rather than if !$field - this is more personal preference, so I would run with that

In mind of OT comment "If it's 0, what happens" it's possible to use unless defined $field

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a step further and accounted for all white-space characters using a regex statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants