diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index c663d6ff..13d35421 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -24,10 +24,9 @@ class Qrz extends CI_Controller { $station_ids = $this->logbook_model->get_station_id_with_qrz_api(); if ($station_ids) { - foreach ($station_ids as $station_id) { - $result = $this->logbook_model->exists_qrz_api_key($station_id); - $qrz_api_key = $result->qrzapikey; - if($this->mass_upload_qsos($station_id, $qrz_api_key)) { + foreach ($station_ids as $station) { + $qrz_api_key = $station->qrzapikey; + if($this->mass_upload_qsos($station->station_id, $qrz_api_key)) { echo "QSOs have been uploaded to QRZ.com."; log_message('info', 'QSOs have been uploaded to QRZ.com.'); } else{ @@ -108,7 +107,7 @@ class Qrz extends CI_Controller { $data['page_title'] = "QRZ Logbook"; - $data['station_profiles'] = $this->stations->all(); + $data['station_profiles'] = $this->stations->all_of_user(); $data['station_profile'] = $this->stations->stations_with_qrz_api_key(); $this->load->view('interface_assets/header', $data); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 8f4e01b5..431d29ce 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -383,7 +383,7 @@ class Logbook_model extends CI_Model { */ function exists_qrz_api_key($station_id) { $sql = 'select qrzapikey, qrzrealtime from station_profile - where station_id = ' . $station_id; + where station_id = ' . $station_id . ' and station_profile.user_id = ' . $this->session->userdata('user_id'); $query = $this->db->query($sql); @@ -926,12 +926,12 @@ class Logbook_model extends CI_Model { * Function returns all the station_id's with QRZ API Key's */ function get_station_id_with_qrz_api() { - $sql = 'select station_id from station_profile + $sql = 'select station_id, qrzapikey from station_profile where coalesce(qrzapikey, "") <> ""'; $query = $this->db->query($sql); - $result = $query->row(); + $result = $query->result(); if ($result) { return $result; diff --git a/application/models/Stations.php b/application/models/Stations.php index c4db7311..e6ba15af 100644 --- a/application/models/Stations.php +++ b/application/models/Stations.php @@ -269,7 +269,8 @@ class Stations extends CI_Model { " where COL_QRZCOM_QSO_UPLOAD_STATUS = 'Y' group by station_id ) as totc on station_profile.station_id = totc.station_id - where coalesce(station_profile.qrzapikey, '') <> ''"; + where coalesce(station_profile.qrzapikey, '') <> '' + and station_profile.user_id = " . $this->session->userdata('user_id'); $query = $this->db->query($sql); return $query;