Check for custom fields in Importer

This commit is contained in:
snipe 2018-03-30 18:50:09 -07:00
parent 116cad88a0
commit 4786c1c59f

View file

@ -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) {