[Station setup] Shows if location belongs to active logbook

This commit is contained in:
Andreas Kristiansen
2024-07-02 08:12:07 +02:00
parent a9dd2032b7
commit 74c8851834
4 changed files with 15 additions and 4 deletions

View File

@@ -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();