Skip to content

Commit

Permalink
Add autoincrementing asset tags to the import if the CSV column is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
inietov committed Aug 3, 2022
1 parent b52c00d commit 9f0ecba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Importer/AssetImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function createAssetIfNotExists(array $row)
{
$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) {
Expand Down

0 comments on commit 9f0ecba

Please sign in to comment.