Skip to content

A free open source IT asset/license management system

Add autoincrementing asset tags to the import if the CSV column is empty

Ivan Nieto Vivanco9f0ecba9b98e
diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php
index e3bc0839ef..10f3883bcc 100644
--- a/app/Importer/AssetImporter.php
+++ b/app/Importer/AssetImporter.php
@@ -55,6 +55,11 @@ class AssetImporter extends ItemImporter
{
$editingAsset = false;
$asset_tag = $this->findCsvMatch($row, 'asset_tag');
+
+ if(empty($asset_tag)){
+ $asset_tag = Asset::autoincrement_asset();
+ }
+
$asset = Asset::where(['asset_tag'=> $asset_tag])->first();
if ($asset) {
if (! $this->updating) {