Check if there are any custom fields before trying to loop through them

This commit is contained in:
snipe 2017-10-16 15:29:19 -07:00
parent 4b84a0c916
commit 6517a95d45

View file

@ -23,6 +23,8 @@ class AssetImporter extends ItemImporter
// ItemImporter handles the general fetching. // ItemImporter handles the general fetching.
parent::handle($row); parent::handle($row);
if ($this->customFields) {
foreach ($this->customFields as $customField) { foreach ($this->customFields as $customField) {
$customFieldValue = $this->array_smart_custom_field_fetch($row, $customField); $customFieldValue = $this->array_smart_custom_field_fetch($row, $customField);
if ($customFieldValue) { if ($customFieldValue) {
@ -30,6 +32,8 @@ class AssetImporter extends ItemImporter
$this->log('Custom Field '. $customField->name.': '.$customFieldValue); $this->log('Custom Field '. $customField->name.': '.$customFieldValue);
} }
} }
}
$this->createAssetIfNotExists($row); $this->createAssetIfNotExists($row);
} }