From 4ae7fd7b133b1b0c682190ac83e745923387319e Mon Sep 17 00:00:00 2001 From: int2001 Date: Thu, 29 Jan 2026 17:36:00 +0000 Subject: [PATCH 1/2] Accept also single-stations --- application/controllers/Api.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 7dcfdf2d4..4336198ee 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -181,6 +181,11 @@ class API extends CI_Controller { $this->output->set_status_header(400)->set_content_type('application/json')->set_output(json_encode(['status' => 'error', 'message' => 'Invalid JSON file'])); return; } + + // If a single station object is posted (not an array), wrap it in an array + if (isset($locations['station_callsign']) || isset($locations['station_profile_name'])) { + $locations = [$locations]; + } } catch (Exception $e) { $this->output->set_status_header(500)->set_content_type('application/json')->set_output(json_encode(['status' => 'error', 'message' => 'Processing error: ' . $e->getMessage()])); } From 3fe22d65007f4ef0f04ae24a3f009a2d06d1596c Mon Sep 17 00:00:00 2001 From: int2001 Date: Sun, 1 Feb 2026 17:38:10 +0000 Subject: [PATCH 2/2] check if station_id is empty or null --- application/models/Stationsetup_model.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/models/Stationsetup_model.php b/application/models/Stationsetup_model.php index 360008151..c1e4f16f0 100644 --- a/application/models/Stationsetup_model.php +++ b/application/models/Stationsetup_model.php @@ -264,6 +264,9 @@ class Stationsetup_model extends CI_Model { if ($imported >= 1000){ return (array('limit',$imported."locations imported. Maximum limit of 1000 locations reached.")); // Prevent importing more than 1000 locations at once } + if (trim($loc['station_uuid'] ?? '') == '') { // Make sure it's null, even if it's set to '' + $loc['station_uuid']=null; + } // Data for station_profile $dbdata = [ 'station_active' => 0,