diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index 45f7d1d170..381047a77a 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -119,10 +119,13 @@ abstract class Importer // Remove any custom fields that do not exist in the header row. This prevents nulling out values that shouldn't exist. // In detail, we compare the lower case name of custom fields (indexed by name) to the keys in the header row. This // results in an array with only custom fields that are in the file. - $this->customFields = array_intersect_key( - array_change_key_case($this->customFields), - array_change_key_case(array_flip($headerRow)) - ); + if ($this->customFields) { + $this->customFields = array_intersect_key( + array_change_key_case($this->customFields), + array_change_key_case(array_flip($headerRow)) + ); + } + DB::transaction(function () use (&$results) {