From 52734086314f78347cb4e639eb610b2ad9589643 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 20 Jan 2025 16:53:48 +0000 Subject: [PATCH] Check for matching ID Signed-off-by: snipe --- app/Importer/LocationImporter.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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,12 +39,13 @@ class LocationImporter extends ItemImporter $editingLocation = false; - if ($this->findCsvMatch($row, 'id')!='') { - $location = Location::find($this->findCsvMatch($row, 'id')); - } else { - $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); - } + $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')); + } if ($location) {