warnings: diverse nicht initialisierte hash keys in CsvImport
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:00:17 +0000 (13:00 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 22 Mar 2016 12:00:17 +0000 (13:00 +0100)
SL/Controller/CsvImport/Base.pm

index c8456ca..8544cf7 100644 (file)
@@ -200,8 +200,8 @@ sub check_vc {
   }
 
   if (!$entry->{object}->$id_column) {
-    my $vc = $self->vc_by->{number}->{customers}->{ $entry->{raw_data}->{customernumber} }
-          || $self->vc_by->{number}->{vendors}->{   $entry->{raw_data}->{vendornumber}   };
+    my $vc = ($entry->{raw_data}->{customernumber} && $self->vc_by->{number}->{customers}->{ $entry->{raw_data}->{customernumber} })
+          || ($entry->{raw_data}->{vendornumber}   && $self->vc_by->{number}->{vendors}->{   $entry->{raw_data}->{vendornumber}   });
     $entry->{object}->$id_column($vc->id) if $vc;
   }
 
@@ -522,7 +522,7 @@ sub clean_fields {
 sub _save_history {
   my ($self, $object) = @_;
 
-  if (any { $_ eq $self->controller->{type} } qw(parts customers_vendors orders ar_transactions)) {
+  if (any { $self->controller->{type} && $_ eq $self->controller->{type} } qw(parts customers_vendors orders ar_transactions)) {
     my $snumbers = $self->controller->{type} eq 'parts'             ? 'partnumber_' . $object->partnumber
                  : $self->controller->{type} eq 'customers_vendors' ?
                      ($self->table eq 'customer' ? 'customernumber_' . $object->customernumber : 'vendornumber_' . $object->vendornumber)