diff --git a/application/models/Stations.php b/application/models/Stations.php index b276183ef..509b1beac 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -6,15 +6,15 @@ class Stations extends CI_Model { } 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, 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->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') ?? 0).') 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->where('station_profile.user_id', $this->session->userdata('user_id')); $this->db->or_where('station_profile.user_id =', NULL); - return $this->db->get(); + + return $this->db->get(); } // Returns ALL station profiles regardless of user logged in