Skip to content

A free open source IT asset/license management system

Check for matching ID

snipe52734086314f
diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php
index 7005834767..5a87d069e5 100644
--- a/app/Importer/LocationImporter.php
+++ b/app/Importer/LocationImporter.php
@@ -39,14 +39,15 @@ class LocationImporter extends ItemImporter
$editingLocation = false;
+ $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
+
if ($this->findCsvMatch($row, 'id')!='') {
+ // Override location if an ID was given
+ \Log::debug('Finding location by ID: '.$this->findCsvMatch($row, 'id'));
$location = Location::find($this->findCsvMatch($row, 'id'));
- } else {
- $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
}
-
if ($location) {
if (! $this->updating) {
$this->log('A matching Location '.$this->item['name'].' already exists');