diff --git a/application/controllers/Stationsetup.php b/application/controllers/Stationsetup.php index 266500df4..40ef64be3 100644 --- a/application/controllers/Stationsetup.php +++ b/application/controllers/Stationsetup.php @@ -312,11 +312,19 @@ class Stationsetup extends CI_Controller { $single->station_copylog = $this->stationcopy2html($entry->station_id); $single->station_delete = $this->stationdelete2html($entry->station_id, $entry->station_profile_name, $entry->station_active); $single->station_favorite = $this->stationfavorite2html($entry->station_id, $quickswitch_enabled); + $single->station_linked = $this->stationlinked2html($entry->linked); array_push($hres,$single); } echo json_encode($hres); } + private function stationlinked2html($linked) { + if ($linked == 1) { + return ''; + } + return ''; + } + private function stationfavorite2html($id, $quickswitch_enabled) { if ($quickswitch_enabled == 'false') { return ''; diff --git a/application/models/Stations.php b/application/models/Stations.php index a5660110c..b276183ef 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -5,14 +5,13 @@ class Stations extends CI_Model { public function __construct() { } - function all_with_count() { - $this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total'); + $this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total, exists(select 1 from station_logbooks_relationship where station_location_id = station_profile.station_id and station_logbook_id = '.$this->session->userdata('active_station_logbook').') as linked'); $this->db->from('station_profile'); $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left'); $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer'); - $this->db->group_by('station_profile.station_id'); + $this->db->group_by('station_profile.station_id'); $this->db->where('station_profile.user_id', $this->session->userdata('user_id')); $this->db->or_where('station_profile.user_id =', NULL); return $this->db->get(); diff --git a/application/views/stationsetup/stationsetup.php b/application/views/stationsetup/stationsetup.php index 4d0b51b77..d470c6e96 100644 --- a/application/views/stationsetup/stationsetup.php +++ b/application/views/stationsetup/stationsetup.php @@ -121,6 +121,7 @@ + ID: station_id;?> qso_total;?> + station_id; ?>" title= class="btn btn-outline-primary btn-sm"> @@ -182,7 +184,7 @@ station_id; ?>" class="btn btn-danger btn-sm" title= onclick="return confirm('');"> - station_active != 1) { + station_active != 1) { $cnfmsg = sprintf(__("Are you sure you want delete station profile '%s'? This will delete all QSOs within this station profile."), $row->station_profile_name); ?>?> station_id; ?>" class="btn btn-danger btn-sm" title= onclick="return confirm('');"> diff --git a/assets/js/sections/stationsetup.js b/assets/js/sections/stationsetup.js index f2e787c39..805f069dd 100644 --- a/assets/js/sections/stationsetup.js +++ b/assets/js/sections/stationsetup.js @@ -378,6 +378,7 @@ function reloadLogbooks() { dataType: 'json', success: function (data) { loadLogbookTable(data); + reloadStations(); }, error: function (data) { BootstrapDialog.alert({ @@ -572,6 +573,7 @@ function loadLocationTable(rows) { data.push(locations.station_country); data.push(locations.station_gridsquare); data.push(locations.station_badge); + data.push(locations.station_linked); data.push(locations.station_edit); data.push(locations.station_copylog); if (locations.station_favorite != ''){