diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 5b0692345..0657e3ca6 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -237,7 +237,7 @@ class API extends CI_Controller { } // in case the provided op call is the same as the clubstation callsign, we need to use the creator of the API key as the operator $recorded_operator = $record['operator'] ?? ''; - if ($real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) { + if (key_exists('operator',$record) && $real_operator != null && ($record['operator'] == $record['station_callsign']) || ($recorded_operator == '')) { $record['operator'] = $real_operator; } diff --git a/application/controllers/Bandmap.php b/application/controllers/Bandmap.php index 8145030ca..db75c0009 100644 --- a/application/controllers/Bandmap.php +++ b/application/controllers/Bandmap.php @@ -13,7 +13,7 @@ class Bandmap extends CI_Controller { function index() { $this->load->model('cat'); $this->load->model('bands'); - $data['radios'] = $this->cat->radios(); + $data['radios'] = $this->cat->radios(true); $data['bands'] = $this->bands->get_user_bands_for_qso_entry(); $footerData = []; diff --git a/application/controllers/Club.php b/application/controllers/Club.php index 934c8a485..78fec7681 100644 --- a/application/controllers/Club.php +++ b/application/controllers/Club.php @@ -56,7 +56,6 @@ class Club extends CI_Controller $data['page_title'] = __("Club Permissions"); $data['club'] = $club; $data['club_members'] = $this->club_model->get_club_members($cid); - $data['users'] = $this->user_model->users(); $data['permissions'] = $this->permissions; $footerData = []; @@ -241,4 +240,4 @@ class Club extends CI_Controller return $this->email->send(); } -} \ No newline at end of file +} diff --git a/application/migrations/233_clubstations.php b/application/migrations/233_clubstations.php index 5690d7c39..fe88ac35d 100644 --- a/application/migrations/233_clubstations.php +++ b/application/migrations/233_clubstations.php @@ -40,12 +40,18 @@ class Migration_clubstations extends CI_Migration { $this->db->query("ALTER TABLE `cat` MODIFY operator INT(6) NOT NULL;"); } - public function down() { - // Due the risk of data loss we can't drop any new created columns or tables - // But we can drop some of the timestamp columns - $this->db->query("ALTER TABLE `users` DROP COLUMN created_at;"); - $this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;"); - $this->db->query("ALTER TABLE `api` DROP COLUMN created_at;"); + public function down() { + // Due the risk of data loss we can't drop any new created columns or tables + // But we can drop some of the timestamp columns + if ($this->db->field_exists('created_at', 'users')) { + $this->db->query("ALTER TABLE `users` DROP COLUMN created_at;"); + } + if ($this->db->field_exists('modified_at', 'users')) { + $this->db->query("ALTER TABLE `users` DROP COLUMN modified_at;"); + } + if ($this->db->field_exists('created_at', 'api')) { + $this->db->query("ALTER TABLE `api` DROP COLUMN created_at;"); + } } private function add_column_if_not_exists($table, $column, $definition) { @@ -61,4 +67,4 @@ class Migration_clubstations extends CI_Migration { log_message('info', "Mig 230 - Column '$column' already exists in table '$table', skipping ALTER TABLE."); } } -} \ No newline at end of file +} diff --git a/application/models/Cat.php b/application/models/Cat.php index c7bfc3ea7..edb4da45f 100644 --- a/application/models/Cat.php +++ b/application/models/Cat.php @@ -107,7 +107,7 @@ function radios($only_operator = false) { $this->db->select('id, radio'); $this->db->where('user_id', $this->session->userdata('user_id')); - if ($only_operator || ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) { + if ($only_operator && ($this->session->userdata('clubstation') == 1 && !clubaccess_check(9))) { $this->db->where('operator', $this->session->userdata('source_uid')); } $query = $this->db->get('cat'); diff --git a/application/views/user/index.php b/application/views/user/index.php index 6d8b919a2..cb56c254d 100644 --- a/application/views/user/index.php +++ b/application/views/user/index.php @@ -43,7 +43,7 @@ - user_callsign; ?> + user_callsign); ?> @@ -158,7 +158,7 @@ foreach ($clubs->result() as $row) { ?> '; ?> user_id; ?>">user_name; ?> - user_callsign; ?> + user_callsign); ?> user_email; ?> lastoperator; ?>