mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2877 from int2001/create_single_station
Accept also single-stations on create_station
This commit is contained in:
@@ -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()]));
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user