From 9f0ecba9b98e69b2d8d85381b902b85e29f3c419 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Wed, 3 Aug 2022 12:48:48 -0500 Subject: [PATCH] Add autoincrementing asset tags to the import if the CSV column is empty --- app/Importer/AssetImporter.php | 5 +++++ 1 file changed, 5 insertions(+) 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) {