A free open source IT asset/license management system
Updated importer
snipe4363e8b34c2b
diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.phpindex b465ec844e..1112a04e35 100644--- a/app/Importer/AssetImporter.php+++ b/app/Importer/AssetImporter.php@@ -177,7 +177,7 @@ class AssetImporter extends ItemImporter$this->log('Asset '.$this->item['name'].' with serial number '.$this->item['serial'].' was created');// If we have a target to checkout to, lets do so.- //-- user_id is a property of the abstract class Importer, which this class inherits from and it's set by+ //-- created_by is a property of the abstract class Importer, which this class inherits from and it's set by//-- the class that needs to use it (command importer or GUI importer inside the project).if (isset($target) && ($target !== false)) {if (!is_null($asset->assigned_to)){diff --git a/app/Importer/ComponentImporter.php b/app/Importer/ComponentImporter.phpindex 125fbdbbef..9687ec4f17 100644--- a/app/Importer/ComponentImporter.php+++ b/app/Importer/ComponentImporter.php@@ -58,7 +58,7 @@ class ComponentImporter extends ItemImporterif (isset($this->item['asset_tag']) && ($asset = Asset::where('asset_tag', $this->item['asset_tag'])->first())) {$component->assets()->attach($component->id, ['component_id' => $component->id,- 'user_id' => $this->created_by,+ 'created_by' => $this->created_by,'created_at' => date('Y-m-d H:i:s'),'assigned_qty' => 1, // Only assign the first one to the asset'asset_id' => $asset->id,diff --git a/app/Importer/Importer.php b/app/Importer/Importer.phpindex 1557a5236f..678fb9ecb2 100644--- a/app/Importer/Importer.php+++ b/app/Importer/Importer.php@@ -22,7 +22,7 @@ abstract class Importer* @var*/- protected $user_id;+ protected $created_by;/*** Are we updating items in the import* @var bool@@ -395,7 +395,7 @@ abstract class Importer}/**- * Matches a user by user_id if user_name provided is a number+ * Matches a user by created_by if user_name provided is a number* @param string $user_name users full name from csv* @return User User Matching ID*/@@ -412,13 +412,13 @@ abstract class Importer/*** Sets the Id of User performing import.*- * @param mixed $user_id the user id+ * @param mixed $created_by the user id** @return self*/- public function setUserId($user_id)+ public function setUserId($created_by){- $this->created_by = $user_id;+ $this->created_by = $created_by;return $this;}diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.phpindex 6043ef0940..360618f4f0 100644--- a/app/Importer/ItemImporter.php+++ b/app/Importer/ItemImporter.php@@ -94,7 +94,7 @@ class ItemImporter extends Importer$this->item['qty'] = $this->findCsvMatch($row, 'quantity');$this->item['requestable'] = $this->findCsvMatch($row, 'requestable');- $this->item['user_id'] = $this->created_by;+ $this->item['created_by'] = $this->created_by;$this->item['serial'] = $this->findCsvMatch($row, 'serial');// NO need to call this method if we're running the user import.// TODO: Merge these methods.diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.phpindex e344b6beaf..b3ef59d248 100644--- a/app/Importer/LocationImporter.php+++ b/app/Importer/LocationImporter.php@@ -65,7 +65,7 @@ class LocationImporter extends ItemImporter$this->item['ldap_ou'] = trim($this->findCsvMatch($row, 'ldap_ou'));$this->item['manager'] = trim($this->findCsvMatch($row, 'manager'));$this->item['manager_username'] = trim($this->findCsvMatch($row, 'manager_username'));- $this->item['user_id'] = auth()->id();+ $this->item['created_by'] = auth()->id();if ($this->findCsvMatch($row, 'parent_location')) {$this->item['parent_id'] = $this->createOrFetchLocation(trim($this->findCsvMatch($row, 'parent_location')));