From 3df34e43c1eaee230f733e494769a7f09a4e69be Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Fri, 7 Nov 2025 09:28:57 +0100 Subject: [PATCH] Added backend for continent update --- application/controllers/Logbookadvanced.php | 6 ++++ application/controllers/Update.php | 11 ------- application/models/Logbook_model.php | 10 ------- application/models/Logbookadvanced_model.php | 16 ++++++++++ application/views/logbookadvanced/index.php | 3 ++ application/views/update/index.php | 25 ++++------------ assets/js/sections/logbookadvanced.js | 31 +++++++++++++++----- 7 files changed, 53 insertions(+), 49 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index e2a297964..3a581ccab 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -801,4 +801,10 @@ class Logbookadvanced extends CI_Controller { header("Content-Type: application/json"); print json_encode($q); } + + public function fixContinent() { + $this->load->model('logbookadvanced_model'); + $result = $this->logbookadvanced_model->check_missing_continent(); + return $result; + } } diff --git a/application/controllers/Update.php b/application/controllers/Update.php index f1a24d501..24b80c296 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -338,17 +338,6 @@ class Update extends CI_Controller { $this->logbook_model->check_missing_dxcc_id($all); } - public function check_missing_continent() { - $this->load->model('user_model'); - if (!$this->user_model->authorize(99)) { - $this->session->set_flashdata('error', __("You're not allowed to do that!")); - redirect('dashboard'); - } - - $this->load->model('logbook_model'); - $this->logbook_model->check_missing_continent(); - } - public function check_missing_grid($all = false){ $this->load->model('user_model'); if (!$this->user_model->authorize(99)) { diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index bfc2d53dc..d8e925ee3 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -5619,16 +5619,6 @@ class Logbook_model extends CI_Model { print("$count updated\n"); } - public function check_missing_continent() { - // get all records with no COL_CONT - $this->db->trans_start(); - $sql = "UPDATE " . $this->config->item('table_name') . " JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif SET col_cont = dxcc_entities.cont WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = ''"; - - $query = $this->db->query($sql); - print($this->db->affected_rows() . " updated\n"); - $this->db->trans_complete(); - } - public function check_missing_grid_id($all) { // get all records with no COL_GRIDSQUARE $this->db->select("COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_TIME_OFF"); diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index d19399d1f..26af202ed 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -1240,4 +1240,20 @@ class Logbookadvanced_model extends CI_Model { $query = $this->db->query($sql, array(json_decode($ids, true), $this->session->userdata('user_id'))); } + + public function check_missing_continent() { + // get all records with no COL_CONT + $this->db->trans_start(); + $sql = "UPDATE " . $this->config->item('table_name') . " + JOIN dxcc_entities ON " . $this->config->item('table_name') . ".col_dxcc = dxcc_entities.adif + JOIN station_profile on " . $this->config->item('table_name') . ".station_id = station_profile.station_id + SET col_cont = dxcc_entities.cont + WHERE COALESCE(" . $this->config->item('table_name') . ".col_cont, '') = '' and station_profile.user_id = ?"; + + $query = $this->db->query($sql, array($this->session->userdata('user_id'))); + $result = $this->db->affected_rows(); + $this->db->trans_complete(); + + return $result; + } } diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 49c21ed42..577b3688e 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -31,6 +31,8 @@ let lang_gen_advanced_logbook_select_only_one_row_quickfilter = ''; let lang_gen_advanced_logbook_select_at_least_one_row_quickfilter = ''; let lang_gen_advanced_logbook_select_at_least_one_row_qslcard = ''; + let lang_gen_advanced_logbook_continents_updated = ''; + let lang_gen_advanced_logbook_problem_fixing_continents = ''; let lang_gen_advanced_logbook_error = ''; let lang_gen_advanced_logbook_success = ''; let lang_gen_advanced_logbook_info = ''; @@ -38,6 +40,7 @@ let lang_gen_advanced_logbook_qsl_card = ''; let lang_gen_advanced_logbook_close = ''; let lang_gen_advanced_logbook_save = ''; + let lang_gen_advanced_logbook_update_now = ''; let lang_gen_advanced_logbook_options = ''; let lang_gen_advanced_logbook_label_print_error = ''; let lang_gen_advanced_logbook_select_at_least_one_row = ''; diff --git a/application/views/update/index.php b/application/views/update/index.php index c726b3c36..76befdc69 100644 --- a/application/views/update/index.php +++ b/application/views/update/index.php @@ -34,39 +34,24 @@ and update existing metadata as well, in case it has changed."); ?>

:

-
- - -
-

- -

: -

- -