From b1e4de55a2061e13b4aa339aa40289b1529e606c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 15 Jun 2023 13:22:13 +0100 Subject: [PATCH] [Station Location][Add] Allows setting the Canadian Province Fixes #2190 --- application/models/Stations.php | 11 +++++++++- application/views/station_profile/create.php | 23 +++++++++++++++++++- assets/js/sections/station_locations.js | 2 -- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/application/models/Stations.php b/application/models/Stations.php index 7f35e0cf..7d9e8823 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -61,6 +61,13 @@ class Stations extends CI_Model { $station_active = 1; } + // Check if the state is Canada and get the correct state + if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") { + $state = $this->input->post('station_ca_state'); + } else { + $state = $this->input->post('station_state'); + } + // Create data array with field values $data = array( 'user_id' => $this->session->userdata('user_id'), @@ -80,7 +87,7 @@ class Stations extends CI_Model { 'station_cnty' => xss_clean($this->input->post('station_cnty', true)), 'station_cq' => xss_clean($this->input->post('station_cq', true)), 'station_itu' => xss_clean($this->input->post('station_itu', true)), - 'state' => xss_clean($this->input->post('station_state', true)), + 'state' => $state, 'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)), 'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)), 'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)), @@ -98,11 +105,13 @@ class Stations extends CI_Model { function edit() { + // Check if the state is Canada and get the correct state if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") { $state = $this->input->post('station_ca_state'); } else { $state = $this->input->post('station_state'); } + $data = array( 'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)), 'station_gridsquare' => xss_clean($this->input->post('gridsquare', true)), diff --git a/application/views/station_profile/create.php b/application/views/station_profile/create.php index 2548b1a9..3350451e 100644 --- a/application/views/station_profile/create.php +++ b/application/views/station_profile/create.php @@ -67,7 +67,7 @@
-
+
+ + + + + + + + + + + + + + + + Station state. Applies to certain countries only. Leave blank if not applicable. +
+
diff --git a/assets/js/sections/station_locations.js b/assets/js/sections/station_locations.js index 08a8eef4..8504357b 100644 --- a/assets/js/sections/station_locations.js +++ b/assets/js/sections/station_locations.js @@ -10,8 +10,6 @@ $(document).ready( function () { var selectedDXCCID = $('#dxcc_select').find(":selected").val(); - console.log(selectedDXCCID); - if(selectedDXCCID == '1'){ $("#canada_state").show(); $("#us_state").hide();