From 163e000563f99042490a32a31996442dba64890b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 6 Apr 2021 16:55:17 +0200 Subject: [PATCH] CSV-Import CustomerVendor: Warnungen wegen nicht initialisierter Variable vermeiden --- SL/Controller/CsvImport/CustomerVendor.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/Controller/CsvImport/CustomerVendor.pm b/SL/Controller/CsvImport/CustomerVendor.pm index 092c6fde5..2f8b15c06 100644 --- a/SL/Controller/CsvImport/CustomerVendor.pm +++ b/SL/Controller/CsvImport/CustomerVendor.pm @@ -91,7 +91,7 @@ sub check_objects { push @{ $entry->{information} }, $::locale->text('Illegal characters have been removed from the following fields: #1', join(', ', @cleaned_fields)) if @cleaned_fields; - my $existing_vc = $vcs_by_number{ $object->$numbercolumn }; + my $existing_vc = $object->$numbercolumn ? $vcs_by_number{ $object->$numbercolumn } : undef; if (!$existing_vc) { $vcs_by_number{ $object->$numbercolumn } = $object if $object->$numbercolumn; @@ -240,8 +240,8 @@ sub save_objects { my ($self, %params) = @_; my $numbercolumn = $self->table . 'number'; - my $with_number = [ grep { $_->{object}->$numbercolumn ne '####' } @{ $self->controller->data } ]; - my $without_number = [ grep { $_->{object}->$numbercolumn eq '####' } @{ $self->controller->data } ]; + my $with_number = [ grep { ($_->{object}->$numbercolumn || '') ne '####' } @{ $self->controller->data } ]; + my $without_number = [ grep { ($_->{object}->$numbercolumn || '') eq '####' } @{ $self->controller->data } ]; $_->{object}->$numbercolumn('') for @{ $without_number }; -- 2.20.1