From f87997f2233d57fd40bd7aa5b7fb94bca7471675 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 30 May 2023 21:03:39 +0200 Subject: [PATCH] [Adif backup] Fetches all locations for user instead of from active logbook --- application/models/Adif_data.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/application/models/Adif_data.php b/application/models/Adif_data.php index c01a6103..3c7641df 100644 --- a/application/models/Adif_data.php +++ b/application/models/Adif_data.php @@ -10,8 +10,7 @@ class adif_data extends CI_Model { if (strpos($this->api_model->access($api_key), 'r') !== false) { $this->api_model->update_last_used($api_key); $user_id = $this->api_model->key_userid($api_key); - $active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id); - $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook); + $logbooks_locations_array = $this->list_station_locations($user_id); } } else { $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); @@ -27,6 +26,22 @@ class adif_data extends CI_Model { return $query; } + function list_station_locations($user_id) { + $this->db->where('user_id', $user_id); + $query = $this->db->get('station_profile'); + + if ($query->num_rows() == 0) { + return array(); + } + + $locations_array = array(); + foreach ($query->result() as $row) { + array_push($locations_array, $row->station_id); + } + + return $locations_array; + } + function export_printrequested($station_id = NULL) { $this->load->model('stations'); $active_station_id = $this->stations->find_active();