A free open source IT asset/license management system
Check if there are any custom fields before trying to loop through them
snipe6517a95d45a6
diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.phpindex 08772e4abb..9bf15acf30 100644--- a/app/Importer/AssetImporter.php+++ b/app/Importer/AssetImporter.php@@ -23,14 +23,18 @@ class AssetImporter extends ItemImporter// ItemImporter handles the general fetching.parent::handle($row);- foreach ($this->customFields as $customField) {- $customFieldValue = $this->array_smart_custom_field_fetch($row, $customField);- if ($customFieldValue) {- $this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue;- $this->log('Custom Field '. $customField->name.': '.$customFieldValue);+ if ($this->customFields) {++ foreach ($this->customFields as $customField) {+ $customFieldValue = $this->array_smart_custom_field_fetch($row, $customField);+ if ($customFieldValue) {+ $this->item['custom_fields'][$customField->db_column_name()] = $customFieldValue;+ $this->log('Custom Field '. $customField->name.': '.$customFieldValue);+ }}}+$this->createAssetIfNotExists($row);}