From: Bernd Bleßmann Date: Tue, 6 Apr 2021 14:55:17 +0000 (+0200) Subject: CSV-Import CustomerVendor: Warnungen wegen nicht initialisierter Variable vermeiden X-Git-Tag: kivitendo-mebil_0.1-0~9^2~377 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=163e000563f99042490a32a31996442dba64890b;p=kivitendo-erp.git CSV-Import CustomerVendor: Warnungen wegen nicht initialisierter Variable vermeiden --- 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 };