diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index bb80ba840383..4bed93de2421 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -287,10 +287,9 @@ class ImportService $this->addExpenseCategoryToMaps($category); } } - if ( ! empty($row->vendor)) { - $vendorId = $transformer->getVendorId($row->vendor); - if ( ! $vendorId) { - $vendor = $this->vendorRepo->save(['name' => $row->vendor, 'vendor_contact' => []]); + if ( ! empty($row->vendor) && ($vendorName = trim($row->vendor))) { + if ( ! $transformer->getVendorId($vendorName)) { + $vendor = $this->vendorRepo->save(['name' => $vendorName, 'vendor_contact' => []]); $this->addVendorToMaps($vendor); } }